CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

ElectronEnergyCorrector Class Reference

#include <ElectronEnergyCorrector.h>

List of all members.

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.

   : ff_(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(), reco::GsfElectron::SHOWERING, reco::GsfElectron::superCluster(), and reco::GsfElectron::UNKNOWN.

Referenced by GsfElectronAlgo::createElectron().

 {
  if (electron.isEcalEnergyCorrected())
   {
          edm::LogWarning("ElectronEnergyCorrector::correct")<<"already done" ;
          return ;
   }

  double scEnergy = electron.superCluster()->energy() ;
  int elClass = electron.classification() ;
  float newEnergy = scEnergy ;
  float newEnergyError = electron.ecalEnergyError() ;

  //===================
  // irrelevant classification
  //===================

  if ( (elClass <= reco::GsfElectron::UNKNOWN) ||
           (elClass>reco::GsfElectron::GAP) )
   {
          edm::LogWarning("ElectronMomentumCorrector::correct")<<"unexpected classification" ;
          return ;
   }

  //===================
  // If not gap, f(eta) correction ;
  //===================

  if ( applyEtaCorrection && (!electron.isGap()) )
   {
    double scEta = EleRelPoint(electron.caloPosition(),bs.position()).eta() ;
    if (electron.isEB()) // barrel
     {
          if ( (elClass==reco::GsfElectron::GOLDEN) ||
               (elClass==reco::GsfElectron::BIGBREM) )
           { newEnergy = scEnergy/fEtaBarrelGood(scEta) ; }
          else if (elClass==reco::GsfElectron::SHOWERING)
           { newEnergy = scEnergy/fEtaBarrelBad(scEta) ; }
     }
    else if (electron.isEE()) // endcap
     {
      double ePreshower = electron.superCluster()->preshowerEnergy() ;
      if ( (elClass==reco::GsfElectron::GOLDEN) ||
               (elClass==reco::GsfElectron::BIGBREM) )
       { newEnergy = (scEnergy-ePreshower)/fEtaEndcapGood(scEta)+ePreshower ; }
          else if (elClass==reco::GsfElectron::SHOWERING)
           { newEnergy = (scEnergy-ePreshower)/fEtaEndcapBad(scEta)+ePreshower ; }
     }
    else
     { edm::LogWarning("ElectronEnergyCorrector::computeNewEnergy")<<"nor barrel neither endcap electron !" ; }
   }

  //===================
  // energy error
  //=====================

  if (!ff_)
   {
    if (electron.isEB())
     { newEnergyError =  scEnergy * barrelEnergyError(scEnergy,elClass) ; }
    else if (electron.isEE())
     { newEnergyError =  scEnergy * endcapEnergyError(scEnergy,elClass) ; }
    else
     { edm::LogWarning("ElectronEnergyCorrector::computeNewEnergy")<<"nor barrel neither endcap electron !" ; }
   }
  else
   { newEnergyError = ff_->getValue(*(electron.superCluster()),0) ; }

  //===================
  // apply
  //=====================

  electron.correctEcalEnergy(newEnergy,newEnergyError) ;
 }
double ElectronEnergyCorrector::fEtaBarrelBad ( double  scEta) const [private]

Definition at line 140 of file ElectronEnergyCorrector.cc.

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

 {
  // f(eta) for the class = 30 (estimated from 1Mevt single e sample)
  // Ivica's new corrections 01/06
  float p0 =  9.99063e-01;
  float p1 = -2.63341e-02;
  float p2 =  5.16054e-02;
  float p3 = -4.95976e-02;
  float p4 =  3.62304e-03;
  double x  = (double) std::abs(scEta) ;
  return p0 + p1*x + p2*x*x + p3*x*x*x + p4*x*x*x*x ;
 }
double ElectronEnergyCorrector::fEtaBarrelGood ( double  scEta) const [private]

Definition at line 127 of file ElectronEnergyCorrector.cc.

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

 {
  // f(eta) for the first 3 classes (0, 10 and 20) (estimated from 1Mevt single e sample)
  // Ivica's new corrections 01/06
  float p0 =  1.00149e+00 ;
  float p1 = -2.06622e-03 ;
  float p2 = -1.08793e-02 ;
  float p3 =  1.54392e-02 ;
  float p4 = -1.02056e-02 ;
  double x  = (double) std::abs(scEta) ;
  return p0 + p1*x + p2*x*x + p3*x*x*x + p4*x*x*x*x ;
 }
double ElectronEnergyCorrector::fEtaEndcapBad ( double  scEta) const [private]

Definition at line 166 of file ElectronEnergyCorrector.cc.

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

 {
  // f(eta) for the class = 130-134
  // Ivica's new corrections 01/06
  float p0 =        -4.25221e+00 ;
  float p1 =         1.01936e+01 ;
  float p2 =        -7.48247e+00 ;
  float p3 =         2.45520e+00 ;
  float p4 =        -3.02872e-01 ;
  double x  = (double) std::abs(scEta);
  return p0 + p1*x + p2*x*x + p3*x*x*x + p4*x*x*x*x ;
 }
double ElectronEnergyCorrector::fEtaEndcapGood ( double  scEta) const [private]

Definition at line 153 of file ElectronEnergyCorrector.cc.

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

 {
  // f(eta) for the first 3 classes (100, 110 and 120)
  // Ivica's new corrections 01/06
  float p0 = -8.51093e-01 ;
  float p1 =  3.54266e+00 ;
  float p2 = -2.59288e+00 ;
  float p3 = 8.58945e-01 ;
  float p4 = -1.07844e-01 ;
  double x  = (double) std::abs(scEta) ;
  return p0 + p1*x + p2*x*x + p3*x*x*x + p4*x*x*x*x ;
 }

Member Data Documentation

Definition at line 27 of file ElectronEnergyCorrector.h.