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 52 of file TrackIsoCalculator.cc.

References reco::deltaR2(), HLT_2018_cff::dEta, reco::LeafCandidate::eta(), HLT_2018_cff::eta2, DiDispStaMuonMonitor_cfi::pt, and reco::TrackBase::qualityByName().

Referenced by photonIsolationHIProducer::produce().

55  {
56  double SClusterEta = cluster.eta();
57  double TotalPt = 0;
58 
59  TotalPt = 0;
60 
61  for (reco::TrackCollection::const_iterator recTrack = recCollection->begin(); recTrack != recCollection->end();
62  recTrack++) {
63  bool goodtrack = recTrack->quality(reco::TrackBase::qualityByName(trackQuality_));
64  if (!goodtrack)
65  continue;
66 
67  double pt = recTrack->pt();
68  double eta2 = recTrack->eta();
69  double dEta = fabs(eta2 - SClusterEta);
70  double dR2 = reco::deltaR2(cluster, *recTrack);
71  if (dEta >= 0.1 * x)
72  continue;
73  if (dR2 < innerDR * innerDR)
74  continue;
75 
76  if (pt > threshold)
77  TotalPt = TotalPt + pt;
78  }
79 
80  double Tx = getTrackIso(cluster, x, threshold, innerDR);
81  double CTx = (Tx - TotalPt / 40.0 * x) * (1 / (1 - x / 40.));
82 
83  return CTx;
84 }
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:126
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 27 of file TrackIsoCalculator.cc.

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

30  {
31  double TotalPt = 0;
32 
33  for (reco::TrackCollection::const_iterator recTrack = recCollection->begin(); recTrack != recCollection->end();
34  recTrack++) {
35  bool goodtrack = recTrack->quality(reco::TrackBase::qualityByName(trackQuality_));
36  if (!goodtrack)
37  continue;
38 
39  double pt = recTrack->pt();
40  double dR2 = reco::deltaR2(cluster, *recTrack);
41  if (dR2 >= (0.01 * x * x))
42  continue;
43  if (dR2 < innerDR * innerDR)
44  continue;
45  if (pt > threshold)
46  TotalPt = TotalPt + pt;
47  }
48 
49  return TotalPt;
50 }
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:126
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.