CMS 3D CMS Logo

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.2 2008/02/28 14:54:24 llista Exp

Definition at line 32 of file CaloIsolationEnergy.h.

Constructor & Destructor Documentation

CaloIsolationEnergy::CaloIsolationEnergy ( )

constructor

Definition at line 17 of file CaloIsolationEnergy.cc.

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

destructor

Definition at line 21 of file CaloIsolationEnergy.cc.

21  {
22 }

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 25 of file CaloIsolationEnergy.cc.

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

Referenced by calculate().

25  {
26  float isoE = this->calculate(*theElectron.gsfTrack(), theElectron.energy(), theTowers, isoConeElectron);
27  return isoE - theElectron.caloEnergy();
28 }
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 29 of file CaloIsolationEnergy.cc.

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

29  {
30  return this->calculate(*theMuon.track(), theMuon.energy(), theTowers, isoConeMuon);
31 }
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 35 of file CaloIsolationEnergy.cc.

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

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