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::core::OutputModuleCore edm::EDConsumerBase

Public Member Functions

 ProvenanceCheckerOutputModule (ParameterSet const &pset)
 
 ~ProvenanceCheckerOutputModule () override
 
- Public Member Functions inherited from edm::one::OutputModule<>
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const OutputModuleoperator= (const OutputModule &)=delete
 
 OutputModule (edm::ParameterSet const &iPSet)
 
 OutputModule (const OutputModule &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::OutputModuleBase
OutputModuleBaseoperator= (OutputModuleBase const &)=delete
 
 OutputModuleBase (ParameterSet const &pset)
 
 OutputModuleBase (OutputModuleBase const &)=delete
 
SharedResourcesAcquirersharedResourcesAcquirer ()
 
SubProcessParentageHelper const * subProcessParentageHelper () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
- Public Member Functions inherited from edm::core::OutputModuleCore
BranchIDLists const * branchIDLists () const
 
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::array< bool, NumBranchTypes > const & hasNewlyDroppedBranch () const
 
SelectedProductsForBranchType const & keptProducts () const
 
int maxEvents () const
 
const ModuleDescriptionmoduleDescription () const
 
OutputModuleCoreoperator= (OutputModuleCore const &)=delete
 
 OutputModuleCore (ParameterSet const &pset)
 
 OutputModuleCore (OutputModuleCore const &)=delete
 
OutputProcessBlockHelper const & outputProcessBlockHelper () const
 
std::string const & processName () const
 
int remainingEvents () const
 
bool selected (BranchDescription const &desc) const
 
void selectProducts (ProductRegistry const &preg, ThinnedAssociationsHelper const &, ProcessBlockHelperBase const &)
 
ThinnedAssociationsHelper const * thinnedAssociationsHelper () const
 
bool wantAllEvents () const
 
 ~OutputModuleCore () 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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (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::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::core::OutputModuleCore
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::core::OutputModuleCore
typedef OutputModuleCore ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::one::OutputModuleBase
void configure (OutputModuleDescription const &desc)
 
void doBeginJob ()
 
bool doEvent (EventTransitionInfo const &, ActivityRegistry *, ModuleCallingContext const *)
 
void doPreallocate (PreallocationConfiguration const &)
 
- Protected Member Functions inherited from edm::core::OutputModuleCore
void configure (OutputModuleDescription const &desc)
 
ModuleDescription const & description () const
 
void doAccessInputProcessBlock (ProcessBlockPrincipal const &, ModuleCallingContext const *)
 
void doBeginJob_ ()
 
bool doBeginLuminosityBlock (LumiTransitionInfo const &, ModuleCallingContext const *)
 
void doBeginProcessBlock (ProcessBlockPrincipal const &, ModuleCallingContext const *)
 
bool doBeginRun (RunTransitionInfo const &, ModuleCallingContext const *)
 
void doEndJob ()
 
bool doEndLuminosityBlock (LumiTransitionInfo const &, ModuleCallingContext const *)
 
void doEndProcessBlock (ProcessBlockPrincipal const &, ModuleCallingContext const *)
 
bool doEndRun (RunTransitionInfo const &, ModuleCallingContext const *)
 
bool doEvent_ (EventTransitionInfo const &, 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
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, 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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 
- Protected Attributes inherited from edm::core::OutputModuleCore
std::atomic< int > remainingEvents_
 

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.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, and edm::core::OutputModuleCore::fillDescription().

187  {
190  descriptions.add("provenanceChecker", desc);
191  }
static void fillDescription(ParameterSetDescription &desc, std::vector< std::string > const &iDefaultOutputCommands=ProductSelectorRules::defaultSelectionStrings())

◆ write()

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

Implements edm::core::OutputModuleCore.

Definition at line 99 of file ProvenanceCheckerOutputModule.cc.

References edm::BranchDescription::branchID(), MillePedeFileConverter_cfg::e, Exception, edm::InEvent, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, B2GTnPMonitor_cfi::item, edm::core::OutputModuleCore::keptProducts(), edm::Provenance::productProvenance(), edm::BasicHandle::provenance(), unpackBuffers-CaloStage2::token, and edm::BranchDescription::unwrappedTypeID().

Referenced by pkg.AbstractPkg::generate().

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  }
std::map< BranchKey, BranchDescription > ProductList
Log< level::Error, false > LogError
SelectedProductsForBranchType const & keptProducts() const
Log< level::Error, true > LogProblem

◆ writeLuminosityBlock()

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

Implements edm::core::OutputModuleCore.

Definition at line 41 of file ProvenanceCheckerOutputModule.cc.

41 {}

◆ writeRun()

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

Implements edm::core::OutputModuleCore.

Definition at line 42 of file ProvenanceCheckerOutputModule.cc.

42 {}