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 
15 
18 
22 
23 #define PI 3.141592653
24 
26 {
27 public:
28  dRxyCalculator(const edm::Event &iEvent, const edm::EventSetup &iSetup, const edm::InputTag& trackLabel);
29  double getDRxy(const reco::Photon& cluster, double x, double y);
30 
31 private:
32  double dRDistance(double eta1,double phi1,double eta2,double phi2)
33  {
34  double deta = eta1 - eta2;
35  double dphi = (calcDphi(phi1, phi2));
36 
37  return sqrt(deta * deta + dphi * dphi);
38  }
39 
40  double calcDphi(double phi1_,double phi2_)
41  {
42  double dphi=phi1_-phi2_;
43 
44  if (dphi>0){
45  while (dphi>2*PI) dphi-=2*PI;
46  if (dphi>PI) dphi=2*PI-dphi;
47  } else {
48  while (dphi<-2*PI) dphi+=2*PI;
49  if (dphi<-PI) dphi=-2*PI-dphi;
50  }
51  return dphi;
52  }
53 
54 private:
56 };
57 
58 #endif
59 
#define PI
double getDRxy(const reco::Photon &cluster, double x, double y)
int iEvent
Definition: GenABIO.cc:230
edm::Handle< reco::TrackCollection > recCollection
T sqrt(T t)
Definition: SSEVec.h:48
double calcDphi(double phi1_, double phi2_)
Definition: DDAxes.h:10
double dRDistance(double eta1, double phi1, double eta2, double phi2)
dRxyCalculator(const edm::Event &iEvent, const edm::EventSetup &iSetup, const edm::InputTag &trackLabel)