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::CaloIsolationEnergy ( )

constructor

Definition at line 17 of file CaloIsolationEnergy.cc.

17 {}

◆ ~CaloIsolationEnergy()

CaloIsolationEnergy::~CaloIsolationEnergy ( )
virtual

destructor

Definition at line 20 of file CaloIsolationEnergy.cc.

20 {}

Member Function Documentation

◆ calculate() [1/3]

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 23 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

◆ calculate() [2/3]

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

31  {
32  return this->calculate(*theMuon.track(), theMuon.energy(), theTowers, isoConeMuon);
33 }
float calculate(const Electron &anElectron, const std::vector< CaloTower > &theTowers, float isoConeElectron=0.3) const
calculate the CalIsoE from the lepton object

◆ calculate() [3/3]

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 HLT_2022v12_cff::dPhi, HGC3DClusterGenMatchSelector_cfi::dR, reco::TrackBase::eta(), M_PI, reco::TrackBase::phi(), funct::pow(), and mathSSE::sqrt().

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