41 faBarrel =
new TF1(
"faBarrel",
"[0]+([1]+[2]/sqrt(x))*exp(-x/[3])-[4]*exp(-x*x/[5])",1.,1000.);
42 fbBarrel =
new TF1(
"fbBarrel",
"[0]+([1]+[2]/sqrt(x))*exp(-x/[3])-[4]*exp(-x*x/[5])",1.,1000.);
43 fcBarrel =
new TF1(
"fcBarrel",
"[0]+([1]+[2]/sqrt(x))*exp(-x/[3])-[4]*exp(-x*x/[5])",1.,1000.);
44 faEtaBarrel =
new TF1(
"faEtaBarrel",
"[0]+[1]*exp(-x/[2])",1.,1000.);
45 fbEtaBarrel =
new TF1(
"fbEtaBarrel",
"[0]+[1]*exp(-x/[2])+[3]*[3]*exp(-x*x/([4]*[4]))",1.,1000.);
72 faEndcap =
new TF1(
"faEndcap",
"[0]+([1]+[2]/sqrt(x))*exp(-x/[3])-[4]*exp(-x*x/[5])",1.,1000.);
73 fbEndcap =
new TF1(
"fbEndcap",
"[0]+([1]+[2]/sqrt(x))*exp(-x/[3])-[4]*exp(-x*x/[5])",1.,1000.);
74 fcEndcap =
new TF1(
"fcEndcap",
"[0]+([1]+[2]/sqrt(x))*exp(-x/[3])-[4]*exp(-x*x/[5])",1.,1000.);
75 faEtaEndcap =
new TF1(
"faEtaEndcap",
"[0]+[1]*exp(-x/[2])",1.,1000.);
76 fbEtaEndcap =
new TF1(
"fbEtaEndcap",
"[0]+[1]*exp(-x/[2])+[3]*[3]*exp(-x*x/([4]*[4]))",1.,1000.);
84 fcEndcap->SetParameter(1,0.00564779);
116 double etaCorrE = 1.;
117 double etaCorrH = 1.;
118 t =
min(999.9,
max(tt,e+h));
119 if ( t < 1. )
return;
122 if ( fabs(eta) < 1.48 ) {
130 if ( a < -0.25 || b < -0.25 ) {
137 t =
min(999.9,
max(tt, thresh+a*e+b*h));
143 t =
max(tt, thresh+etaCorrE*a*e+etaCorrH*b*h);
145 if ( e > 0. && thresh > 0. )
147 if ( h > 0. && thresh > 0. )
172 if ( a < -0.25 || b < -0.25 ) {
179 t =
min(999.9,
max(tt, thresh+a*e+b*h));
182 double dEta = fabs ( fabs(eta) - 1.5 );
183 double etaPow = dEta * dEta * dEta * dEta;
195 t =
min(999.9,
max(tt, thresh + etaCorrE*a*e + etaCorrH*b*h));
197 if ( e > 0. && thresh > 0. )
199 if ( h > 0. && thresh > 0. )
206 if ( e < 0. || h < 0. ) {
213 if ( e < 0. ) e = ee;
214 if ( h < 0. ) h = hh;
386 std::vector<double> &EclustersPS1,
387 std::vector<double> &EclustersPS2,
388 bool crackCorrection ){
389 double eEcal = clusterEcal.
energy();
399 for(
unsigned i=0;
i<EclustersPS1.size();
i++) ePS1 += EclustersPS1[
i];
400 for(
unsigned i=0;
i<EclustersPS2.size();
i++) ePS2 += EclustersPS2[
i];
402 double calibrated =
Ecorr(eEcal,ePS1,ePS2,eta,phi, crackCorrection);
403 if(eEcal!=0 && calibrated==0)
std::cout<<
"Eecal = "<<eEcal<<
" eta = "<<eta<<
" phi = "<<phi<<std::endl;
408 std::vector<double> &EclustersPS1,
409 std::vector<double> &EclustersPS2,
410 double& ps1,
double& ps2,
411 bool crackCorrection){
412 double eEcal = clusterEcal.
energy();
422 for(
unsigned i=0;
i<EclustersPS1.size();
i++) ePS1 += EclustersPS1[
i];
423 for(
unsigned i=0;
i<EclustersPS2.size();
i++) ePS2 += EclustersPS2[
i];
425 double calibrated =
Ecorr(eEcal,ePS1,ePS2,eta,phi,ps1,ps2,crackCorrection);
426 if(eEcal!=0 && calibrated==0)
std::cout<<
"Eecal = "<<eEcal<<
" eta = "<<eta<<
" phi = "<<phi<<std::endl;
434 if(!out )
return out;
436 out<<
"PFEnergyCalibration -- "<<endl;
440 std::cout <<
"Functions taken from the global tags : " << std::endl;
442 static std::map<std::string, PerformanceResult::ResultType> functType;
455 for(std::map<std::string,PerformanceResult::ResultType>::const_iterator
456 func = functType.begin();
457 func != functType.end();
460 cout <<
"Function: " << func->first << endl;
467 std::cout <<
"Default calibration functions : " << std::endl;
512 if(TMath::Abs(b)<TMath::Abs(a)) a=
b;
524 static std::vector<double> cPhi;
529 for(
unsigned i=1;
i<=17;++
i) cPhi[
i]=cPhi[0]-2*
i*pi/18;
533 static double delta_cPhi=0.00638;
538 if(eta<0) phi +=delta_cPhi;
540 if (phi>=-pi && phi<=pi){
543 if (phi<cPhi[17] || phi>=cPhi[0]){
544 if (phi<0) phi+= 2*
pi;
545 m =
minimum(phi -cPhi[0],phi-cPhi[17]-2*pi);
554 m=
minimum(phi-cPhi[i+1],phi-cPhi[i]);
563 std::cout<<
"Problem in dminphi"<<std::endl;
574 static double p1= 5.59379e-01;
575 static double p2= -1.26607e-03;
576 static double p3= 9.61133e-04;
578 static double p4= 1.81691e-01;
579 static double p5= -4.97535e-03;
580 static double p6= 1.31006e-03;
582 static double p7= 1.38498e-01;
583 static double p8= 1.18599e-04;
584 static double p9= 2.01858e-03;
589 double result = (1+p1*TMath::Gaus(dminphi,p2,p3)+p4*TMath::Gaus(dminphi,p5,p6)+p7*TMath::Gaus(dminphi,p8,p9));
600 static std::vector<double>
a;
601 static std::vector<double>
m;
602 static std::vector<double>
s;
603 static std::vector<double> sa;
604 static std::vector<double> ss;
608 a.push_back(6.13349
e-01) ;a.push_back(5.08146
e-01) ;a.push_back(4.44480
e-01) ;a.push_back(3.3487
e-01) ;a.push_back(7.65627
e-01) ;
609 m.push_back(-1.79514
e-02);m.push_back(4.44747
e-01) ;m.push_back(7.92824
e-01) ;m.push_back(1.14090
e+00) ;m.push_back(1.47464
e+00) ;
610 s.push_back(7.92382
e-03) ;s.push_back(3.06028
e-03) ;s.push_back(3.36139
e-03) ;s.push_back(3.94521
e-03) ;s.push_back(8.63950
e-04) ;
611 sa.push_back(1.27228
e+01);sa.push_back(3.81517
e-02) ;sa.push_back(1.63507
e-01);sa.push_back(-6.56480
e-02);sa.push_back(1.87160
e-01);
612 ss.push_back(5.48753
e-02);ss.push_back(-1.00223
e-02);ss.push_back(2.22866
e-03);ss.push_back(4.26288
e-04) ;ss.push_back(2.67937
e-03);
616 for(
unsigned i=0;
i<=4;
i++) result+=a[
i]*TMath::Gaus(eta,m[
i],s[i])*(1+sa[
i]*TMath::Sign(1.,eta-m[i])*TMath::Exp(-TMath::Abs(eta-m[i])/ss[i]));
638 static double p0 = 0.9944;
639 static double p1 = 9.827;
640 static double p2 = 1.503;
641 static double p3 = 1.196;
642 static double p4 = 0.3349;
643 static double p5 = 0.89;
644 static double p6 = 0.004361;
645 static double p7 = 51.51;
647 static double p8=2.705593e-03;
649 double result = (p0+1/(p1+p2*TMath::Power(E,p3))+p4*TMath::Exp(-E/p5)+p6*TMath::Exp(-E*E/(p7*p7)))*(1+p8*eta*eta);
673 static double p0 = 5.97621e-01;
676 static double p1 =-1.86407e-01;
677 static double p2 = 3.85197e-01;
680 static double norm = (p1+p2*(2.6+1.656)/2);
691 static double p0 = 0.032;
692 static double p1 = 9.70394e-02;
693 static double p2 = 2.23072e+01;
694 static double p3 = 100;
697 static double p4 = 1.02496e+00 ;
698 static double p5 = -4.40176e-03 ;
701 static double norm = (p4+p5*(2.6+1.656)/2);
703 double result = (1.0012+p0*TMath::Exp(-E/p3)+p1*TMath::Exp(-E/p2))*(p4+p5*eta)/norm;
712 static double p0 = 2.49752e-02;
715 static double p1 = 6.48816e-02;
716 static double p2 = -1.59517e-02;
719 static double norm = (p1+p2*(2.6+1.656)/2);
721 double result = p0*(p1+p2*etaEcal)/norm;
739 bool crackCorrection ){
755 static double p1 =0.18;
756 static double p2 =8.;
759 static double p3 =0.3;
760 static double p4 =1.11;
761 static double p5 =0.025;
762 static double p6 =1.49;
763 static double p7 =0.6;
766 static double norm = 1.21;
768 double result = E*(p0+p1*TMath::Exp(-E/p2))*(p3+p4*TMath::Gaus(eta,p6,p5)+p7*
eta)/norm;
780 double E =
Beta(1.0155*eEcal+0.025*(ePS1+0.5976*ePS2)/9
e-5,etaEcal)*eEcal+
Gamma(etaEcal)*(ePS1+
Alpha(etaEcal)*ePS2)/9
e-5 ;
783 static double p0 = 1.00;
784 static double p1 = 2.18;
785 static double p2 =1.94;
786 static double p3 =4.13;
787 static double p4 =1.127;
789 double result = E*(p0+p1*TMath::Exp(-E/p2)-p3*TMath::Exp(-E/p4));
800 double gammaprime=
Gamma(etaEcal)/9
e-5;
801 outputPS1=gammaprime*ePS1;
802 outputPS2=gammaprime*
Alpha(etaEcal)*ePS2;
803 double E =
Beta(1.0155*eEcal+0.025*(ePS1+0.5976*ePS2)/9
e-5,etaEcal)*eEcal+outputPS1+outputPS2;
806 static double p0 = 1.00;
807 static double p1 = 2.18;
808 static double p2 =1.94;
809 static double p3 =4.13;
810 static double p4 =1.127;
812 double corrfac=(p0+p1*TMath::Exp(-E/p2)-p3*TMath::Exp(-E/p4));
815 double result = E*corrfac;
827 static double p0= 1.02;
828 static double p1= 0.165;
829 static double p2= 6.5 ;
830 static double p3= 2.1 ;
833 static double p4 = 1.02496e+00 ;
834 static double p5 = -4.40176e-03 ;
837 static double norm = (p4+p5*(2.6+1.656)/2);
839 double result = eEcal*(p0+p1*TMath::Exp(-TMath::Abs(eEcal-p3)/p2))*(p4+p5*eta)/norm;
851 static double p1 = 0.058;
852 static double p2 =12.5;
853 static double p3 =-1.05444e+00;
854 static double p4 =-5.39557e+00;
855 static double p5 =8.38444e+00;
856 static double p6 = 6.10998e-01 ;
859 static double p7 =1.06161e+00;
860 static double p8 = 0.41;
861 static double p9 =2.918;
862 static double p10 =0.0181;
863 static double p11= 2.05;
864 static double p12 =2.99;
865 static double p13=0.0287;
868 static double norm=1.045;
870 double result = E*(p0+p1*TMath::Exp(-(E-p3)/p2)+1/(p4+p5*TMath::Power(E,p6)))*(p7+p8*TMath::Gaus(eta,p9,p10)+p11*TMath::Gaus(eta,p12,p13))/norm;
882 bool crackCorrection ) {
884 static double endBarrel=1.48;
885 static double beginingPS=1.65;
886 static double endPS=2.6;
887 static double endEndCap=2.98;
894 if(eta <= endBarrel) result =
EcorrBarrel(eEcal,eta,phi,crackCorrection);
896 else if((eta < endPS) && ePS1==0 && ePS2==0) result =
EcorrPS_ePSNil(eEcal,eta);
897 else if(eta < endPS) result =
EcorrPS(eEcal,ePS1,ePS2,eta);
903 if(result<eEcal) result=eEcal;
912 static double endBarrel=1.48;
913 static double beginingPS=1.65;
914 static double endPS=2.6;
915 static double endEndCap=2.98;
922 if(eta <= endBarrel) result =
EcorrBarrel(eEcal,eta,phi,crackCorrection);
924 else if((eta < endPS) && ePS1==0 && ePS2==0) result =
EcorrPS_ePSNil(eEcal,eta);
925 else if(eta < endPS) result =
EcorrPS(eEcal,ePS1,ePS2,eta,ps1,ps2);
931 if(result<eEcal) result=eEcal;
double Beta(double E, double eta)
double EcorrZoneAfterPS(double E, double eta)
const PerformancePayloadFromTFormula * pfCalibrations
double bBarrel(double x) const
Particle flow cluster, see clustering algorithm in PFClusterAlgo.
double aEndcap(double x) const
double bEndcap(double x) const
double EcorrBarrel(double E, double eta, double phi, bool crackCorrection=true)
double EcorrZoneBeforePS(double E, double eta)
double EcorrPS_ePSNil(double eEcal, double eta)
double CorrEta(double eta)
std::ostream & operator<<(std::ostream &out, const ALILine &li)
void energyEmHad(double t, double &e, double &h, double eta, double phi) const
double Gamma(double etaEcal)
MVATrainerComputer * calib
double CorrPhi(double phi, double eta)
double CorrBarrel(double E, double eta)
const T & max(const T &a, const T &b)
void calculatePositionREP()
computes posrep_ once and for all
double bEtaEndcap(double x) const
double cEndcap(double x) const
const REPPoint & positionREP() const
cluster position: rho, eta, phi
double dCrackPhi(double phi, double eta)
double energy() const
cluster energy
bool insert(BinningVariables::BinningVariablesType, float)
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
double EcorrPS(double eEcal, double ePS1, double ePS2, double etaEcal)
double aEtaBarrel(double x) const
double Ecorr(double eEcal, double ePS1, double ePS2, double eta, double phi, bool crackCorrection=true)
double aEtaEndcap(double x) const
double bEtaBarrel(double x) const
void initializeCalibrationFunctions()
double minimum(double a, double b)
double aBarrel(double x) const
double cBarrel(double x) const
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
double energyEm(const reco::PFCluster &clusterEcal, std::vector< double > &EclustersPS1, std::vector< double > &EclustersPS2, bool crackCorrection=true)