CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Private Attributes
PFCandIsolatorFromDeposits Class Reference
Inheritance diagram for PFCandIsolatorFromDeposits:
edm::stream::EDProducer<>

Classes

class  SingleDeposit
 

Public Types

typedef edm::ValueMap< double > CandDoubleMap
 
enum  Mode {
  Sum, SumRelative, Sum2, Sum2Relative,
  Max, MaxRelative, Count, NearestDR
}
 
- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Public Member Functions

 PFCandIsolatorFromDeposits (const edm::ParameterSet &)
 constructor with config More...
 
void produce (edm::Event &, const edm::EventSetup &) override
 build deposits More...
 
 ~PFCandIsolatorFromDeposits () override
 destructor More...
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Private Attributes

std::vector< SingleDepositsources_
 

Detailed Description

Definition at line 31 of file PFCandIsolatorFromDeposit.cc.

Member Typedef Documentation

◆ CandDoubleMap

Definition at line 33 of file PFCandIsolatorFromDeposit.cc.

Member Enumeration Documentation

◆ Mode

Constructor & Destructor Documentation

◆ PFCandIsolatorFromDeposits()

PFCandIsolatorFromDeposits::PFCandIsolatorFromDeposits ( const edm::ParameterSet par)

constructor with config

Definition at line 222 of file PFCandIsolatorFromDeposit.cc.

References edm::ParameterSet::getParameter(), sources_, and HistogramManager_cfi::VPSet().

222  {
223  typedef std::vector<edm::ParameterSet> VPSet;
224  VPSet depPSets = par.getParameter<VPSet>("deposits");
225  for (VPSet::const_iterator it = depPSets.begin(), ed = depPSets.end(); it != ed; ++it) {
226  sources_.push_back(SingleDeposit(*it, consumesCollector()));
227  }
228  if (sources_.empty())
229  throw cms::Exception("Configuration Error") << "Please specify at least one deposit!";
230  produces<CandDoubleMap>();
231 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
std::vector< SingleDeposit > sources_

◆ ~PFCandIsolatorFromDeposits()

PFCandIsolatorFromDeposits::~PFCandIsolatorFromDeposits ( )
override

destructor

Definition at line 234 of file PFCandIsolatorFromDeposit.cc.

References mps_fire::end, and sources_.

234  {
235  std::vector<SingleDeposit>::iterator it, begin = sources_.begin(), end = sources_.end();
236  for (it = begin; it != end; ++it)
237  it->cleanup();
238 }
std::vector< SingleDeposit > sources_

Member Function Documentation

◆ produce()

void PFCandIsolatorFromDeposits::produce ( edm::Event event,
const edm::EventSetup eventSetup 
)
override

build deposits

Definition at line 241 of file PFCandIsolatorFromDeposit.cc.

References edm::View< T >::begin(), mps_fire::end, options_cfi::eventSetup, trigObjTnPSource_cfi::filler, genParticles_cff::map, eostools::move(), edm::View< T >::refAt(), runTheMatrix::ret, and sources_.

241  {
242  std::vector<SingleDeposit>::iterator it, begin = sources_.begin(), end = sources_.end();
243  for (it = begin; it != end; ++it)
244  it->open(event, eventSetup);
245 
246  const IsoDepositMap &map = begin->map();
247 
248  if (map.empty()) { // !!???
249  event.put(std::make_unique<CandDoubleMap>());
250  return;
251  }
252  std::unique_ptr<CandDoubleMap> ret(new CandDoubleMap());
254 
255  typedef reco::IsoDepositMap::const_iterator iterator_i;
257  iterator_i depI = map.begin();
258  iterator_i depIEnd = map.end();
259  for (; depI != depIEnd; ++depI) {
260  std::vector<double> retV(depI.size(), 0);
262  event.get(depI.id(), candH);
263  const edm::View<reco::Candidate> &candV = *candH;
264 
265  iterator_ii depII = depI.begin();
266  iterator_ii depIIEnd = depI.end();
267  size_t iRet = 0;
268  for (; depII != depIIEnd; ++depII, ++iRet) {
269  double sum = 0;
270  for (it = begin; it != end; ++it)
271  sum += it->compute(candV.refAt(iRet));
272  retV[iRet] = sum;
273  }
274  filler.insert(candH, retV.begin(), retV.end());
275  }
276  filler.fill();
277  event.put(std::move(ret));
278 }
std::vector< SingleDeposit > sources_
RefToBase< value_type > refAt(size_type i) const
ret
prodAgent to be discontinued
helper::Filler< ValueMap< T > > Filler
Definition: ValueMap.h:168
const_iterator begin() const
edm::ValueMap< double > CandDoubleMap
def move(src, dest)
Definition: eostools.py:511
Definition: event.py:1

Member Data Documentation

◆ sources_

std::vector<SingleDeposit> PFCandIsolatorFromDeposits::sources_
private