#include <PFEnergyCalibration.h>
Public Member Functions | |
double | energyEm (const reco::PFCluster &clusterEcal, std::vector< double > &EclustersPS1, std::vector< double > &EclustersPS2, bool crackCorrection=true) |
double | energyEm (const reco::PFCluster &clusterEcal, std::vector< double > &EclustersPS1, std::vector< double > &EclustersPS2, double &ps1, double &ps2, bool crackCorrection=true) |
void | energyEmHad (double t, double &e, double &h, double eta, double phi) const |
void | initializeCalibrationFunctions () |
PFEnergyCalibration () | |
void | setCalibrationFunctions (const PerformancePayloadFromTFormula *thePFCal) |
~PFEnergyCalibration () | |
Protected Attributes | |
TF1 * | faBarrel |
TF1 * | faEndcap |
TF1 * | faEtaBarrel |
TF1 * | faEtaEndcap |
TF1 * | fbBarrel |
TF1 * | fbEndcap |
TF1 * | fbEtaBarrel |
TF1 * | fbEtaEndcap |
TF1 * | fcBarrel |
TF1 * | fcEndcap |
const PerformancePayloadFromTFormula * | pfCalibrations |
Private Member Functions | |
double | aBarrel (double x) const |
double | aEndcap (double x) const |
double | aEtaBarrel (double x) const |
double | aEtaEndcap (double x) const |
double | Alpha (double eta) |
double | bBarrel (double x) const |
double | bEndcap (double x) const |
double | Beta (double E, double eta) |
double | bEtaBarrel (double x) const |
double | bEtaEndcap (double x) const |
double | cBarrel (double x) const |
double | cEndcap (double x) const |
double | CorrBarrel (double E, double eta) |
double | CorrEta (double eta) |
double | CorrPhi (double phi, double eta) |
double | dCrackPhi (double phi, double eta) |
double | Ecorr (double eEcal, double ePS1, double ePS2, double eta, double phi, double &, double &, bool crackCorrection=true) |
double | Ecorr (double eEcal, double ePS1, double ePS2, double eta, double phi, bool crackCorrection=true) |
double | EcorrBarrel (double E, double eta, double phi, bool crackCorrection=true) |
double | EcorrPS (double eEcal, double ePS1, double ePS2, double etaEcal) |
double | EcorrPS (double eEcal, double ePS1, double ePS2, double etaEcal, double &, double &) |
double | EcorrPS_ePSNil (double eEcal, double eta) |
double | EcorrZoneAfterPS (double E, double eta) |
double | EcorrZoneBeforePS (double E, double eta) |
double | Gamma (double etaEcal) |
double | minimum (double a, double b) |
Private Attributes | |
double | threshE |
double | threshH |
Friends | |
std::ostream & | operator<< (std::ostream &out, const PFEnergyCalibration &calib) |
Definition at line 40 of file PFEnergyCalibration.h.
PFEnergyCalibration::PFEnergyCalibration | ( | ) |
Definition at line 11 of file PFEnergyCalibration.cc.
References initializeCalibrationFunctions().
: pfCalibrations(0) { initializeCalibrationFunctions(); }
PFEnergyCalibration::~PFEnergyCalibration | ( | ) |
Definition at line 16 of file PFEnergyCalibration.cc.
References faBarrel, faEndcap, faEtaBarrel, faEtaEndcap, fbBarrel, fbEndcap, fbEtaBarrel, fbEtaEndcap, fcBarrel, and fcEndcap.
{ delete faBarrel; delete fbBarrel; delete fcBarrel; delete faEtaBarrel; delete fbEtaBarrel; delete faEndcap; delete fbEndcap; delete fcEndcap; delete faEtaEndcap; delete fbEtaEndcap; }
double PFEnergyCalibration::aBarrel | ( | double | x | ) | const [private] |
Definition at line 224 of file PFEnergyCalibration.cc.
References faBarrel, PerformancePayloadFromTFormula::getResult(), BinningPointByMap::insert(), BinningVariables::JetEt, pfCalibrations, PerformanceResult::PFfa_BARREL, and point.
Referenced by energyEmHad().
{ if ( pfCalibrations ) { BinningPointByMap point; point.insert(BinningVariables::JetEt, x); return pfCalibrations->getResult(PerformanceResult::PFfa_BARREL,point); } else { return faBarrel->Eval(x); } }
double PFEnergyCalibration::aEndcap | ( | double | x | ) | const [private] |
Definition at line 304 of file PFEnergyCalibration.cc.
References faEndcap, PerformancePayloadFromTFormula::getResult(), BinningPointByMap::insert(), BinningVariables::JetEt, pfCalibrations, PerformanceResult::PFfa_ENDCAP, and point.
Referenced by energyEmHad().
{ if ( pfCalibrations ) { BinningPointByMap point; point.insert(BinningVariables::JetEt, x); return pfCalibrations->getResult(PerformanceResult::PFfa_ENDCAP,point); } else { return faEndcap->Eval(x); } }
double PFEnergyCalibration::aEtaBarrel | ( | double | x | ) | const [private] |
Definition at line 272 of file PFEnergyCalibration.cc.
References faEtaBarrel, PerformancePayloadFromTFormula::getResult(), BinningPointByMap::insert(), BinningVariables::JetEt, pfCalibrations, PerformanceResult::PFfaEta_BARREL, and point.
Referenced by energyEmHad().
{ if ( pfCalibrations ) { BinningPointByMap point; point.insert(BinningVariables::JetEt, x); return pfCalibrations->getResult(PerformanceResult::PFfaEta_BARREL,point); } else { return faEtaBarrel->Eval(x); } }
double PFEnergyCalibration::aEtaEndcap | ( | double | x | ) | const [private] |
Definition at line 352 of file PFEnergyCalibration.cc.
References faEtaEndcap, PerformancePayloadFromTFormula::getResult(), BinningPointByMap::insert(), BinningVariables::JetEt, pfCalibrations, PerformanceResult::PFfaEta_ENDCAP, and point.
Referenced by energyEmHad().
{ if ( pfCalibrations ) { BinningPointByMap point; point.insert(BinningVariables::JetEt, x); return pfCalibrations->getResult(PerformanceResult::PFfaEta_ENDCAP,point); } else { return faEtaEndcap->Eval(x); } }
double PFEnergyCalibration::Alpha | ( | double | eta | ) | [private] |
Definition at line 670 of file PFEnergyCalibration.cc.
References eta(), lumiNorm::norm, p1, p2, and query::result.
Referenced by EcorrPS().
double PFEnergyCalibration::bBarrel | ( | double | x | ) | const [private] |
Definition at line 240 of file PFEnergyCalibration.cc.
References fbBarrel, PerformancePayloadFromTFormula::getResult(), BinningPointByMap::insert(), BinningVariables::JetEt, pfCalibrations, PerformanceResult::PFfb_BARREL, and point.
Referenced by energyEmHad().
{ if ( pfCalibrations ) { BinningPointByMap point; point.insert(BinningVariables::JetEt, x); return pfCalibrations->getResult(PerformanceResult::PFfb_BARREL,point); } else { return fbBarrel->Eval(x); } }
double PFEnergyCalibration::bEndcap | ( | double | x | ) | const [private] |
Definition at line 320 of file PFEnergyCalibration.cc.
References fbEndcap, PerformancePayloadFromTFormula::getResult(), BinningPointByMap::insert(), BinningVariables::JetEt, pfCalibrations, PerformanceResult::PFfb_ENDCAP, and point.
Referenced by energyEmHad().
{ if ( pfCalibrations ) { BinningPointByMap point; point.insert(BinningVariables::JetEt, x); return pfCalibrations->getResult(PerformanceResult::PFfb_ENDCAP,point); } else { return fbEndcap->Eval(x); } }
double PFEnergyCalibration::Beta | ( | double | E, |
double | eta | ||
) | [private] |
Definition at line 688 of file PFEnergyCalibration.cc.
References lumiNorm::norm, p1, p2, p3, p4, and query::result.
Referenced by EcorrPS().
{ //Energy dependency static double p0 = 0.032; static double p1 = 9.70394e-02; static double p2 = 2.23072e+01; static double p3 = 100; //Eta dependency static double p4 = 1.02496e+00 ; static double p5 = -4.40176e-03 ; //so that <feta()> = 1 static double norm = (p4+p5*(2.6+1.656)/2); double result = (1.0012+p0*TMath::Exp(-E/p3)+p1*TMath::Exp(-E/p2))*(p4+p5*eta)/norm; return result; }
double PFEnergyCalibration::bEtaBarrel | ( | double | x | ) | const [private] |
Definition at line 288 of file PFEnergyCalibration.cc.
References fbEtaBarrel, PerformancePayloadFromTFormula::getResult(), BinningPointByMap::insert(), BinningVariables::JetEt, pfCalibrations, PerformanceResult::PFfbEta_BARREL, and point.
Referenced by energyEmHad().
{ if ( pfCalibrations ) { BinningPointByMap point; point.insert(BinningVariables::JetEt, x); return pfCalibrations->getResult(PerformanceResult::PFfbEta_BARREL,point); } else { return fbEtaBarrel->Eval(x); } }
double PFEnergyCalibration::bEtaEndcap | ( | double | x | ) | const [private] |
Definition at line 368 of file PFEnergyCalibration.cc.
References fbEtaEndcap, PerformancePayloadFromTFormula::getResult(), BinningPointByMap::insert(), BinningVariables::JetEt, pfCalibrations, PerformanceResult::PFfbEta_ENDCAP, and point.
Referenced by energyEmHad().
{ if ( pfCalibrations ) { BinningPointByMap point; point.insert(BinningVariables::JetEt, x); return pfCalibrations->getResult(PerformanceResult::PFfbEta_ENDCAP,point); } else { return fbEtaEndcap->Eval(x); } }
double PFEnergyCalibration::cBarrel | ( | double | x | ) | const [private] |
Definition at line 256 of file PFEnergyCalibration.cc.
References fcBarrel, PerformancePayloadFromTFormula::getResult(), BinningPointByMap::insert(), BinningVariables::JetEt, pfCalibrations, PerformanceResult::PFfc_BARREL, and point.
Referenced by energyEmHad().
{ if ( pfCalibrations ) { BinningPointByMap point; point.insert(BinningVariables::JetEt, x); return pfCalibrations->getResult(PerformanceResult::PFfc_BARREL,point); } else { return fcBarrel->Eval(x); } }
double PFEnergyCalibration::cEndcap | ( | double | x | ) | const [private] |
Definition at line 336 of file PFEnergyCalibration.cc.
References fcEndcap, PerformancePayloadFromTFormula::getResult(), BinningPointByMap::insert(), BinningVariables::JetEt, pfCalibrations, PerformanceResult::PFfc_ENDCAP, and point.
Referenced by energyEmHad().
{ if ( pfCalibrations ) { BinningPointByMap point; point.insert(BinningVariables::JetEt, x); return pfCalibrations->getResult(PerformanceResult::PFfc_ENDCAP,point); } else { return fcEndcap->Eval(x); } }
double PFEnergyCalibration::CorrBarrel | ( | double | E, |
double | eta | ||
) | [private] |
Definition at line 624 of file PFEnergyCalibration.cc.
References p1, p2, p3, p4, and query::result.
Referenced by EcorrBarrel().
{ //Energy dependency /* //YM Parameters 52XX: static double p0=1.00000e+00; static double p1=3.27753e+01; static double p2=2.28552e-02; static double p3=3.06139e+00; static double p4=2.25135e-01; static double p5=1.47824e+00; static double p6=1.09e-02; static double p7=4.19343e+01; */ static double p0 = 0.9944; static double p1 = 9.827; static double p2 = 1.503; static double p3 = 1.196; static double p4 = 0.3349; static double p5 = 0.89; static double p6 = 0.004361; static double p7 = 51.51; //Eta dependency static double p8=2.705593e-03; 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); return result; }
double PFEnergyCalibration::CorrEta | ( | double | eta | ) | [private] |
Definition at line 597 of file PFEnergyCalibration.cc.
References a, alignCSCRings::e, i, m, query::result, and alignCSCRings::s.
Referenced by EcorrBarrel().
{ // we use a gaussian with a screwness for each of the 5 |eta|-cracks static std::vector<double> a; //amplitude static std::vector<double> m; //mean static std::vector<double> s; //sigma static std::vector<double> sa; // screwness amplitude static std::vector<double> ss; // screwness sigma if(a.size()==0) { 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) ; 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) ; 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) ; 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); 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); } double result = 1; 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])); return result; }
double PFEnergyCalibration::CorrPhi | ( | double | phi, |
double | eta | ||
) | [private] |
Definition at line 571 of file PFEnergyCalibration.cc.
References dCrackPhi(), p1, p2, p3, p4, and query::result.
Referenced by EcorrBarrel().
{ // we use 3 gaussians to correct the phi-cracks effect static double p1= 5.59379e-01; static double p2= -1.26607e-03; static double p3= 9.61133e-04; static double p4= 1.81691e-01; static double p5= -4.97535e-03; static double p6= 1.31006e-03; static double p7= 1.38498e-01; static double p8= 1.18599e-04; static double p9= 2.01858e-03; double dminphi = dCrackPhi(phi,eta); double result = (1+p1*TMath::Gaus(dminphi,p2,p3)+p4*TMath::Gaus(dminphi,p5,p6)+p7*TMath::Gaus(dminphi,p8,p9)); return result; }
double PFEnergyCalibration::dCrackPhi | ( | double | phi, |
double | eta | ||
) | [private] |
Definition at line 519 of file PFEnergyCalibration.cc.
References gather_cfg::cout, i, m, M_PI, minimum(), and pi.
Referenced by CorrPhi().
{ static double pi= M_PI;// 3.14159265358979323846; //Location of the 18 phi-cracks static std::vector<double> cPhi; if(cPhi.size()==0) { cPhi.resize(18,0); cPhi[0]=2.97025; for(unsigned i=1;i<=17;++i) cPhi[i]=cPhi[0]-2*i*pi/18; } //Shift of this location if eta<0 static double delta_cPhi=0.00638; double m; //the result //the location is shifted if(eta<0) phi +=delta_cPhi; if (phi>=-pi && phi<=pi){ //the problem of the extrema if (phi<cPhi[17] || phi>=cPhi[0]){ if (phi<0) phi+= 2*pi; m = minimum(phi -cPhi[0],phi-cPhi[17]-2*pi); } //between these extrema... else{ bool OK = false; unsigned i=16; while(!OK){ if (phi<cPhi[i]){ m=minimum(phi-cPhi[i+1],phi-cPhi[i]); OK=true; } else i-=1; } } } else{ m=0.; //if there is a problem, we assum that we are in a crack std::cout<<"Problem in dminphi"<<std::endl; } if(eta<0) m=-m; //because of the disymetry return m; }
double PFEnergyCalibration::Ecorr | ( | double | eEcal, |
double | ePS1, | ||
double | ePS2, | ||
double | eta, | ||
double | phi, | ||
bool | crackCorrection = true |
||
) | [private] |
Definition at line 880 of file PFEnergyCalibration.cc.
References EcorrBarrel(), EcorrPS(), EcorrPS_ePSNil(), EcorrZoneAfterPS(), EcorrZoneBeforePS(), and query::result.
Referenced by energyEm().
{ static double endBarrel=1.48; static double beginingPS=1.65; static double endPS=2.6; static double endEndCap=2.98; double result=0; eta=TMath::Abs(eta); if(eEcal>0){ if(eta <= endBarrel) result = EcorrBarrel(eEcal,eta,phi,crackCorrection); else if(eta <= beginingPS) result = EcorrZoneBeforePS(eEcal,eta); else if((eta < endPS) && ePS1==0 && ePS2==0) result = EcorrPS_ePSNil(eEcal,eta); else if(eta < endPS) result = EcorrPS(eEcal,ePS1,ePS2,eta); else if(eta < endEndCap) result = EcorrZoneAfterPS(eEcal,eta); else result =eEcal; } else result = eEcal;// useful if eEcal=0 or eta>2.98 //protection if(result<eEcal) result=eEcal; return result; }
double PFEnergyCalibration::Ecorr | ( | double | eEcal, |
double | ePS1, | ||
double | ePS2, | ||
double | eta, | ||
double | phi, | ||
double & | ps1, | ||
double & | ps2, | ||
bool | crackCorrection = true |
||
) | [private] |
Definition at line 910 of file PFEnergyCalibration.cc.
References EcorrBarrel(), EcorrPS(), EcorrPS_ePSNil(), EcorrZoneAfterPS(), EcorrZoneBeforePS(), and query::result.
{ static double endBarrel=1.48; static double beginingPS=1.65; static double endPS=2.6; static double endEndCap=2.98; double result=0; eta=TMath::Abs(eta); if(eEcal>0){ if(eta <= endBarrel) result = EcorrBarrel(eEcal,eta,phi,crackCorrection); else if(eta <= beginingPS) result = EcorrZoneBeforePS(eEcal,eta); else if((eta < endPS) && ePS1==0 && ePS2==0) result = EcorrPS_ePSNil(eEcal,eta); else if(eta < endPS) result = EcorrPS(eEcal,ePS1,ePS2,eta,ps1,ps2); else if(eta < endEndCap) result = EcorrZoneAfterPS(eEcal,eta); else result =eEcal; } else result = eEcal;// useful if eEcal=0 or eta>2.98 // protection if(result<eEcal) result=eEcal; return result; }
double PFEnergyCalibration::EcorrBarrel | ( | double | E, |
double | eta, | ||
double | phi, | ||
bool | crackCorrection = true |
||
) | [private] |
Definition at line 738 of file PFEnergyCalibration.cc.
References CorrBarrel(), CorrEta(), CorrPhi(), max(), and query::result.
Referenced by Ecorr().
double PFEnergyCalibration::EcorrPS | ( | double | eEcal, |
double | ePS1, | ||
double | ePS2, | ||
double | etaEcal | ||
) | [private] |
Definition at line 777 of file PFEnergyCalibration.cc.
References Alpha(), Beta(), alignCSCRings::e, Gamma(), p1, p2, p3, p4, and query::result.
Referenced by Ecorr().
{ // gives the good weights to each subdetector double E = Beta(1.0155*eEcal+0.025*(ePS1+0.5976*ePS2)/9e-5,etaEcal)*eEcal+Gamma(etaEcal)*(ePS1+Alpha(etaEcal)*ePS2)/9e-5 ; //Correction of the residual energy dependency static double p0 = 1.00; static double p1 = 2.18; static double p2 =1.94; static double p3 =4.13; static double p4 =1.127; double result = E*(p0+p1*TMath::Exp(-E/p2)-p3*TMath::Exp(-E/p4)); return result; }
double PFEnergyCalibration::EcorrPS | ( | double | eEcal, |
double | ePS1, | ||
double | ePS2, | ||
double | etaEcal, | ||
double & | outputPS1, | ||
double & | outputPS2 | ||
) | [private] |
Definition at line 797 of file PFEnergyCalibration.cc.
References Alpha(), Beta(), alignCSCRings::e, Gamma(), p1, p2, p3, p4, and query::result.
{ // gives the good weights to each subdetector double gammaprime=Gamma(etaEcal)/9e-5; outputPS1=gammaprime*ePS1; outputPS2=gammaprime*Alpha(etaEcal)*ePS2; double E = Beta(1.0155*eEcal+0.025*(ePS1+0.5976*ePS2)/9e-5,etaEcal)*eEcal+outputPS1+outputPS2; //Correction of the residual energy dependency static double p0 = 1.00; static double p1 = 2.18; static double p2 =1.94; static double p3 =4.13; static double p4 =1.127; double corrfac=(p0+p1*TMath::Exp(-E/p2)-p3*TMath::Exp(-E/p4)); outputPS1*=corrfac; outputPS2*=corrfac; double result = E*corrfac; return result; }
double PFEnergyCalibration::EcorrPS_ePSNil | ( | double | eEcal, |
double | eta | ||
) | [private] |
Definition at line 824 of file PFEnergyCalibration.cc.
References lumiNorm::norm, p1, p2, p3, p4, and query::result.
Referenced by Ecorr().
{ //Energy dependency static double p0= 1.02; static double p1= 0.165; static double p2= 6.5 ; static double p3= 2.1 ; //Eta dependency static double p4 = 1.02496e+00 ; static double p5 = -4.40176e-03 ; //so that <feta()> = 1 static double norm = (p4+p5*(2.6+1.656)/2); double result = eEcal*(p0+p1*TMath::Exp(-TMath::Abs(eEcal-p3)/p2))*(p4+p5*eta)/norm; return result; }
double PFEnergyCalibration::EcorrZoneAfterPS | ( | double | E, |
double | eta | ||
) | [private] |
Definition at line 847 of file PFEnergyCalibration.cc.
References lumiNorm::norm, p1, p2, p3, p4, and query::result.
Referenced by Ecorr().
{ //Energy dependency static double p0 =1; static double p1 = 0.058; static double p2 =12.5; static double p3 =-1.05444e+00; static double p4 =-5.39557e+00; static double p5 =8.38444e+00; static double p6 = 6.10998e-01 ; //Eta dependency static double p7 =1.06161e+00; static double p8 = 0.41; static double p9 =2.918; static double p10 =0.0181; static double p11= 2.05; static double p12 =2.99; static double p13=0.0287; //so that <feta()> = 1 static double norm=1.045; 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; return result; }
double PFEnergyCalibration::EcorrZoneBeforePS | ( | double | E, |
double | eta | ||
) | [private] |
Definition at line 751 of file PFEnergyCalibration.cc.
References eta(), lumiNorm::norm, p1, p2, p3, p4, and query::result.
Referenced by Ecorr().
{ //Energy dependency static double p0 =1; static double p1 =0.18; static double p2 =8.; //Eta dependency static double p3 =0.3; static double p4 =1.11; static double p5 =0.025; static double p6 =1.49; static double p7 =0.6; //so that <feta()> = 1 static double norm = 1.21; double result = E*(p0+p1*TMath::Exp(-E/p2))*(p3+p4*TMath::Gaus(eta,p6,p5)+p7*eta)/norm; return result; }
double PFEnergyCalibration::energyEm | ( | const reco::PFCluster & | clusterEcal, |
std::vector< double > & | EclustersPS1, | ||
std::vector< double > & | EclustersPS2, | ||
double & | ps1, | ||
double & | ps2, | ||
bool | crackCorrection = true |
||
) |
Definition at line 407 of file PFEnergyCalibration.cc.
References reco::PFCluster::calculatePositionREP(), gather_cfg::cout, Ecorr(), reco::PFCluster::energy(), eta(), i, phi, and reco::PFCluster::positionREP().
{ double eEcal = clusterEcal.energy(); //temporaty ugly fix reco::PFCluster myPFCluster=clusterEcal; myPFCluster.calculatePositionREP(); double eta = myPFCluster.positionREP().eta(); double phi = myPFCluster.positionREP().phi(); double ePS1 = 0; double ePS2 = 0; for(unsigned i=0;i<EclustersPS1.size();i++) ePS1 += EclustersPS1[i]; for(unsigned i=0;i<EclustersPS2.size();i++) ePS2 += EclustersPS2[i]; double calibrated = Ecorr(eEcal,ePS1,ePS2,eta,phi,ps1,ps2,crackCorrection); if(eEcal!=0 && calibrated==0) std::cout<<"Eecal = "<<eEcal<<" eta = "<<eta<<" phi = "<<phi<<std::endl; return calibrated; }
double PFEnergyCalibration::energyEm | ( | const reco::PFCluster & | clusterEcal, |
std::vector< double > & | EclustersPS1, | ||
std::vector< double > & | EclustersPS2, | ||
bool | crackCorrection = true |
||
) |
Definition at line 385 of file PFEnergyCalibration.cc.
References reco::PFCluster::calculatePositionREP(), gather_cfg::cout, Ecorr(), reco::PFCluster::energy(), eta(), i, phi, and reco::PFCluster::positionREP().
Referenced by ConvBremPFTrackFinder::runConvBremFinder().
{ double eEcal = clusterEcal.energy(); //temporaty ugly fix reco::PFCluster myPFCluster=clusterEcal; myPFCluster.calculatePositionREP(); double eta = myPFCluster.positionREP().eta(); double phi = myPFCluster.positionREP().phi(); double ePS1 = 0; double ePS2 = 0; for(unsigned i=0;i<EclustersPS1.size();i++) ePS1 += EclustersPS1[i]; for(unsigned i=0;i<EclustersPS2.size();i++) ePS2 += EclustersPS2[i]; double calibrated = Ecorr(eEcal,ePS1,ePS2,eta,phi, crackCorrection); if(eEcal!=0 && calibrated==0) std::cout<<"Eecal = "<<eEcal<<" eta = "<<eta<<" phi = "<<phi<<std::endl; return calibrated; }
void PFEnergyCalibration::energyEmHad | ( | double | t, |
double & | e, | ||
double & | h, | ||
double | eta, | ||
double | phi | ||
) | const |
Definition at line 107 of file PFEnergyCalibration.cc.
References a, aBarrel(), aEndcap(), aEtaBarrel(), aEtaEndcap(), b, bBarrel(), bEndcap(), bEtaBarrel(), bEtaEndcap(), cBarrel(), cEndcap(), alignCSCRings::e, h, max(), min, lumiQTWidget::t, GOODCOLL_filter_cfg::thresh, threshE, threshH, and groupFilesInBlocks::tt.
{ // Use calorimetric energy as true energy for neutral particles double tt = t; double ee = e; double hh = h; double a = 1.; double b = 1.; double etaCorrE = 1.; double etaCorrH = 1.; t = min(999.9,max(tt,e+h)); if ( t < 1. ) return; // Barrel calibration if ( fabs(eta) < 1.48 ) { // The energy correction a = e>0. ? aBarrel(t) : 1.; b = e>0. ? bBarrel(t) : cBarrel(t); double thresh = e > 0. ? threshE : threshH; // Protection against negative calibration - to be tuned if ( a < -0.25 || b < -0.25 ) { a = 1.; b = 1.; thresh = 0.; } // The new estimate of the true energy t = min(999.9,max(tt, thresh+a*e+b*h)); // The angular correction for ECAL hadronic deposits etaCorrE = 1. + aEtaBarrel(t) + bEtaBarrel(t)*fabs(eta)*fabs(eta); etaCorrH = 1.; // etaCorr = 1.; t = max(tt, thresh+etaCorrE*a*e+etaCorrH*b*h); if ( e > 0. && thresh > 0. ) e = h > 0. ? threshE-threshH + etaCorrE * a * e : threshE + etaCorrE * a * e; if ( h > 0. && thresh > 0. ) h = threshH + etaCorrH * b * h; /* if ( e < 0. || h < 0. ) { std::cout << "Warning : Energy correction ! " << std::endl << "eta,tt,e,h,a,b = " << eta << " " << tt << " " << ee << "/" << e << " " << hh << "/" << h << " " << a << " " << b << std::endl; } if ( etaCorrE > 2. || etaCorrE < 0.5 || etaCorrH > 2. || etaCorrH < 0.5 ) std::cout << "Warning : Angular correction ! " << std::endl << "etaCorrE,etaCorrH,eta,t = " << etaCorrE << " " << etaCorrH << " " << eta << " " << t << std::endl; */ // Endcap calibration } else { // The energy correction a = e>0. ? aEndcap(t) : 1.; b = e>0. ? bEndcap(t) : cEndcap(t); double thresh = e > 0. ? threshE : threshH; if ( a < -0.25 || b < -0.25 ) { a = 1.; b = 1.; thresh = 0.; } // The new estimate of the true energy t = min(999.9,max(tt, thresh+a*e+b*h)); // The angular correction double dEta = fabs ( fabs(eta) - 1.5 ); double etaPow = dEta * dEta * dEta * dEta; //etaCorrE = 1. + aEtaEndcap(t) + 0.5*bEtaEndcap(t)*etaPow; etaCorrE = 1. + aEtaEndcap(t) + bEtaEndcap(t)*etaPow; etaCorrH = 1. + aEtaEndcap(t) + bEtaEndcap(t)*etaPow; /* if ( etaCorr > 2. || etaCorr < 0.5 ) std::cout << "Warning : Angular correction ! " << std::endl << "etaCorr,eta,t = " << etaCorr << " " << eta << " " << tt << " ee,hh,e,h = " << e << " " << h << " " << a*e << " " << b*h << std::endl; */ t = min(999.9,max(tt, thresh + etaCorrE*a*e + etaCorrH*b*h)); if ( e > 0. && thresh > 0. ) e = h > 0. ? threshE-threshH + etaCorrE * a * e : threshE + etaCorrE * a * e; if ( h > 0. && thresh > 0. ) h = threshH + b * etaCorrH * h; } // Protection if ( e < 0. || h < 0. ) { /* std::cout << "Warning : Energy correction ! " << std::endl << "eta,tt,e,h,a,b = " << eta << " " << tt << " " << ee << "/" << e << " " << hh << "/" << h << " " << a << " " << b << std::endl; */ // Some protection against crazy calibration if ( e < 0. ) e = ee; if ( h < 0. ) h = hh; } // And that's it ! }
double PFEnergyCalibration::Gamma | ( | double | etaEcal | ) | [private] |
Definition at line 709 of file PFEnergyCalibration.cc.
References lumiNorm::norm, p1, p2, and query::result.
Referenced by EcorrPS().
void PFEnergyCalibration::initializeCalibrationFunctions | ( | ) |
Definition at line 33 of file PFEnergyCalibration.cc.
References faBarrel, faEndcap, faEtaBarrel, faEtaEndcap, fbBarrel, fbEndcap, fbEtaBarrel, fbEtaEndcap, fcBarrel, fcEndcap, threshE, and threshH.
Referenced by PFEnergyCalibration().
{ // NEW NEW with HCAL pre-calibration threshE = 3.5; threshH = 2.5; // Barrel (fit made with |eta| < 1.2) faBarrel = new TF1("faBarrel","[0]+([1]+[2]/sqrt(x))*exp(-x/[3])-[4]*exp(-x*x/[5])",1.,1000.); fbBarrel = new TF1("fbBarrel","[0]+([1]+[2]/sqrt(x))*exp(-x/[3])-[4]*exp(-x*x/[5])",1.,1000.); fcBarrel = new TF1("fcBarrel","[0]+([1]+[2]/sqrt(x))*exp(-x/[3])-[4]*exp(-x*x/[5])",1.,1000.); faEtaBarrel = new TF1("faEtaBarrel","[0]+[1]*exp(-x/[2])",1.,1000.); fbEtaBarrel = new TF1("fbEtaBarrel","[0]+[1]*exp(-x/[2])+[3]*[3]*exp(-x*x/([4]*[4]))",1.,1000.); faBarrel->SetParameter(0,1.15665); fbBarrel->SetParameter(0,0.994603); fcBarrel->SetParameter(0,0.956544); faEtaBarrel->SetParameter(0,0.014664); fbEtaBarrel->SetParameter(0,0.00975451); faBarrel->SetParameter(1,0.165627); fbBarrel->SetParameter(1,0.13632); fcBarrel->SetParameter(1,0.0857207); faEtaBarrel->SetParameter(1,-0.0426776); fbEtaBarrel->SetParameter(1,0.102247); faBarrel->SetParameter(2,0.827718); fbBarrel->SetParameter(2,-0.758013); fcBarrel->SetParameter(2,-0.44347); faEtaBarrel->SetParameter(2,431.054); fbEtaBarrel->SetParameter(2,436.21); faBarrel->SetParameter(3,231.339); fbBarrel->SetParameter(3,183.627); fcBarrel->SetParameter(3,63.3479); faBarrel->SetParameter(4,2.45332); fbBarrel->SetParameter(4,1); fcBarrel->SetParameter(4,1.24174); faBarrel->SetParameter(5,29.6603); fbBarrel->SetParameter(5,39.6784); fcBarrel->SetParameter(5,12.322); // End-caps (fit made with eta faEndcap = new TF1("faEndcap","[0]+([1]+[2]/sqrt(x))*exp(-x/[3])-[4]*exp(-x*x/[5])",1.,1000.); fbEndcap = new TF1("fbEndcap","[0]+([1]+[2]/sqrt(x))*exp(-x/[3])-[4]*exp(-x*x/[5])",1.,1000.); fcEndcap = new TF1("fcEndcap","[0]+([1]+[2]/sqrt(x))*exp(-x/[3])-[4]*exp(-x*x/[5])",1.,1000.); faEtaEndcap = new TF1("faEtaEndcap","[0]+[1]*exp(-x/[2])",1.,1000.); fbEtaEndcap = new TF1("fbEtaEndcap","[0]+[1]*exp(-x/[2])+[3]*[3]*exp(-x*x/([4]*[4]))",1.,1000.); faEndcap->SetParameter(0,1.1272); fbEndcap->SetParameter(0,0.982824); fcEndcap->SetParameter(0,0.950244); faEtaEndcap->SetParameter(0,-0.000582903); fbEtaEndcap->SetParameter(0,0.0267319); faEndcap->SetParameter(1,0.258536); fbEndcap->SetParameter(1,0.0977533); fcEndcap->SetParameter(1,0.00564779); faEtaEndcap->SetParameter(1,-0.000482148); fbEtaEndcap->SetParameter(1,-0.554552); faEndcap->SetParameter(2,0.808071); fbEndcap->SetParameter(2,0.155416); fcEndcap->SetParameter(2,0.227162); faEtaEndcap->SetParameter(2,209.466); fbEtaEndcap->SetParameter(2,1.71188); faEndcap->SetParameter(3,214.039); fbEndcap->SetParameter(3,240.379); fcEndcap->SetParameter(3,207.786); fbEtaEndcap->SetParameter(3,0.235834); faEndcap->SetParameter(4,2); fbEndcap->SetParameter(4,1.2); fcEndcap->SetParameter(4,1.32824); fbEtaEndcap->SetParameter(4,-135.431); faEndcap->SetParameter(5,47.2602); fbEndcap->SetParameter(5,78.3083); fcEndcap->SetParameter(5,22.1825); }
double PFEnergyCalibration::minimum | ( | double | a, |
double | b | ||
) | [private] |
Definition at line 511 of file PFEnergyCalibration.cc.
Referenced by dCrackPhi().
void PFEnergyCalibration::setCalibrationFunctions | ( | const PerformancePayloadFromTFormula * | thePFCal | ) | [inline] |
Definition at line 66 of file PFEnergyCalibration.h.
References pfCalibrations.
{ pfCalibrations = thePFCal; }
std::ostream& operator<< | ( | std::ostream & | out, |
const PFEnergyCalibration & | calib | ||
) | [friend] |
Definition at line 431 of file PFEnergyCalibration.cc.
{ if(!out ) return out; out<<"PFEnergyCalibration -- "<<endl; if ( calib.pfCalibrations ) { std::cout << "Functions taken from the global tags : " << std::endl; static std::map<std::string, PerformanceResult::ResultType> functType; functType["PFfa_BARREL"] = PerformanceResult::PFfa_BARREL; functType["PFfa_ENDCAP"] = PerformanceResult::PFfa_ENDCAP; functType["PFfb_BARREL"] = PerformanceResult::PFfb_BARREL; functType["PFfb_ENDCAP"] = PerformanceResult::PFfb_ENDCAP; functType["PFfc_BARREL"] = PerformanceResult::PFfc_BARREL; functType["PFfc_ENDCAP"] = PerformanceResult::PFfc_ENDCAP; functType["PFfaEta_BARREL"] = PerformanceResult::PFfaEta_BARREL; functType["PFfaEta_ENDCAP"] = PerformanceResult::PFfaEta_ENDCAP; functType["PFfbEta_BARREL"] = PerformanceResult::PFfbEta_BARREL; functType["PFfbEta_ENDCAP"] = PerformanceResult::PFfbEta_ENDCAP; for(std::map<std::string,PerformanceResult::ResultType>::const_iterator func = functType.begin(); func != functType.end(); ++func) { cout << "Function: " << func->first << endl; PerformanceResult::ResultType fType = func->second; calib.pfCalibrations->printFormula(fType); } } else { std::cout << "Default calibration functions : " << std::endl; calib.faBarrel->Print(); calib.fbBarrel->Print(); calib.fcBarrel->Print(); calib.faEtaBarrel->Print(); calib.fbEtaBarrel->Print(); calib.faEndcap->Print(); calib.fbEndcap->Print(); calib.fcEndcap->Print(); calib.faEtaEndcap->Print(); calib.fbEtaEndcap->Print(); } return out; }
TF1* PFEnergyCalibration::faBarrel [protected] |
Definition at line 79 of file PFEnergyCalibration.h.
Referenced by aBarrel(), initializeCalibrationFunctions(), operator<<(), and ~PFEnergyCalibration().
TF1* PFEnergyCalibration::faEndcap [protected] |
Definition at line 86 of file PFEnergyCalibration.h.
Referenced by aEndcap(), initializeCalibrationFunctions(), operator<<(), and ~PFEnergyCalibration().
TF1* PFEnergyCalibration::faEtaBarrel [protected] |
Definition at line 82 of file PFEnergyCalibration.h.
Referenced by aEtaBarrel(), initializeCalibrationFunctions(), operator<<(), and ~PFEnergyCalibration().
TF1* PFEnergyCalibration::faEtaEndcap [protected] |
Definition at line 89 of file PFEnergyCalibration.h.
Referenced by aEtaEndcap(), initializeCalibrationFunctions(), operator<<(), and ~PFEnergyCalibration().
TF1* PFEnergyCalibration::fbBarrel [protected] |
Definition at line 80 of file PFEnergyCalibration.h.
Referenced by bBarrel(), initializeCalibrationFunctions(), operator<<(), and ~PFEnergyCalibration().
TF1* PFEnergyCalibration::fbEndcap [protected] |
Definition at line 87 of file PFEnergyCalibration.h.
Referenced by bEndcap(), initializeCalibrationFunctions(), operator<<(), and ~PFEnergyCalibration().
TF1* PFEnergyCalibration::fbEtaBarrel [protected] |
Definition at line 83 of file PFEnergyCalibration.h.
Referenced by bEtaBarrel(), initializeCalibrationFunctions(), operator<<(), and ~PFEnergyCalibration().
TF1* PFEnergyCalibration::fbEtaEndcap [protected] |
Definition at line 90 of file PFEnergyCalibration.h.
Referenced by bEtaEndcap(), initializeCalibrationFunctions(), operator<<(), and ~PFEnergyCalibration().
TF1* PFEnergyCalibration::fcBarrel [protected] |
Definition at line 81 of file PFEnergyCalibration.h.
Referenced by cBarrel(), initializeCalibrationFunctions(), operator<<(), and ~PFEnergyCalibration().
TF1* PFEnergyCalibration::fcEndcap [protected] |
Definition at line 88 of file PFEnergyCalibration.h.
Referenced by cEndcap(), initializeCalibrationFunctions(), operator<<(), and ~PFEnergyCalibration().
const PerformancePayloadFromTFormula* PFEnergyCalibration::pfCalibrations [protected] |
Definition at line 76 of file PFEnergyCalibration.h.
Referenced by aBarrel(), aEndcap(), aEtaBarrel(), aEtaEndcap(), bBarrel(), bEndcap(), bEtaBarrel(), bEtaEndcap(), cBarrel(), cEndcap(), operator<<(), and setCalibrationFunctions().
double PFEnergyCalibration::threshE [private] |
Definition at line 124 of file PFEnergyCalibration.h.
Referenced by energyEmHad(), and initializeCalibrationFunctions().
double PFEnergyCalibration::threshH [private] |
Definition at line 124 of file PFEnergyCalibration.h.
Referenced by energyEmHad(), and initializeCalibrationFunctions().