CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/RecoHI/HiEgammaAlgos/interface/dRxyCalculator.h

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 #include "DataFormats/EgammaCandidates/interface/Photon.h"
00023 
00024 #define PI 3.141592653
00025 
00026 class dRxyCalculator
00027 {
00028 public:  
00029    dRxyCalculator(const edm::Event &iEvent, const edm::EventSetup &iSetup, edm::InputTag trackLabel);
00030    double getDRxy(const reco::Photon cluster, double x, double y);
00031 
00032 private:
00033    double dRDistance(double eta1,double phi1,double eta2,double phi2)
00034    {
00035       double deta = eta1 - eta2;
00036       double dphi = (calcDphi(phi1, phi2));
00037       
00038       return sqrt(deta * deta + dphi * dphi);
00039    }
00040    
00041    double calcDphi(double phi1_,double phi2_)
00042    {
00043        double dphi=phi1_-phi2_;
00044 
00045       if (dphi>0){
00046          while (dphi>2*PI) dphi-=2*PI;
00047          if (dphi>PI) dphi=2*PI-dphi; 
00048       } else {
00049          while (dphi<-2*PI) dphi+=2*PI;
00050          if (dphi<-PI) dphi=-2*PI-dphi;
00051       }
00052       return dphi;
00053    }
00054    
00055 private:
00056    edm::Handle<reco::TrackCollection>  recCollection;
00057 };
00058 
00059 #endif
00060