00001
00009 #include "RecoEgamma/EgammaHLTProducers/interface/EgammaHLTHcalIsolationProducersRegional.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
00023 #include "DataFormats/Common/interface/RefToBase.h"
00024 #include "DataFormats/Common/interface/Ref.h"
00025 #include "DataFormats/Common/interface/RefProd.h"
00026
00027 #include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h"
00028 #include "DataFormats/HcalDetId/interface/HcalDetId.h"
00029 #include "Geometry/CaloGeometry/interface/CaloCellGeometry.h"
00030 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
00031
00032 #include "Geometry/Records/interface/CaloGeometryRecord.h"
00033
00034 EgammaHLTHcalIsolationProducersRegional::EgammaHLTHcalIsolationProducersRegional(const edm::ParameterSet& config) : conf_(config)
00035 {
00036
00037 recoEcalCandidateProducer_ = conf_.getParameter<edm::InputTag>("recoEcalCandidateProducer");
00038
00039 hbRecHitProducer_ = conf_.getParameter<edm::InputTag>("hbRecHitProducer");
00040 hfRecHitProducer_ = conf_.getParameter<edm::InputTag>("hfRecHitProducer");
00041
00042 egHcalIsoPtMin_ = conf_.getParameter<double>("egHcalIsoPtMin");
00043 egHcalIsoConeSize_ = conf_.getParameter<double>("egHcalIsoConeSize");
00044
00045 test_ = new EgammaHLTHcalIsolation(egHcalIsoPtMin_,egHcalIsoConeSize_);
00046
00047
00048
00049 produces < reco::RecoEcalCandidateIsolationMap >();
00050 }
00051
00052
00053 EgammaHLTHcalIsolationProducersRegional::~EgammaHLTHcalIsolationProducersRegional(){delete test_;}
00054
00055
00056
00057
00058
00059
00060
00061 void
00062 EgammaHLTHcalIsolationProducersRegional::produce(edm::Event& iEvent, const edm::EventSetup& iSetup)
00063 {
00064
00065
00066 edm::Handle<reco::RecoEcalCandidateCollection> recoecalcandHandle;
00067 iEvent.getByLabel(recoEcalCandidateProducer_,recoecalcandHandle);
00068
00069 edm::Handle<HBHERecHitCollection> hhitBarrelHandle;
00070 iEvent.getByLabel(hbRecHitProducer_, hhitBarrelHandle);
00071 const HBHERecHitCollection* hcalhitBarrelCollection = hhitBarrelHandle.product();
00072
00073 edm::Handle<HFRecHitCollection> hhitEndcapHandle;
00074 iEvent.getByLabel(hfRecHitProducer_, hhitEndcapHandle);
00075 const HFRecHitCollection* hcalhitEndcapCollection = hhitEndcapHandle.product();
00076
00077 edm::ESHandle<CaloGeometry> pG;
00078 iSetup.get<CaloGeometryRecord>().get(pG);
00079 const CaloGeometry* caloGeom = pG.product();
00080
00081 reco::RecoEcalCandidateIsolationMap isoMap;
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
00088
00089 const reco::RecoCandidate *tempiRecoEcalCand = &(*recoecalcandref);
00090 float isol = test_->isolPtSum(tempiRecoEcalCand,hcalhitBarrelCollection,hcalhitEndcapCollection,caloGeom);
00091
00092 isoMap.insert(recoecalcandref, isol);
00093
00094 }
00095
00096 std::auto_ptr<reco::RecoEcalCandidateIsolationMap> isolMap(new reco::RecoEcalCandidateIsolationMap(isoMap));
00097 iEvent.put(isolMap);
00098
00099 }
00100
00101
00102