CMS 3D CMS Logo

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

#include <UniqueMerger.h>

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

Public Types

typedef std::set< typename OutputCollection::value_type > set_type
 
- 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
 

Public Member Functions

 UniqueMerger (const edm::ParameterSet &)
 constructor from parameter set More...
 
 ~UniqueMerger () override
 destructor More...
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () 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
 
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

- 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>
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<typename InputCollection, typename OutputCollection = InputCollection, typename P = typename edm::clonehelper::CloneTrait<InputCollection>::type>
class UniqueMerger< InputCollection, OutputCollection, P >

Merges an arbitrary number of collections into a single collection, without duplicates. Based on logic from Merger.h. This class template differs from Merger.h in that it uses a set instead of std::vector. This requires the OutputCollection type to be sortable, which allows us to search for elements downstream efficiently.

Template parameters:

Author
Lauren Hay
Version
Revision
1.1

Definition at line 32 of file UniqueMerger.h.

Member Typedef Documentation

◆ set_type

template<typename InputCollection , typename OutputCollection = InputCollection, typename P = typename edm::clonehelper::CloneTrait<InputCollection>::type>
typedef std::set<typename OutputCollection::value_type> UniqueMerger< InputCollection, OutputCollection, P >::set_type

Definition at line 34 of file UniqueMerger.h.

◆ vtoken

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

vector of strings

Definition at line 44 of file UniqueMerger.h.

Constructor & Destructor Documentation

◆ UniqueMerger()

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

constructor from parameter set

Definition at line 50 of file UniqueMerger.h.

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

References GlobalPosition_Frontier_DevDB_cff::tag.

◆ ~UniqueMerger()

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

destructor

Definition at line 57 of file UniqueMerger.h.

57 {}

Member Function Documentation

◆ produce()

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

process an event

Implements edm::global::EDProducerBase.

Definition at line 60 of file UniqueMerger.h.

62  {
63  set_type coll_set;
64  for (typename vtoken::const_iterator s = srcToken_.begin(); s != srcToken_.end(); ++s) {
66  evt.getByToken(*s, h);
67  for (typename InputCollection::const_iterator c = h->begin(); c != h->end(); ++c) {
68  coll_set.emplace(P::clone(*c));
69  }
70  }
71  std::unique_ptr<OutputCollection> coll(new OutputCollection(coll_set.size()));
72  std::copy(coll_set.begin(), coll_set.end(), coll->begin());
73  evt.put(std::move(coll));
74 }

References HltBtagPostValidation_cff::c, clone(), filterCSVwithJSON::copy, 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 UniqueMerger< InputCollection, OutputCollection, P >::srcToken_
private

labels of the collections to be merged

Definition at line 46 of file UniqueMerger.h.

filterCSVwithJSON.copy
copy
Definition: filterCSVwithJSON.py:36
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:528
h
UniqueMerger::srcToken_
vtoken srcToken_
labels of the collections to be merged
Definition: UniqueMerger.h:46
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
UniqueMerger::set_type
std::set< typename OutputCollection::value_type > set_type
Definition: UniqueMerger.h:34
edm::Event::put
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:132
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
eostools.move
def move(src, dest)
Definition: eostools.py:511
HLTTauReferences_cfi.OutputCollection
OutputCollection
Definition: HLTTauReferences_cfi.py:92
edm::InputTag
Definition: InputTag.h:15