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::EDFilter edm::EDProducer 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

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

Private Member Functions

template<typename P >
void commit_ (P &iPrincipal)
 
template<typename P , typename I >
void commit_ (P &iPrincipal, I *iID)
 
- 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<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<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
 ProductRegistryHelper ()
 
std::vector< bool > const & recordProvenanceList () const
 
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 EDFilter
 
class EDProducer
 
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
 

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

◆ ModuleToResolverIndicies

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

Definition at line 89 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.

◆ ~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 120 of file ProducerBase.h.

120  {
121  iPrincipal.commit_(putIndicies_[producerbasehelper::PrincipalTraits<P>::kBranchType]);
122  }

References putIndicies_.

Referenced by edm::PuttableSourceBase::doBeginLumi(), edm::EDProducer::doBeginLuminosityBlock(), edm::EDFilter::doBeginLuminosityBlock(), edm::one::EDFilterBase::doBeginLuminosityBlock(), edm::one::EDProducerBase::doBeginLuminosityBlock(), edm::global::EDProducerBase::doBeginLuminosityBlock(), edm::limited::EDProducerBase::doBeginLuminosityBlock(), edm::limited::EDFilterBase::doBeginLuminosityBlock(), edm::global::EDFilterBase::doBeginLuminosityBlock(), edm::one::EDProducerBase::doBeginProcessBlock(), edm::one::EDFilterBase::doBeginProcessBlock(), edm::global::EDProducerBase::doBeginProcessBlock(), edm::limited::EDProducerBase::doBeginProcessBlock(), edm::limited::EDFilterBase::doBeginProcessBlock(), edm::global::EDFilterBase::doBeginProcessBlock(), edm::PuttableSourceBase::doBeginRun(), edm::EDProducer::doBeginRun(), edm::EDFilter::doBeginRun(), edm::one::EDProducerBase::doBeginRun(), edm::one::EDFilterBase::doBeginRun(), edm::global::EDProducerBase::doBeginRun(), edm::limited::EDProducerBase::doBeginRun(), edm::limited::EDFilterBase::doBeginRun(), edm::global::EDFilterBase::doBeginRun(), edm::EDProducer::doEndLuminosityBlock(), edm::EDFilter::doEndLuminosityBlock(), edm::one::EDProducerBase::doEndLuminosityBlock(), edm::one::EDFilterBase::doEndLuminosityBlock(), edm::global::EDProducerBase::doEndLuminosityBlock(), edm::limited::EDProducerBase::doEndLuminosityBlock(), edm::limited::EDFilterBase::doEndLuminosityBlock(), edm::global::EDFilterBase::doEndLuminosityBlock(), edm::one::EDProducerBase::doEndProcessBlock(), edm::one::EDFilterBase::doEndProcessBlock(), edm::global::EDProducerBase::doEndProcessBlock(), edm::limited::EDProducerBase::doEndProcessBlock(), edm::limited::EDFilterBase::doEndProcessBlock(), edm::global::EDFilterBase::doEndProcessBlock(), edm::EDProducer::doEndRun(), edm::EDFilter::doEndRun(), edm::one::EDFilterBase::doEndRun(), edm::one::EDProducerBase::doEndRun(), edm::global::EDProducerBase::doEndRun(), edm::limited::EDProducerBase::doEndRun(), edm::limited::EDFilterBase::doEndRun(), edm::global::EDFilterBase::doEndRun(), edm::EDProducer::doEvent(), edm::EDFilter::doEvent(), 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().

◆ commit_() [2/2]

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

Definition at line 125 of file ProducerBase.h.

125  {
126  iPrincipal.commit_(putIndicies_[producerbasehelper::PrincipalTraits<P>::kBranchType], iID);
127  }

References putIndicies_.

◆ indiciesForPutProducts()

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

Definition at line 94 of file ProducerBase.h.

94  {
95  return putIndicies_[iBranchType];
96  }

References putIndicies_.

◆ produces() [1/9]

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

Definition at line 130 of file ProductRegistryHelper.h.

130  {
131  return produces<ProductType, B>(std::string());
132  }

◆ produces() [2/9]

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

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 108 of file ProductRegistryHelper.h.

108  {
109  return produces<ProductType, InEvent>(std::string());
110  }

◆ produces() [3/9]

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

Definition at line 118 of file ProductRegistryHelper.h.

118  {
119  return produces<ProductType, B>(std::string());
120  }

◆ produces() [4/9]

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

Definition at line 148 of file ProductRegistryHelper.h.

150  {
151  unsigned int index = typeLabelList_.size();
153  recordProvenanceList_.push_back(recordProvenance and B == InEvent);
154  return BranchAliasSetter{typeLabelList_.back(), EDPutToken{static_cast<unsigned int>(index)}};
155  }

◆ produces() [5/9]

BranchAliasSetter edm::ProductRegistryHelper::produces
inlineprotected

Definition at line 141 of file ProductRegistryHelper.h.

143  {
144  return produces<Transition::Event>(id, std::move(instanceName), recordProvenance);
145  }

◆ produces() [6/9]

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

Definition at line 157 of file ProductRegistryHelper.h.

159  {
160  unsigned int index = typeLabelList_.size();
161  typeLabelList_.emplace_back(B, id, std::move(instanceName));
162  recordProvenanceList_.push_back(recordProvenance and B == Transition::Event);
163  return BranchAliasSetter{typeLabelList_.back(), EDPutToken{index}};
164  }

◆ produces() [7/9]

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

Definition at line 135 of file ProductRegistryHelper.h.

135  {
136  TypeID tid(typeid(ProductType));
137  return BranchAliasSetterT<ProductType>{produces<B>(
139  }

◆ produces() [8/9]

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

Definition at line 113 of file ProductRegistryHelper.h.

113  {
114  return produces<ProductType, InEvent>(std::move(instanceName));
115  }

◆ produces() [9/9]

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

Definition at line 123 of file ProductRegistryHelper.h.

123  {
124  TypeID tid(typeid(ProductType));
125  return BranchAliasSetterT<ProductType>{
127  }

◆ producesCollector()

ProducesCollector edm::ProducerBase::producesCollector ( )
protected

Definition at line 105 of file ProducerBase.cc.

105 { return ProducesCollector{this}; }

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

◆ putTokenIndexToProductResolverIndex()

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

◆ recordProvenanceList()

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

Definition at line 91 of file ProductRegistryHelper.h.

91 { return recordProvenanceList_; }

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

◆ registerProducts()

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

Definition at line 57 of file ProducerBase.cc.

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  }

References edm::ProductRegistryHelper::addToRegistry(), edm::ProductRegistry::callForEachBranch(), relativeConstraints::empty, RawToDigi_Repacked_cff::producer, registrationCallback(), and edm::ProductRegistryHelper::typeLabelList().

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

◆ 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  }

References callWhenNewProductsRegistered_.

Referenced by registerProducts().

◆ resolvePutIndicies()

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

Definition at line 79 of file ProducerBase.cc.

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  }

References edm::convertToBranchType(), mps_fire::i, SiStripPI::max, HerwigMaxPtPartonFilter_cfi::moduleLabel, putIndicies_, putTokenToResolverIndex_, FastTimerService_cff::range, and edm::ProductRegistryHelper::typeLabelList().

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

◆ typeLabelList()

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

used by the fwk to register the list of products of this module

Definition at line 20 of file ProductRegistryHelper.cc.

20 { return typeLabelList_; }

Referenced by edm::PrincipalGetAdapter::getPutTokenIndex(), edm::PrincipalGetAdapter::getTypeIDForPutTokenIndex(), and edm::PrincipalGetAdapter::productInstanceLabel().

Friends And Related Function Documentation

◆ EDFilter

friend class EDFilter
friend

Definition at line 108 of file ProducerBase.h.

◆ EDProducer

friend class EDProducer
friend

Definition at line 107 of file ProducerBase.h.

◆ global::EDFilterBase

friend class global::EDFilterBase
friend

Definition at line 112 of file ProducerBase.h.

◆ global::EDProducerBase

friend class global::EDProducerBase
friend

Definition at line 111 of file ProducerBase.h.

◆ limited::EDFilterBase

friend class limited::EDFilterBase
friend

Definition at line 114 of file ProducerBase.h.

◆ limited::EDProducerBase

friend class limited::EDProducerBase
friend

Definition at line 113 of file ProducerBase.h.

◆ one::EDFilterBase

friend class one::EDFilterBase
friend

Definition at line 110 of file ProducerBase.h.

◆ one::EDProducerBase

friend class one::EDProducerBase
friend

Definition at line 109 of file ProducerBase.h.

◆ PuttableSourceBase

friend class PuttableSourceBase
friend

Definition at line 115 of file ProducerBase.h.

◆ stream::ProducingModuleAdaptorBase

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

Definition at line 117 of file ProducerBase.h.

Member Data Documentation

◆ callWhenNewProductsRegistered_

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

Definition at line 129 of file ProducerBase.h.

Referenced by callWhenNewProductsRegistered(), and registrationCallback().

◆ putIndicies_

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

Definition at line 130 of file ProducerBase.h.

Referenced by commit_(), indiciesForPutProducts(), and resolvePutIndicies().

◆ putTokenToResolverIndex_

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

Definition at line 131 of file ProducerBase.h.

Referenced by putTokenIndexToProductResolverIndex(), and resolvePutIndicies().

FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
mps_fire.i
i
Definition: mps_fire.py:428
edm::ProducerBase::putIndicies_
std::array< std::vector< edm::ProductResolverIndex >, edm::NumBranchTypes > putIndicies_
Definition: ProducerBase.h:130
edm::ProducerBase::TypeLabelList
ProductRegistryHelper::TypeLabelList TypeLabelList
Definition: ProducerBase.h:72
edm::Transition::Event
edm::ProductRegistryHelper::has_donotrecordparents::value
static constexpr bool value
Definition: ProductRegistryHelper.h:32
RawToDigi_Repacked_cff.producer
producer
Definition: RawToDigi_Repacked_cff.py:6
EDPutToken
edm::ProductRegistryHelper::recordProvenanceList_
std::vector< bool > recordProvenanceList_
Definition: ProductRegistryHelper.h:177
Service
edm::InEvent
Definition: BranchType.h:11
edm::ProductRegistryHelper::typeLabelList
TypeLabelList const & typeLabelList() const
used by the fwk to register the list of products of this module
Definition: ProductRegistryHelper.cc:20
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::convertToBranchType
constexpr BranchType convertToBranchType(Transition iValue)
Definition: Transition.h:26
edm::ProducerBase::registrationCallback
std::function< void(BranchDescription const &)> registrationCallback() const
used by the fwk to register list of products
Definition: ProducerBase.cc:19
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
edm::ProductRegistryHelper::typeLabelList_
TypeLabelList typeLabelList_
Definition: ProductRegistryHelper.h:176
edm::ProducerBase::putTokenToResolverIndex_
std::vector< edm::ProductResolverIndex > putTokenToResolverIndex_
Definition: ProducerBase.h:131
TrackCollections2monitor_cff.func
func
Definition: TrackCollections2monitor_cff.py:359
edm::ProductRegistryHelper::ProductRegistryHelper
ProductRegistryHelper()
Definition: ProductRegistryHelper.h:26
edm::ProductRegistryHelper::addToRegistry
static void addToRegistry(TypeLabelList::const_iterator const &iBegin, TypeLabelList::const_iterator const &iEnd, ModuleDescription const &iDesc, ProductRegistry &iReg, ProductRegistryHelper *iProd, bool iIsListener=false)
Definition: ProductRegistryHelper.cc:34
edm::convertToTransition
constexpr Transition convertToTransition(BranchType iValue)
Definition: Transition.h:31
TtFullHadDaughter::B
static const std::string B
Definition: TtFullHadronicEvent.h:9
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::ProducerBase::callWhenNewProductsRegistered_
std::function< void(BranchDescription const &)> callWhenNewProductsRegistered_
Definition: ProducerBase.h:129
relativeConstraints.empty
bool empty
Definition: relativeConstraints.py:46
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
HerwigMaxPtPartonFilter_cfi.moduleLabel
moduleLabel
Definition: HerwigMaxPtPartonFilter_cfi.py:4
MuonErrorMatrixAdjuster_cfi.instanceName
instanceName
Definition: MuonErrorMatrixAdjuster_cfi.py:16