CMS 3D CMS Logo

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

#include <TxyCalculator.h>

Public Member Functions

int getNumAllTracks (double ptCut)
 
int getNumLocalTracks (const reco::SuperClusterRef p, double detaCut, double ptCut)
 
double getTxy (const reco::SuperClusterRef p, double x, double y)
 
 TxyCalculator (const edm::Event &iEvent, const edm::EventSetup &iSetup, edm::InputTag trackLabel)
 

Private Member Functions

double calcDphi (double phi1_, double phi2_)
 
double dRDistance (double eta1, double phi1, double eta2, double phi2)
 

Private Attributes

edm::Handle
< reco::TrackCollection
recCollection
 

Detailed Description

Definition at line 25 of file TxyCalculator.h.

Constructor & Destructor Documentation

TxyCalculator::TxyCalculator ( const edm::Event iEvent,
const edm::EventSetup iSetup,
edm::InputTag  trackLabel 
)

Definition at line 13 of file TxyCalculator.cc.

References edm::Event::getByLabel().

14 {
15  // Get reconstructed tracks
16  iEvent.getByLabel(trackLabel, recCollection); // !!
17 }
edm::Handle< reco::TrackCollection > recCollection
Definition: TxyCalculator.h:58
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:359

Member Function Documentation

double TxyCalculator::calcDphi ( double  phi1_,
double  phi2_ 
)
inlineprivate

Definition at line 43 of file TxyCalculator.h.

References PI.

Referenced by dRDistance().

44  {
45  double dphi=phi1_-phi2_;
46 
47  if (dphi>0){
48  while (dphi>2*PI) dphi-=2*PI;
49  if (dphi>PI) dphi=2*PI-dphi;
50  } else {
51  while (dphi<-2*PI) dphi+=2*PI;
52  if (dphi<-PI) dphi=-2*PI-dphi;
53  }
54  return dphi;
55  }
#define PI
double TxyCalculator::dRDistance ( double  eta1,
double  phi1,
double  eta2,
double  phi2 
)
inlineprivate

Definition at line 35 of file TxyCalculator.h.

References calcDphi(), and mathSSE::sqrt().

36  {
37  double deta = eta1 - eta2;
38  double dphi = (calcDphi(phi1, phi2));
39 
40  return sqrt(deta * deta + dphi * dphi);
41  }
T sqrt(T t)
Definition: SSEVec.h:28
double calcDphi(double phi1_, double phi2_)
Definition: TxyCalculator.h:43
int TxyCalculator::getNumAllTracks ( double  ptCut)

Definition at line 20 of file TxyCalculator.cc.

References ExpressReco_HICollisions_FallBack::pt, and dt_offlineAnalysis_common_cff::reco.

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 }
edm::Handle< reco::TrackCollection > recCollection
Definition: TxyCalculator.h:58
int TxyCalculator::getNumLocalTracks ( const reco::SuperClusterRef  p,
double  detaCut,
double  ptCut 
)

Definition at line 38 of file TxyCalculator.cc.

References ExpressReco_HICollisions_FallBack::pt, and dt_offlineAnalysis_common_cff::reco.

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 }
edm::Handle< reco::TrackCollection > recCollection
Definition: TxyCalculator.h:58
double calcDphi(double phi1_, double phi2_)
Definition: TxyCalculator.h:43
double TxyCalculator::getTxy ( const reco::SuperClusterRef  p,
double  x,
double  y 
)

Definition at line 58 of file TxyCalculator.cc.

References ExpressReco_HICollisions_FallBack::pt, and dt_offlineAnalysis_common_cff::reco.

Referenced by HiEgammaIsolationProducer::produce().

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 }
double dRDistance(double eta1, double phi1, double eta2, double phi2)
Definition: TxyCalculator.h:35
edm::Handle< reco::TrackCollection > recCollection
Definition: TxyCalculator.h:58

Member Data Documentation

edm::Handle<reco::TrackCollection> TxyCalculator::recCollection
private

Definition at line 58 of file TxyCalculator.h.