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::SuperClusterRef 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::SuperClusterRef p, double x, double y)
59 {
60  using namespace edm;
61  using namespace reco;
62 
63  /*
64  if(!recCollection)
65  {
66  LogError("TxyCalculator") << "Error! The track container is not found.";
67  return -100;
68  }
69  */
70 
71 
72  double eta1 = p->eta();
73  double phi1 = p->phi();
74 
75  float txy = 0;
76 
77  for(reco::TrackCollection::const_iterator
78  recTrack = recCollection->begin(); recTrack!= recCollection->end(); recTrack++)
79  {
80  double pt = recTrack->pt();
81  double eta2 = recTrack->eta();
82  double phi2 = recTrack->phi();
83 
84  if(dRDistance(eta1,phi1,eta2,phi2) >= 0.1 * x)
85  continue;
86 
87  if(pt > y * 0.4)
88  txy = txy + 1;
89  }
90 
91  return txy;
92 }
93 
double getTxy(const reco::SuperClusterRef p, double x, double y)
int iEvent
Definition: GenABIO.cc:243
int getNumAllTracks(double ptCut)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:355
int getNumLocalTracks(const reco::SuperClusterRef p, double detaCut, double ptCut)
TxyCalculator(const edm::Event &iEvent, const edm::EventSetup &iSetup, edm::InputTag trackLabel)
Definition: DDAxes.h:10