CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
TrackIsoCalculator Class Reference

#include <TrackIsoCalculator.h>

Public Member Functions

double getBkgSubTrackIso (const reco::Photon clus, const double i, const double threshold, const double innerDR=0)
 Return the background-subtracted tracker energy in a cone around the photon. More...
 
double getTrackIso (const reco::Photon clus, const double i, const double threshold, const double innerDR=0)
 Return the tracker energy in a cone around the photon. More...
 
 TrackIsoCalculator (const edm::Event &iEvent, const edm::EventSetup &iSetup, const edm::Handle< reco::TrackCollection > trackLabel, const std::string trackQuality_)
 

Private Attributes

edm::Handle< reco::TrackCollectionrecCollection
 
std::string trackQuality_
 

Detailed Description

Definition at line 22 of file TrackIsoCalculator.h.

Constructor & Destructor Documentation

TrackIsoCalculator::TrackIsoCalculator ( const edm::Event iEvent,
const edm::EventSetup iSetup,
const edm::Handle< reco::TrackCollection trackLabel,
const std::string  trackQuality_ 
)

Member Function Documentation

double TrackIsoCalculator::getBkgSubTrackIso ( const reco::Photon  clus,
const double  i,
const double  threshold,
const double  innerDR = 0 
)

Return the background-subtracted tracker energy in a cone around the photon.

Definition at line 48 of file TrackIsoCalculator.cc.

References reco::deltaR2(), particleFlow_cfi::dEta, reco::LeafCandidate::eta(), EnergyCorrector::pt, and reco::TrackBase::qualityByName().

Referenced by photonIsolationHIProducer::produce().

49 {
50  double SClusterEta = cluster.eta();
51  double TotalPt = 0;
52 
53  TotalPt = 0;
54 
55  for(reco::TrackCollection::const_iterator
56  recTrack = recCollection->begin(); recTrack!= recCollection->end(); recTrack++)
57  {
58  bool goodtrack = recTrack->quality(reco::TrackBase::qualityByName(trackQuality_));
59  if(!goodtrack) continue;
60 
61  double pt = recTrack->pt();
62  double eta2 = recTrack->eta();
63  double dEta = fabs(eta2-SClusterEta);
64  double dR2 = reco::deltaR2(cluster, *recTrack);
65  if(dEta >= 0.1 * x)
66  continue;
67  if(dR2 < innerDR*innerDR)
68  continue;
69 
70  if(pt > threshold)
71  TotalPt = TotalPt + pt;
72  }
73 
74  double Tx = getTrackIso(cluster,x,threshold,innerDR);
75  double CTx = (Tx - TotalPt / 40.0 * x)*(1/(1-x/40.));
76 
77  return CTx;
78 }
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:16
static TrackQuality qualityByName(const std::string &name)
Definition: TrackBase.cc:125
double getTrackIso(const reco::Photon clus, const double i, const double threshold, const double innerDR=0)
Return the tracker energy in a cone around the photon.
edm::Handle< reco::TrackCollection > recCollection
double TrackIsoCalculator::getTrackIso ( const reco::Photon  clus,
const double  i,
const double  threshold,
const double  innerDR = 0 
)

Return the tracker energy in a cone around the photon.

Definition at line 25 of file TrackIsoCalculator.cc.

References reco::deltaR2(), EnergyCorrector::pt, and reco::TrackBase::qualityByName().

26 {
27  double TotalPt = 0;
28 
29  for(reco::TrackCollection::const_iterator
30  recTrack = recCollection->begin(); recTrack!= recCollection->end(); recTrack++)
31  {
32  bool goodtrack = recTrack->quality(reco::TrackBase::qualityByName(trackQuality_));
33  if(!goodtrack) continue;
34 
35  double pt = recTrack->pt();
36  double dR2 = reco::deltaR2(cluster, *recTrack);
37  if(dR2 >= (0.01 * x*x))
38  continue;
39  if(dR2 < innerDR*innerDR)
40  continue;
41  if(pt > threshold)
42  TotalPt = TotalPt + pt;
43  }
44 
45  return TotalPt;
46 }
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:16
static TrackQuality qualityByName(const std::string &name)
Definition: TrackBase.cc:125
edm::Handle< reco::TrackCollection > recCollection

Member Data Documentation

edm::Handle<reco::TrackCollection> TrackIsoCalculator::recCollection
private

Definition at line 35 of file TrackIsoCalculator.h.

std::string TrackIsoCalculator::trackQuality_
private

Definition at line 36 of file TrackIsoCalculator.h.