#include <PFCandIsolatorFromDeposit.h>
Classes | |
class | SingleDeposit |
Public Types | |
typedef edm::ValueMap< double > | CandDoubleMap |
enum | Mode { Sum, SumRelative, Sum2, Sum2Relative, Max, MaxRelative, Count, NearestDR } |
Public Member Functions | |
PFCandIsolatorFromDeposits (const edm::ParameterSet &) | |
constructor with config | |
virtual void | produce (edm::Event &, const edm::EventSetup &) |
build deposits | |
virtual | ~PFCandIsolatorFromDeposits () |
destructor | |
Private Attributes | |
std::vector< SingleDeposit > | sources_ |
Definition at line 22 of file PFCandIsolatorFromDeposit.h.
typedef edm::ValueMap<double> PFCandIsolatorFromDeposits::CandDoubleMap |
Definition at line 25 of file PFCandIsolatorFromDeposit.h.
Definition at line 27 of file PFCandIsolatorFromDeposit.h.
{ Sum, SumRelative, Sum2, Sum2Relative, Max, MaxRelative, Count, NearestDR };
PFCandIsolatorFromDeposits::PFCandIsolatorFromDeposits | ( | const edm::ParameterSet & | par | ) |
constructor with config
Definition at line 163 of file PFCandIsolatorFromDeposit.cc.
References edm::ParameterSet::getParameter(), and sources_.
{ typedef std::vector<edm::ParameterSet> VPSet; VPSet depPSets = par.getParameter<VPSet>("deposits"); for (VPSet::const_iterator it = depPSets.begin(), ed = depPSets.end(); it != ed; ++it) { sources_.push_back(SingleDeposit(*it)); } if (sources_.size() == 0) throw cms::Exception("Configuration Error") << "Please specify at least one deposit!"; produces<CandDoubleMap>(); }
PFCandIsolatorFromDeposits::~PFCandIsolatorFromDeposits | ( | ) | [virtual] |
void PFCandIsolatorFromDeposits::produce | ( | edm::Event & | event, |
const edm::EventSetup & | eventSetup | ||
) | [virtual] |
build deposits
Implements edm::EDProducer.
Definition at line 180 of file PFCandIsolatorFromDeposit.cc.
References edm::View< T >::begin(), edm::ValueMap< T >::begin(), begin, end, edm::ValueMap< T >::end(), edm::helper::Filler< Map >::fill(), edm::helper::Filler< Map >::insert(), edm::View< T >::refAt(), run_regression::ret, edm::ValueMap< T >::size(), and sources_.
{ std::vector<SingleDeposit>::iterator it, begin = sources_.begin(), end = sources_.end(); for (it = begin; it != end; ++it) it->open(event, eventSetup); const IsoDepositMap & map = begin->map(); if (map.size()==0) { // !!??? event.put(std::auto_ptr<CandDoubleMap>(new CandDoubleMap())); return; } std::auto_ptr<CandDoubleMap> ret(new CandDoubleMap()); CandDoubleMap::Filler filler(*ret); typedef reco::IsoDepositMap::const_iterator iterator_i; typedef reco::IsoDepositMap::container::const_iterator iterator_ii; iterator_i depI = map.begin(); iterator_i depIEnd = map.end(); for (; depI != depIEnd; ++depI){ std::vector<double> retV(depI.size(),0); edm::Handle<edm::View<reco::Candidate> > candH; event.get(depI.id(), candH); const edm::View<reco::Candidate>& candV = *candH; iterator_ii depII = depI.begin(); iterator_ii depIIEnd = depI.end(); size_t iRet = 0; for (; depII != depIIEnd; ++depII,++iRet){ double sum=0; for (it = begin; it != end; ++it) sum += it->compute(candV.refAt(iRet)); retV[iRet] = sum; } filler.insert(candH, retV.begin(), retV.end()); } filler.fill(); event.put(ret); }
std::vector<SingleDeposit> PFCandIsolatorFromDeposits::sources_ [private] |
Definition at line 61 of file PFCandIsolatorFromDeposit.h.
Referenced by PFCandIsolatorFromDeposits(), produce(), and ~PFCandIsolatorFromDeposits().