#include <RecoEgamma/EgammaHLTProducers/interface/EgammaHLTElectronCombinedIsolationProducer.h>
Public Member Functions | |
EgammaHLTElectronCombinedIsolationProducer (const edm::ParameterSet &) | |
virtual void | produce (edm::Event &, const edm::EventSetup &) |
~EgammaHLTElectronCombinedIsolationProducer () | |
Private Attributes | |
std::vector< edm::InputTag > | CaloIsolTag_ |
std::vector< double > | CaloIsolWeight_ |
edm::ParameterSet | conf_ |
edm::InputTag | electronProducer_ |
edm::InputTag | recoEcalCandidateProducer_ |
edm::InputTag | TrackIsolTag_ |
double | TrackIsolWeight_ |
Definition at line 29 of file EgammaHLTElectronCombinedIsolationProducer.h.
EgammaHLTElectronCombinedIsolationProducer::EgammaHLTElectronCombinedIsolationProducer | ( | const edm::ParameterSet & | config | ) | [explicit] |
Definition at line 32 of file EgammaHLTElectronCombinedIsolationProducer.cc.
References CaloIsolTag_, CaloIsolWeight_, conf_, electronProducer_, Exception, edm::ParameterSet::getParameter(), recoEcalCandidateProducer_, TrackIsolTag_, and TrackIsolWeight_.
: conf_(config) { electronProducer_ = conf_.getParameter<edm::InputTag>("electronProducer"); recoEcalCandidateProducer_ = conf_.getParameter<edm::InputTag>("recoEcalCandidateProducer"); CaloIsolTag_ = conf_.getParameter< std::vector<edm::InputTag> > ("CaloIsolationMapTags"); //need to be in the order EcalIso, HcalIso, EleTrackIso CaloIsolWeight_ = conf_.getParameter< std::vector<double> > ("CaloIsolationWeight"); TrackIsolTag_ = conf_.getParameter<edm::InputTag>("TrackIsolationMapTag"); TrackIsolWeight_ = conf_.getParameter<double>("TrackIsolationWeight"); if ( CaloIsolTag_.size() != CaloIsolWeight_.size()){ throw cms::Exception("BadConfig") << "vectors CaloIsolationMapTags and CaloIsolationWeight need to have size 3"; } // SCProducer_ = conf_.getParameter<edm::InputTag>("electronProducer"); //register your products produces < reco::ElectronIsolationMap >(); }
EgammaHLTElectronCombinedIsolationProducer::~EgammaHLTElectronCombinedIsolationProducer | ( | ) |
Definition at line 56 of file EgammaHLTElectronCombinedIsolationProducer.cc.
{}
void EgammaHLTElectronCombinedIsolationProducer::produce | ( | edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [virtual] |
Implements edm::EDProducer.
Definition at line 59 of file EgammaHLTElectronCombinedIsolationProducer.cc.
References CaloIsolTag_, CaloIsolWeight_, electronProducer_, spr::find(), edm::Event::getByLabel(), edm::Event::put(), recoEcalCandidateProducer_, TrackIsolTag_, and TrackIsolWeight_.
{ using namespace std; edm::Handle<reco::ElectronCollection> electronHandle; iEvent.getByLabel(electronProducer_,electronHandle); edm::Handle<reco::RecoEcalCandidateCollection> recoecalcandHandle; iEvent.getByLabel(recoEcalCandidateProducer_,recoecalcandHandle); std::vector< edm::Handle<reco::RecoEcalCandidateIsolationMap> > CaloIsoMap; for( unsigned int u=0; u < CaloIsolTag_.size(); u++){ edm::Handle<reco::RecoEcalCandidateIsolationMap> depMapTemp; if(CaloIsolWeight_[u] != 0){ iEvent.getByLabel (CaloIsolTag_[u],depMapTemp);} CaloIsoMap.push_back(depMapTemp); } edm::Handle<reco::ElectronIsolationMap> TrackIsoMap; if(TrackIsolWeight_ != 0){ iEvent.getByLabel (TrackIsolTag_,TrackIsoMap);} reco::ElectronIsolationMap TotalIsolMap; double TotalIso=0; for(reco::ElectronCollection::const_iterator iElectron = electronHandle->begin(); iElectron != electronHandle->end(); iElectron++){ TotalIso=0; reco::ElectronRef electronref(reco::ElectronRef(electronHandle,iElectron - electronHandle->begin())); const reco::SuperClusterRef theEleClus = electronref->superCluster(); //look for corresponding recoecal candidates to search for in the ecal and Hcal iso map for(reco::RecoEcalCandidateCollection::const_iterator iRecoEcalCand = recoecalcandHandle->begin(); iRecoEcalCand != recoecalcandHandle->end(); iRecoEcalCand++){ reco::RecoEcalCandidateRef recoecalcandref(recoecalcandHandle,iRecoEcalCand-recoecalcandHandle->begin()); const reco::SuperClusterRef cluster = recoecalcandref->superCluster(); if(&(*cluster) == &(*theEleClus)) {//recoecalcand and electron have the same SC for(unsigned int u=0; u < CaloIsolTag_.size() ;u++){ if(CaloIsolWeight_[u]==0){continue;} reco::RecoEcalCandidateIsolationMap::const_iterator mapi = (*CaloIsoMap[u]).find( recoecalcandref ); TotalIso += mapi->val * CaloIsolWeight_[u]; } break; } } //add the track isolation if(TrackIsolWeight_ != 0){ reco::ElectronIsolationMap::const_iterator mapi = (*TrackIsoMap).find( electronref ); TotalIso += mapi->val * TrackIsolWeight_; } TotalIsolMap.insert(electronref, TotalIso); } std::auto_ptr<reco::ElectronIsolationMap> isolMap(new reco::ElectronIsolationMap(TotalIsolMap)); iEvent.put(isolMap); }
std::vector<edm::InputTag> EgammaHLTElectronCombinedIsolationProducer::CaloIsolTag_ [private] |
Definition at line 41 of file EgammaHLTElectronCombinedIsolationProducer.h.
Referenced by EgammaHLTElectronCombinedIsolationProducer(), and produce().
std::vector<double> EgammaHLTElectronCombinedIsolationProducer::CaloIsolWeight_ [private] |
Definition at line 42 of file EgammaHLTElectronCombinedIsolationProducer.h.
Referenced by EgammaHLTElectronCombinedIsolationProducer(), and produce().
Definition at line 45 of file EgammaHLTElectronCombinedIsolationProducer.h.
Referenced by EgammaHLTElectronCombinedIsolationProducer().
Definition at line 40 of file EgammaHLTElectronCombinedIsolationProducer.h.
Referenced by EgammaHLTElectronCombinedIsolationProducer(), and produce().
Definition at line 39 of file EgammaHLTElectronCombinedIsolationProducer.h.
Referenced by EgammaHLTElectronCombinedIsolationProducer(), and produce().
Definition at line 43 of file EgammaHLTElectronCombinedIsolationProducer.h.
Referenced by EgammaHLTElectronCombinedIsolationProducer(), and produce().
double EgammaHLTElectronCombinedIsolationProducer::TrackIsolWeight_ [private] |
Definition at line 44 of file EgammaHLTElectronCombinedIsolationProducer.h.
Referenced by EgammaHLTElectronCombinedIsolationProducer(), and produce().