CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Attributes
pat::helper::ManyThingsToValueMaps< Adaptor, Collection, value_type > Class Template Reference

#include <AnythingToValueMap.h>

Inheritance diagram for pat::helper::ManyThingsToValueMaps< Adaptor, Collection, value_type >:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Types

typedef edm::ValueMap< value_type > Map
 
typedef Map::Filler MapFiller
 
- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Public Member Functions

 ManyThingsToValueMaps (const edm::ParameterSet &iConfig)
 
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
 ~ManyThingsToValueMaps () override
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducer () override
 
- 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 ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
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, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
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::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

std::vector< Adaptor > adaptors_
 
bool failSilently_
 
std::vector< edm::InputTaginputs_
 
edm::EDGetTokenT< Collection > src_
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

template<class Adaptor, class Collection = typename Adaptor::Collection, typename value_type = typename Adaptor::value_type>
class pat::helper::ManyThingsToValueMaps< Adaptor, Collection, value_type >

Definition at line 66 of file AnythingToValueMap.h.

Member Typedef Documentation

◆ Map

template<class Adaptor , class Collection = typename Adaptor::Collection, typename value_type = typename Adaptor::value_type>
typedef edm::ValueMap<value_type> pat::helper::ManyThingsToValueMaps< Adaptor, Collection, value_type >::Map

Definition at line 68 of file AnythingToValueMap.h.

◆ MapFiller

template<class Adaptor , class Collection = typename Adaptor::Collection, typename value_type = typename Adaptor::value_type>
typedef Map::Filler pat::helper::ManyThingsToValueMaps< Adaptor, Collection, value_type >::MapFiller

Definition at line 69 of file AnythingToValueMap.h.

Constructor & Destructor Documentation

◆ ManyThingsToValueMaps()

template<class Adaptor , class Collection = typename Adaptor::Collection, typename value_type = typename Adaptor::value_type>
pat::helper::ManyThingsToValueMaps< Adaptor, Collection, value_type >::ManyThingsToValueMaps ( const edm::ParameterSet iConfig)
inlineexplicit

Definition at line 70 of file AnythingToValueMap.h.

71  : failSilently_(iConfig.getUntrackedParameter<bool>("failSilently", false)),
72  src_(consumes<Collection>(iConfig.getParameter<edm::InputTag>("collection"))),
73  inputs_(iConfig.getParameter<std::vector<edm::InputTag> >("associations")) {
74  for (std::vector<edm::InputTag>::const_iterator it = inputs_.begin(), ed = inputs_.end(); it != ed; ++it) {
75  adaptors_.push_back(Adaptor(*it, iConfig, consumesCollector()));
76  produces<Map>(adaptors_.back().label());
77  }
78  }

References pat::helper::ManyThingsToValueMaps< Adaptor, Collection, value_type >::adaptors_, edm::EDConsumerBase::consumesCollector(), and pat::helper::ManyThingsToValueMaps< Adaptor, Collection, value_type >::inputs_.

◆ ~ManyThingsToValueMaps()

template<class Adaptor , class Collection = typename Adaptor::Collection, typename value_type = typename Adaptor::value_type>
pat::helper::ManyThingsToValueMaps< Adaptor, Collection, value_type >::~ManyThingsToValueMaps ( )
inlineoverride

Definition at line 79 of file AnythingToValueMap.h.

79 {}

Member Function Documentation

◆ produce()

template<class Adaptor , class Collection , typename value_type >
void pat::helper::ManyThingsToValueMaps< Adaptor, Collection, value_type >::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Implements edm::EDProducer.

Definition at line 91 of file AnythingToValueMap.h.

92  {
94  iEvent.getByToken(src_, handle);
95  if (handle.failedToGet() && failSilently_)
96  return;
97 
98  std::vector<value_type> ret;
99  ret.reserve(handle->size());
100 
101  for (typename std::vector<Adaptor>::iterator it = adaptors_.begin(), ed = adaptors_.end(); it != ed; ++it) {
102  ret.clear();
103  if (it->run(iEvent, *handle, ret)) {
104  auto map = std::make_unique<Map>();
105  MapFiller filler(*map);
106  filler.insert(handle, ret.begin(), ret.end());
107  filler.fill();
108  iEvent.put(std::move(map), it->label());
109  } else {
110  if (!failSilently_)
111  throw cms::Exception("ManyThingsToValueMaps") << "Error in adapter " << it->label() << "\n";
112  }
113  }
114  }

References Exception, trigObjTnPSource_cfi::filler, patZpeak::handle, iEvent, genParticles_cff::map, eostools::move(), and runTheMatrix::ret.

Member Data Documentation

◆ adaptors_

template<class Adaptor , class Collection = typename Adaptor::Collection, typename value_type = typename Adaptor::value_type>
std::vector<Adaptor> pat::helper::ManyThingsToValueMaps< Adaptor, Collection, value_type >::adaptors_
private

◆ failSilently_

template<class Adaptor , class Collection = typename Adaptor::Collection, typename value_type = typename Adaptor::value_type>
bool pat::helper::ManyThingsToValueMaps< Adaptor, Collection, value_type >::failSilently_
private

Definition at line 84 of file AnythingToValueMap.h.

◆ inputs_

template<class Adaptor , class Collection = typename Adaptor::Collection, typename value_type = typename Adaptor::value_type>
std::vector<edm::InputTag> pat::helper::ManyThingsToValueMaps< Adaptor, Collection, value_type >::inputs_
private

◆ src_

template<class Adaptor , class Collection = typename Adaptor::Collection, typename value_type = typename Adaptor::value_type>
edm::EDGetTokenT<Collection> pat::helper::ManyThingsToValueMaps< Adaptor, Collection, value_type >::src_
private

Definition at line 85 of file AnythingToValueMap.h.

runTheMatrix.ret
ret
prodAgent to be discontinued
Definition: runTheMatrix.py:542
patZpeak.handle
handle
Definition: patZpeak.py:23
edm::EDConsumerBase::consumesCollector
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
Definition: EDConsumerBase.cc:47
pat::helper::ManyThingsToValueMaps::inputs_
std::vector< edm::InputTag > inputs_
Definition: AnythingToValueMap.h:86
pat::helper::ManyThingsToValueMaps::MapFiller
Map::Filler MapFiller
Definition: AnythingToValueMap.h:69
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
edm::Handle
Definition: AssociativeIterator.h:50
pat::helper::ManyThingsToValueMaps::failSilently_
bool failSilently_
Definition: AnythingToValueMap.h:84
pat::helper::ManyThingsToValueMaps::src_
edm::EDGetTokenT< Collection > src_
Definition: AnythingToValueMap.h:85
trigObjTnPSource_cfi.filler
filler
Definition: trigObjTnPSource_cfi.py:21
iEvent
int iEvent
Definition: GenABIO.cc:224
eostools.move
def move(src, dest)
Definition: eostools.py:511
Exception
Definition: hltDiff.cc:245
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
genParticles_cff.map
map
Definition: genParticles_cff.py:11
pat::helper::ManyThingsToValueMaps::adaptors_
std::vector< Adaptor > adaptors_
Definition: AnythingToValueMap.h:87
edm::InputTag
Definition: InputTag.h:15