CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Attributes
TrackIsoCalculator Class Reference

#include <TrackIsoCalculator.h>

Public Member Functions

double getBkgSubTrackIso (reco::Photon const &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 (reco::Photon const &clus, const double i, const double threshold, const double innerDR=0)
 Return the tracker energy in a cone around the photon. More...
 
 TrackIsoCalculator (reco::TrackCollection const &trackCollection, std::string const &trackQuality)
 

Private Attributes

reco::TrackCollection const & recCollection_
 
std::string const & trackQuality_
 

Detailed Description

Definition at line 8 of file TrackIsoCalculator.h.

Constructor & Destructor Documentation

TrackIsoCalculator::TrackIsoCalculator ( reco::TrackCollection const &  trackCollection,
std::string const &  trackQuality 
)

Definition at line 9 of file TrackIsoCalculator.cc.

Member Function Documentation

double TrackIsoCalculator::getBkgSubTrackIso ( reco::Photon const &  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 36 of file TrackIsoCalculator.cc.

References funct::abs(), reco::deltaR2(), reco::LeafCandidate::eta(), getTrackIso(), DiDispStaMuonMonitor_cfi::pt, reco::TrackBase::qualityByName(), recCollection_, trackQuality_, and x.

Referenced by photonIsolationHIProducer::produce().

39  {
40  double SClusterEta = cluster.eta();
41  double totalPt = 0.0;
42 
43  for (auto const& recTrack : recCollection_) {
44  bool goodtrack = recTrack.quality(reco::TrackBase::qualityByName(trackQuality_));
45  if (!goodtrack)
46  continue;
47 
48  double pt = recTrack.pt();
49  if (std::abs(recTrack.eta() - SClusterEta) >= 0.1 * x)
50  continue;
51  if (reco::deltaR2(cluster, recTrack) < innerDR * innerDR)
52  continue;
53 
54  if (pt > threshold)
55  totalPt = totalPt + pt;
56  }
57 
58  double Tx = getTrackIso(cluster, x, threshold, innerDR);
59  double CTx = (Tx - totalPt / 40.0 * x) * (1 / (1 - x / 40.));
60 
61  return CTx;
62 }
reco::TrackCollection const & recCollection_
std::string const & trackQuality_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
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(reco::Photon const &clus, const double i, const double threshold, const double innerDR=0)
Return the tracker energy in a cone around the photon.
double TrackIsoCalculator::getTrackIso ( reco::Photon const &  clus,
const double  i,
const double  threshold,
const double  innerDR = 0 
)

Return the tracker energy in a cone around the photon.

Definition at line 12 of file TrackIsoCalculator.cc.

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

Referenced by getBkgSubTrackIso().

15  {
16  double totalPt = 0;
17 
18  for (auto const& recTrack : recCollection_) {
19  bool goodtrack = recTrack.quality(reco::TrackBase::qualityByName(trackQuality_));
20  if (!goodtrack)
21  continue;
22 
23  double pt = recTrack.pt();
24  double dR2 = reco::deltaR2(cluster, recTrack);
25  if (dR2 >= (0.01 * x * x))
26  continue;
27  if (dR2 < innerDR * innerDR)
28  continue;
29  if (pt > threshold)
30  totalPt = totalPt + pt;
31  }
32 
33  return totalPt;
34 }
reco::TrackCollection const & recCollection_
std::string const & trackQuality_
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

Member Data Documentation

reco::TrackCollection const& TrackIsoCalculator::recCollection_
private

Definition at line 18 of file TrackIsoCalculator.h.

Referenced by getBkgSubTrackIso(), and getTrackIso().

std::string const& TrackIsoCalculator::trackQuality_
private

Definition at line 19 of file TrackIsoCalculator.h.

Referenced by getBkgSubTrackIso(), and getTrackIso().