Go to the documentation of this file.00001
00009 #include "RecoEgamma/EgammaHLTProducers/interface/EgammaHLTR9Producer.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/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
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
00034 produces < reco::RecoEcalCandidateIsolationMap >();
00035 }
00036
00037
00038 EgammaHLTR9Producer::~EgammaHLTR9Producer(){}
00039
00040
00041
00042
00043
00044
00045
00046 void
00047 EgammaHLTR9Producer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup)
00048 {
00049
00050
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 DetId maxEId = (lazyTools.getMaximum(*(recoecalcandref->superCluster()->seed()) )).first;
00066
00067 edm::Handle< EcalRecHitCollection > pEBRecHits;
00068 iEvent.getByLabel( ecalRechitEBTag_, pEBRecHits );
00069 r9 = EcalSeverityLevelAlgo::swissCross( maxEId, *(pEBRecHits.product()), 0. );
00070 }
00071 else{
00072 float e9 = lazyTools.e3x3( *(recoecalcandref->superCluster()->seed()) );
00073 if (e9 != 0 ) {r9 = lazyTools.eMax(*(recoecalcandref->superCluster()->seed()) )/e9;}
00074 }
00075
00076 r9Map.insert(recoecalcandref, r9);
00077
00078 }
00079
00080 std::auto_ptr<reco::RecoEcalCandidateIsolationMap> R9Map(new reco::RecoEcalCandidateIsolationMap(r9Map));
00081 iEvent.put(R9Map);
00082
00083 }
00084
00085
00086