CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TxyCalculator.h
Go to the documentation of this file.
1 #ifndef TxyCalculator_h
2 #define TxyCalculator_h
3 
7 
9 
12 
16 
19 
22 
24 
25 #define PI 3.141592653
26 
28 {
29 public:
30  TxyCalculator(const edm::Event &iEvent, const edm::EventSetup &iSetup, edm::InputTag trackLabel);
31  double getTxy(const reco::Photon p, double x, double y);
32  double getHollSxy(const reco::Photon p, double thePtCut, double outerR, double innerR);
33  int getNumAllTracks(double ptCut);
34  int getNumLocalTracks(const reco::Photon p, double detaCut, double ptCut);
35 
36 
37 private:
38 
39  double dRDistance(double eta1,double phi1,double eta2,double phi2)
40  {
41  double deta = eta1 - eta2;
42  double dphi = (calcDphi(phi1, phi2));
43 
44  return sqrt(deta * deta + dphi * dphi);
45  }
46 
47  double calcDphi(double phi1_,double phi2_)
48  {
49  double dphi=phi1_-phi2_;
50 
51  if (dphi>0){
52  while (dphi>2*PI) dphi-=2*PI;
53  if (dphi>PI) dphi=2*PI-dphi;
54  } else {
55  while (dphi<-2*PI) dphi+=2*PI;
56  if (dphi<-PI) dphi=-2*PI-dphi;
57  }
58  return dphi;
59  }
60 
61 private:
63 };
64 
65 #endif
66 
#define PI
double dRDistance(double eta1, double phi1, double eta2, double phi2)
Definition: TxyCalculator.h:39
edm::Handle< reco::TrackCollection > recCollection
Definition: TxyCalculator.h:62
int iEvent
Definition: GenABIO.cc:243
T sqrt(T t)
Definition: SSEVec.h:46
int getNumAllTracks(double ptCut)
int getNumLocalTracks(const reco::Photon p, double detaCut, double ptCut)
double getTxy(const reco::Photon p, double x, double y)
double getHollSxy(const reco::Photon p, double thePtCut, double outerR, double innerR)
TxyCalculator(const edm::Event &iEvent, const edm::EventSetup &iSetup, edm::InputTag trackLabel)
Definition: DDAxes.h:10
double calcDphi(double phi1_, double phi2_)
Definition: TxyCalculator.h:47