#include <RecoEgamma/EgammaHLTProducers/interface/EgammaHLTCombinedIsolationProducer.h>
Public Member Functions | |
EgammaHLTCombinedIsolationProducer (const edm::ParameterSet &) | |
virtual void | produce (edm::Event &, const edm::EventSetup &) |
~EgammaHLTCombinedIsolationProducer () | |
Private Attributes | |
edm::ParameterSet | conf_ |
std::vector< edm::InputTag > | IsolTag_ |
std::vector< double > | IsolWeight_ |
edm::InputTag | recoEcalCandidateProducer_ |
$Id:
Definition at line 29 of file EgammaHLTCombinedIsolationProducer.h.
EgammaHLTCombinedIsolationProducer::EgammaHLTCombinedIsolationProducer | ( | const edm::ParameterSet & | config | ) | [explicit] |
Definition at line 25 of file EgammaHLTCombinedIsolationProducer.cc.
References conf_, Exception, edm::ParameterSet::getParameter(), IsolTag_, IsolWeight_, and recoEcalCandidateProducer_.
: conf_(config) { // use configuration file to setup input/output collection names recoEcalCandidateProducer_ = conf_.getParameter<edm::InputTag>("recoEcalCandidateProducer"); IsolTag_ = conf_.getParameter< std::vector<edm::InputTag> > ("IsolationMapTags"); IsolWeight_ = conf_.getParameter< std::vector<double> > ("IsolationWeight"); //register your products produces < reco::RecoEcalCandidateIsolationMap >(); if ( IsolTag_.size() != IsolWeight_.size()){ throw cms::Exception("BadConfig") << "vectors IsolationMapTags and IsolationWeight need to have the same size"; } }
EgammaHLTCombinedIsolationProducer::~EgammaHLTCombinedIsolationProducer | ( | ) |
Definition at line 43 of file EgammaHLTCombinedIsolationProducer.cc.
{}
void EgammaHLTCombinedIsolationProducer::produce | ( | edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [virtual] |
Implements edm::EDProducer.
Definition at line 52 of file EgammaHLTCombinedIsolationProducer.cc.
References spr::find(), edm::Event::getByLabel(), edm::AssociationMap< Tag >::insert(), IsolTag_, IsolWeight_, edm::Event::put(), and recoEcalCandidateProducer_.
{ edm::Handle<reco::RecoEcalCandidateCollection> recoecalcandHandle; iEvent.getByLabel(recoEcalCandidateProducer_,recoecalcandHandle); reco::RecoEcalCandidateIsolationMap TotalIsolMap; double TotalIso=0; std::vector< edm::Handle<reco::RecoEcalCandidateIsolationMap> > IsoMap; for( unsigned int u=0; u < IsolWeight_.size(); u++){ edm::Handle<reco::RecoEcalCandidateIsolationMap> depMapTemp; if(IsolWeight_[u] != 0){ iEvent.getByLabel (IsolTag_[u],depMapTemp);} IsoMap.push_back(depMapTemp); } for(reco::RecoEcalCandidateCollection::const_iterator iRecoEcalCand = recoecalcandHandle->begin(); iRecoEcalCand != recoecalcandHandle->end(); iRecoEcalCand++){ reco::RecoEcalCandidateRef recoecalcandref(recoecalcandHandle,iRecoEcalCand-recoecalcandHandle->begin()); TotalIso = 0; for( unsigned int u=0; u < IsolWeight_.size(); u++){ if(IsolWeight_[u]==0){continue;} reco::RecoEcalCandidateIsolationMap::const_iterator mapi = (*IsoMap[u]).find( recoecalcandref ); TotalIso += mapi->val * IsolWeight_[u]; } TotalIsolMap.insert(recoecalcandref, TotalIso); } std::auto_ptr<reco::RecoEcalCandidateIsolationMap> Map(new reco::RecoEcalCandidateIsolationMap(TotalIsolMap)); iEvent.put(Map); }
Definition at line 42 of file EgammaHLTCombinedIsolationProducer.h.
Referenced by EgammaHLTCombinedIsolationProducer().
std::vector<edm::InputTag> EgammaHLTCombinedIsolationProducer::IsolTag_ [private] |
Definition at line 40 of file EgammaHLTCombinedIsolationProducer.h.
Referenced by EgammaHLTCombinedIsolationProducer(), and produce().
std::vector<double> EgammaHLTCombinedIsolationProducer::IsolWeight_ [private] |
Definition at line 41 of file EgammaHLTCombinedIsolationProducer.h.
Referenced by EgammaHLTCombinedIsolationProducer(), and produce().
Definition at line 39 of file EgammaHLTCombinedIsolationProducer.h.
Referenced by EgammaHLTCombinedIsolationProducer(), and produce().