00001
00009 #include "RecoEgamma/EgammaHLTProducers/interface/EgammaHLTPhotonTrackIsolationProducersRegional.h"
00010
00011
00012 #include "FWCore/Framework/interface/Event.h"
00013 #include "FWCore/Framework/interface/EventSetup.h"
00014 #include "DataFormats/Common/interface/Handle.h"
00015 #include "FWCore/Framework/interface/ESHandle.h"
00016 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00017 #include "FWCore/Utilities/interface/Exception.h"
00018
00019 #include "DataFormats/RecoCandidate/interface/RecoEcalCandidate.h"
00020 #include "DataFormats/RecoCandidate/interface/RecoEcalCandidateIsolation.h"
00021
00022 #include "DataFormats/Common/interface/RefToBase.h"
00023 #include "DataFormats/Common/interface/Ref.h"
00024 #include "DataFormats/Common/interface/RefProd.h"
00025
00026 #include "DataFormats/TrackReco/interface/TrackFwd.h"
00027 #include "DataFormats/TrackReco/interface/Track.h"
00028 #include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h"
00029
00030
00031
00032
00033 EgammaHLTPhotonTrackIsolationProducersRegional::EgammaHLTPhotonTrackIsolationProducersRegional(const edm::ParameterSet& config) : conf_(config)
00034 {
00035
00036 recoEcalCandidateProducer_ = conf_.getParameter<edm::InputTag>("recoEcalCandidateProducer");
00037 trackProducer_ = conf_.getParameter<edm::InputTag>("trackProducer");
00038
00039 countTracks_ = conf_.getParameter<bool>("countTracks");
00040
00041 egTrkIsoPtMin_ = conf_.getParameter<double>("egTrkIsoPtMin");
00042 egTrkIsoConeSize_ = conf_.getParameter<double>("egTrkIsoConeSize");
00043 egTrkIsoZSpan_ = conf_.getParameter<double>("egTrkIsoZSpan");
00044 egTrkIsoRSpan_ = conf_.getParameter<double>("egTrkIsoRSpan");
00045 egTrkIsoVetoConeSize_ = conf_.getParameter<double>("egTrkIsoVetoConeSize");
00046
00047
00048 test_ = new EgammaHLTTrackIsolation(egTrkIsoPtMin_,egTrkIsoConeSize_,
00049 egTrkIsoZSpan_,egTrkIsoRSpan_,egTrkIsoVetoConeSize_);
00050
00051
00052
00053 produces < reco::RecoEcalCandidateIsolationMap >();
00054
00055 }
00056
00057
00058 EgammaHLTPhotonTrackIsolationProducersRegional::~EgammaHLTPhotonTrackIsolationProducersRegional(){delete test_;}
00059
00060
00061
00062
00063
00064
00065
00066 void
00067 EgammaHLTPhotonTrackIsolationProducersRegional::produce(edm::Event& iEvent, const edm::EventSetup& iSetup)
00068 {
00069
00070
00071 edm::Handle<reco::RecoEcalCandidateCollection> recoecalcandHandle;
00072 iEvent.getByLabel(recoEcalCandidateProducer_,recoecalcandHandle);
00073
00074
00075 edm::Handle<reco::TrackCollection> trackHandle;
00076 iEvent.getByLabel(trackProducer_, trackHandle);
00077 const reco::TrackCollection* trackCollection = trackHandle.product();
00078
00079
00080 reco::RecoEcalCandidateIsolationMap isoMap;
00081
00082
00083
00084 for(reco::RecoEcalCandidateCollection::const_iterator iRecoEcalCand = recoecalcandHandle->begin(); iRecoEcalCand != recoecalcandHandle->end(); iRecoEcalCand++){
00085
00086 reco::RecoEcalCandidateRef recoecalcandref(recoecalcandHandle,iRecoEcalCand -recoecalcandHandle ->begin());
00087 const reco::RecoCandidate *tempiRecoEcalCand = &(*recoecalcandref);
00088
00089 bool usePhotonVertex = false;
00090
00091 float isol;
00092 if (countTracks_) {
00093 isol = test_->photonTrackCount(tempiRecoEcalCand,trackCollection,usePhotonVertex);
00094 } else {
00095 isol = test_->photonPtSum(tempiRecoEcalCand,trackCollection,usePhotonVertex);
00096 }
00097
00098 isoMap.insert(recoecalcandref, isol);
00099
00100 }
00101
00102 std::auto_ptr<reco::RecoEcalCandidateIsolationMap> isolMap(new reco::RecoEcalCandidateIsolationMap(isoMap));
00103 iEvent.put(isolMap);
00104
00105 }
00106
00107
00108