CMS 3D CMS Logo

Public Member Functions | Private Member Functions

pat::CaloIsolationEnergy Class Reference

Calculates a lepton's calorimetric isolation energy. More...

#include <PhysicsTools/PatUtils/interface/CaloIsolationEnergy.h>

List of all members.

Public Member Functions

float calculate (const Electron &anElectron, const std::vector< CaloTower > &theTowers, float isoConeElectron=0.3) const
 calculate the CalIsoE from the lepton object
float calculate (const Muon &aMuon, const std::vector< CaloTower > &theTowers, float isoConeMuon=0.3) const
 CaloIsolationEnergy ()
 constructor
virtual ~CaloIsolationEnergy ()
 destructor

Private Member Functions

float calculate (const reco::Track &track, const float leptonEnergy, const std::vector< CaloTower > &theTowers, float isoCone) const
 calculate the CalIsoE from the lepton's track

Detailed Description

Calculates a lepton's calorimetric isolation energy.

CaloIsolationEnergy calculates a calorimetric isolation energy in a half-cone (dependent on the lepton's charge) around the lepton's impact position on the ECAL surface, as defined in CMS Note 2006/024

Author:
Steven Lowette
Version:
Id:
CaloIsolationEnergy.h,v 1.3 2008/03/05 14:51:02 fronga Exp

Definition at line 33 of file CaloIsolationEnergy.h.


Constructor & Destructor Documentation

CaloIsolationEnergy::CaloIsolationEnergy ( )

constructor

Definition at line 18 of file CaloIsolationEnergy.cc.

                                         {
}
CaloIsolationEnergy::~CaloIsolationEnergy ( ) [virtual]

destructor

Definition at line 22 of file CaloIsolationEnergy.cc.

                                          {
}

Member Function Documentation

float CaloIsolationEnergy::calculate ( const Electron anElectron,
const std::vector< CaloTower > &  theTowers,
float  isoConeElectron = 0.3 
) const

calculate the CalIsoE from the lepton object

Definition at line 26 of file CaloIsolationEnergy.cc.

References reco::GsfElectron::caloEnergy(), reco::LeafCandidate::energy(), and pat::Electron::gsfTrack().

Referenced by calculate().

                                                                                                                                      {
  float isoE = this->calculate(*theElectron.gsfTrack(), theElectron.energy(), theTowers, isoConeElectron);
  return isoE - theElectron.caloEnergy();
}
float CaloIsolationEnergy::calculate ( const reco::Track track,
const float  leptonEnergy,
const std::vector< CaloTower > &  theTowers,
float  isoCone 
) const [private]

calculate the CalIsoE from the lepton's track

Definition at line 36 of file CaloIsolationEnergy.cc.

References dPhi(), reco::TrackBase::eta(), M_PI, reco::TrackBase::phi(), funct::pow(), and mathSSE::sqrt().

                                                                                                                                                      {
  float isoELepton = 0;
  // calculate iso energy
  const CaloTower * closestTower = 0;
  float closestDR = 10000;
  for (std::vector<CaloTower>::const_iterator itTower = theTowers.begin(); itTower != theTowers.end(); itTower++) {
    // calculate dPhi with correct sign
    float dPhi = theTrack.phi() - itTower->phi();
    if (dPhi > M_PI)  dPhi = -2*M_PI + dPhi;
    if (dPhi < -M_PI) dPhi =  2*M_PI + dPhi;
    // calculate dR
    float dR = sqrt(std::pow(theTrack.eta()-itTower->eta(), 2) + std::pow(dPhi, 2));
    // calculate energy in cone around direction at vertex of the track
    if (dR < isoCone) {
      isoELepton += itTower->energy();
      if (dR < closestDR) {
        closestDR = dR;
        closestTower = &(*itTower);
      }
    }
  }
  // subtract track deposits from total energy in cone
//  if (closestTower) isoELepton -= closestTower->energy();
  // return the iso energy
  return isoELepton;
}
float CaloIsolationEnergy::calculate ( const Muon aMuon,
const std::vector< CaloTower > &  theTowers,
float  isoConeMuon = 0.3 
) const

Definition at line 30 of file CaloIsolationEnergy.cc.

References calculate(), reco::LeafCandidate::energy(), and pat::Muon::track().

                                                                                                                          {
  return this->calculate(*theMuon.track(), theMuon.energy(), theTowers, isoConeMuon);
}