#include <PhysicsTools/IsolationAlgos/plugins/CandIsolatorFromDeposits.h>
Public Types | |
typedef edm::ValueMap< double > | CandDoubleMap |
enum | Mode { Sum, SumRelative, Sum2, Sum2Relative, Max, MaxRelative, Count } |
Public Member Functions | |
CandIsolatorFromDeposits (const edm::ParameterSet &) | |
constructor with config | |
virtual void | produce (edm::Event &, const edm::EventSetup &) |
build deposits | |
virtual | ~CandIsolatorFromDeposits () |
destructor | |
Private Attributes | |
std::vector< SingleDeposit > | sources_ |
Classes | |
class | SingleDeposit |
Definition at line 22 of file CandIsolatorFromDeposits.h.
typedef edm::ValueMap<double> CandIsolatorFromDeposits::CandDoubleMap |
Definition at line 25 of file CandIsolatorFromDeposits.h.
Definition at line 27 of file CandIsolatorFromDeposits.h.
00027 { Sum, SumRelative, Sum2, Sum2Relative, Max, MaxRelative, Count };
CandIsolatorFromDeposits::CandIsolatorFromDeposits | ( | const edm::ParameterSet & | par | ) |
constructor with config
Definition at line 113 of file CandIsolatorFromDeposits.cc.
References edm::ParameterSet::getParameter(), it, and sources_.
00113 { 00114 typedef std::vector<edm::ParameterSet> VPSet; 00115 VPSet depPSets = par.getParameter<VPSet>("deposits"); 00116 for (VPSet::const_iterator it = depPSets.begin(), ed = depPSets.end(); it != ed; ++it) { 00117 sources_.push_back(SingleDeposit(*it)); 00118 } 00119 if (sources_.size() == 0) throw cms::Exception("Configuration Error") << "Please specify at least one deposit!"; 00120 produces<CandDoubleMap>(); 00121 }
CandIsolatorFromDeposits::~CandIsolatorFromDeposits | ( | ) | [virtual] |
void CandIsolatorFromDeposits::produce | ( | edm::Event & | event, | |
const edm::EventSetup & | eventSetup | |||
) | [virtual] |
build deposits
Implements edm::EDProducer.
Definition at line 130 of file CandIsolatorFromDeposits.cc.
References edm::ValueMap< T >::begin(), begin, end, edm::ValueMap< T >::end(), edm::helper::Filler< Map >::fill(), edm::helper::Filler< Map >::insert(), it, edm::View< T >::refAt(), edm::ValueMap< T >::size(), sources_, and sum().
00130 { 00131 00132 vector<SingleDeposit>::iterator it, begin = sources_.begin(), end = sources_.end(); 00133 for (it = begin; it != end; ++it) it->open(event, eventSetup); 00134 00135 const IsoDepositMap & map = begin->map(); 00136 00137 if (map.size()==0) { // !!??? 00138 event.put(auto_ptr<CandDoubleMap>(new CandDoubleMap())); 00139 return; 00140 } 00141 auto_ptr<CandDoubleMap> ret(new CandDoubleMap()); 00142 CandDoubleMap::Filler filler(*ret); 00143 00144 typedef reco::IsoDepositMap::const_iterator iterator_i; 00145 typedef reco::IsoDepositMap::container::const_iterator iterator_ii; 00146 iterator_i depI = map.begin(); 00147 iterator_i depIEnd = map.end(); 00148 for (; depI != depIEnd; ++depI){ 00149 std::vector<double> retV(depI.size(),0); 00150 edm::Handle<edm::View<reco::Candidate> > candH; 00151 event.get(depI.id(), candH); 00152 const edm::View<reco::Candidate>& candV = *candH; 00153 00154 iterator_ii depII = depI.begin(); 00155 iterator_ii depIIEnd = depI.end(); 00156 size_t iRet = 0; 00157 for (; depII != depIIEnd; ++depII,++iRet){ 00158 double sum=0; 00159 for (it = begin; it != end; ++it) sum += it->compute(candV.refAt(iRet)); 00160 retV[iRet] = sum; 00161 } 00162 filler.insert(candH, retV.begin(), retV.end()); 00163 } 00164 filler.fill(); 00165 event.put(ret); 00166 }
std::vector<SingleDeposit> CandIsolatorFromDeposits::sources_ [private] |
Definition at line 55 of file CandIsolatorFromDeposits.h.
Referenced by CandIsolatorFromDeposits(), produce(), and ~CandIsolatorFromDeposits().