CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Attributes
edm::ProductRegistryHelper Class Reference

#include <ProductRegistryHelper.h>

Inheritance diagram for edm::ProductRegistryHelper:
edm::ProducerBase 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

Classes

struct  BranchAliasSetter
 
struct  BranchAliasSetterT
 
struct  has_donotrecordparents
 
struct  TypeLabelItem
 

Public Types

typedef std::vector< TypeLabelItemTypeLabelList
 

Public Member Functions

virtual bool hasAbilityToProduceInLumis () const
 
virtual bool hasAbilityToProduceInRuns () const
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
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
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
virtual ~ProductRegistryHelper () noexcept(false)
 

Static Public Member Functions

static void addToRegistry (TypeLabelList::const_iterator const &iBegin, TypeLabelList::const_iterator const &iEnd, ModuleDescription const &iDesc, ProductRegistry &iReg, ProductRegistryHelper *iProd, bool iIsListener=false)
 

Private Attributes

std::vector< bool > recordProvenanceList_
 
TypeLabelList typeLabelList_
 

Detailed Description

Definition at line 23 of file ProductRegistryHelper.h.

Member Typedef Documentation

Definition at line 81 of file ProductRegistryHelper.h.

Constructor & Destructor Documentation

edm::ProductRegistryHelper::~ProductRegistryHelper ( )
virtualnoexcept

Definition at line 17 of file ProductRegistryHelper.cc.

17 { }
edm::ProductRegistryHelper::ProductRegistryHelper ( )
inline

Definition at line 26 of file ProductRegistryHelper.h.

Member Function Documentation

void edm::ProductRegistryHelper::addToRegistry ( TypeLabelList::const_iterator const &  iBegin,
TypeLabelList::const_iterator const &  iEnd,
ModuleDescription const &  iDesc,
ProductRegistry iReg,
ProductRegistryHelper iProd,
bool  iIsListener = false 
)
static

Definition at line 39 of file ProductRegistryHelper.cc.

References edm::ProductRegistry::addProduct(), edm::BeginLuminosityBlock, edm::BeginRun, revisionDML::branchType(), edm::checkClassDictionaries(), edm::checkDictionary(), edm::checkDictionaryOfWrappedType(), edm::convertToBranchType(), edm::EndLuminosityBlock, edm::EndRun, mps_splice::entry, hasAbilityToProduceInLumis(), hasAbilityToProduceInRuns(), edm::InEvent, edm::BranchDescription::insertBranchAlias(), edm::isEndTransition(), edm::ModuleDescription::moduleLabel(), edm::ModuleDescription::moduleName(), AlCaHLTBitMon_ParallelJobs::p, edm::ModuleDescription::parameterSetID(), edm::ModuleDescription::processName(), AlCaHLTBitMon_QueryRunRegistry::string, and edm::throwMissingDictionariesException().

Referenced by recordProvenanceList(), edm::ProducerBase::registerProducts(), and edm::ProducerBase::registrationCallback().

44  {
45 
46  std::vector<std::string> missingDictionaries;
47  std::vector<std::string> producedTypes;
48  std::set<std::tuple<BranchType,std::type_index,std::string>> registeredProducts;
49 
50  for(TypeLabelList::const_iterator p = iBegin; p != iEnd; ++p) {
51  if (p->transition_ == Transition::BeginRun ||
52  p->transition_ == Transition::EndRun) {
53  if (not iProd->hasAbilityToProduceInRuns()) {
54  throwProducesWithoutAbility("Run", p->typeID_.userClassName());
55  }
56  } else if (p->transition_ == Transition::BeginLuminosityBlock ||
57  p->transition_ == Transition::EndLuminosityBlock) {
58  if (not iProd->hasAbilityToProduceInLumis()) {
59  throwProducesWithoutAbility("LuminosityBlock", p->typeID_.userClassName());
60  }
61  }
62  if (!checkDictionary(missingDictionaries, p->typeID_)) {
63  checkDictionaryOfWrappedType(missingDictionaries, p->typeID_);
64  producedTypes.emplace_back(p->typeID_.className());
65  continue;
66  }
67  auto branchType = convertToBranchType(p->transition_);
68  if(branchType != InEvent) {
69  std::tuple<BranchType, std::type_index, std::string> entry{ branchType,p->typeID_.typeInfo(),p->productInstanceName_};
70  if(registeredProducts.end() != registeredProducts.find(entry) ) {
71  //ignore registration of items if in both begin and end transitions for now
72  // This is to work around ExternalLHEProducer
73  continue;
74  } else {
75  registeredProducts.insert(entry);
76  }
77  }
78 
79  TypeWithDict type(p->typeID_.typeInfo());
80  BranchDescription pdesc(branchType,
81  iDesc.moduleLabel(),
82  iDesc.processName(),
83  p->typeID_.userClassName(),
84  p->typeID_.friendlyClassName(),
85  p->productInstanceName_,
86  iDesc.moduleName(),
87  iDesc.parameterSetID(),
88  type,
89  true,
90  isEndTransition(p->transition_));
91 
92  if (pdesc.transient()) {
93  if (!checkDictionary(missingDictionaries, pdesc.wrappedName(), pdesc.wrappedType())) {
94  // It is should be impossible to get here, because the only way to
95  // make it transient is in the line that causes the wrapped dictionary
96  // to be created. Just to be safe I leave this check here ...
97  producedTypes.emplace_back(pdesc.className());
98  continue;
99  }
100  } else {
101  // also check constituents of wrapped types if it is not transient
102  if (!checkClassDictionaries(missingDictionaries, pdesc.wrappedName(), pdesc.wrappedType())) {
103  producedTypes.emplace_back(pdesc.className());
104  continue;
105  }
106  }
107  if (!p->branchAlias_.empty()) pdesc.insertBranchAlias(p->branchAlias_);
108  iReg.addProduct(pdesc, iIsListener);
109  }
110 
111  if (!missingDictionaries.empty()) {
112  std::string context("Calling ProductRegistryHelper::addToRegistry, checking dictionaries for produced types");
113  throwMissingDictionariesException(missingDictionaries, context, producedTypes);
114  }
115  }
type
Definition: HCALResponse.h:21
void throwMissingDictionariesException(std::vector< std::string > &missingDictionaries, std::string const &context)
constexpr bool isEndTransition(Transition iValue)
Definition: Transition.h:31
bool checkDictionary(std::vector< std::string > &missingDictionaries, TypeID const &typeID)
bool checkClassDictionaries(std::vector< std::string > &missingDictionaries, TypeID const &typeID)
bool checkDictionaryOfWrappedType(std::vector< std::string > &missingDictionaries, TypeID const &unwrappedTypeID)
constexpr BranchType convertToBranchType(Transition iValue)
Definition: Transition.h:21
def branchType(schema, name)
Definition: revisionDML.py:112
virtual bool edm::ProductRegistryHelper::hasAbilityToProduceInLumis ( ) const
inlinevirtual

Reimplemented in edm::limited::EDFilter< T >, edm::stream::EDFilter< T >, edm::stream::EDFilter< edm::GlobalCache< AlCaIsoTracks::Counters > >, edm::stream::EDFilter< edm::GlobalCache< PythiaFilterIsoTracks::Counters > >, edm::stream::EDFilter<>, edm::stream::EDFilter< edm::GlobalCache< AlCaIsoTracksProdFilter::Counters > >, edm::stream::EDFilter< edm::GlobalCache< trigger::Efficiency > >, edm::stream::EDFilter< edm::GlobalCache< AlCaHBHEMuons::Counters > >, edm::stream::EDFilter< edm::GlobalCache< AlCaIsolatedBunch::Counters > >, edm::stream::EDFilter< edm::GlobalCache< gsfidhelper::HeavyObjectCache > >, edm::stream::EDFilter< edm::GlobalCache< AlCaGammaJet::Counters > >, edm::global::EDFilter< T >, edm::global::EDFilter< edm::RunCache< leef::RunErrors >, edm::LuminosityBlockCache< LumiErrors >, edm::EndLuminosityBlockProducer >, edm::global::EDFilter<>, edm::limited::EDProducer< T >, edm::global::EDProducer< T >, edm::global::EDProducer< edm::BeginLuminosityBlockProducer >, edm::global::EDProducer<>, edm::global::EDProducer< edm::BeginRunProducer >, edm::global::EDProducer< edm::StreamCache< Counter >, edm::RunCache< DynamicWeightChoice >, edm::RunSummaryCache< Counter >, edm::EndRunProducer >, edm::global::EDProducer< edm::EndLuminosityBlockProducer, edm::LuminosityBlockCache< Sums > >, edm::global::EDProducer< edm::StreamCache< CSCTriggerPrimitivesBuilder > >, edm::global::EDProducer< edm::RunCache< GEMROmap > >, edm::global::EDProducer< edm::RunCache< ConvertParticle > >, edm::global::EDProducer< edm::RunCache< IDto3Charge > >, edm::one::EDProducer< T >, edm::one::EDProducer< edm::one::WatchRuns, edm::one::WatchLuminosityBlocks, edm::one::SharedResources, edm::EndLuminosityBlockProducer, edm::EndRunProducer >, edm::one::EDProducer< edm::Accumulator, edm::EndLuminosityBlockProducer, edm::EndRunProducer, edm::one::WatchLuminosityBlocks, edm::one::WatchRuns, edm::one::SharedResources >, edm::one::EDProducer< edm::BeginLuminosityBlockProducer >, edm::one::EDProducer< edm::one::WatchRuns, edm::BeginLuminosityBlockProducer, edm::EndRunProducer >, edm::one::EDProducer<>, edm::one::EDProducer< edm::BeginRunProducer >, edm::one::EDProducer< edm::one::WatchRuns, edm::one::WatchLuminosityBlocks, edm::EndLuminosityBlockProducer, edm::EndRunProducer, edm::one::SharedResources >, edm::one::EDProducer< edm::EndRunProducer, edm::EndLuminosityBlockProducer >, edm::one::EDProducer< EndRunProducer, one::WatchLuminosityBlocks >, edm::one::EDProducer< EndRunProducer, one::WatchLuminosityBlocks, one::SharedResources >, edm::one::EDProducer< edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::one::WatchRuns, edm::one::WatchLuminosityBlocks >, edm::one::EDProducer< edm::EndLuminosityBlockProducer >, edm::one::EDProducer< edm::EndLuminosityBlockProducer, edm::one::WatchLuminosityBlocks, edm::Accumulator >, edm::one::EDProducer< edm::one::WatchLuminosityBlocks, edm::EndLuminosityBlockProducer >, edm::one::EDProducer< edm::one::SharedResources, edm::one::WatchRuns >, edm::one::EDProducer< edm::BeginRunProducer, edm::EndRunProducer >, edm::one::EDProducer< edm::EndLuminosityBlockProducer, edm::one::WatchLuminosityBlocks >, edm::one::EDProducer< one::WatchRuns, EndRunProducer >, edm::one::EDProducer< edm::Accumulator, edm::EndLuminosityBlockProducer, edm::EndRunProducer, edm::one::WatchLuminosityBlocks, edm::one::WatchRuns >, edm::one::EDProducer< edm::EndRunProducer >, edm::one::EDProducer< edm::one::SharedResources >, edm::one::EDFilter< T >, edm::PuttableSourceBase, edm::one::EDFilter<>, edm::one::EDFilter< EndRunProducer, BeginLuminosityBlockProducer, EndLuminosityBlockProducer, one::WatchRuns, one::WatchLuminosityBlocks, one::SharedResources >, edm::one::EDFilter< EndRunProducer, BeginLuminosityBlockProducer, EndLuminosityBlockProducer, one::WatchLuminosityBlocks, one::SharedResources >, and edm::one::EDFilter< edm::one::WatchLuminosityBlocks >.

Definition at line 162 of file ProductRegistryHelper.h.

Referenced by addToRegistry().

162  {
163  return false;
164  }
virtual bool edm::ProductRegistryHelper::hasAbilityToProduceInRuns ( ) const
inlinevirtual

Reimplemented in edm::limited::EDFilter< T >, edm::stream::EDFilter< T >, edm::stream::EDFilter< edm::GlobalCache< AlCaIsoTracks::Counters > >, edm::stream::EDFilter< edm::GlobalCache< PythiaFilterIsoTracks::Counters > >, edm::stream::EDFilter<>, edm::stream::EDFilter< edm::GlobalCache< AlCaIsoTracksProdFilter::Counters > >, edm::stream::EDFilter< edm::GlobalCache< trigger::Efficiency > >, edm::stream::EDFilter< edm::GlobalCache< AlCaHBHEMuons::Counters > >, edm::stream::EDFilter< edm::GlobalCache< AlCaIsolatedBunch::Counters > >, edm::stream::EDFilter< edm::GlobalCache< gsfidhelper::HeavyObjectCache > >, edm::stream::EDFilter< edm::GlobalCache< AlCaGammaJet::Counters > >, edm::global::EDFilter< T >, edm::global::EDFilter< edm::RunCache< leef::RunErrors >, edm::LuminosityBlockCache< LumiErrors >, edm::EndLuminosityBlockProducer >, edm::global::EDFilter<>, edm::limited::EDProducer< T >, edm::global::EDProducer< T >, edm::global::EDProducer< edm::BeginLuminosityBlockProducer >, edm::global::EDProducer<>, edm::global::EDProducer< edm::BeginRunProducer >, edm::global::EDProducer< edm::StreamCache< Counter >, edm::RunCache< DynamicWeightChoice >, edm::RunSummaryCache< Counter >, edm::EndRunProducer >, edm::global::EDProducer< edm::EndLuminosityBlockProducer, edm::LuminosityBlockCache< Sums > >, edm::global::EDProducer< edm::StreamCache< CSCTriggerPrimitivesBuilder > >, edm::global::EDProducer< edm::RunCache< GEMROmap > >, edm::global::EDProducer< edm::RunCache< ConvertParticle > >, edm::global::EDProducer< edm::RunCache< IDto3Charge > >, edm::one::EDProducer< T >, edm::one::EDProducer< edm::one::WatchRuns, edm::one::WatchLuminosityBlocks, edm::one::SharedResources, edm::EndLuminosityBlockProducer, edm::EndRunProducer >, edm::one::EDProducer< edm::Accumulator, edm::EndLuminosityBlockProducer, edm::EndRunProducer, edm::one::WatchLuminosityBlocks, edm::one::WatchRuns, edm::one::SharedResources >, edm::one::EDProducer< edm::BeginLuminosityBlockProducer >, edm::one::EDProducer< edm::one::WatchRuns, edm::BeginLuminosityBlockProducer, edm::EndRunProducer >, edm::one::EDProducer<>, edm::one::EDProducer< edm::BeginRunProducer >, edm::one::EDProducer< edm::one::WatchRuns, edm::one::WatchLuminosityBlocks, edm::EndLuminosityBlockProducer, edm::EndRunProducer, edm::one::SharedResources >, edm::one::EDProducer< edm::EndRunProducer, edm::EndLuminosityBlockProducer >, edm::one::EDProducer< EndRunProducer, one::WatchLuminosityBlocks >, edm::one::EDProducer< EndRunProducer, one::WatchLuminosityBlocks, one::SharedResources >, edm::one::EDProducer< edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::one::WatchRuns, edm::one::WatchLuminosityBlocks >, edm::one::EDProducer< edm::EndLuminosityBlockProducer >, edm::one::EDProducer< edm::EndLuminosityBlockProducer, edm::one::WatchLuminosityBlocks, edm::Accumulator >, edm::one::EDProducer< edm::one::WatchLuminosityBlocks, edm::EndLuminosityBlockProducer >, edm::one::EDProducer< edm::one::SharedResources, edm::one::WatchRuns >, edm::one::EDProducer< edm::BeginRunProducer, edm::EndRunProducer >, edm::one::EDProducer< edm::EndLuminosityBlockProducer, edm::one::WatchLuminosityBlocks >, edm::one::EDProducer< one::WatchRuns, EndRunProducer >, edm::one::EDProducer< edm::Accumulator, edm::EndLuminosityBlockProducer, edm::EndRunProducer, edm::one::WatchLuminosityBlocks, edm::one::WatchRuns >, edm::one::EDProducer< edm::EndRunProducer >, edm::one::EDProducer< edm::one::SharedResources >, edm::one::EDFilter< T >, edm::PuttableSourceBase, edm::one::EDFilter<>, edm::one::EDFilter< EndRunProducer, BeginLuminosityBlockProducer, EndLuminosityBlockProducer, one::WatchRuns, one::WatchLuminosityBlocks, one::SharedResources >, edm::one::EDFilter< EndRunProducer, BeginLuminosityBlockProducer, EndLuminosityBlockProducer, one::WatchLuminosityBlocks, one::SharedResources >, and edm::one::EDFilter< edm::one::WatchLuminosityBlocks >.

Definition at line 158 of file ProductRegistryHelper.h.

Referenced by addToRegistry().

158  {
159  return false;
160  }
template<class ProductType >
BranchAliasSetterT<ProductType> edm::ProductRegistryHelper::produces ( )
inline
template<class ProductType >
BranchAliasSetterT<ProductType> edm::ProductRegistryHelper::produces ( std::string  instanceName)
inline

Definition at line 110 of file ProductRegistryHelper.h.

References eostools::move().

110  {
111  return produces<ProductType, InEvent>( std::move(instanceName));
112  }
def move(src, dest)
Definition: eostools.py:510
template<typename ProductType , BranchType B>
BranchAliasSetterT<ProductType> edm::ProductRegistryHelper::produces ( )
inline

Definition at line 115 of file ProductRegistryHelper.h.

References AlCaHLTBitMon_QueryRunRegistry::string.

115  {
116  return produces<ProductType, B>(std::string());
117  }
template<typename ProductType , BranchType B>
BranchAliasSetterT<ProductType> edm::ProductRegistryHelper::produces ( std::string  instanceName)
inline

Definition at line 120 of file ProductRegistryHelper.h.

References TtFullHadDaughter::B, edm::InEvent, and eostools::move().

120  {
121  TypeID tid(typeid(ProductType));
122  return BranchAliasSetterT<ProductType>{produces<B>(tid,std::move(instanceName),
124  }
static const std::string B
def move(src, dest)
Definition: eostools.py:510
template<typename ProductType , Transition B>
BranchAliasSetterT<ProductType> edm::ProductRegistryHelper::produces ( )
inline

Definition at line 127 of file ProductRegistryHelper.h.

References AlCaHLTBitMon_QueryRunRegistry::string.

127  {
128  return produces<ProductType, B>(std::string());
129  }
template<typename ProductType , Transition B>
BranchAliasSetterT<ProductType> edm::ProductRegistryHelper::produces ( std::string  instanceName)
inline

Definition at line 132 of file ProductRegistryHelper.h.

References TtFullHadDaughter::B, edm::Event, and eostools::move().

132  {
133  TypeID tid(typeid(ProductType));
134  return BranchAliasSetterT<ProductType>{produces<B>(tid,std::move(instanceName),
136  }
static const std::string B
def move(src, dest)
Definition: eostools.py:510
BranchAliasSetter edm::ProductRegistryHelper::produces ( const TypeID id,
std::string  instanceName = std::string(),
bool  recordProvenance = true 
)
inline

Definition at line 139 of file ProductRegistryHelper.h.

References triggerObjects_cff::id, MuonErrorMatrixAdjuster_cfi::instanceName, and eostools::move().

139  {
140  return produces<Transition::Event>(id,std::move(instanceName),recordProvenance);
141  }
def move(src, dest)
Definition: eostools.py:510
template<BranchType B>
BranchAliasSetter edm::ProductRegistryHelper::produces ( const TypeID id,
std::string  instanceName = std::string(),
bool  recordProvenance = true 
)
inline

Definition at line 144 of file ProductRegistryHelper.h.

References TtFullHadDaughter::B, edm::convertToTransition(), edm::InEvent, MuonErrorMatrixAdjuster_cfi::instanceName, eostools::move(), recordProvenanceList_, and typeLabelList_.

144  {
145  unsigned int index =typeLabelList_.size();
147  recordProvenanceList_.push_back(recordProvenance and B == InEvent);
148  return BranchAliasSetter{typeLabelList_.back(),EDPutToken{static_cast<unsigned int>(index)}};
149  }
static const std::string B
constexpr Transition convertToTransition(BranchType iValue)
Definition: Transition.h:26
std::vector< bool > recordProvenanceList_
def move(src, dest)
Definition: eostools.py:510
template<Transition B>
BranchAliasSetter edm::ProductRegistryHelper::produces ( const TypeID id,
std::string  instanceName = std::string(),
bool  recordProvenance = true 
)
inline

Definition at line 151 of file ProductRegistryHelper.h.

References TtFullHadDaughter::B, edm::Event, MuonErrorMatrixAdjuster_cfi::instanceName, eostools::move(), recordProvenanceList_, and typeLabelList_.

151  {
152  unsigned int index =typeLabelList_.size();
153  typeLabelList_.emplace_back(B, id, std::move(instanceName));
154  recordProvenanceList_.push_back(recordProvenance and B == Transition::Event);
155  return BranchAliasSetter{typeLabelList_.back(),EDPutToken{ index }};
156  }
static const std::string B
std::vector< bool > recordProvenanceList_
def move(src, dest)
Definition: eostools.py:510
std::vector<bool> const& edm::ProductRegistryHelper::recordProvenanceList ( ) const
inline
ProductRegistryHelper::TypeLabelList const & edm::ProductRegistryHelper::typeLabelList ( ) const

Member Data Documentation

std::vector<bool> edm::ProductRegistryHelper::recordProvenanceList_
private

Definition at line 168 of file ProductRegistryHelper.h.

Referenced by produces(), and recordProvenanceList().

TypeLabelList edm::ProductRegistryHelper::typeLabelList_
private

Definition at line 167 of file ProductRegistryHelper.h.

Referenced by produces(), and typeLabelList().