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::OutputModule edm::EDConsumerBase

Public Member Functions

 ProvenanceCheckerOutputModule (ParameterSet const &pset)
 
 ~ProvenanceCheckerOutputModule () override
 
- Public Member Functions inherited from edm::OutputModule
BranchIDLists const * branchIDLists ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
std::array< bool, NumBranchTypes > const & hasNewlyDroppedBranch () const
 
SelectedProductsForBranchType const & keptProducts () const
 
int maxEvents () const
 
OutputModuleoperator= (OutputModule const &)=delete
 
 OutputModule (ParameterSet const &pset)
 
 OutputModule (OutputModule const &)=delete
 
std::string const & processName () const
 
int remainingEvents () const
 
bool selected (BranchDescription const &desc) const
 
void selectProducts (ProductRegistry const &preg, ThinnedAssociationsHelper const &)
 
SharedResourcesAcquirersharedResourcesAcquirer ()
 
ThinnedAssociationsHelper const * thinnedAssociationsHelper () const
 
bool wantAllEvents () const
 
 ~OutputModule () 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
 
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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
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::OutputModule
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 &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 

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::OutputModule
typedef OutputModule ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::OutputModule
void configure (OutputModuleDescription const &desc)
 
ModuleDescription const & description () const
 
void doBeginJob ()
 
bool doBeginLuminosityBlock (LuminosityBlockPrincipal const &lbp, EventSetupImpl const &c, ModuleCallingContext const *mcc)
 
bool doBeginRun (RunPrincipal const &rp, EventSetupImpl const &c, ModuleCallingContext const *mcc)
 
void doEndJob ()
 
bool doEndLuminosityBlock (LuminosityBlockPrincipal const &lbp, EventSetupImpl const &c, ModuleCallingContext const *mcc)
 
bool doEndRun (RunPrincipal const &rp, EventSetupImpl const &c, ModuleCallingContext const *mcc)
 
bool doEvent (EventPrincipal const &ep, EventSetupImpl const &c, ActivityRegistry *act, ModuleCallingContext const *mcc)
 
void doPreallocate (PreallocationConfiguration const &)
 
std::map< BranchID::value_type, BranchID::value_type > const & droppedBranchIDToKeptBranchID ()
 
Trig getTriggerResults (EDGetTokenT< TriggerResults > const &token, EventForOutput const &e) const
 
ModuleDescription const & moduleDescription () const
 
void preActionBeforeRunEventAsync (WaitingTask *iTask, ModuleCallingContext const &iModuleCallingContext, Principal const &iPrincipal) const
 
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)
 
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 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)
 
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)
 

Detailed Description

Definition at line 32 of file ProvenanceCheckerOutputModule.cc.

Constructor & Destructor Documentation

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

Definition at line 56 of file ProvenanceCheckerOutputModule.cc.

56 : OutputModule(pset) {}
OutputModule(ParameterSet const &pset)
Definition: OutputModule.cc:40
edm::ProvenanceCheckerOutputModule::~ProvenanceCheckerOutputModule ( )
override

Member Function Documentation

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

Definition at line 186 of file ProvenanceCheckerOutputModule.cc.

References edm::ConfigurationDescriptions::add(), DEFINE_FWK_MODULE, and edm::OutputModule::fillDescription().

186  {
189  descriptions.add("provenanceChecker", desc);
190  }
static void fillDescription(ParameterSetDescription &desc, std::vector< std::string > const &iDefaultOutputCommands=ProductSelectorRules::defaultSelectionStrings())
void edm::ProvenanceCheckerOutputModule::write ( EventForOutput const &  e)
overrideprivatevirtual

Implements edm::OutputModule.

Definition at line 98 of file ProvenanceCheckerOutputModule.cc.

References edm::BranchDescription::branchID(), Exception, edm::OccurrenceForOutput::getByToken(), edm::OccurrenceForOutput::getProvenance(), edm::InEvent, edm::OutputModule::keptProducts(), edm::Provenance::productProvenance(), edm::BasicHandle::provenance(), and edm::BranchDescription::unwrappedTypeID().

Referenced by pkg.AbstractPkg::generate().

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

Implements edm::OutputModule.

Definition at line 41 of file ProvenanceCheckerOutputModule.cc.

41 {}
void edm::ProvenanceCheckerOutputModule::writeRun ( RunForOutput const &  )
inlineoverrideprivatevirtual

Implements edm::OutputModule.

Definition at line 42 of file ProvenanceCheckerOutputModule.cc.

42 {}