CMS 3D CMS Logo

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

Classes

class  SingleDeposit
 

Public Types

typedef edm::ValueMap< double > CandDoubleMap
 
enum  Mode {
  Sum, SumRelative, Sum2, Sum2Relative,
  Max, MaxRelative, Count, NearestDR,
  MeanDR, SumDR
}
 
- 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

 CandIsolatorFromDeposits (const edm::ParameterSet &)
 constructor with config More...
 
void produce (edm::Event &, const edm::EventSetup &) override
 build deposits More...
 
 ~CandIsolatorFromDeposits () 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 23 of file CandIsolatorFromDeposits.cc.

Member Typedef Documentation

◆ CandDoubleMap

Definition at line 25 of file CandIsolatorFromDeposits.cc.

Member Enumeration Documentation

◆ Mode

Constructor & Destructor Documentation

◆ CandIsolatorFromDeposits()

CandIsolatorFromDeposits::CandIsolatorFromDeposits ( const edm::ParameterSet par)

constructor with config

Definition at line 171 of file CandIsolatorFromDeposits.cc.

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

171  {
172  typedef std::vector<edm::ParameterSet> VPSet;
173  VPSet depPSets = par.getParameter<VPSet>("deposits");
174  for (VPSet::const_iterator it = depPSets.begin(), ed = depPSets.end(); it != ed; ++it) {
175  sources_.push_back(SingleDeposit(*it, consumesCollector()));
176  }
177  if (sources_.empty())
178  throw cms::Exception("Configuration Error") << "Please specify at least one deposit!";
179  produces<CandDoubleMap>();
180 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::vector< SingleDeposit > sources_

◆ ~CandIsolatorFromDeposits()

CandIsolatorFromDeposits::~CandIsolatorFromDeposits ( )
override

destructor

Definition at line 183 of file CandIsolatorFromDeposits.cc.

References mps_fire::end, and sources_.

183  {
184  std::vector<SingleDeposit>::iterator it, begin = sources_.begin(), end = sources_.end();
185  for (it = begin; it != end; ++it)
186  it->cleanup();
187 }
std::vector< SingleDeposit > sources_

Member Function Documentation

◆ produce()

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

build deposits

Definition at line 190 of file CandIsolatorFromDeposits.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_.

190  {
191  std::vector<SingleDeposit>::iterator it, begin = sources_.begin(), end = sources_.end();
192  for (it = begin; it != end; ++it)
193  it->open(event, eventSetup);
194 
195  const IsoDepositMap &map = begin->map();
196 
197  if (map.empty()) { // !!???
198  event.put(std::make_unique<CandDoubleMap>());
199  return;
200  }
201  auto ret = std::make_unique<CandDoubleMap>();
203 
204  typedef reco::IsoDepositMap::const_iterator iterator_i;
206  iterator_i depI = map.begin();
207  iterator_i depIEnd = map.end();
208  for (; depI != depIEnd; ++depI) {
209  std::vector<double> retV(depI.size(), 0);
211  event.get(depI.id(), candH);
212  const edm::View<reco::Candidate> &candV = *candH;
213 
214  iterator_ii depII = depI.begin();
215  iterator_ii depIIEnd = depI.end();
216  size_t iRet = 0;
217  for (; depII != depIIEnd; ++depII, ++iRet) {
218  double sum = 0;
219  for (it = begin; it != end; ++it)
220  sum += it->compute(candV.refAt(iRet));
221  retV[iRet] = sum;
222  }
223  filler.insert(candH, retV.begin(), retV.end());
224  }
225  filler.fill();
226  event.put(std::move(ret));
227 }
RefToBase< value_type > refAt(size_type i) const
ret
prodAgent to be discontinued
std::vector< SingleDeposit > sources_
helper::Filler< ValueMap< T > > Filler
Definition: ValueMap.h:168
const_iterator begin() const
def move(src, dest)
Definition: eostools.py:511
Definition: event.py:1

Member Data Documentation

◆ sources_

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