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<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

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 Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Public Member Functions

 CandIsolatorFromDeposits (const edm::ParameterSet &)
 constructor with config More...
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 build deposits More...
 
virtual ~CandIsolatorFromDeposits ()
 destructor More...
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

std::vector< SingleDepositsources_
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 23 of file CandIsolatorFromDeposits.h.

Member Typedef Documentation

Definition at line 26 of file CandIsolatorFromDeposits.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

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

constructor with config

Definition at line 118 of file CandIsolatorFromDeposits.cc.

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

118  {
119  typedef std::vector<edm::ParameterSet> VPSet;
120  VPSet depPSets = par.getParameter<VPSet>("deposits");
121  for (VPSet::const_iterator it = depPSets.begin(), ed = depPSets.end(); it != ed; ++it) {
122  sources_.push_back(SingleDeposit(*it, consumesCollector()));
123  }
124  if (sources_.size() == 0) throw cms::Exception("Configuration Error") << "Please specify at least one deposit!";
125  produces<CandDoubleMap>();
126 }
T getParameter(std::string const &) const
std::vector< SingleDeposit > sources_
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
CandIsolatorFromDeposits::~CandIsolatorFromDeposits ( )
virtual

destructor

Definition at line 129 of file CandIsolatorFromDeposits.cc.

References begin, end, and sources_.

129  {
130  std::vector<SingleDeposit>::iterator it, begin = sources_.begin(), end = sources_.end();
131  for (it = begin; it != end; ++it) it->cleanup();
132 }
std::vector< SingleDeposit > sources_
#define end
Definition: vmac.h:37
#define begin
Definition: vmac.h:30

Member Function Documentation

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

build deposits

Definition at line 135 of file CandIsolatorFromDeposits.cc.

References begin, edm::View< T >::begin(), edm::ValueMap< T >::begin(), DEFINE_FWK_MODULE, end, edm::ValueMap< T >::end(), objects.autophobj::filler, CandIsolatorFromDeposits::SingleDeposit::map(), eostools::move(), edm::View< T >::refAt(), edm::ValueMap< T >::size(), and sources_.

135  {
136 
137  std::vector<SingleDeposit>::iterator it, begin = sources_.begin(), end = sources_.end();
138  for (it = begin; it != end; ++it) it->open(event, eventSetup);
139 
140  const IsoDepositMap & map = begin->map();
141 
142  if (map.size()==0) { // !!???
143  event.put(std::make_unique<CandDoubleMap>());
144  return;
145  }
146  auto ret = std::make_unique<CandDoubleMap>();
148 
149  typedef reco::IsoDepositMap::const_iterator iterator_i;
150  typedef reco::IsoDepositMap::container::const_iterator iterator_ii;
151  iterator_i depI = map.begin();
152  iterator_i depIEnd = map.end();
153  for (; depI != depIEnd; ++depI){
154  std::vector<double> retV(depI.size(),0);
156  event.get(depI.id(), candH);
157  const edm::View<reco::Candidate>& candV = *candH;
158 
159  iterator_ii depII = depI.begin();
160  iterator_ii depIIEnd = depI.end();
161  size_t iRet = 0;
162  for (; depII != depIIEnd; ++depII,++iRet){
163  double sum=0;
164  for (it = begin; it != end; ++it) sum += it->compute(candV.refAt(iRet));
165  retV[iRet] = sum;
166  }
167  filler.insert(candH, retV.begin(), retV.end());
168  }
169  filler.fill();
170  event.put(std::move(ret));
171 }
const_iterator end() const
Definition: ValueMap.h:208
std::vector< SingleDeposit > sources_
RefToBase< value_type > refAt(size_type i) const
const_iterator begin() const
#define end
Definition: vmac.h:37
helper::Filler< ValueMap< T > > Filler
Definition: ValueMap.h:168
const_iterator begin() const
Definition: ValueMap.h:207
#define begin
Definition: vmac.h:30
size_t size() const
Definition: ValueMap.h:157
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

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