CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TxyCalculator.cc
Go to the documentation of this file.
9 
10 using namespace edm;
11 using namespace reco;
12 
14 {
15  // Get reconstructed tracks
16  iEvent.getByLabel(trackLabel, recCollection); // !!
17 }
18 
19 
21 {
22  using namespace edm;
23  using namespace reco;
24 
25  int nTracks = 0;
26 
27  for(reco::TrackCollection::const_iterator
28  recTrack = recCollection->begin(); recTrack!= recCollection->end(); recTrack++)
29  {
30  double pt = recTrack->pt();
31  if ( pt > ptCut)
32  nTracks = nTracks +1;
33  }
34  return nTracks;
35 }
36 
37 
38 int TxyCalculator::getNumLocalTracks(const reco::Photon p, double detaCut, double ptCut)
39 {
40  using namespace edm;
41  using namespace reco;
42 
43  int nTracks = 0;
44 
45  double eta1 = p.eta();
46  double phi1 = p.phi();
47 
48  for(reco::TrackCollection::const_iterator
49  recTrack = recCollection->begin(); recTrack!= recCollection->end(); recTrack++)
50  {
51  double pt = recTrack->pt();
52  if ( (pt > ptCut) && ( fabs(eta1 - recTrack->eta()) < detaCut) && ( fabs(calcDphi(recTrack->phi(),phi1)) < 3.141592/2. ) )
53  nTracks= nTracks +1;
54  }
55  return nTracks;
56 }
57 
58 double TxyCalculator::getTxy(const reco::Photon p, double x, double y)
59 {
60  using namespace edm;
61  using namespace reco;
62 
63  // if(!recCollection)
64  // {
65  // LogError("TxyCalculator") << "Error! The track container is not found.";
66  // return -100;
67  // }
68 
69 
70  double eta1 = p.eta();
71  double phi1 = p.phi();
72 
73  float txy = 0;
74 
75  for(reco::TrackCollection::const_iterator
76  recTrack = recCollection->begin(); recTrack!= recCollection->end(); recTrack++)
77  {
78  double pt = recTrack->pt();
79  double eta2 = recTrack->eta();
80  double phi2 = recTrack->phi();
81 
82  if(dRDistance(eta1,phi1,eta2,phi2) >= 0.1 * x)
83  continue;
84 
85  if(pt > y * 0.4)
86  txy = txy + 1;
87  }
88 
89  return txy;
90 }
91 
92 double TxyCalculator::getHollSxy(const reco::Photon p, double thePtCut, double outerR, double innerR)
93 {
94  using namespace edm;
95  using namespace reco;
96 
97  double eta1 = p.eta();
98  double phi1 = p.phi();
99 
100  double ptSum = 0;
101 
102  for(reco::TrackCollection::const_iterator
103  recTrack = recCollection->begin(); recTrack!= recCollection->end(); recTrack++)
104  {
105  double pt = recTrack->pt();
106  double eta2 = recTrack->eta();
107  double phi2 = recTrack->phi();
108  if (dRDistance(eta1,phi1,eta2,phi2) >= outerR)
109  continue;
110  if (dRDistance(eta1,phi1,eta2,phi2) <= innerR)
111  continue;
112  if(pt > thePtCut)
113  ptSum = ptSum + pt;
114  }
115 
116  return ptSum;
117 }
virtual float phi() const GCC11_FINAL
momentum azimuthal angle
int iEvent
Definition: GenABIO.cc:243
int getNumAllTracks(double ptCut)
int getNumLocalTracks(const reco::Photon p, double detaCut, double ptCut)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
double getTxy(const reco::Photon p, double x, double y)
double getHollSxy(const reco::Photon p, double thePtCut, double outerR, double innerR)
virtual float eta() const GCC11_FINAL
momentum pseudorapidity
TxyCalculator(const edm::Event &iEvent, const edm::EventSetup &iSetup, edm::InputTag trackLabel)
Definition: DDAxes.h:10