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 {
21  recCollection = trackLabel;
22  trackQuality_ = trackQuality;
23 }
24 
25 double TrackIsoCalculator::getTrackIso(const reco::Photon cluster, const double x, const double threshold, const double innerDR)
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 }
47 
48 double TrackIsoCalculator::getBkgSubTrackIso(const reco::Photon cluster, const double x, const double threshold, const double innerDR)
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 }
double eta() const final
momentum pseudorapidity
int iEvent
Definition: GenABIO.cc:230
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:125
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.