CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
 
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)
 
 ~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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
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
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

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

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.

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

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.

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

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  }
T getUntrackedParameter(std::string const &, T const &) const
std::vector< edm::InputTag > inputs_
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::EDGetTokenT< Collection > src_
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

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.

References Exception, edm::HandleBase::failedToGet(), edm::Event::getByToken(), patZpeak::handle, eostools::move(), edm::Event::put(), and runTheMatrix::ret.

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  }
tuple ret
prodAgent to be discontinued
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
def move
Definition: eostools.py:511
tuple handle
Definition: patZpeak.py:25
bool failedToGet() const
Definition: HandleBase.h:72
edm::EDGetTokenT< Collection > src_

Member Data Documentation

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
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.

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
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.