Go to the documentation of this file.00001 #ifndef dRxyCalculator_h
00002 #define dRxyCalculator_h
00003
00004 #include "FWCore/Framework/interface/Event.h"
00005 #include "FWCore/Framework/interface/EventSetup.h"
00006 #include "FWCore/Framework/interface/ESHandle.h"
00007
00008 #include "FWCore/Utilities/interface/InputTag.h"
00009
00010 #include "DataFormats/EgammaReco/interface/BasicClusterFwd.h"
00011 #include "DataFormats/EgammaReco/interface/SuperClusterFwd.h"
00012
00013 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
00014 #include "Geometry/Records/interface/IdealGeometryRecord.h"
00015 #include "RecoCaloTools/MetaCollections/interface/CaloRecHitMetaCollections.h"
00016
00017 #include "DataFormats/Candidate/interface/CandidateFwd.h"
00018 #include "DataFormats/Candidate/interface/Candidate.h"
00019
00020 #include "DataFormats/TrackReco/interface/Track.h"
00021 #include "DataFormats/TrackReco/interface/TrackFwd.h"
00022
00023 #define PI 3.141592653
00024
00025 class dRxyCalculator
00026 {
00027 public:
00028 dRxyCalculator(const edm::Event &iEvent, const edm::EventSetup &iSetup, edm::InputTag trackLabel);
00029 double getDRxy(const reco::SuperClusterRef cluster, double x, double y);
00030
00031 private:
00032 double dRDistance(double eta1,double phi1,double eta2,double phi2)
00033 {
00034 double deta = eta1 - eta2;
00035 double dphi = (calcDphi(phi1, phi2));
00036
00037 return sqrt(deta * deta + dphi * dphi);
00038 }
00039
00040 double calcDphi(double phi1_,double phi2_)
00041 {
00042 double dphi=phi1_-phi2_;
00043
00044 if (dphi>0){
00045 while (dphi>2*PI) dphi-=2*PI;
00046 if (dphi>PI) dphi=2*PI-dphi;
00047 } else {
00048 while (dphi<-2*PI) dphi+=2*PI;
00049 if (dphi<-PI) dphi=-2*PI-dphi;
00050 }
00051 return dphi;
00052 }
00053
00054 private:
00055 edm::Handle<reco::TrackCollection> recCollection;
00056 };
00057
00058 #endif
00059