42 faBarrel =
new TF1(
"faBarrel",
"[0]+((([1]+([2]/sqrt(x)))*exp(-(x^[6]/[3])))-([4]*exp(-(x^[7]/[5]))))",1.,1000.);
47 faBarrel->SetParameter(4,-0.0197432);
51 fbBarrel =
new TF1(
"fbBarrel",
"[0]+((([1]+([2]/sqrt(x)))*exp(-(x^[6]/[3])))-([4]*exp(-(x^[7]/[5]))))",1.,1000.);
60 fcBarrel =
new TF1(
"fcBarrel",
"[0]+((([1]+([2]/sqrt(x)))*exp(-(x^[6]/[3])))-([4]*exp(-(x^[7]/[5]))))",1.,1000.);
69 faEtaBarrel =
new TF1(
"faEtaBarrel",
"[0]+[1]*exp(-x/[2])",1.,1000.);
73 fbEtaBarrel =
new TF1(
"fbEtaBarrel",
"[0]+[1]*exp(-x/[2])",1.,1000.);
79 faEndcap =
new TF1(
"faEndcap",
"[0]+((([1]+([2]/sqrt(x)))*exp(-(x^[6]/[3])))-([4]*exp(-(x^[7]/[5]))))",1.,1000.);
88 fbEndcap =
new TF1(
"fbEndcap",
"[0]+((([1]+([2]/sqrt(x)))*exp(-(x^[6]/[3])))-([4]*exp(-(x^[7]/[5]))))",1.,1000.);
97 fcEndcap =
new TF1(
"fcEndcap",
"[0]+((([1]+([2]/sqrt(x)))*exp(-(x^[6]/[3])))-([4]*exp(-(x^[7]/[5]))))",1.,1000.);
105 fcEndcap->SetParameter(7,-0.252215);
106 faEtaEndcap =
new TF1(
"faEtaEndcap",
"[0]+[1]*exp(-x/[2])",1.,1000.);
110 fbEtaEndcap =
new TF1(
"fbEtaEndcap",
"[0]+[1]*exp(-x/[2])",1.,1000.);
128 double etaCorrE = 1.;
129 double etaCorrH = 1.;
130 t =
min(999.9,
max(tt,e+h));
131 if ( t < 1. )
return;
142 if ( a < -0.25 || b < -0.25 ) {
149 t =
min(999.9,
max(tt, thresh+a*e+b*h));
155 t =
max(tt, thresh+etaCorrE*a*e+etaCorrH*b*h);
157 if ( e > 0. && thresh > 0. )
159 if ( h > 0. && thresh > 0. )
170 if ( a < -0.25 || b < -0.25 ) {
177 t =
min(999.9,
max(tt, thresh+a*e+b*h));
182 double etaPow = dEta * dEta * dEta * dEta;
186 t =
min(999.9,
max(tt, thresh + etaCorrE*a*e + etaCorrH*b*h));
188 if ( e > 0. && thresh > 0. )
190 if ( h > 0. && thresh > 0. )
197 if ( e < 0. || h < 0. ) {
200 if ( e < 0. ) e = ee;
201 if ( h < 0. ) h = hh;
373 std::vector<double> &EclustersPS1,
374 std::vector<double> &EclustersPS2,
375 bool crackCorrection ){
376 double ePS1(std::accumulate(EclustersPS1.begin(), EclustersPS1.end(), 0.0));
377 double ePS2(std::accumulate(EclustersPS2.begin(), EclustersPS2.end(), 0.0));
378 return energyEm(clusterEcal, ePS1, ePS2, crackCorrection);
385 bool crackCorrection ){
386 double eEcal = clusterEcal.
energy();
393 double calibrated =
Ecorr(eEcal,ePS1,ePS2,eta,phi, crackCorrection);
399 std::vector<double> &EclustersPS1,
400 std::vector<double> &EclustersPS2,
401 double& ps1,
double& ps2,
402 bool crackCorrection){
403 double ePS1(std::accumulate(EclustersPS1.begin(), EclustersPS1.end(), 0.0));
404 double ePS2(std::accumulate(EclustersPS2.begin(), EclustersPS2.end(), 0.0));
405 return energyEm(clusterEcal, ePS1, ePS2, ps1, ps2, crackCorrection);
408 double ePS1,
double ePS2,
409 double& ps1,
double& ps2,
410 bool crackCorrection){
411 double eEcal = clusterEcal.
energy();
418 double calibrated =
Ecorr(eEcal,ePS1,ePS2,eta,phi,ps1,ps2,crackCorrection);
427 if(!out )
return out;
429 out<<
"PFEnergyCalibration -- "<<endl;
433 std::cout <<
"Functions taken from the global tags : " << std::endl;
435 static std::map<std::string, PerformanceResult::ResultType> functType;
448 for(std::map<std::string,PerformanceResult::ResultType>::const_iterator
449 func = functType.begin();
450 func != functType.end();
453 cout <<
"Function: " << func->first << endl;
460 std::cout <<
"Default calibration functions : " << std::endl;
513 std::vector<double> fillcPhi() {
514 std::vector<double> retValue;
515 retValue.resize(18,0);
517 for(
unsigned i=1;
i<=17;++
i) retValue[
i]=retValue[0]-2*
i*pi/18;
523 const std::vector<double> cPhi = fillcPhi();
537 if(eta<0) phi +=delta_cPhi;
539 if (phi>=-pi && phi<=pi){
542 if (phi<cPhi[17] || phi>=cPhi[0]){
543 if (phi<0) phi+= 2*
pi;
544 m =
minimum(phi -cPhi[0],phi-cPhi[17]-2*pi);
553 m=
minimum(phi-cPhi[i+1],phi-cPhi[i]);
562 std::cout<<
"Problem in dminphi"<<std::endl;
588 double result = (1+p1*TMath::Gaus(dminphi,p2,p3)+p4*TMath::Gaus(dminphi,p5,p6)+p7*TMath::Gaus(dminphi,p8,p9));
599 constexpr double a[] = {6.13349e-01, 5.08146e-01, 4.44480e-01, 3.3487e-01, 7.65627e-01};
600 constexpr double m[] = {-1.79514e-02, 4.44747e-01, 7.92824e-01, 1.14090e+00, 1.47464e+00};
601 constexpr double s[] = {7.92382e-03, 3.06028e-03, 3.36139e-03, 3.94521e-03, 8.63950e-04};
602 constexpr double sa[] = {1.27228e+01, 3.81517e-02, 1.63507e-01, -6.56480e-02, 1.87160e-01};
603 constexpr double ss[] = {5.48753e-02, -1.00223e-02, 2.22866e-03, 4.26288e-04, 2.67937e-03};
606 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]));
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);
670 constexpr double norm = (p1+p2*(2.6+1.656)/2);
691 constexpr 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;
709 constexpr double norm = (p1+p2*(2.6+1.656)/2);
711 double result = p0*(p1+p2*etaEcal)/norm;
729 bool crackCorrection ){
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)/9
e-5,etaEcal)*eEcal+
Gamma(etaEcal)*(ePS1+
Alpha(etaEcal)*ePS2)/9
e-5 ;
779 double result = E*(p0+p1*TMath::Exp(-E/p2)-p3*TMath::Exp(-E/p4));
790 double gammaprime=
Gamma(etaEcal)/9
e-5;
791 outputPS1=gammaprime*ePS1;
792 outputPS2=gammaprime*
Alpha(etaEcal)*ePS2;
793 double E =
Beta(1.0155*eEcal+0.025*(ePS1+0.5976*ePS2)/9
e-5,etaEcal)*eEcal+outputPS1+outputPS2;
802 double corrfac=(p0+p1*TMath::Exp(-E/p2)-p3*TMath::Exp(-E/p4));
805 double result = E*corrfac;
827 constexpr 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;
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 ) {
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;
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
pair< int, edm::FunctionWithDict > OK
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)
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
Abs< T >::type abs(const T &t)
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
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)
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)