CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 26 of file CandIsolatorFromDeposits.cc.

Member Typedef Documentation

Definition at line 28 of file CandIsolatorFromDeposits.cc.

Member Enumeration Documentation

Constructor & Destructor Documentation

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

constructor with config

Definition at line 174 of file CandIsolatorFromDeposits.cc.

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

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

destructor

Definition at line 186 of file CandIsolatorFromDeposits.cc.

References SplitLinear::begin, dataset::end, and sources_.

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

Member Function Documentation

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

build deposits

Definition at line 193 of file CandIsolatorFromDeposits.cc.

References SplitLinear::begin, edm::View< T >::begin(), edm::ValueMap< T >::begin(), edm::ValueMap< T >::empty(), edm::ValueMap< T >::end(), dataset::end, eostools::move(), edm::View< T >::refAt(), runTheMatrix::ret, and sources_.

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

Member Data Documentation

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