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
pat::CaloIsolationEnergy Class Reference

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

#include "PhysicsTools/PatUtils/interface/CaloIsolationEnergy.h"

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 More...
 
float calculate (const Muon &aMuon, const std::vector< CaloTower > &theTowers, float isoConeMuon=0.3) const
 
 CaloIsolationEnergy ()
 constructor More...
 
virtual ~CaloIsolationEnergy ()
 destructor More...
 

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 More...
 

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.

18  {
19 }
CaloIsolationEnergy::~CaloIsolationEnergy ( )
virtual

destructor

Definition at line 22 of file CaloIsolationEnergy.cc.

22  {
23 }

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().

26  {
27  float isoE = this->calculate(*theElectron.gsfTrack(), theElectron.energy(), theTowers, isoConeElectron);
28  return isoE - theElectron.caloEnergy();
29 }
float calculate(const Electron &anElectron, const std::vector< CaloTower > &theTowers, float isoConeElectron=0.3) const
calculate the CalIsoE from the lepton object
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().

30  {
31  return this->calculate(*theMuon.track(), theMuon.energy(), theTowers, isoConeMuon);
32 }
float calculate(const Electron &anElectron, const std::vector< CaloTower > &theTowers, float isoConeElectron=0.3) const
calculate the CalIsoE from the lepton object
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(), PFRecoTauDiscriminationAgainstElectronDeadECAL_cfi::dR, reco::TrackBase::eta(), M_PI, reco::TrackBase::phi(), funct::pow(), and mathSSE::sqrt().

36  {
37  float isoELepton = 0;
38  // calculate iso energy
39  //const CaloTower * closestTower = 0;
40  float closestDR = 10000;
41  for (std::vector<CaloTower>::const_iterator itTower = theTowers.begin(); itTower != theTowers.end(); itTower++) {
42  // calculate dPhi with correct sign
43  float dPhi = theTrack.phi() - itTower->phi();
44  if (dPhi > M_PI) dPhi = -2*M_PI + dPhi;
45  if (dPhi < -M_PI) dPhi = 2*M_PI + dPhi;
46  // calculate dR
47  float dR = sqrt(std::pow(theTrack.eta()-itTower->eta(), 2) + std::pow(dPhi, 2));
48  // calculate energy in cone around direction at vertex of the track
49  if (dR < isoCone) {
50  isoELepton += itTower->energy();
51  if (dR < closestDR) {
52  closestDR = dR;
53  //closestTower = &(*itTower);
54  }
55  }
56  }
57  // subtract track deposits from total energy in cone
58 // if (closestTower) isoELepton -= closestTower->energy();
59  // return the iso energy
60  return isoELepton;
61 }
double dPhi(double phi1, double phi2)
Definition: JetUtil.h:30
T sqrt(T t)
Definition: SSEVec.h:46
#define M_PI
Definition: BFit3D.cc:3
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40