Go to the documentation of this file.00001 #include "RecoHI/HiEgammaAlgos/interface/dRxyCalculator.h"
00002 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00003 #include "Geometry/Records/interface/IdealGeometryRecord.h"
00004 #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h"
00005 #include "DataFormats/Common/interface/Handle.h"
00006 #include "DataFormats/EgammaReco/interface/BasicCluster.h"
00007 #include "DataFormats/EgammaReco/interface/SuperCluster.h"
00008 #include "DataFormats/Candidate/interface/Candidate.h"
00009
00010 using namespace edm;
00011 using namespace reco;
00012
00013 dRxyCalculator::dRxyCalculator(const edm::Event &iEvent, const edm::EventSetup &iSetup, edm::InputTag trackLabel)
00014 {
00015
00016 iEvent.getByLabel(trackLabel, recCollection);
00017
00018 }
00019
00020 double dRxyCalculator::getDRxy(const reco::SuperClusterRef p, double x, double y)
00021 {
00022 using namespace edm;
00023 using namespace reco;
00024
00025 double eta1 = p->eta();
00026 double phi1 = p->phi();
00027
00028 std::vector<double> Rxy;
00029
00030 for(reco::TrackCollection::const_iterator
00031 recTrack = recCollection->begin(); recTrack!= recCollection->end(); recTrack++)
00032 {
00033 double pt = recTrack->pt();
00034 double eta2 = recTrack->eta();
00035 double phi2 = recTrack->phi();
00036
00037 if(pt < x * 0.4)
00038 continue;
00039
00040 double dR = dRDistance(eta1,phi1,eta2,phi2);
00041
00042 if(Rxy.size() < y+1)
00043 {
00044 Rxy.push_back(dR);
00045 sort(Rxy.begin(), Rxy.end());
00046 continue;
00047 }
00048
00049 if(dR < Rxy[Rxy.size()-1])
00050 {
00051 Rxy[Rxy.size()-1] = dR;
00052 sort(Rxy.begin(), Rxy.end());
00053 }
00054 }
00055
00056 double rxy = 4;
00057 if (Rxy.size()<y) rxy=4; else rxy = Rxy[(int)y-1];
00058 Rxy.clear();
00059 return rxy;
00060 }
00061