6 #include <streamlog/streamlog.h>
12 if ( pars.size() != 2 ) {
13 streamlog_out (ERROR) <<
"Wrong number of parameters for energyCorr_linearise ! expecting 2 got " << pars.size() << std::endl;
22 if ( pars.size() != 5 ) {
23 streamlog_out (ERROR) <<
"Wrong number of parameters for energyCorr_barrelPhi ! expecting 5 got " << pars.size() << std::endl;
34 if ( pars.size() != 12 ) {
35 streamlog_out (ERROR) <<
"Wrong number of parameters for energyCorr_costheta ! expecting 12 got " << pars.size() << std::endl;
53 if ( pars.size() != 6 ) {
54 streamlog_out (ERROR) <<
"Wrong number of parameters for energyCorr_endcap ! expecting 6, got " << pars.size() << std::endl;
66 if ( pars.size() != 18 ) {
67 streamlog_out (ERROR) <<
"Wrong number of parameters for phiCorr_barrel ! expecting 18 got " << pars.size() << std::endl;
92 if ( pars.size() != 4 ) {
93 streamlog_out (ERROR) <<
"Wrong number of parameters for thetaCorr_barrel ! expecting 4 got " << pars.size() << std::endl;
104 if ( pars.size() != 6 ) {
105 streamlog_out (ERROR) <<
"Wrong number of parameters for thetaCorr_endcap ! expecting 6 got " << pars.size() << std::endl;
126 float logen = log10(en);
128 return en/energyCorrectionFactor;
133 float gapcorrectionFactor(1.0);
134 float en = rp->getEnergy();
136 if ( rp->getType() != 22 ) {
137 streamlog_out (WARNING) <<
"gapCompensate designed only for photons! not applying correction" << endl;
139 float cosTheta = rp->getMomentum()[2]/sqrt( pow(rp->getMomentum()[0],2)+pow(rp->getMomentum()[1],2)+pow(rp->getMomentum()[2],2) );
140 float phi = atan2( rp->getMomentum()[1], rp->getMomentum()[0] );
149 return en*gapcorrectionFactor;
154 float logen = log10(en);
166 float logen = log10(en);
167 float absCosTh = fabs(costh);
205 else if ( endX > _assumed_boxsize && endY > -_assumed_boxsize ) quad=1;
206 else if ( endX > -_assumed_boxsize && endY < -_assumed_boxsize ) quad=2;
207 else if ( endX < -_assumed_boxsize && endY < _assumed_boxsize ) quad=3;
211 float foldPhi = phi + quad*acos(-1)/2.;
219 if ( phi<0 ) phi+=2*acos(-1);
220 int sector = phi/(acos(-1)/4);
221 float foldedPhi = phi - sector*acos(-1)/4.;
227 float origEn = rp->getEnergy();
229 for (
int i=0; i<3; i++) {
230 p+=pow(rp->getMomentum()[i],2);
233 float origCosth=rp->getMomentum()[2]/p;
234 float origTheta=acos(origCosth);
235 float origPhi=atan2(rp->getMomentum()[1],rp->getMomentum()[0]);
244 float logen=log10(en);
251 if (par[1]<0.) par[1]=0.;
261 y = y + par[1]*exp( -0.5*pow( (phifold-par[2])/par[3] , 2 ) );
262 y = y + par[4]*sin(4*phifold);
263 y = y + par[5]*sin(8*phifold);
264 y = y + par[6]*sin(12*phifold);
265 y = y + par[7]*sin(16*phifold);
279 float costh = cos(theta);
280 float newtheta(theta);
282 float logen=log10(en);
288 float y = par[0]*costh + par[1]*( 4*pow(costh,3) -3*costh );
289 newtheta = theta - y;
296 float logen=log10(en);
297 float foldTheta = theta;
298 if ( theta>acos(-1)/2. ) {
299 foldTheta = acos(-1.) - theta;
305 float cor = par[0] + par[1]*foldTheta + par[2]*pow(foldTheta,2.);
306 if (theta>acos(-1)/2.) {
314 float corTheta(theta);
315 float abscth= fabs(cos(theta));
327 streamlog_out (MESSAGE) <<
"photonCorrector::printParams" << endl;
float _costhCorr_gaus2_norm_const
float get_phiBarrelCorr_pos_logen()
float get_phiBias_barrel_p0_4()
float _costhCorr_gaus2_mean
float getEndcapCorrectedTheta(float en, float theta)
float get_phiBias_barrel_p5_3()
float get_endcap_gaus2_mean()
float _phiBias_barrel_p0_2
float _phiBias_barrel_p1_2
void set_energyCorr_costheta(std::vector< float > pars)
float _phiBias_barrel_p0_3
float get_phiBias_barrel_p2_2()
void set_energyCorr_linearise(std::vector< float > pars)
float getDistanceAcrossEndcapQuadrant(float costh, float phi)
float _phiBias_barrel_p5_3
float _phiBarrelCorr_pos_const
float gapCompensatedEnergy(EVENT::ReconstructedParticle *rp)
float get_phiBias_barrel_p1_2()
float _costhCorr_gaus3_mean
float _thetaBias_endcap_p0_2
float get_endcap_gaus2_sigm()
float _costhCorr_gaus1_norm_logen
float get_costhCorr_gaus1_mean()
float get_phiBias_barrel_p2_1()
float _phiBias_barrel_p2_2
float _phiBias_barrel_p7_1
float _phiBias_barrel_p5_1
float _phiBias_barrel_p6_2
float _phiBarrelCorr_depth
void set_phiCorr_barrel(std::vector< float > pars)
float get_phiBias_barrel_p5_2()
float get_phiBarrelCorr_pos_const()
float photonEnergyCorrection(EVENT::ReconstructedParticle *rp)
float _phiBias_barrel_p6_1
float _costhCorr_gaus1_norm_const
float get_assumed_boxsize()
float _phiBias_barrel_p5_2
float get_thetaBias_endcap_p2_2()
float get_phiBias_barrel_p0_1()
float get_thetaBias_endcap_p1_2()
float _costhCorr_gaus2_sigm
float _costhCorr_gaus3_sigm
float _thetaBias_barrel_p0_1
float get_phiBias_barrel_p7_3()
float get_thetaBias_endcap_p2_1()
float get_phiBias_barrel_p7_2()
float _phiBias_barrel_p7_2
float _phiBarrelCorr_width2
float _thetaBias_endcap_p1_1
void photonDirectionCorrection(EVENT::ReconstructedParticle *rp, float &cor_theta, float &cor_phi)
float gapCompensate_endcap(float xAcross)
float get_phiBias_barrel_p6_2()
float get_phiBarrelCorr_depth()
float get_phiBias_barrel_p1_1()
float _thetaBias_endcap_p1_2
float get_thetaBias_endcap_p0_1()
float getBarrelFoldedPhi(float phi)
float _thetaBias_barrel_p1_1
float _costhCorr_gaus1_mean
float get_costhCorr_gaus2_norm_logen()
float _costhCorr_gaus1_sigm
float _phiBias_barrel_p0_1
float get_phiBias_barrel_p5_1()
void set_thetaCorr_barrel(std::vector< float > pars)
float get_phiBias_barrel_p0_3()
float get_endcap_gaus1_norm()
float get_costhCorr_gaus2_sigm()
float get_costhCorr_gaus3_mean()
float get_energyLin_const()
float _thetaBias_endcap_p2_1
float get_barrelendcap_limit()
void set_thetaCorr_endcap(std::vector< float > pars)
float get_phiBias_barrel_p7_1()
float getBarrelCorrectedTheta(float en, float theta)
float get_costhCorr_gaus2_norm_const()
float get_thetaBias_barrel_p0_2()
float get_costhCorr_gaus3_norm()
float _thetaBias_barrel_p0_2
float get_endcap_gaus1_sigm()
float get_phiBias_barrel_p0_2()
float get_costhCorr_gaus1_norm_logen()
float _costhCorr_gaus2_norm_logen
float _thetaBias_endcap_p2_2
float _phiBias_barrel_p3_1
float get_phiBias_barrel_p3_1()
float get_phiBarrelCorr_width2()
float get_thetaBias_barrel_p1_2()
float get_costhCorr_gaus1_norm_const()
float _phiBias_barrel_p7_3
float get_costhCorr_gaus2_mean()
float _barrelendcap_costhlimit
float get_phiBias_barrel_p4_1()
float get_phiBias_barrel_p6_1()
float get_phiBarrelCorr_width1()
float gapCompensate_barrelPhi(float en, float phi)
float _phiBias_barrel_p1_1
float get_thetaBias_barrel_p0_1()
float get_costhCorr_gaus1_sigm()
float get_costhCorr_gaus3_sigm()
float get_thetaBias_endcap_p0_2()
float get_endcap_gaus2_norm()
void set_energyCorr_endcap(std::vector< float > pars)
void set_energyCorr_barrelPhi(std::vector< float > pars)
float get_thetaBias_endcap_p1_1()
float _phiBias_barrel_p4_1
float _phiBarrelCorr_width1
float get_costhCorr_endcap_scale()
float _thetaBias_endcap_p0_1
float getCorrectedTheta(float en, float theta)
float getBarrelCorrectedPhi(float en, float phi)
float gapCompensate_theta(float en, float costh)
float get_energyLin_logen()
float get_endcap_gaus1_mean()
float energyLinearise(float en)
float _thetaBias_barrel_p1_2
float _phiBarrelCorr_pos_logen
float _costhCorr_endcap_scale
float _costhCorr_gaus3_norm
float _phiBias_barrel_p0_4
float getCorrectedPhi(float en, float costh, float phi)
float get_thetaBias_barrel_p1_1()
float _phiBias_barrel_p2_1