CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
ElectronEnergyCorrector Class Reference

#include <ElectronEnergyCorrector.h>

Public Member Functions

void correct (reco::GsfElectron &, const reco::BeamSpot &bs, bool applyEtaCorrection=true)
 
 ElectronEnergyCorrector (EcalClusterFunctionBaseClass *ff=0)
 

Private Member Functions

double fEtaBarrelBad (double scEta) const
 
double fEtaBarrelGood (double scEta) const
 
double fEtaEndcapBad (double scEta) const
 
double fEtaEndcapGood (double scEta) const
 

Private Attributes

EcalClusterFunctionBaseClassff_
 

Detailed Description

Definition at line 9 of file ElectronEnergyCorrector.h.

Constructor & Destructor Documentation

ElectronEnergyCorrector::ElectronEnergyCorrector ( EcalClusterFunctionBaseClass ff = 0)
inline

Definition at line 13 of file ElectronEnergyCorrector.h.

14  : ff_(ff) {}
EcalClusterFunctionBaseClass * ff_

Member Function Documentation

void ElectronEnergyCorrector::correct ( reco::GsfElectron electron,
const reco::BeamSpot bs,
bool  applyEtaCorrection = true 
)

Definition at line 51 of file ElectronEnergyCorrector.cc.

References barrelEnergyError(), reco::GsfElectron::BIGBREM, reco::GsfElectron::caloPosition(), reco::GsfElectron::classification(), reco::GsfElectron::correctEcalEnergy(), reco::GsfElectron::ecalEnergyError(), endcapEnergyError(), eta(), reco::GsfElectron::GAP, reco::GsfElectron::GOLDEN, reco::GsfElectron::isEB(), reco::GsfElectron::isEcalEnergyCorrected(), reco::GsfElectron::isEE(), reco::GsfElectron::isGap(), reco::BeamSpot::position(), mathSSE::return(), reco::GsfElectron::SHOWERING, reco::GsfElectron::superCluster(), and reco::GsfElectron::UNKNOWN.

Referenced by GsfElectronAlgo::createElectron().

52  {
53  if (electron.isEcalEnergyCorrected())
54  {
55  edm::LogWarning("ElectronEnergyCorrector::correct")<<"already done" ;
56  return ;
57  }
58 
59  double scEnergy = electron.superCluster()->energy() ;
60  int elClass = electron.classification() ;
61  float newEnergy = scEnergy ;
62  float newEnergyError = electron.ecalEnergyError() ;
63 
64  //===================
65  // irrelevant classification
66  //===================
67 
68  if ( (elClass <= reco::GsfElectron::UNKNOWN) ||
69  (elClass>reco::GsfElectron::GAP) )
70  {
71  edm::LogWarning("ElectronMomentumCorrector::correct")<<"unexpected classification" ;
72  return ;
73  }
74 
75  //===================
76  // If not gap, f(eta) correction ;
77  //===================
78 
79  if ( applyEtaCorrection && (!electron.isGap()) )
80  {
81  double scEta = EleRelPoint(electron.caloPosition(),bs.position()).eta() ;
82  if (electron.isEB()) // barrel
83  {
84  if ( (elClass==reco::GsfElectron::GOLDEN) ||
85  (elClass==reco::GsfElectron::BIGBREM) )
86  { newEnergy = scEnergy/fEtaBarrelGood(scEta) ; }
87  else if (elClass==reco::GsfElectron::SHOWERING)
88  { newEnergy = scEnergy/fEtaBarrelBad(scEta) ; }
89  }
90  else if (electron.isEE()) // endcap
91  {
92  double ePreshower = electron.superCluster()->preshowerEnergy() ;
93  if ( (elClass==reco::GsfElectron::GOLDEN) ||
94  (elClass==reco::GsfElectron::BIGBREM) )
95  { newEnergy = (scEnergy-ePreshower)/fEtaEndcapGood(scEta)+ePreshower ; }
96  else if (elClass==reco::GsfElectron::SHOWERING)
97  { newEnergy = (scEnergy-ePreshower)/fEtaEndcapBad(scEta)+ePreshower ; }
98  }
99  else
100  { edm::LogWarning("ElectronEnergyCorrector::computeNewEnergy")<<"nor barrel neither endcap electron !" ; }
101  }
102 
103  //===================
104  // energy error
105  //=====================
106 
107  if (!ff_)
108  {
109  if (electron.isEB())
110  { newEnergyError = scEnergy * barrelEnergyError(scEnergy,elClass) ; }
111  else if (electron.isEE())
112  { newEnergyError = scEnergy * endcapEnergyError(scEnergy,elClass) ; }
113  else
114  { edm::LogWarning("ElectronEnergyCorrector::computeNewEnergy")<<"nor barrel neither endcap electron !" ; }
115  }
116  else
117  { newEnergyError = ff_->getValue(*(electron.superCluster()),0) ; }
118 
119  //===================
120  // apply
121  //=====================
122 
123  electron.correctEcalEnergy(newEnergy,newEnergyError) ;
124  }
double fEtaBarrelGood(double scEta) const
SuperClusterRef superCluster() const
reference to a SuperCluster
Definition: GsfElectron.h:166
T eta() const
bool isEcalEnergyCorrected() const
Definition: GsfElectron.h:586
bool isEE() const
Definition: GsfElectron.h:335
bool isEB() const
Definition: GsfElectron.h:334
double fEtaEndcapBad(double scEta) const
return((rh^lh)&mask)
virtual float getValue(const reco::BasicCluster &, const EcalRecHitCollection &) const =0
bool isGap() const
Definition: GsfElectron.h:336
float endcapEnergyError(float E, int elClass)
float ecalEnergyError() const
Definition: GsfElectron.h:588
double fEtaEndcapGood(double scEta) const
void correctEcalEnergy(float newEnergy, float newEnergyError)
Definition: GsfElectron.cc:137
Classification classification() const
Definition: GsfElectron.h:530
math::XYZPoint caloPosition() const
Definition: GsfElectron.h:275
double fEtaBarrelBad(double scEta) const
float barrelEnergyError(float E, int elClass)
EcalClusterFunctionBaseClass * ff_
const Point & position() const
position
Definition: BeamSpot.h:63
double ElectronEnergyCorrector::fEtaBarrelBad ( double  scEta) const
private

Definition at line 140 of file ElectronEnergyCorrector.cc.

References abs, p1, p2, p3, p4, and ExpressReco_HICollisions_FallBack::x.

141  {
142  // f(eta) for the class = 30 (estimated from 1Mevt single e sample)
143  // Ivica's new corrections 01/06
144  float p0 = 9.99063e-01;
145  float p1 = -2.63341e-02;
146  float p2 = 5.16054e-02;
147  float p3 = -4.95976e-02;
148  float p4 = 3.62304e-03;
149  double x = (double) std::abs(scEta) ;
150  return p0 + p1*x + p2*x*x + p3*x*x*x + p4*x*x*x*x ;
151  }
#define abs(x)
Definition: mlp_lapack.h:159
double p4[4]
Definition: TauolaWrapper.h:92
double p2[4]
Definition: TauolaWrapper.h:90
double p1[4]
Definition: TauolaWrapper.h:89
double p3[4]
Definition: TauolaWrapper.h:91
double ElectronEnergyCorrector::fEtaBarrelGood ( double  scEta) const
private

Definition at line 127 of file ElectronEnergyCorrector.cc.

References abs, p1, p2, p3, p4, and ExpressReco_HICollisions_FallBack::x.

128  {
129  // f(eta) for the first 3 classes (0, 10 and 20) (estimated from 1Mevt single e sample)
130  // Ivica's new corrections 01/06
131  float p0 = 1.00149e+00 ;
132  float p1 = -2.06622e-03 ;
133  float p2 = -1.08793e-02 ;
134  float p3 = 1.54392e-02 ;
135  float p4 = -1.02056e-02 ;
136  double x = (double) std::abs(scEta) ;
137  return p0 + p1*x + p2*x*x + p3*x*x*x + p4*x*x*x*x ;
138  }
#define abs(x)
Definition: mlp_lapack.h:159
double p4[4]
Definition: TauolaWrapper.h:92
double p2[4]
Definition: TauolaWrapper.h:90
double p1[4]
Definition: TauolaWrapper.h:89
double p3[4]
Definition: TauolaWrapper.h:91
double ElectronEnergyCorrector::fEtaEndcapBad ( double  scEta) const
private

Definition at line 166 of file ElectronEnergyCorrector.cc.

References abs, p1, p2, p3, p4, and ExpressReco_HICollisions_FallBack::x.

167  {
168  // f(eta) for the class = 130-134
169  // Ivica's new corrections 01/06
170  float p0 = -4.25221e+00 ;
171  float p1 = 1.01936e+01 ;
172  float p2 = -7.48247e+00 ;
173  float p3 = 2.45520e+00 ;
174  float p4 = -3.02872e-01 ;
175  double x = (double) std::abs(scEta);
176  return p0 + p1*x + p2*x*x + p3*x*x*x + p4*x*x*x*x ;
177  }
#define abs(x)
Definition: mlp_lapack.h:159
double p4[4]
Definition: TauolaWrapper.h:92
double p2[4]
Definition: TauolaWrapper.h:90
double p1[4]
Definition: TauolaWrapper.h:89
double p3[4]
Definition: TauolaWrapper.h:91
double ElectronEnergyCorrector::fEtaEndcapGood ( double  scEta) const
private

Definition at line 153 of file ElectronEnergyCorrector.cc.

References abs, p1, p2, p3, p4, and ExpressReco_HICollisions_FallBack::x.

154  {
155  // f(eta) for the first 3 classes (100, 110 and 120)
156  // Ivica's new corrections 01/06
157  float p0 = -8.51093e-01 ;
158  float p1 = 3.54266e+00 ;
159  float p2 = -2.59288e+00 ;
160  float p3 = 8.58945e-01 ;
161  float p4 = -1.07844e-01 ;
162  double x = (double) std::abs(scEta) ;
163  return p0 + p1*x + p2*x*x + p3*x*x*x + p4*x*x*x*x ;
164  }
#define abs(x)
Definition: mlp_lapack.h:159
double p4[4]
Definition: TauolaWrapper.h:92
double p2[4]
Definition: TauolaWrapper.h:90
double p1[4]
Definition: TauolaWrapper.h:89
double p3[4]
Definition: TauolaWrapper.h:91

Member Data Documentation

EcalClusterFunctionBaseClass* ElectronEnergyCorrector::ff_
private

Definition at line 27 of file ElectronEnergyCorrector.h.