CMS 3D CMS Logo

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

#include <AnythingToValueMap.h>

Inheritance diagram for pat::helper::AnythingToValueMap< 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

 AnythingToValueMap (const edm::ParameterSet &iConfig)
 
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
 ~AnythingToValueMap () 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
 
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
 
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

Adaptor adaptor_
 
bool failSilently_
 
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 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>
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<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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::AnythingToValueMap< Adaptor, Collection, value_type >

Definition at line 19 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::AnythingToValueMap< Adaptor, Collection, value_type >::Map

Definition at line 21 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::AnythingToValueMap< Adaptor, Collection, value_type >::MapFiller

Definition at line 22 of file AnythingToValueMap.h.

Constructor & Destructor Documentation

◆ AnythingToValueMap()

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

Definition at line 23 of file AnythingToValueMap.h.

24  : failSilently_(iConfig.getUntrackedParameter<bool>("failSilently", false)),
25  src_(consumes<Collection>(iConfig.getParameter<edm::InputTag>("src"))),
26  adaptor_(iConfig, consumesCollector()) {
27  produces<Map>(adaptor_.label());
28  }

References pat::helper::AnythingToValueMap< Adaptor, Collection, value_type >::adaptor_.

◆ ~AnythingToValueMap()

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

Definition at line 29 of file AnythingToValueMap.h.

29 {}

Member Function Documentation

◆ produce()

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

Implements edm::EDProducer.

Definition at line 40 of file AnythingToValueMap.h.

41  {
43  iEvent.getByToken(src_, handle);
44  if (handle.failedToGet() && failSilently_)
45  return;
46 
47  bool adaptorOk = adaptor_.init(iEvent);
48  if ((!adaptorOk) && failSilently_)
49  return;
50 
51  std::vector<value_type> ret;
52  ret.reserve(handle->size());
53 
54  adaptor_.run(*handle, ret);
55 
56  auto map = std::make_unique<Map>();
58  filler.insert(handle, ret.begin(), ret.end());
59  filler.fill();
60  iEvent.put(std::move(map), adaptor_.label());
61  }

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

Member Data Documentation

◆ adaptor_

template<class Adaptor , class Collection = typename Adaptor::Collection, typename value_type = typename Adaptor::value_type>
Adaptor pat::helper::AnythingToValueMap< Adaptor, Collection, value_type >::adaptor_
private

◆ failSilently_

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

Definition at line 34 of file AnythingToValueMap.h.

◆ src_

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

Definition at line 35 of file AnythingToValueMap.h.

runTheMatrix.ret
ret
prodAgent to be discontinued
Definition: runTheMatrix.py:355
pat::helper::AnythingToValueMap::adaptor_
Adaptor adaptor_
Definition: AnythingToValueMap.h:36
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:71
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
edm::Handle
Definition: AssociativeIterator.h:50
pat::helper::AnythingToValueMap::MapFiller
Map::Filler MapFiller
Definition: AnythingToValueMap.h:22
trigObjTnPSource_cfi.filler
filler
Definition: trigObjTnPSource_cfi.py:21
iEvent
int iEvent
Definition: GenABIO.cc:224
pat::helper::AnythingToValueMap::src_
edm::EDGetTokenT< Collection > src_
Definition: AnythingToValueMap.h:35
pat::helper::AnythingToValueMap::failSilently_
bool failSilently_
Definition: AnythingToValueMap.h:34
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
eostools.move
def move(src, dest)
Definition: eostools.py:511
genParticles_cff.map
map
Definition: genParticles_cff.py:11
edm::InputTag
Definition: InputTag.h:15