CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions
edm::ProvenanceCheckerOutputModule Class Reference
Inheritance diagram for edm::ProvenanceCheckerOutputModule:
edm::one::OutputModule<> edm::one::OutputModuleBase edm::EDConsumerBase

Public Member Functions

 ProvenanceCheckerOutputModule (ParameterSet const &pset)
 
 ~ProvenanceCheckerOutputModule () override
 
- Public Member Functions inherited from edm::one::OutputModule<>
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
 OutputModule (edm::ParameterSet const &iPSet)
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
- Public Member Functions inherited from edm::one::OutputModuleBase
BranchIDLists const * branchIDLists ()
 
std::array< bool, NumBranchTypes > const & hasNewlyDroppedBranch () const
 
SelectedProductsForBranchType const & keptProducts () const
 
int maxEvents () const
 
const ModuleDescriptionmoduleDescription () const
 
OutputModuleBaseoperator= (OutputModuleBase const &)=delete
 
 OutputModuleBase (OutputModuleBase const &)=delete
 
 OutputModuleBase (ParameterSet const &pset)
 
std::string const & processName () const
 
int remainingEvents () const
 
bool selected (BranchDescription const &desc) const
 
void selectProducts (ProductRegistry const &preg, ThinnedAssociationsHelper const &)
 
SharedResourcesAcquirersharedResourcesAcquirer ()
 
SubProcessParentageHelper const * subProcessParentageHelper () const
 
ThinnedAssociationsHelper const * thinnedAssociationsHelper () const
 
bool wantAllEvents () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~OutputModuleBase () 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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (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::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::one::OutputModuleBase
static const std::string & baseType ()
 
static void fillDescription (ParameterSetDescription &desc, std::vector< std::string > const &iDefaultOutputCommands=ProductSelectorRules::defaultSelectionStrings())
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 

Private Member Functions

void write (EventForOutput const &e) override
 
void writeLuminosityBlock (LuminosityBlockForOutput const &) override
 
void writeRun (RunForOutput const &) override
 

Additional Inherited Members

- Public Types inherited from edm::one::OutputModuleBase
typedef OutputModuleBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::one::OutputModuleBase
void configure (OutputModuleDescription const &desc)
 
ModuleDescription const & description () const
 
void doBeginJob ()
 
bool doBeginLuminosityBlock (LuminosityBlockPrincipal const &lbp, EventSetupImpl const &c, ModuleCallingContext const *)
 
bool doBeginRun (RunPrincipal const &rp, EventSetupImpl const &c, ModuleCallingContext const *)
 
void doEndJob ()
 
bool doEndLuminosityBlock (LuminosityBlockPrincipal const &lbp, EventSetupImpl const &c, ModuleCallingContext const *)
 
bool doEndRun (RunPrincipal const &rp, EventSetupImpl const &c, ModuleCallingContext const *)
 
bool doEvent (EventPrincipal const &ep, EventSetupImpl const &c, ActivityRegistry *, ModuleCallingContext const *)
 
void doPreallocate (PreallocationConfiguration const &)
 
std::map< BranchID::value_type, BranchID::value_type > const & droppedBranchIDToKeptBranchID ()
 
virtual void preallocLumis (unsigned int)
 
ParameterSetID selectorConfig () const
 
void setEventSelectionInfo (std::map< std::string, std::vector< std::pair< std::string, int >>> const &outputModulePathPositions, bool anyProductProduced)
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (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 ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
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)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 32 of file ProvenanceCheckerOutputModule.cc.

Constructor & Destructor Documentation

◆ ProvenanceCheckerOutputModule()

edm::ProvenanceCheckerOutputModule::ProvenanceCheckerOutputModule ( ParameterSet const &  pset)
explicit

Definition at line 56 of file ProvenanceCheckerOutputModule.cc.

57  : one::OutputModuleBase(pset), one::OutputModule<>(pset) {}

◆ ~ProvenanceCheckerOutputModule()

edm::ProvenanceCheckerOutputModule::~ProvenanceCheckerOutputModule ( )
override

Definition at line 64 of file ProvenanceCheckerOutputModule.cc.

64 {}

Member Function Documentation

◆ fillDescriptions()

void edm::ProvenanceCheckerOutputModule::fillDescriptions ( ConfigurationDescriptions descriptions)
static

Definition at line 187 of file ProvenanceCheckerOutputModule.cc.

187  {
190  descriptions.add("provenanceChecker", desc);
191  }

References edm::ConfigurationDescriptions::add(), and edm::one::OutputModuleBase::fillDescription().

◆ write()

void edm::ProvenanceCheckerOutputModule::write ( EventForOutput const &  e)
overrideprivatevirtual

Implements edm::one::OutputModuleBase.

Definition at line 99 of file ProvenanceCheckerOutputModule.cc.

99  {
100  //check ProductProvenance's parents to see if they are in the ProductProvenance list
101 
102  std::map<BranchID, bool> seenParentInPrincipal;
103  std::set<BranchID> missingFromMapper;
104  std::set<BranchID> missingProductProvenance;
105 
106  std::map<BranchID, const BranchDescription*> idToBranchDescriptions;
107  for (auto const& product : keptProducts()[InEvent]) {
108  BranchDescription const* branchDescription = product.first;
109  BranchID branchID = branchDescription->branchID();
110  idToBranchDescriptions[branchID] = branchDescription;
111  TypeID const& tid(branchDescription->unwrappedTypeID());
112  EDGetToken const& token = product.second;
113  BasicHandle bh = e.getByToken(token, tid);
114  bool cannotFindProductProvenance = false;
115  if (!(bh.provenance() and bh.provenance()->productProvenance())) {
116  missingProductProvenance.insert(branchID);
117  cannotFindProductProvenance = true;
118  }
119  ProductProvenance const* pInfo = e.getProvenance(branchID).productProvenance();
120  if (!pInfo) {
121  missingFromMapper.insert(branchID);
122  continue;
123  }
124  if (cannotFindProductProvenance) {
125  continue;
126  }
127  markAncestors(e, *(bh.provenance()->productProvenance()), seenParentInPrincipal, missingFromMapper);
128  seenParentInPrincipal[branchID] = true;
129  }
130 
131  //Determine what BranchIDs are in the product registry
133  ProductRegistry::ProductList const& prodList = reg->productList();
134  std::set<BranchID> branchesInReg;
135  for (auto const& product : prodList) {
136  branchesInReg.insert(product.second.branchID());
137  idToBranchDescriptions[product.second.branchID()] = &product.second;
138  }
139 
140  std::set<BranchID> missingFromReg;
141  for (auto const& item : seenParentInPrincipal) {
142  if (branchesInReg.find(item.first) == branchesInReg.end()) {
143  missingFromReg.insert(item.first);
144  }
145  }
146 
147  if (!missingFromMapper.empty()) {
148  LogError("ProvenanceChecker") << "Missing the following BranchIDs from ProductProvenanceRetriever\n";
149  for (std::set<BranchID>::iterator it = missingFromMapper.begin(), itEnd = missingFromMapper.end(); it != itEnd;
150  ++it) {
151  LogProblem("ProvenanceChecker") << *it << " " << *(idToBranchDescriptions[*it]);
152  }
153  }
154 
155  if (!missingProductProvenance.empty()) {
156  LogError("ProvenanceChecker") << "The ProductResolvers for the following BranchIDs have no ProductProvenance\n";
157  for (std::set<BranchID>::iterator it = missingProductProvenance.begin(), itEnd = missingProductProvenance.end();
158  it != itEnd;
159  ++it) {
160  LogProblem("ProvenanceChecker") << *it << " " << *(idToBranchDescriptions[*it]);
161  }
162  }
163 
164  if (!missingFromReg.empty()) {
165  LogError("ProvenanceChecker") << "Missing the following BranchIDs from ProductRegistry\n";
166  for (auto const& item : missingFromReg) {
167  LogProblem("ProvenanceChecker") << item << " " << *(idToBranchDescriptions[item]);
168  }
169  }
170 
171  if (!missingFromMapper.empty() || !missingProductProvenance.empty() || !missingFromReg.empty()) {
172  throw cms::Exception("ProvenanceError")
173  << (!missingFromMapper.empty() ? "Having missing ancestors from ProductProvenanceRetriever.\n" : "")
174  << (!missingProductProvenance.empty() ? " Have missing ProductProvenance's from ProductResolver in Event.\n"
175  : "")
176  << (!missingFromReg.empty() ? " Have missing info from ProductRegistry.\n" : "");
177  }
178  }

References edm::BranchDescription::branchID(), MillePedeFileConverter_cfg::e, Exception, edm::InEvent, B2GTnPMonitor_cfi::item, edm::one::OutputModuleBase::keptProducts(), edm::Provenance::productProvenance(), edm::BasicHandle::provenance(), unpackBuffers-CaloStage2::token, and edm::BranchDescription::unwrappedTypeID().

Referenced by pkg.AbstractPkg::generate().

◆ writeLuminosityBlock()

void edm::ProvenanceCheckerOutputModule::writeLuminosityBlock ( LuminosityBlockForOutput const &  )
inlineoverrideprivatevirtual

Implements edm::one::OutputModuleBase.

Definition at line 41 of file ProvenanceCheckerOutputModule.cc.

41 {}

◆ writeRun()

void edm::ProvenanceCheckerOutputModule::writeRun ( RunForOutput const &  )
inlineoverrideprivatevirtual

Implements edm::one::OutputModuleBase.

Definition at line 42 of file ProvenanceCheckerOutputModule.cc.

42 {}
Service
edm::InEvent
Definition: BranchType.h:11
edm::one::OutputModuleBase::fillDescription
static void fillDescription(ParameterSetDescription &desc, std::vector< std::string > const &iDefaultOutputCommands=ProductSelectorRules::defaultSelectionStrings())
Definition: OutputModuleBase.cc:350
edm::ProductRegistry::ProductList
std::map< BranchKey, BranchDescription > ProductList
Definition: ProductRegistry.h:36
edm::one::OutputModuleBase::keptProducts
SelectedProductsForBranchType const & keptProducts() const
Definition: OutputModuleBase.h:96
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
EDGetToken
Exception
Definition: hltDiff.cc:246
ParameterSetDescription
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
unpackBuffers-CaloStage2.token
token
Definition: unpackBuffers-CaloStage2.py:316