CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Friends
edm::ProducerBase Class Reference

#include <ProducerBase.h>

Inheritance diagram for edm::ProducerBase:
edm::ProductRegistryHelper edm::global::EDFilterBase edm::global::EDProducerBase edm::limited::EDFilterBase edm::limited::EDProducerBase edm::one::EDFilterBase edm::one::EDProducerBase edm::PuttableSourceBase edm::stream::EDFilterBase edm::stream::EDProducerBase

Public Types

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 Member Functions

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
 

Protected Member Functions

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 ()
 

Private Member Functions

template<typename P >
void commit_ (P &iPrincipal)
 
template<typename P , typename I >
void commit_ (P &iPrincipal, I *iID)
 
EDPutToken transforms (const TypeID &id, std::string instanceName)
 
- Private Member Functions inherited from edm::ProductRegistryHelper
virtual bool hasAbilityToProduceInBeginLumis () const
 
virtual bool hasAbilityToProduceInBeginProcessBlocks () const
 
virtual bool hasAbilityToProduceInBeginRuns () const
 
virtual bool hasAbilityToProduceInEndLumis () const
 
virtual bool hasAbilityToProduceInEndProcessBlocks () const
 
virtual bool hasAbilityToProduceInEndRuns () const
 
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 Tr = Transition::Event>
auto produces () noexcept
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
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)
 
 ProductRegistryHelper ()
 
std::vector< bool > const & recordProvenanceList () const
 
EDPutToken transforms (const TypeID &id, std::string instanceName)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
virtual ~ProductRegistryHelper () noexcept(false)
 

Private Attributes

std::function< void(BranchDescription const &)> callWhenNewProductsRegistered_
 
std::array< std::vector< edm::ProductResolverIndex >, edm::NumBranchTypesputIndicies_
 
std::vector< edm::ProductResolverIndexputTokenToResolverIndex_
 

Friends

class global::EDFilterBase
 
class global::EDProducerBase
 
class limited::EDFilterBase
 
class limited::EDProducerBase
 
class one::EDFilterBase
 
class one::EDProducerBase
 
class PuttableSourceBase
 
template<typename T >
class stream::ProducingModuleAdaptorBase
 
class TransformerBase
 

Additional Inherited Members

- Private Types inherited from edm::ProductRegistryHelper
typedef std::vector< TypeLabelItemTypeLabelList
 
- Static Private Member Functions inherited from edm::ProductRegistryHelper
static void addToRegistry (TypeLabelList::const_iterator const &iBegin, TypeLabelList::const_iterator const &iEnd, ModuleDescription const &iDesc, ProductRegistry &iReg, ProductRegistryHelper *iProd, bool iIsListener=false)
 

Detailed Description

Definition at line 70 of file ProducerBase.h.

Member Typedef Documentation

◆ BranchAliasSetterT

Definition at line 85 of file ProducerBase.h.

◆ ModuleToResolverIndicies

using edm::ProducerBase::ModuleToResolverIndicies = std::unordered_multimap<std::string, std::tuple<edm::TypeID const*, const char*, edm::ProductResolverIndex> >

Definition at line 92 of file ProducerBase.h.

◆ TypeLabelList

Definition at line 72 of file ProducerBase.h.

Constructor & Destructor Documentation

◆ ProducerBase()

edm::ProducerBase::ProducerBase ( )

Definition at line 16 of file ProducerBase.cc.

std::function< void(BranchDescription const &)> callWhenNewProductsRegistered_
Definition: ProducerBase.h:133

◆ ~ProducerBase()

edm::ProducerBase::~ProducerBase ( )
overridenoexcept

Definition at line 17 of file ProducerBase.cc.

17 {}

Member Function Documentation

◆ callWhenNewProductsRegistered()

void edm::ProducerBase::callWhenNewProductsRegistered ( std::function< void(BranchDescription const &)> const &  func)
inline

◆ commit_() [1/2]

template<typename P >
void edm::ProducerBase::commit_ ( P iPrincipal)
inlineprivate

Definition at line 122 of file ProducerBase.h.

Referenced by edm::PuttableSourceBase::doBeginLumi(), edm::one::EDFilterBase::doBeginLuminosityBlock(), edm::one::EDProducerBase::doBeginLuminosityBlock(), edm::limited::EDProducerBase::doBeginLuminosityBlock(), edm::global::EDProducerBase::doBeginLuminosityBlock(), edm::global::EDFilterBase::doBeginLuminosityBlock(), edm::limited::EDFilterBase::doBeginLuminosityBlock(), edm::one::EDProducerBase::doBeginProcessBlock(), edm::one::EDFilterBase::doBeginProcessBlock(), edm::global::EDProducerBase::doBeginProcessBlock(), edm::limited::EDProducerBase::doBeginProcessBlock(), edm::global::EDFilterBase::doBeginProcessBlock(), edm::limited::EDFilterBase::doBeginProcessBlock(), edm::PuttableSourceBase::doBeginRun(), edm::one::EDFilterBase::doBeginRun(), edm::one::EDProducerBase::doBeginRun(), edm::limited::EDProducerBase::doBeginRun(), edm::global::EDProducerBase::doBeginRun(), edm::global::EDFilterBase::doBeginRun(), edm::limited::EDFilterBase::doBeginRun(), edm::one::EDProducerBase::doEndLuminosityBlock(), edm::one::EDFilterBase::doEndLuminosityBlock(), edm::limited::EDProducerBase::doEndLuminosityBlock(), edm::global::EDProducerBase::doEndLuminosityBlock(), edm::global::EDFilterBase::doEndLuminosityBlock(), edm::limited::EDFilterBase::doEndLuminosityBlock(), edm::one::EDFilterBase::doEndProcessBlock(), edm::one::EDProducerBase::doEndProcessBlock(), edm::limited::EDProducerBase::doEndProcessBlock(), edm::global::EDProducerBase::doEndProcessBlock(), edm::global::EDFilterBase::doEndProcessBlock(), edm::limited::EDFilterBase::doEndProcessBlock(), edm::one::EDProducerBase::doEndRun(), edm::one::EDFilterBase::doEndRun(), edm::global::EDProducerBase::doEndRun(), edm::limited::EDProducerBase::doEndRun(), edm::global::EDFilterBase::doEndRun(), edm::limited::EDFilterBase::doEndRun(), edm::global::EDFilterBase::doEvent(), edm::one::EDProducerBase::doEvent(), edm::one::EDFilterBase::doEvent(), edm::global::EDProducerBase::doEvent(), edm::limited::EDFilterBase::doEvent(), and edm::limited::EDProducerBase::doEvent().

122  {
123  iPrincipal.commit_(putIndicies_[producerbasehelper::PrincipalTraits<P>::kBranchType]);
124  }
std::array< std::vector< edm::ProductResolverIndex >, edm::NumBranchTypes > putIndicies_
Definition: ProducerBase.h:134

◆ commit_() [2/2]

template<typename P , typename I >
void edm::ProducerBase::commit_ ( P iPrincipal,
I *  iID 
)
inlineprivate

Definition at line 127 of file ProducerBase.h.

127  {
128  iPrincipal.commit_(putIndicies_[producerbasehelper::PrincipalTraits<P>::kBranchType], iID);
129  }
std::array< std::vector< edm::ProductResolverIndex >, edm::NumBranchTypes > putIndicies_
Definition: ProducerBase.h:134

◆ indiciesForPutProducts()

std::vector<edm::ProductResolverIndex> const& edm::ProducerBase::indiciesForPutProducts ( BranchType  iBranchType) const
inline

Definition at line 97 of file ProducerBase.h.

97  {
98  return putIndicies_[iBranchType];
99  }
std::array< std::vector< edm::ProductResolverIndex >, edm::NumBranchTypes > putIndicies_
Definition: ProducerBase.h:134

◆ produces() [1/11]

template<typename ProductType , BranchType B>
BranchAliasSetterT<ProductType> edm::ProductRegistryHelper::produces ( typename ProductType  ,
BranchType  B 
)
inlineprotected

Definition at line 138 of file ProductRegistryHelper.h.

138  {
139  return produces<ProductType, B>(std::string());
140  }

◆ produces() [2/11]

template<typename ProductType , BranchType B>
BranchAliasSetterT<ProductType> edm::ProductRegistryHelper::produces ( typename ProductType  ,
BranchType  B 
)
inlineprotected

Definition at line 143 of file ProductRegistryHelper.h.

143  {
144  TypeID tid(typeid(ProductType));
145  return BranchAliasSetterT<ProductType>{
146  produces<B>(tid, std::move(instanceName), (not has_donotrecordparents<ProductType>::value) and B == InEvent)};
147  }
Definition: APVGainStruct.h:7
def move(src, dest)
Definition: eostools.py:511

◆ produces() [3/11]

template<typename ProductType , Transition B>
BranchAliasSetterT<ProductType> edm::ProductRegistryHelper::produces ( typename ProductType  ,
Transition  B 
)
inlineprotected

Definition at line 150 of file ProductRegistryHelper.h.

150  {
151  return produces<ProductType, B>(std::string());
152  }

◆ produces() [4/11]

template<typename ProductType , Transition B>
BranchAliasSetterT<ProductType> edm::ProductRegistryHelper::produces ( typename ProductType  ,
Transition  B 
)
inlineprotected

Definition at line 155 of file ProductRegistryHelper.h.

155  {
156  TypeID tid(typeid(ProductType));
157  return BranchAliasSetterT<ProductType>{produces<B>(
158  tid, std::move(instanceName), (not has_donotrecordparents<ProductType>::value) and B == Transition::Event)};
159  }
Definition: APVGainStruct.h:7
def move(src, dest)
Definition: eostools.py:511

◆ produces() [5/11]

BranchAliasSetter edm::ProductRegistryHelper::produces
inlineprotected

Definition at line 161 of file ProductRegistryHelper.h.

163  {
164  return produces<Transition::Event>(id, std::move(instanceName), recordProvenance);
165  }
def move(src, dest)
Definition: eostools.py:511

◆ produces() [6/11]

template<class ProductType >
BranchAliasSetterT<ProductType> edm::ProductRegistryHelper::produces ( class ProductType  )
inlineprotected

Definition at line 133 of file ProductRegistryHelper.h.

133  {
134  return produces<ProductType, InEvent>(std::move(instanceName));
135  }
def move(src, dest)
Definition: eostools.py:511

◆ produces() [7/11]

template<BranchType B>
BranchAliasSetter edm::ProductRegistryHelper::produces ( BranchType  B)
inlineprotected

Definition at line 168 of file ProductRegistryHelper.h.

170  {
171  unsigned int index = typeLabelList_.size();
172  typeLabelList_.emplace_back(convertToTransition(B), id, std::move(instanceName));
173  recordProvenanceList_.push_back(recordProvenance and B == InEvent);
174  return BranchAliasSetter{typeLabelList_.back(), EDPutToken{static_cast<unsigned int>(index)}};
175  }
Definition: APVGainStruct.h:7
constexpr Transition convertToTransition(BranchType iValue)
Definition: Transition.h:31
std::vector< bool > recordProvenanceList_
def move(src, dest)
Definition: eostools.py:511

◆ produces() [8/11]

template<Transition B>
BranchAliasSetter edm::ProductRegistryHelper::produces ( Transition  B)
inlineprotected

Definition at line 177 of file ProductRegistryHelper.h.

179  {
180  unsigned int index = typeLabelList_.size();
181  typeLabelList_.emplace_back(B, id, std::move(instanceName));
182  recordProvenanceList_.push_back(recordProvenance and B == Transition::Event);
183  return BranchAliasSetter{typeLabelList_.back(), EDPutToken{index}};
184  }
Definition: APVGainStruct.h:7
std::vector< bool > recordProvenanceList_
def move(src, dest)
Definition: eostools.py:511

◆ produces() [9/11]

template<Transition Tr = Transition::Event>
auto edm::ProductRegistryHelper::produces ( Transition  Tr = Transition::Event)
inlineprotectednoexcept

declare what type of product will make and with which optional label

the statement

produces<ProductType>("optlabel");

should be added to the producer ctor for every product

Definition at line 119 of file ProductRegistryHelper.h.

119  {
120  return ProductRegistryHelperAdaptor<Tr>(*this, std::move(instanceName));
121  }
def move(src, dest)
Definition: eostools.py:511

◆ produces() [10/11]

template<Transition Tr = Transition::Event>
auto edm::ProductRegistryHelper::produces ( Transition  Tr = Transition::Event)
inlineprotectednoexcept

Definition at line 123 of file ProductRegistryHelper.h.

123  {
124  return ProductRegistryHelperAdaptor<Tr>(*this);
125  }

◆ produces() [11/11]

template<class ProductType >
BranchAliasSetterT<ProductType> edm::ProductRegistryHelper::produces ( class ProductType  )
inlineprotected

Definition at line 128 of file ProductRegistryHelper.h.

128  {
129  return produces<ProductType, InEvent>(std::string());
130  }

◆ producesCollector()

ProducesCollector edm::ProducerBase::producesCollector ( )
protected

Definition at line 105 of file ProducerBase.cc.

Referenced by ConfigurableAnalysis::ConfigurableAnalysis(), and NTuplingDevice::NTuplingDevice().

105 { return ProducesCollector{this}; }

◆ putTokenIndexToProductResolverIndex()

std::vector<edm::ProductResolverIndex> const& edm::ProducerBase::putTokenIndexToProductResolverIndex ( ) const
inline

◆ recordProvenanceList()

std::vector<bool> const& edm::ProductRegistryHelper::recordProvenanceList
inline

Definition at line 102 of file ProductRegistryHelper.h.

Referenced by edm::PrincipalGetAdapter::recordProvenanceList().

102 { return recordProvenanceList_; }
std::vector< bool > recordProvenanceList_

◆ registerProducts()

void edm::ProducerBase::registerProducts ( ProducerBase producer,
ProductRegistry iReg,
ModuleDescription const &  md 
)

Definition at line 57 of file ProducerBase.cc.

Referenced by edm::one::EDFilterBase::registerProductsAndCallbacks(), edm::one::EDProducerBase::registerProductsAndCallbacks(), edm::global::EDProducerBase::registerProductsAndCallbacks(), edm::limited::EDProducerBase::registerProductsAndCallbacks(), edm::global::EDFilterBase::registerProductsAndCallbacks(), and edm::limited::EDFilterBase::registerProductsAndCallbacks().

57  {
59  return;
60  }
61  //If we have a callback, first tell the callback about all the entries already in the
62  // product registry, then add any items this producer wants to add to the registry
63  // and only after that do we register the callback. This is done so the callback does not
64  // get called for items registered by this producer (avoids circular reference problems)
65  bool isListener = false;
66  if (registrationCallback()) {
67  isListener = true;
68  iReg->callForEachBranch(registrationCallback());
69  }
70  TypeLabelList const& plist = typeLabelList();
71 
72  ProductRegistryHelper::addToRegistry(plist.begin(), plist.end(), md, *(iReg), this, isListener);
73  if (registrationCallback()) {
75  regService->watchProductAdditions(CallbackWrapper(producer, registrationCallback(), iReg, md));
76  }
77  }
std::function< void(BranchDescription const &)> registrationCallback() const
used by the fwk to register list of products
Definition: ProducerBase.cc:19
ProductRegistryHelper::TypeLabelList TypeLabelList
Definition: ProducerBase.h:72
static void addToRegistry(TypeLabelList::const_iterator const &iBegin, TypeLabelList::const_iterator const &iEnd, ModuleDescription const &iDesc, ProductRegistry &iReg, ProductRegistryHelper *iProd, bool iIsListener=false)
TypeLabelList const & typeLabelList() const
used by the fwk to register the list of products of this module

◆ registrationCallback()

std::function< void(BranchDescription const &)> edm::ProducerBase::registrationCallback ( ) const

used by the fwk to register list of products

Definition at line 19 of file ProducerBase.cc.

19  {
21  }
std::function< void(BranchDescription const &)> callWhenNewProductsRegistered_
Definition: ProducerBase.h:133

◆ resolvePutIndicies()

void edm::ProducerBase::resolvePutIndicies ( BranchType  iBranchType,
ModuleToResolverIndicies const &  iIndicies,
std::string const &  moduleLabel 
)

Definition at line 79 of file ProducerBase.cc.

Referenced by edm::PuttableSourceBase::beginJob().

81  {
82  auto const& plist = typeLabelList();
83  if (putTokenToResolverIndex_.size() != plist.size()) {
85  }
86  auto range = iIndicies.equal_range(moduleLabel);
87  putIndicies_[iBranchType].reserve(iIndicies.count(moduleLabel));
88  for (auto it = range.first; it != range.second; ++it) {
89  putIndicies_[iBranchType].push_back(std::get<2>(it->second));
90  unsigned int i = 0;
91  for (auto const& tl : plist) {
92  if (convertToBranchType(tl.transition_) == iBranchType and (tl.typeID_ == *std::get<0>(it->second)) and
93  (tl.productInstanceName_ == std::get<1>(it->second))) {
94  putTokenToResolverIndex_[i] = std::get<2>(it->second);
95  //NOTE: The ExternalLHEProducer puts the 'same' product in at
96  // both beginRun and endRun. Therefore we can get multiple matches.
97  // When the module is finally fixed, we can use the 'break'
98  //break;
99  }
100  ++i;
101  }
102  }
103  }
std::array< std::vector< edm::ProductResolverIndex >, edm::NumBranchTypes > putIndicies_
Definition: ProducerBase.h:134
std::vector< edm::ProductResolverIndex > putTokenToResolverIndex_
Definition: ProducerBase.h:135
TypeLabelList const & typeLabelList() const
used by the fwk to register the list of products of this module
constexpr BranchType convertToBranchType(Transition iValue)
Definition: Transition.h:26

◆ transforms()

EDPutToken edm::ProductRegistryHelper::transforms
inlineprivate

Definition at line 186 of file ProductRegistryHelper.h.

Referenced by edm::TransformerBase::registerTransformAsyncImp(), and edm::TransformerBase::registerTransformImp().

186  {
187  unsigned int index = typeLabelList_.size();
188  typeLabelList_.emplace_back(Transition::Event, id, std::move(instanceName));
189  typeLabelList_.back().isTransform_ = true;
190  recordProvenanceList_.push_back(true);
191  return EDPutToken{index};
192  }
std::vector< bool > recordProvenanceList_
def move(src, dest)
Definition: eostools.py:511

◆ typeLabelList()

ProductRegistryHelper::TypeLabelList const & edm::ProductRegistryHelper::typeLabelList

Friends And Related Function Documentation

◆ global::EDFilterBase

friend class global::EDFilterBase
friend

Definition at line 113 of file ProducerBase.h.

◆ global::EDProducerBase

friend class global::EDProducerBase
friend

Definition at line 112 of file ProducerBase.h.

◆ limited::EDFilterBase

friend class limited::EDFilterBase
friend

Definition at line 115 of file ProducerBase.h.

◆ limited::EDProducerBase

friend class limited::EDProducerBase
friend

Definition at line 114 of file ProducerBase.h.

◆ one::EDFilterBase

friend class one::EDFilterBase
friend

Definition at line 111 of file ProducerBase.h.

◆ one::EDProducerBase

friend class one::EDProducerBase
friend

Definition at line 110 of file ProducerBase.h.

◆ PuttableSourceBase

friend class PuttableSourceBase
friend

Definition at line 116 of file ProducerBase.h.

◆ stream::ProducingModuleAdaptorBase

template<typename T >
friend class stream::ProducingModuleAdaptorBase
friend

Definition at line 119 of file ProducerBase.h.

◆ TransformerBase

friend class TransformerBase
friend

Definition at line 117 of file ProducerBase.h.

Member Data Documentation

◆ callWhenNewProductsRegistered_

std::function<void(BranchDescription const&)> edm::ProducerBase::callWhenNewProductsRegistered_
private

◆ putIndicies_

std::array<std::vector<edm::ProductResolverIndex>, edm::NumBranchTypes> edm::ProducerBase::putIndicies_
private

◆ putTokenToResolverIndex_

std::vector<edm::ProductResolverIndex> edm::ProducerBase::putTokenToResolverIndex_
private