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

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...
 
 ~ProductRegistryHelper ()
 

Static Public Member Functions

static void addToRegistry (TypeLabelList::const_iterator const &iBegin, TypeLabelList::const_iterator const &iEnd, ModuleDescription const &iDesc, ProductRegistry &iReg, 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 82 of file ProductRegistryHelper.h.

Constructor & Destructor Documentation

edm::ProductRegistryHelper::ProductRegistryHelper ( )
inline

Definition at line 26 of file ProductRegistryHelper.h.

References ~ProductRegistryHelper().

edm::ProductRegistryHelper::~ProductRegistryHelper ( )

Definition at line 16 of file ProductRegistryHelper.cc.

Referenced by ProductRegistryHelper().

16 { }

Member Function Documentation

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

Definition at line 23 of file ProductRegistryHelper.cc.

References edm::ProductRegistry::addProduct(), revisionDML::branchType(), edm::checkClassDictionaries(), edm::checkDictionary(), edm::checkDictionaryOfWrappedType(), edm::convertToBranchType(), mps_splice::entry, 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().

27  {
28 
29  std::vector<std::string> missingDictionaries;
30  std::vector<std::string> producedTypes;
31  std::set<std::tuple<BranchType,std::type_index,std::string>> registeredProducts;
32 
33  for(TypeLabelList::const_iterator p = iBegin; p != iEnd; ++p) {
34 
35  if (!checkDictionary(missingDictionaries, p->typeID_)) {
36  checkDictionaryOfWrappedType(missingDictionaries, p->typeID_);
37  producedTypes.emplace_back(p->typeID_.className());
38  continue;
39  }
40  auto branchType = convertToBranchType(p->transition_);
41  if(branchType != InEvent) {
42  std::tuple<BranchType, std::type_index, std::string> entry{ branchType,p->typeID_.typeInfo(),p->productInstanceName_};
43  if(registeredProducts.end() != registeredProducts.find(entry) ) {
44  //ignore registration of items if in both begin and end transitions for now
45  // This is to work around ExternalLHEProducer
46  continue;
47  } else {
48  registeredProducts.insert(entry);
49  }
50  }
51 
52  TypeWithDict type(p->typeID_.typeInfo());
53  BranchDescription pdesc(branchType,
54  iDesc.moduleLabel(),
55  iDesc.processName(),
56  p->typeID_.userClassName(),
57  p->typeID_.friendlyClassName(),
58  p->productInstanceName_,
59  iDesc.moduleName(),
60  iDesc.parameterSetID(),
61  type,
62  true,
63  isEndTransition(p->transition_));
64 
65  if (pdesc.transient()) {
66  if (!checkDictionary(missingDictionaries, pdesc.wrappedName(), pdesc.wrappedType())) {
67  // It is should be impossible to get here, because the only way to
68  // make it transient is in the line that causes the wrapped dictionary
69  // to be created. Just to be safe I leave this check here ...
70  producedTypes.emplace_back(pdesc.className());
71  continue;
72  }
73  } else {
74  // also check constituents of wrapped types if it is not transient
75  if (!checkClassDictionaries(missingDictionaries, pdesc.wrappedName(), pdesc.wrappedType())) {
76  producedTypes.emplace_back(pdesc.className());
77  continue;
78  }
79  }
80  if (!p->branchAlias_.empty()) pdesc.insertBranchAlias(p->branchAlias_);
81  iReg.addProduct(pdesc, iIsListener);
82  }
83 
84  if (!missingDictionaries.empty()) {
85  std::string context("Calling ProductRegistryHelper::addToRegistry, checking dictionaries for produced types");
86  throwMissingDictionariesException(missingDictionaries, context, producedTypes);
87  }
88  }
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
template<class ProductType >
BranchAliasSetterT<ProductType> edm::ProductRegistryHelper::produces ( )
inline

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

References AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by edm::DataMixingModule::DataMixingModule(), GEDPhotonProducer::GEDPhotonProducer(), GoodSeedProducer::GoodSeedProducer(), MuonProducer::MuonProducer(), hitTripletEDProducerT::ImplSeedingHitSets::produces(), hitTripletEDProducerT::ImplIntermediateHitTriplets::produces(), VariableNTupler::registerleaves(), and StringBasedNTupler::registerleaves().

105  {
106  return produces<ProductType, InEvent>(std::string());
107  }
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(), diffTreeTool::index, 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, diffTreeTool::index, 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 160 of file ProductRegistryHelper.h.

Referenced by produces(), and recordProvenanceList().

TypeLabelList edm::ProductRegistryHelper::typeLabelList_
private

Definition at line 159 of file ProductRegistryHelper.h.

Referenced by produces(), and typeLabelList().