CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
AssociationVectorSelector< KeyRefProd, CVal, KeySelector, ValSelector > Class Template Reference

#include <AssociationVectorSelector.h>

Inheritance diagram for AssociationVectorSelector< KeyRefProd, CVal, KeySelector, ValSelector >:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 AssociationVectorSelector (const edm::ParameterSet &)
 
- 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 Types

typedef edm::AssociationVector< KeyRefProd, CVal > association_t
 
typedef association_t::CKey collection_t
 

Private Member Functions

void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

edm::EDGetTokenT< association_tassociationToken_
 
KeySelector selectKey_
 
ValSelector selectVal_
 

Additional Inherited Members

- 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
 
- 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<typename KeyRefProd, typename CVal, typename KeySelector = AnySelector, typename ValSelector = AnySelector>
class AssociationVectorSelector< KeyRefProd, CVal, KeySelector, ValSelector >

Definition at line 16 of file AssociationVectorSelector.h.

Member Typedef Documentation

◆ association_t

template<typename KeyRefProd , typename CVal , typename KeySelector = AnySelector, typename ValSelector = AnySelector>
typedef edm::AssociationVector<KeyRefProd, CVal> AssociationVectorSelector< KeyRefProd, CVal, KeySelector, ValSelector >::association_t
private

Definition at line 21 of file AssociationVectorSelector.h.

◆ collection_t

template<typename KeyRefProd , typename CVal , typename KeySelector = AnySelector, typename ValSelector = AnySelector>
typedef association_t::CKey AssociationVectorSelector< KeyRefProd, CVal, KeySelector, ValSelector >::collection_t
private

Definition at line 22 of file AssociationVectorSelector.h.

Constructor & Destructor Documentation

◆ AssociationVectorSelector()

template<typename KeyRefProd , typename CVal , typename KeySelector , typename ValSelector >
AssociationVectorSelector< KeyRefProd, CVal, KeySelector, ValSelector >::AssociationVectorSelector ( const edm::ParameterSet cfg)

Definition at line 36 of file AssociationVectorSelector.h.

38  : associationToken_(consumes<association_t>(cfg.template getParameter<edm::InputTag>("association"))),
39  selectKey_(reco::modules::make<KeySelector>(cfg, consumesCollector())),
40  selectVal_(reco::modules::make<ValSelector>(cfg, consumesCollector())) {
41  std::string alias(cfg.template getParameter<std::string>("@module_label"));
42  produces<collection_t>().setBranchAlias(alias);
43  produces<association_t>().setBranchAlias(alias + "Association");
44 }

References SiStripOfflineCRack_cfg::alias, looper::cfg, and AlCaHLTBitMon_QueryRunRegistry::string.

Member Function Documentation

◆ produce()

template<typename KeyRefProd , typename CVal , typename KeySelector , typename ValSelector >
void AssociationVectorSelector< KeyRefProd, CVal, KeySelector, ValSelector >::produce ( edm::Event evt,
const edm::EventSetup  
)
overrideprivatevirtual

Implements edm::EDProducer.

Definition at line 47 of file AssociationVectorSelector.h.

48  {
49  using namespace edm;
50  using namespace std;
53  unique_ptr<collection_t> selected(new collection_t);
54  vector<typename CVal::value_type> selectedValues;
55  size_t size = association->size();
56  selected->reserve(size);
57  selectedValues.reserve(size);
58  for (typename association_t::const_iterator i = association->begin(); i != association->end(); ++i) {
59  const typename association_t::key_type& obj = *i->first;
60  if (selectKey_(obj) && selectVal_(i->second)) {
61  typedef typename edm::clonehelper::CloneTrait<collection_t>::type clone_t;
62  selected->push_back(clone_t::clone(obj));
63  selectedValues.push_back(i->second);
64  }
65  }
66  // new association must be created after the
67  // selected collection is full because it uses the size
68  KeyRefProd ref = evt.getRefBeforePut<collection_t>();
69  unique_ptr<association_t> selectedAssociation(new association_t(ref, selected.get()));
70  size = selected->size();
71  OrphanHandle<collection_t> oh = evt.put(std::move(selected));
72  for (size_t i = 0; i != size; ++i)
73  selectedAssociation->setValue(i, selectedValues[i]);
74  evt.put(std::move(selectedAssociation));
75 }

References clone(), edm::Event::getByToken(), edm::Event::getRefBeforePut(), mps_fire::i, eostools::move(), getGTfromDQMFile::obj, edm::Event::put(), and findQualityFiles::size.

Member Data Documentation

◆ associationToken_

template<typename KeyRefProd , typename CVal , typename KeySelector = AnySelector, typename ValSelector = AnySelector>
edm::EDGetTokenT<association_t> AssociationVectorSelector< KeyRefProd, CVal, KeySelector, ValSelector >::associationToken_
private

Definition at line 24 of file AssociationVectorSelector.h.

◆ selectKey_

template<typename KeyRefProd , typename CVal , typename KeySelector = AnySelector, typename ValSelector = AnySelector>
KeySelector AssociationVectorSelector< KeyRefProd, CVal, KeySelector, ValSelector >::selectKey_
private

Definition at line 25 of file AssociationVectorSelector.h.

◆ selectVal_

template<typename KeyRefProd , typename CVal , typename KeySelector = AnySelector, typename ValSelector = AnySelector>
ValSelector AssociationVectorSelector< KeyRefProd, CVal, KeySelector, ValSelector >::selectVal_
private

Definition at line 26 of file AssociationVectorSelector.h.

edm::Event::getRefBeforePut
RefProd< PROD > getRefBeforePut()
Definition: Event.h:158
mps_fire.i
i
Definition: mps_fire.py:428
AssociationVectorSelector::associationToken_
edm::EDGetTokenT< association_t > associationToken_
Definition: AssociationVectorSelector.h:24
AssociationVectorSelector::selectKey_
KeySelector selectKey_
Definition: AssociationVectorSelector.h:25
AssociationVectorSelector::collection_t
association_t::CKey collection_t
Definition: AssociationVectorSelector.h:22
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::EDConsumerBase::consumesCollector
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
Definition: EDConsumerBase.cc:47
edm::Handle
Definition: AssociativeIterator.h:50
clone
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
edm::clonehelper::CloneTrait
Definition: CloneTrait.h:12
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:535
getGTfromDQMFile.obj
obj
Definition: getGTfromDQMFile.py:32
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::AssociationVector::key_type
KeyRef::value_type key_type
Definition: AssociationVector.h:76
AssociationVectorSelector::association_t
edm::AssociationVector< KeyRefProd, CVal > association_t
Definition: AssociationVectorSelector.h:21
edm::Event::put
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
edm::AssociationVector::const_iterator
transient_vector_type::const_iterator const_iterator
Definition: AssociationVector.h:106
looper.cfg
cfg
Definition: looper.py:297
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
AssociationVectorSelector::selectVal_
ValSelector selectVal_
Definition: AssociationVectorSelector.h:26
edm::OrphanHandle
Definition: EDProductfwd.h:39
hgcal::association
std::tuple< layerClusterToCaloParticle, caloParticleToLayerCluster > association
Definition: LayerClusterAssociatorByEnergyScoreImpl.h:44
SiStripOfflineCRack_cfg.alias
alias
Definition: SiStripOfflineCRack_cfg.py:128
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443