CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Private Attributes
PFCandIsolatorFromDeposits Class Reference

#include <PFCandIsolatorFromDeposit.h>

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<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache 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
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Private Attributes

std::vector< SingleDepositsources_
 

Detailed Description

Definition at line 27 of file PFCandIsolatorFromDeposit.h.

Member Typedef Documentation

◆ CandDoubleMap

Definition at line 29 of file PFCandIsolatorFromDeposit.h.

Member Enumeration Documentation

◆ Mode

Enumerator
Sum 
SumRelative 
Sum2 
Sum2Relative 
Max 
MaxRelative 
Count 
NearestDR 

Definition at line 31 of file PFCandIsolatorFromDeposit.h.

Constructor & Destructor Documentation

◆ PFCandIsolatorFromDeposits()

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

constructor with config

Definition at line 179 of file PFCandIsolatorFromDeposit.cc.

179  {
180  typedef std::vector<edm::ParameterSet> VPSet;
181  VPSet depPSets = par.getParameter<VPSet>("deposits");
182  for (VPSet::const_iterator it = depPSets.begin(), ed = depPSets.end(); it != ed; ++it) {
183  sources_.push_back(SingleDeposit(*it, consumesCollector()));
184  }
185  if (sources_.empty())
186  throw cms::Exception("Configuration Error") << "Please specify at least one deposit!";
187  produces<CandDoubleMap>();
188 }

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

◆ ~PFCandIsolatorFromDeposits()

PFCandIsolatorFromDeposits::~PFCandIsolatorFromDeposits ( )
override

destructor

Definition at line 191 of file PFCandIsolatorFromDeposit.cc.

191  {
192  std::vector<SingleDeposit>::iterator it, begin = sources_.begin(), end = sources_.end();
193  for (it = begin; it != end; ++it)
194  it->cleanup();
195 }

References mps_fire::end, and sources_.

Member Function Documentation

◆ produce()

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

build deposits

Definition at line 198 of file PFCandIsolatorFromDeposit.cc.

198  {
199  std::vector<SingleDeposit>::iterator it, begin = sources_.begin(), end = sources_.end();
200  for (it = begin; it != end; ++it)
201  it->open(event, eventSetup);
202 
203  const IsoDepositMap &map = begin->map();
204 
205  if (map.empty()) { // !!???
206  event.put(std::make_unique<CandDoubleMap>());
207  return;
208  }
209  std::unique_ptr<CandDoubleMap> ret(new CandDoubleMap());
211 
212  typedef reco::IsoDepositMap::const_iterator iterator_i;
214  iterator_i depI = map.begin();
215  iterator_i depIEnd = map.end();
216  for (; depI != depIEnd; ++depI) {
217  std::vector<double> retV(depI.size(), 0);
219  event.get(depI.id(), candH);
220  const edm::View<reco::Candidate> &candV = *candH;
221 
222  iterator_ii depII = depI.begin();
223  iterator_ii depIIEnd = depI.end();
224  size_t iRet = 0;
225  for (; depII != depIIEnd; ++depII, ++iRet) {
226  double sum = 0;
227  for (it = begin; it != end; ++it)
228  sum += it->compute(candV.refAt(iRet));
229  retV[iRet] = sum;
230  }
231  filler.insert(candH, retV.begin(), retV.end());
232  }
233  filler.fill();
234  event.put(std::move(ret));
235 }

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

Member Data Documentation

◆ sources_

std::vector<SingleDeposit> PFCandIsolatorFromDeposits::sources_
private
runTheMatrix.ret
ret
prodAgent to be discontinued
Definition: runTheMatrix.py:542
PFCandIsolatorFromDeposits::Max
Definition: PFCandIsolatorFromDeposit.h:31
PFCandIsolatorFromDeposits::Sum2
Definition: PFCandIsolatorFromDeposit.h:31
edm::View::begin
const_iterator begin() const
edm::View::refAt
RefToBase< value_type > refAt(size_type i) const
PFCandIsolatorFromDeposits::MaxRelative
Definition: PFCandIsolatorFromDeposit.h:31
PFCandIsolatorFromDeposits::Sum
Definition: PFCandIsolatorFromDeposit.h:31
edm::Handle
Definition: AssociativeIterator.h:50
PFCandIsolatorFromDeposits::SumRelative
Definition: PFCandIsolatorFromDeposit.h:31
edm::ValueMap::const_iterator
Definition: ValueMap.h:170
mps_fire.end
end
Definition: mps_fire.py:242
edm::View
Definition: CaloClusterFwd.h:14
trigObjTnPSource_cfi.filler
filler
Definition: trigObjTnPSource_cfi.py:21
PFCandIsolatorFromDeposits::Sum2Relative
Definition: PFCandIsolatorFromDeposit.h:31
edm::ValueMap::Filler
helper::Filler< ValueMap< T > > Filler
Definition: ValueMap.h:168
PFCandIsolatorFromDeposits::CandDoubleMap
edm::ValueMap< double > CandDoubleMap
Definition: PFCandIsolatorFromDeposit.h:29
HistogramManager_cfi.VPSet
def VPSet(*args)
Definition: HistogramManager_cfi.py:404
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::ValueMap
Definition: ValueMap.h:107
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
PFCandIsolatorFromDeposits::NearestDR
Definition: PFCandIsolatorFromDeposit.h:31
cms::Exception
Definition: Exception.h:70
genParticles_cff.map
map
Definition: genParticles_cff.py:11
PFCandIsolatorFromDeposits::Count
Definition: PFCandIsolatorFromDeposit.h:31
event
Definition: event.py:1
PFCandIsolatorFromDeposits::sources_
std::vector< SingleDeposit > sources_
Definition: PFCandIsolatorFromDeposit.h:66