CMS 3D CMS Logo

TrackIsoCalculator.cc
Go to the documentation of this file.
1 // ROOT includes
2 #include <Math/VectorUtil.h>
3 
6 
9 
14 
15 using namespace edm;
16 using namespace reco;
17 using namespace std;
18 
20  const edm::EventSetup &iSetup,
22  const std::string trackQuality) {
23  recCollection = trackLabel;
24  trackQuality_ = trackQuality;
25 }
26 
28  const double x,
29  const double threshold,
30  const double innerDR) {
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 }
51 
53  const double x,
54  const double threshold,
55  const double innerDR) {
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 }
double eta() const final
momentum pseudorapidity
int iEvent
Definition: GenABIO.cc:224
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.
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
fixed size matrix
HLT enums.
TrackIsoCalculator(const edm::Event &iEvent, const edm::EventSetup &iSetup, const edm::Handle< reco::TrackCollection > trackLabel, const std::string trackQuality_)
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.