Go to the documentation of this file.00001
00002 #include "RecoEgamma/EgammaElectronAlgos/interface/ElectronEnergyCorrector.h"
00003 #include "RecoEgamma/EgammaElectronAlgos/interface/ElectronUtilities.h"
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 float energyError( float E, float * par )
00019 { return sqrt( pow(par[0]/sqrt(E),2) + pow(par[1]/E,2) + pow(par[2],2) ) ; }
00020
00021 float barrelEnergyError( float E, int elClass )
00022 {
00023
00024 float parEB[5][3] =
00025 {
00026 { 2.46e-02, 1.97e-01, 5.23e-03},
00027 { 9.99e-07, 2.80e-01, 5.69e-03},
00028 { 9.37e-07, 2.32e-01, 5.82e-03},
00029 { 7.30e-02, 1.95e-01, 1.30e-02},
00030 { 9.25e-06, 2.84e-01, 8.77e-03}
00031 } ;
00032
00033 return energyError(E,parEB[elClass]) ;
00034 }
00035
00036 float endcapEnergyError( float E, int elClass )
00037 {
00038
00039 float parEE[5][3] =
00040 {
00041 { 1.25841e-01, 7.01145e-01, 2.81884e-11},
00042 { 1.25841e-01, 7.01145e-01, 2.81884e-11},
00043 { 1.25841e-01, 7.01145e-01, 2.81884e-11},
00044 { 1.63634e-01, 1.11307e+00, 3.64770e-03},
00045 { .02, .15, .005}
00046 } ;
00047 return energyError(E,parEE[elClass]) ;
00048 }
00049
00050 void ElectronEnergyCorrector::correct
00051 ( reco::GsfElectron & electron, const reco::BeamSpot & bs, bool applyEtaCorrection )
00052 {
00053 if (electron.isEcalEnergyCorrected())
00054 {
00055 edm::LogWarning("ElectronEnergyCorrector::correct")<<"already done" ;
00056 return ;
00057 }
00058
00059 double scEnergy = electron.superCluster()->energy() ;
00060 int elClass = electron.classification() ;
00061 float newEnergy = scEnergy ;
00062 float newEnergyError = electron.ecalEnergyError() ;
00063
00064
00065
00066
00067
00068 if ( (elClass <= reco::GsfElectron::UNKNOWN) ||
00069 (elClass>reco::GsfElectron::GAP) )
00070 {
00071 edm::LogWarning("ElectronMomentumCorrector::correct")<<"unexpected classification" ;
00072 return ;
00073 }
00074
00075
00076
00077
00078
00079 if ( applyEtaCorrection && (!electron.isGap()) )
00080 {
00081 double scEta = EleRelPoint(electron.caloPosition(),bs.position()).eta() ;
00082 if (electron.isEB())
00083 {
00084 if ( (elClass==reco::GsfElectron::GOLDEN) ||
00085 (elClass==reco::GsfElectron::BIGBREM) )
00086 { newEnergy = scEnergy/fEtaBarrelGood(scEta) ; }
00087 else if (elClass==reco::GsfElectron::SHOWERING)
00088 { newEnergy = scEnergy/fEtaBarrelBad(scEta) ; }
00089 }
00090 else if (electron.isEE())
00091 {
00092 double ePreshower = electron.superCluster()->preshowerEnergy() ;
00093 if ( (elClass==reco::GsfElectron::GOLDEN) ||
00094 (elClass==reco::GsfElectron::BIGBREM) )
00095 { newEnergy = (scEnergy-ePreshower)/fEtaEndcapGood(scEta)+ePreshower ; }
00096 else if (elClass==reco::GsfElectron::SHOWERING)
00097 { newEnergy = (scEnergy-ePreshower)/fEtaEndcapBad(scEta)+ePreshower ; }
00098 }
00099 else
00100 { edm::LogWarning("ElectronEnergyCorrector::computeNewEnergy")<<"nor barrel neither endcap electron !" ; }
00101 }
00102
00103
00104
00105
00106
00107 if (!ff_)
00108 {
00109 if (electron.isEB())
00110 { newEnergyError = scEnergy * barrelEnergyError(scEnergy,elClass) ; }
00111 else if (electron.isEE())
00112 { newEnergyError = scEnergy * endcapEnergyError(scEnergy,elClass) ; }
00113 else
00114 { edm::LogWarning("ElectronEnergyCorrector::computeNewEnergy")<<"nor barrel neither endcap electron !" ; }
00115 }
00116 else
00117 { newEnergyError = ff_->getValue(*(electron.superCluster()),0) ; }
00118
00119
00120
00121
00122
00123 electron.correctEcalEnergy(newEnergy,newEnergyError) ;
00124 }
00125
00126
00127 double ElectronEnergyCorrector::fEtaBarrelGood( double scEta ) const
00128 {
00129
00130
00131 float p0 = 1.00149e+00 ;
00132 float p1 = -2.06622e-03 ;
00133 float p2 = -1.08793e-02 ;
00134 float p3 = 1.54392e-02 ;
00135 float p4 = -1.02056e-02 ;
00136 double x = (double) std::abs(scEta) ;
00137 return p0 + p1*x + p2*x*x + p3*x*x*x + p4*x*x*x*x ;
00138 }
00139
00140 double ElectronEnergyCorrector::fEtaBarrelBad(double scEta) const
00141 {
00142
00143
00144 float p0 = 9.99063e-01;
00145 float p1 = -2.63341e-02;
00146 float p2 = 5.16054e-02;
00147 float p3 = -4.95976e-02;
00148 float p4 = 3.62304e-03;
00149 double x = (double) std::abs(scEta) ;
00150 return p0 + p1*x + p2*x*x + p3*x*x*x + p4*x*x*x*x ;
00151 }
00152
00153 double ElectronEnergyCorrector::fEtaEndcapGood( double scEta ) const
00154 {
00155
00156
00157 float p0 = -8.51093e-01 ;
00158 float p1 = 3.54266e+00 ;
00159 float p2 = -2.59288e+00 ;
00160 float p3 = 8.58945e-01 ;
00161 float p4 = -1.07844e-01 ;
00162 double x = (double) std::abs(scEta) ;
00163 return p0 + p1*x + p2*x*x + p3*x*x*x + p4*x*x*x*x ;
00164 }
00165
00166 double ElectronEnergyCorrector::fEtaEndcapBad( double scEta ) const
00167 {
00168
00169
00170 float p0 = -4.25221e+00 ;
00171 float p1 = 1.01936e+01 ;
00172 float p2 = -7.48247e+00 ;
00173 float p3 = 2.45520e+00 ;
00174 float p4 = -3.02872e-01 ;
00175 double x = (double) std::abs(scEta);
00176 return p0 + p1*x + p2*x*x + p3*x*x*x + p4*x*x*x*x ;
00177 }
00178
00179
00180
00181