CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_4/src/RecoEgamma/EgammaHLTProducers/src/EgammaHLTR9IDProducer.cc

Go to the documentation of this file.
00001 
00009 #include "RecoEgamma/EgammaHLTProducers/interface/EgammaHLTR9IDProducer.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 EgammaHLTR9IDProducer::EgammaHLTR9IDProducer(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   //register your products
00033   produces < reco::RecoEcalCandidateIsolationMap >();
00034 }
00035 
00036 
00037 EgammaHLTR9IDProducer::~EgammaHLTR9IDProducer(){}
00038 
00039 
00040 //
00041 // member functions
00042 //
00043 
00044 // ------------ method called to produce the data  ------------
00045 void
00046 EgammaHLTR9IDProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup)
00047 {
00048   
00049   // Get the HLT filtered objects
00050   edm::Handle<reco::RecoEcalCandidateCollection> recoecalcandHandle;
00051   iEvent.getByLabel(recoEcalCandidateProducer_,recoecalcandHandle);
00052 
00053   EcalClusterLazyTools lazyTools( iEvent, iSetup, ecalRechitEBTag_, ecalRechitEETag_ );
00054   
00055   reco::RecoEcalCandidateIsolationMap r9Map;
00056    
00057   for(reco::RecoEcalCandidateCollection::const_iterator iRecoEcalCand = recoecalcandHandle->begin(); iRecoEcalCand != recoecalcandHandle->end(); iRecoEcalCand++){
00058     
00059     reco::RecoEcalCandidateRef recoecalcandref(recoecalcandHandle,iRecoEcalCand-recoecalcandHandle->begin());
00060 
00061     float r9 = -1;
00062 
00063     float e9 = lazyTools.e3x3( *(recoecalcandref->superCluster()->seed()) );
00064     float eraw = recoecalcandref->superCluster()->rawEnergy();
00065     if (eraw > 0. ) {r9 = e9/eraw;}
00066 
00067     r9Map.insert(recoecalcandref, r9);
00068     
00069   }
00070 
00071   std::auto_ptr<reco::RecoEcalCandidateIsolationMap> R9Map(new reco::RecoEcalCandidateIsolationMap(r9Map));
00072   iEvent.put(R9Map);
00073 
00074 }
00075 
00076 //define this as a plug-in
00077 //DEFINE_FWK_MODULE(EgammaHLTR9IDProducer);