CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
Merger< InputCollection, OutputCollection, P > Class Template Reference

#include <Merger.h>

Inheritance diagram for Merger< InputCollection, OutputCollection, P >:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 Merger (const edm::ParameterSet &)
 constructor from parameter set More...
 
 ~Merger () override
 destructor More...
 
- Public Member Functions inherited from edm::global::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
 
EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () 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::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 Types

typedef std::vector< edm::EDGetTokenT< InputCollection > > vtoken
 vector of strings More...
 

Private Member Functions

void produce (edm::StreamID, edm::Event &, const edm::EventSetup &) const override
 process an event More...
 

Private Attributes

vtoken srcToken_
 labels of the collections to be merged More...
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase 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
 
- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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<typename InputCollection, typename OutputCollection = InputCollection, typename P = typename edm::clonehelper::CloneTrait<InputCollection>::type>
class Merger< InputCollection, OutputCollection, P >

Merges an arbitrary number of collections into a single collection.

Template parameters:

Author
Luca Lista, INFN
Version
Revision
1.2
Id
Merger.h,v 1.2 2010/02/20 20:55:21 wmtan Exp

Definition at line 31 of file Merger.h.

Member Typedef Documentation

◆ vtoken

template<typename InputCollection , typename OutputCollection = InputCollection, typename P = typename edm::clonehelper::CloneTrait<InputCollection>::type>
typedef std::vector<edm::EDGetTokenT<InputCollection> > Merger< InputCollection, OutputCollection, P >::vtoken
private

vector of strings

Definition at line 42 of file Merger.h.

Constructor & Destructor Documentation

◆ Merger()

template<typename InputCollection , typename OutputCollection , typename P >
Merger< InputCollection, OutputCollection, P >::Merger ( const edm::ParameterSet par)
explicit

constructor from parameter set

Definition at line 48 of file Merger.h.

49  : srcToken_(edm::vector_transform(par.template getParameter<std::vector<edm::InputTag> >("src"),
50  [this](edm::InputTag const& tag) { return consumes<InputCollection>(tag); })) {
51  produces<OutputCollection>();
52 }

References GlobalPosition_Frontier_DevDB_cff::tag.

◆ ~Merger()

template<typename InputCollection , typename OutputCollection , typename P >
Merger< InputCollection, OutputCollection, P >::~Merger ( )
override

destructor

Definition at line 55 of file Merger.h.

55 {}

Member Function Documentation

◆ produce()

template<typename InputCollection , typename OutputCollection , typename P >
void Merger< InputCollection, OutputCollection, P >::produce ( edm::StreamID  ,
edm::Event evt,
const edm::EventSetup  
) const
overrideprivatevirtual

process an event

Implements edm::global::EDProducerBase.

Definition at line 58 of file Merger.h.

60  {
61  std::unique_ptr<OutputCollection> coll(new OutputCollection);
62  for (typename vtoken::const_iterator s = srcToken_.begin(); s != srcToken_.end(); ++s) {
64  evt.getByToken(*s, h);
65  for (typename InputCollection::const_iterator c = h->begin(); c != h->end(); ++c) {
66  coll->push_back(P::clone(*c));
67  }
68  }
69  evt.put(std::move(coll));
70 }

References HltBtagPostValidation_cff::c, clone(), edm::Event::getByToken(), h, eostools::move(), HLTTauReferences_cfi::OutputCollection, edm::Event::put(), and alignCSCRings::s.

Member Data Documentation

◆ srcToken_

template<typename InputCollection , typename OutputCollection = InputCollection, typename P = typename edm::clonehelper::CloneTrait<InputCollection>::type>
vtoken Merger< InputCollection, OutputCollection, P >::srcToken_
private

labels of the collections to be merged

Definition at line 44 of file Merger.h.

h
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
Definition: L1TUtmAlgorithmRcd.h:4
edm::Handle
Definition: AssociativeIterator.h:50
alignCSCRings.s
s
Definition: alignCSCRings.py:92
clone
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition: GlobalPosition_Frontier_DevDB_cff.py:11
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:531
h
edm::vector_transform
auto vector_transform(std::vector< InputType > const &input, Function predicate) -> std::vector< typename std::remove_cv< typename std::remove_reference< decltype(predicate(input.front()))>::type >::type >
Definition: transform.h:11
edm::Event::put
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
eostools.move
def move(src, dest)
Definition: eostools.py:511
Merger::srcToken_
vtoken srcToken_
labels of the collections to be merged
Definition: Merger.h:44
HLTTauReferences_cfi.OutputCollection
OutputCollection
Definition: HLTTauReferences_cfi.py:92
edm::InputTag
Definition: InputTag.h:15