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.13349e-01) ;a.push_back(5.08146e-01) ;a.push_back(4.44480e-01) ;a.push_back(3.3487e-01) ;a.push_back(7.65627e-01) ;
609 m.push_back(-1.79514e-02);m.push_back(4.44747e-01) ;m.push_back(7.92824e-01) ;m.push_back(1.14090e+00) ;m.push_back(1.47464e+00) ;
610 s.push_back(7.92382e-03) ;s.push_back(3.06028e-03) ;s.push_back(3.36139e-03) ;s.push_back(3.94521e-03) ;s.push_back(8.63950e-04) ;
611 sa.push_back(1.27228e+01);sa.push_back(3.81517e-02) ;sa.push_back(1.63507e-01);sa.push_back(-6.56480e-02);sa.push_back(1.87160e-01);
612 ss.push_back(5.48753e-02);ss.push_back(-1.00223e-02);ss.push_back(2.22866e-03);ss.push_back(4.26288e-04) ;ss.push_back(2.67937e-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]));
627 static double p0=1.00000e+00;
628 static double p1=3.27753e+01;
629 static double p2=2.28552e-02;
630 static double p3=3.06139e+00;
631 static double p4=2.25135e-01;
632 static double p5=1.47824e+00;
633 static double p6=1.09e-02;
634 static double p7=4.19343e+01;
637 static double p8=2.705593e-03;
639 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);
663 static double p0 = 5.97621e-01;
666 static double p1 =-1.86407e-01;
667 static double p2 = 3.85197e-01;
670 static double norm = (p1+p2*(2.6+1.656)/2);
681 static double p0 = 0.032;
682 static double p1 = 9.70394e-02;
683 static double p2 = 2.23072e+01;
684 static double p3 = 100;
687 static double p4 = 1.02496e+00 ;
688 static double p5 = -4.40176e-03 ;
691 static double norm = (p4+p5*(2.6+1.656)/2);
693 double result = (1.0012+p0*TMath::Exp(-E/p3)+p1*TMath::Exp(-E/p2))*(p4+p5*eta)/
norm;
702 static double p0 = 2.49752e-02;
705 static double p1 = 6.48816e-02;
706 static double p2 = -1.59517e-02;
709 static double norm = (p1+p2*(2.6+1.656)/2);
711 double result = p0*(p1+p2*etaEcal)/norm;
729 bool crackCorrection ){
745 static double p1 =0.18;
746 static double p2 =8.;
749 static double p3 =0.3;
750 static double p4 =1.11;
751 static double p5 =0.025;
752 static double p6 =1.49;
753 static double p7 =0.6;
756 static double norm = 1.21;
758 double result = E*(p0+p1*TMath::Exp(-E/p2))*(p3+p4*TMath::Gaus(eta,p6,p5)+p7*
eta)/norm;
770 double E =
Beta(1.0155*eEcal+0.025*(ePS1+0.5976*ePS2)/9e-5,etaEcal)*eEcal+
Gamma(etaEcal)*(ePS1+
Alpha(etaEcal)*ePS2)/9e-5 ;
773 static double p0 = 1.00;
774 static double p1 = 2.18;
775 static double p2 =1.94;
776 static double p3 =4.13;
777 static double p4 =1.127;
779 double result = E*(p0+p1*TMath::Exp(-E/p2)-p3*TMath::Exp(-E/p4));
790 double gammaprime=
Gamma(etaEcal)/9e-5;
791 outputPS1=gammaprime*ePS1;
792 outputPS2=gammaprime*
Alpha(etaEcal)*ePS2;
793 double E =
Beta(1.0155*eEcal+0.025*(ePS1+0.5976*ePS2)/9e-5,etaEcal)*eEcal+outputPS1+outputPS2;
796 static double p0 = 1.00;
797 static double p1 = 2.18;
798 static double p2 =1.94;
799 static double p3 =4.13;
800 static double p4 =1.127;
802 double corrfac=(p0+p1*TMath::Exp(-E/p2)-p3*TMath::Exp(-E/p4));
805 double result = E*corrfac;
817 static double p0= 1.02;
818 static double p1= 0.165;
819 static double p2= 6.5 ;
820 static double p3= 2.1 ;
823 static double p4 = 1.02496e+00 ;
824 static double p5 = -4.40176e-03 ;
827 static double norm = (p4+p5*(2.6+1.656)/2);
829 double result = eEcal*(p0+p1*TMath::Exp(-TMath::Abs(eEcal-p3)/p2))*(p4+p5*eta)/
norm;
841 static double p1 = 0.058;
842 static double p2 =12.5;
843 static double p3 =-1.05444e+00;
844 static double p4 =-5.39557e+00;
845 static double p5 =8.38444e+00;
846 static double p6 = 6.10998e-01 ;
849 static double p7 =1.06161e+00;
850 static double p8 = 0.41;
851 static double p9 =2.918;
852 static double p10 =0.0181;
853 static double p11= 2.05;
854 static double p12 =2.99;
855 static double p13=0.0287;
858 static double norm=1.045;
860 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;
872 bool crackCorrection ) {
874 static double endBarrel=1.48;
875 static double beginingPS=1.65;
876 static double endPS=2.6;
877 static double endEndCap=2.98;
884 if(eta <= endBarrel) result =
EcorrBarrel(eEcal,eta,phi,crackCorrection);
886 else if((eta < endPS) && ePS1==0 && ePS2==0) result =
EcorrPS_ePSNil(eEcal,eta);
887 else if(eta < endPS) result =
EcorrPS(eEcal,ePS1,ePS2,eta);
893 if(result<eEcal) result=eEcal;
902 static double endBarrel=1.48;
903 static double beginingPS=1.65;
904 static double endPS=2.6;
905 static double endEndCap=2.98;
912 if(eta <= endBarrel) result =
EcorrBarrel(eEcal,eta,phi,crackCorrection);
914 else if((eta < endPS) && ePS1==0 && ePS2==0) result =
EcorrPS_ePSNil(eEcal,eta);
915 else if(eta < endPS) result =
EcorrPS(eEcal,ePS1,ePS2,eta,ps1,ps2);
921 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)
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)
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
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)