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 173 of file CandIsolatorFromDeposits.cc.

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

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

◆ ~CandIsolatorFromDeposits()

CandIsolatorFromDeposits::~CandIsolatorFromDeposits ( )
override

destructor

Definition at line 185 of file CandIsolatorFromDeposits.cc.

References mps_fire::end, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, and sources_.

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

Member Function Documentation

◆ produce()

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

build deposits

Definition at line 192 of file CandIsolatorFromDeposits.cc.

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

192  {
193  std::vector<SingleDeposit>::iterator it, begin = sources_.begin(), end = sources_.end();
194  for (it = begin; it != end; ++it)
195  it->open(event, eventSetup);
196 
197  const IsoDepositMap &map = begin->map();
198 
199  if (map.empty()) { // !!???
200  event.put(std::make_unique<CandDoubleMap>());
201  return;
202  }
203  auto ret = std::make_unique<CandDoubleMap>();
205 
206  typedef reco::IsoDepositMap::const_iterator iterator_i;
208  iterator_i depI = map.begin();
209  iterator_i depIEnd = map.end();
210  for (; depI != depIEnd; ++depI) {
211  std::vector<double> retV(depI.size(), 0);
213  event.get(depI.id(), candH);
214  const edm::View<reco::Candidate> &candV = *candH;
215 
216  iterator_ii depII = depI.begin();
217  iterator_ii depIIEnd = depI.end();
218  size_t iRet = 0;
219  for (; depII != depIIEnd; ++depII, ++iRet) {
220  double sum = 0;
221  for (it = begin; it != end; ++it)
222  sum += it->compute(candV.refAt(iRet));
223  retV[iRet] = sum;
224  }
225  filler.insert(candH, retV.begin(), retV.end());
226  }
227  filler.fill();
228  event.put(std::move(ret));
229 }
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:162
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