CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Attributes
edmtest::AssociationMapProducer Class Reference
Inheritance diagram for edmtest::AssociationMapProducer:
edm::one::EDProducer<> edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Types

typedef edm::AssociationMap< edm::OneToMany< std::vector< int >, std::vector< int > > > AssocOneToMany
 
typedef edm::AssociationMap< edm::OneToManyWithQuality< std::vector< int >, std::vector< int >, double > > AssocOneToManyWithQuality
 
typedef edm::AssociationMap< edm::OneToOne< std::vector< int >, std::vector< int > > > AssocOneToOne
 
typedef edm::AssociationMap< edm::OneToOne< edm::View< int >, edm::View< int > > > AssocOneToOneView
 
typedef edm::AssociationMap< edm::OneToValue< std::vector< int >, double > > AssocOneToValue
 
- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
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

 AssociationMapProducer (edm::ParameterSet const &)
 
void produce (edm::Event &, edm::EventSetup const &) override
 
 ~AssociationMapProducer () override
 
- Public Member Functions inherited from edm::one::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const noexcept final
 
bool wantsGlobalRuns () const noexcept final
 
bool wantsInputProcessBlocks () const noexcept final
 
bool wantsProcessBlocks () const noexcept final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const noexcept
 
bool wantsStreamRuns () const noexcept
 
 ~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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

edm::EDGetTokenT< std::vector< int > > inputToken1_
 
edm::EDGetTokenT< edm::View< int > > inputToken1V_
 
edm::EDGetTokenT< std::vector< int > > inputToken2_
 
edm::EDGetTokenT< edm::View< int > > inputToken2V_
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
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)
 
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 ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
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 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

Definition at line 29 of file AssociationMapProducer.cc.

Member Typedef Documentation

◆ AssocOneToMany

Definition at line 38 of file AssociationMapProducer.cc.

◆ AssocOneToManyWithQuality

Definition at line 40 of file AssociationMapProducer.cc.

◆ AssocOneToOne

Definition at line 37 of file AssociationMapProducer.cc.

◆ AssocOneToOneView

Definition at line 41 of file AssociationMapProducer.cc.

◆ AssocOneToValue

Definition at line 36 of file AssociationMapProducer.cc.

Constructor & Destructor Documentation

◆ AssociationMapProducer()

edmtest::AssociationMapProducer::AssociationMapProducer ( edm::ParameterSet const &  pset)
explicit

Definition at line 51 of file AssociationMapProducer.cc.

References inputToken1_, inputToken1V_, inputToken2_, inputToken2V_, and muonDTDigis_cfi::pset.

51  {
52  inputToken1_ = consumes<std::vector<int> >(pset.getParameter<edm::InputTag>("inputTag1"));
53  inputToken2_ = consumes<std::vector<int> >(pset.getParameter<edm::InputTag>("inputTag2"));
54 
55  inputToken1V_ = consumes<edm::View<int> >(pset.getParameter<edm::InputTag>("inputTag1"));
56  inputToken2V_ = consumes<edm::View<int> >(pset.getParameter<edm::InputTag>("inputTag2"));
57 
58  produces<AssocOneToOne>();
59  produces<AssocOneToOne>("twoArg");
60  produces<AssocOneToValue>();
61  produces<AssocOneToValue>("handleArg");
62  produces<AssocOneToMany>();
63  produces<AssocOneToManyWithQuality>();
64  produces<AssocOneToOneView>();
65  produces<AssocOneToOneView>("twoArg");
66  }
edm::EDGetTokenT< edm::View< int > > inputToken1V_
edm::EDGetTokenT< std::vector< int > > inputToken2_
edm::EDGetTokenT< edm::View< int > > inputToken2V_
edm::EDGetTokenT< std::vector< int > > inputToken1_

◆ ~AssociationMapProducer()

edmtest::AssociationMapProducer::~AssociationMapProducer ( )
override

Definition at line 68 of file AssociationMapProducer.cc.

68 {}

Member Function Documentation

◆ produce()

void edmtest::AssociationMapProducer::produce ( edm::Event event,
edm::EventSetup const &   
)
overridevirtual

Implements edm::one::EDProducerBase.

Definition at line 70 of file AssociationMapProducer.cc.

References edmPickEvents::event, inputToken1_, inputToken1V_, inputToken2_, inputToken2V_, edm::makeRefToBaseProdFrom(), eostools::move(), and edm::View< T >::refAt().

70  {
71  edm::Handle<std::vector<int> > inputCollection1 = event.getHandle(inputToken1_);
72 
73  edm::Handle<std::vector<int> > inputCollection2 = event.getHandle(inputToken2_);
74 
75  // insert some entries into some AssociationMaps, in another
76  // module we will readout the contents and check that we readout
77  // the same content as was put in. Note that the particular values
78  // used are arbitrary and have no meaning.
79 
80  auto assoc1 = std::make_unique<AssocOneToOne>(&event.productGetter());
81  assoc1->insert(edm::Ref<std::vector<int> >(inputCollection1, 0), edm::Ref<std::vector<int> >(inputCollection2, 1));
82  assoc1->insert(edm::Ref<std::vector<int> >(inputCollection1, 2), edm::Ref<std::vector<int> >(inputCollection2, 3));
83  event.put(std::move(assoc1));
84 
85  auto assoc2 = std::make_unique<AssocOneToOne>(inputCollection1, inputCollection2);
86  assoc2->insert(edm::Ref<std::vector<int> >(inputCollection1, 0), edm::Ref<std::vector<int> >(inputCollection2, 1));
87  assoc2->insert(edm::Ref<std::vector<int> >(inputCollection1, 2), edm::Ref<std::vector<int> >(inputCollection2, 4));
88  event.put(std::move(assoc2), "twoArg");
89 
90  auto assoc3 = std::make_unique<AssocOneToValue>(&event.productGetter());
91  assoc3->insert(edm::Ref<std::vector<int> >(inputCollection1, 0), 11.0);
92  assoc3->insert(edm::Ref<std::vector<int> >(inputCollection1, 2), 12.0);
93  event.put(std::move(assoc3));
94 
95  auto assoc4 = std::make_unique<AssocOneToValue>(inputCollection1);
96  assoc4->insert(edm::Ref<std::vector<int> >(inputCollection1, 0), 21.0);
97  assoc4->insert(edm::Ref<std::vector<int> >(inputCollection1, 2), 22.0);
98  event.put(std::move(assoc4), "handleArg");
99 
100  auto assoc5 = std::make_unique<AssocOneToMany>(&event.productGetter());
101  assoc5->insert(edm::Ref<std::vector<int> >(inputCollection1, 0), edm::Ref<std::vector<int> >(inputCollection2, 1));
102  assoc5->insert(edm::Ref<std::vector<int> >(inputCollection1, 2), edm::Ref<std::vector<int> >(inputCollection2, 4));
103  assoc5->insert(edm::Ref<std::vector<int> >(inputCollection1, 2), edm::Ref<std::vector<int> >(inputCollection2, 6));
104  event.put(std::move(assoc5));
105 
106  auto assoc6 = std::make_unique<AssocOneToManyWithQuality>(&event.productGetter());
107  assoc6->insert(edm::Ref<std::vector<int> >(inputCollection1, 0),
108  AssocOneToManyWithQuality::data_type(edm::Ref<std::vector<int> >(inputCollection2, 1), 31.0));
109  assoc6->insert(edm::Ref<std::vector<int> >(inputCollection1, 2),
110  AssocOneToManyWithQuality::data_type(edm::Ref<std::vector<int> >(inputCollection2, 4), 32.0));
111  assoc6->insert(edm::Ref<std::vector<int> >(inputCollection1, 2),
112  AssocOneToManyWithQuality::data_type(edm::Ref<std::vector<int> >(inputCollection2, 7), 33.0));
113  event.put(std::move(assoc6));
114 
115  edm::View<int> const& inputView1 = event.get(inputToken1V_);
116 
117  edm::Handle<edm::View<int> > inputView2 = event.getHandle(inputToken2V_);
118 
119  auto assoc7 = std::make_unique<AssocOneToOneView>(&event.productGetter());
120  assoc7->insert(inputView1.refAt(0), inputView2->refAt(3));
121  assoc7->insert(inputView1.refAt(2), inputView2->refAt(4));
122  event.put(std::move(assoc7));
123 
124  auto assoc8 = std::make_unique<AssocOneToOneView>(edm::makeRefToBaseProdFrom(inputView1.refAt(0), event),
125  edm::makeRefToBaseProdFrom(inputView2->refAt(0), event));
126 
127  assoc8->insert(inputView1.refAt(0), inputView2->refAt(5));
128  assoc8->insert(inputView1.refAt(2), inputView2->refAt(6));
129  event.put(std::move(assoc8), "twoArg");
130  }
RefToBase< value_type > refAt(size_type i) const
Tag::data_type data_type
insert data type
edm::EDGetTokenT< edm::View< int > > inputToken1V_
edm::EDGetTokenT< std::vector< int > > inputToken2_
edm::EDGetTokenT< edm::View< int > > inputToken2V_
edm::EDGetTokenT< std::vector< int > > inputToken1_
RefToBaseProd< T > makeRefToBaseProdFrom(RefToBase< T > const &iRef, Event const &iEvent)
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ inputToken1_

edm::EDGetTokenT<std::vector<int> > edmtest::AssociationMapProducer::inputToken1_
private

Definition at line 44 of file AssociationMapProducer.cc.

Referenced by AssociationMapProducer(), and produce().

◆ inputToken1V_

edm::EDGetTokenT<edm::View<int> > edmtest::AssociationMapProducer::inputToken1V_
private

Definition at line 47 of file AssociationMapProducer.cc.

Referenced by AssociationMapProducer(), and produce().

◆ inputToken2_

edm::EDGetTokenT<std::vector<int> > edmtest::AssociationMapProducer::inputToken2_
private

Definition at line 45 of file AssociationMapProducer.cc.

Referenced by AssociationMapProducer(), and produce().

◆ inputToken2V_

edm::EDGetTokenT<edm::View<int> > edmtest::AssociationMapProducer::inputToken2V_
private

Definition at line 48 of file AssociationMapProducer.cc.

Referenced by AssociationMapProducer(), and produce().