CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/src/RecoHI/HiEgammaAlgos/interface/TxyCalculator.h

Go to the documentation of this file.
00001 #ifndef TxyCalculator_h
00002 #define TxyCalculator_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 #include "DataFormats/EgammaCandidates/interface/Photon.h"
00024 
00025 #define PI 3.141592653
00026 
00027 class TxyCalculator
00028 {
00029 public:  
00030    TxyCalculator(const edm::Event &iEvent, const edm::EventSetup &iSetup, edm::InputTag trackLabel);
00031    double getTxy(const reco::Photon p, double x, double y);
00032    double getHollSxy(const reco::Photon p, double thePtCut, double outerR, double innerR);
00033    int getNumAllTracks(double ptCut);
00034    int getNumLocalTracks(const reco::Photon p, double detaCut, double ptCut);
00035 
00036    
00037 private:
00038 
00039    double dRDistance(double eta1,double phi1,double eta2,double phi2)
00040    {
00041       double deta = eta1 - eta2;
00042       double dphi = (calcDphi(phi1, phi2));
00043       
00044       return sqrt(deta * deta + dphi * dphi);
00045    }
00046 
00047    double calcDphi(double phi1_,double phi2_)
00048    {
00049        double dphi=phi1_-phi2_;
00050 
00051       if (dphi>0){
00052          while (dphi>2*PI) dphi-=2*PI;
00053          if (dphi>PI) dphi=2*PI-dphi; 
00054       } else {
00055          while (dphi<-2*PI) dphi+=2*PI;
00056          if (dphi<-PI) dphi=-2*PI-dphi;
00057       }
00058       return dphi;
00059    }
00060 
00061 private:
00062    edm::Handle<reco::TrackCollection>  recCollection;
00063 };
00064 
00065 #endif
00066