00001 00009 #include "RecoEgamma/EgammaHLTProducers/interface/EgammaHLTR9Producer.h" 00010 00011 // Framework 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/EgammaReco/interface/SuperCluster.h" 00023 #include "RecoEcal/EgammaCoreTools/interface/EcalClusterLazyTools.h" 00024 #include "RecoLocalCalo/EcalRecAlgos/interface/EcalSeverityLevelAlgo.h" 00025 00026 EgammaHLTR9Producer::EgammaHLTR9Producer(const edm::ParameterSet& config) : conf_(config) 00027 { 00028 // use configuration file to setup input/output collection names 00029 recoEcalCandidateProducer_ = conf_.getParameter<edm::InputTag>("recoEcalCandidateProducer"); 00030 ecalRechitEBTag_ = conf_.getParameter< edm::InputTag > ("ecalRechitEB"); 00031 ecalRechitEETag_ = conf_.getParameter< edm::InputTag > ("ecalRechitEE"); 00032 useSwissCross_ = conf_.getParameter< bool > ("useSwissCross"); 00033 //register your products 00034 produces < reco::RecoEcalCandidateIsolationMap >(); 00035 } 00036 00037 00038 EgammaHLTR9Producer::~EgammaHLTR9Producer(){} 00039 00040 00041 // 00042 // member functions 00043 // 00044 00045 // ------------ method called to produce the data ------------ 00046 void 00047 EgammaHLTR9Producer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) 00048 { 00049 00050 // Get the HLT filtered objects 00051 edm::Handle<reco::RecoEcalCandidateCollection> recoecalcandHandle; 00052 iEvent.getByLabel(recoEcalCandidateProducer_,recoecalcandHandle); 00053 00054 EcalClusterLazyTools lazyTools( iEvent, iSetup, ecalRechitEBTag_, ecalRechitEETag_ ); 00055 00056 reco::RecoEcalCandidateIsolationMap r9Map; 00057 00058 for(reco::RecoEcalCandidateCollection::const_iterator iRecoEcalCand = recoecalcandHandle->begin(); iRecoEcalCand != recoecalcandHandle->end(); iRecoEcalCand++){ 00059 00060 reco::RecoEcalCandidateRef recoecalcandref(recoecalcandHandle,iRecoEcalCand-recoecalcandHandle->begin()); 00061 00062 float r9 = -1; 00063 00064 if (useSwissCross_){ 00065 // I guess this can be removed completely 00066 //DetId maxEId = (lazyTools.getMaximum(*(recoecalcandref->superCluster()->seed()) )).first; 00067 //float EcalSeverityLevelAlgo::swissCross( const DetId id, const EcalRecHitCollection & recHits, float recHitEtThreshold ) 00068 edm::Handle< EcalRecHitCollection > pEBRecHits; 00069 iEvent.getByLabel( ecalRechitEBTag_, pEBRecHits ); 00070 r9 = -1;//EcalSeverityLevelAlgo::swissCross( maxEId, *(pEBRecHits.product()), 0. ); 00071 } 00072 else{ 00073 float e9 = lazyTools.e3x3( *(recoecalcandref->superCluster()->seed()) ); 00074 if (e9 != 0 ) {r9 = lazyTools.eMax(*(recoecalcandref->superCluster()->seed()) )/e9;} 00075 } 00076 00077 r9Map.insert(recoecalcandref, r9); 00078 00079 } 00080 00081 std::auto_ptr<reco::RecoEcalCandidateIsolationMap> R9Map(new reco::RecoEcalCandidateIsolationMap(r9Map)); 00082 iEvent.put(R9Map); 00083 00084 } 00085 00086 //define this as a plug-in 00087 //DEFINE_FWK_MODULE(EgammaHLTR9Producer);