CMS 3D CMS Logo

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