CMS 3D CMS Logo

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

#include <CandIsolatorFromDeposits.h>

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<>
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

 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
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Private Attributes

std::vector< SingleDepositsources_
 

Detailed Description

Definition at line 27 of file CandIsolatorFromDeposits.h.

Member Typedef Documentation

◆ CandDoubleMap

Definition at line 29 of file CandIsolatorFromDeposits.h.

Member Enumeration Documentation

◆ Mode

Enumerator
Sum 
SumRelative 
Sum2 
Sum2Relative 
Max 
MaxRelative 
Count 
NearestDR 
MeanDR 
SumDR 

Definition at line 31 of file CandIsolatorFromDeposits.h.

Constructor & Destructor Documentation

◆ CandIsolatorFromDeposits()

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

constructor with config

Definition at line 138 of file CandIsolatorFromDeposits.cc.

138  {
139  typedef std::vector<edm::ParameterSet> VPSet;
140  VPSet depPSets = par.getParameter<VPSet>("deposits");
141  for (VPSet::const_iterator it = depPSets.begin(), ed = depPSets.end(); it != ed; ++it) {
142  sources_.push_back(SingleDeposit(*it, consumesCollector()));
143  }
144  if (sources_.empty())
145  throw cms::Exception("Configuration Error") << "Please specify at least one deposit!";
146  produces<CandDoubleMap>();
147 }

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

◆ ~CandIsolatorFromDeposits()

CandIsolatorFromDeposits::~CandIsolatorFromDeposits ( )
override

destructor

Definition at line 150 of file CandIsolatorFromDeposits.cc.

150  {
151  std::vector<SingleDeposit>::iterator it, begin = sources_.begin(), end = sources_.end();
152  for (it = begin; it != end; ++it)
153  it->cleanup();
154 }

References begin, end, and sources_.

Member Function Documentation

◆ produce()

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

build deposits

Definition at line 157 of file CandIsolatorFromDeposits.cc.

157  {
158  std::vector<SingleDeposit>::iterator it, begin = sources_.begin(), end = sources_.end();
159  for (it = begin; it != end; ++it)
160  it->open(event, eventSetup);
161 
162  const IsoDepositMap &map = begin->map();
163 
164  if (map.empty()) { // !!???
165  event.put(std::make_unique<CandDoubleMap>());
166  return;
167  }
168  auto ret = std::make_unique<CandDoubleMap>();
170 
171  typedef reco::IsoDepositMap::const_iterator iterator_i;
173  iterator_i depI = map.begin();
174  iterator_i depIEnd = map.end();
175  for (; depI != depIEnd; ++depI) {
176  std::vector<double> retV(depI.size(), 0);
178  event.get(depI.id(), candH);
179  const edm::View<reco::Candidate> &candV = *candH;
180 
181  iterator_ii depII = depI.begin();
182  iterator_ii depIIEnd = depI.end();
183  size_t iRet = 0;
184  for (; depII != depIIEnd; ++depII, ++iRet) {
185  double sum = 0;
186  for (it = begin; it != end; ++it)
187  sum += it->compute(candV.refAt(iRet));
188  retV[iRet] = sum;
189  }
190  filler.insert(candH, retV.begin(), retV.end());
191  }
192  filler.fill();
193  event.put(std::move(ret));
194 }

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

Member Data Documentation

◆ sources_

std::vector<SingleDeposit> CandIsolatorFromDeposits::sources_
private
runTheMatrix.ret
ret
prodAgent to be discontinued
Definition: runTheMatrix.py:355
edm::View::begin
const_iterator begin() const
edm::View::refAt
RefToBase< value_type > refAt(size_type i) const
CandIsolatorFromDeposits::sources_
std::vector< SingleDeposit > sources_
Definition: CandIsolatorFromDeposits.h:60
edm::Handle
Definition: AssociativeIterator.h:50
CandIsolatorFromDeposits::Sum
Definition: CandIsolatorFromDeposits.h:31
end
#define end
Definition: vmac.h:39
CandIsolatorFromDeposits::SumRelative
Definition: CandIsolatorFromDeposits.h:31
edm::ValueMap::const_iterator
Definition: ValueMap.h:170
CandIsolatorFromDeposits::NearestDR
Definition: CandIsolatorFromDeposits.h:31
edm::View
Definition: CaloClusterFwd.h:14
CandIsolatorFromDeposits::Max
Definition: CandIsolatorFromDeposits.h:31
trigObjTnPSource_cfi.filler
filler
Definition: trigObjTnPSource_cfi.py:21
CandIsolatorFromDeposits::Sum2
Definition: CandIsolatorFromDeposits.h:31
edm::ValueMap::Filler
helper::Filler< ValueMap< T > > Filler
Definition: ValueMap.h:168
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
HistogramManager_cfi.VPSet
def VPSet(*args)
Definition: HistogramManager_cfi.py:401
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::ValueMap
Definition: ValueMap.h:107
CandIsolatorFromDeposits::MaxRelative
Definition: CandIsolatorFromDeposits.h:31
CandIsolatorFromDeposits::SumDR
Definition: CandIsolatorFromDeposits.h:31
CandIsolatorFromDeposits::Count
Definition: CandIsolatorFromDeposits.h:31
cms::Exception
Definition: Exception.h:70
genParticles_cff.map
map
Definition: genParticles_cff.py:11
CandIsolatorFromDeposits::Sum2Relative
Definition: CandIsolatorFromDeposits.h:31
event
Definition: event.py:1
begin
#define begin
Definition: vmac.h:32
CandIsolatorFromDeposits::MeanDR
Definition: CandIsolatorFromDeposits.h:31