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

Definition at line 29 of file CandIsolatorFromDeposits.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

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

constructor with config

Definition at line 138 of file CandIsolatorFromDeposits.cc.

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

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 }
T getParameter(std::string const &) const
std::vector< SingleDeposit > sources_
CandIsolatorFromDeposits::~CandIsolatorFromDeposits ( )
override

destructor

Definition at line 150 of file CandIsolatorFromDeposits.cc.

References begin, end, and sources_.

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

Member Function Documentation

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

build deposits

Definition at line 157 of file CandIsolatorFromDeposits.cc.

References begin, edm::View< T >::begin(), edm::ValueMap< T >::begin(), DEFINE_FWK_MODULE, edm::ValueMap< T >::empty(), end, edm::ValueMap< T >::end(), trigObjTnPSource_cfi::filler, CandIsolatorFromDeposits::SingleDeposit::map(), eostools::move(), edm::View< T >::refAt(), runTheMatrix::ret, and sources_.

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 }
bool empty() const
Definition: ValueMap.h:158
const_iterator end() const
Definition: ValueMap.h:230
ret
prodAgent to be discontinued
std::vector< SingleDeposit > sources_
RefToBase< value_type > refAt(size_type i) const
const_iterator begin() const
#define end
Definition: vmac.h:39
helper::Filler< ValueMap< T > > Filler
Definition: ValueMap.h:168
const_iterator begin() const
Definition: ValueMap.h:229
#define begin
Definition: vmac.h:32
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

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