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
 
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)
 
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, EventSetup const &c, ModuleCallingContext const *mcc)
 
bool doBeginRun (RunPrincipal const &rp, EventSetup const &c, ModuleCallingContext const *mcc)
 
void doEndJob ()
 
bool doEndLuminosityBlock (LuminosityBlockPrincipal const &lbp, EventSetup const &c, ModuleCallingContext const *mcc)
 
bool doEndRun (RunPrincipal const &rp, EventSetup const &c, ModuleCallingContext const *mcc)
 
bool doEvent (EventPrincipal const &ep, EventSetup 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 ESProduct , Transition Tr = Transition::Event>
auto esConsumes (eventsetup::EventSetupRecordKey const &, 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 33 of file ProvenanceCheckerOutputModule.cc.

Constructor & Destructor Documentation

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

Definition at line 58 of file ProvenanceCheckerOutputModule.cc.

58  :
60  {
61  }
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 196 of file ProvenanceCheckerOutputModule.cc.

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

196  {
199  descriptions.add("provenanceChecker", desc);
200  }
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 106 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().

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

Implements edm::OutputModule.

Definition at line 42 of file ProvenanceCheckerOutputModule.cc.

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

Implements edm::OutputModule.

Definition at line 43 of file ProvenanceCheckerOutputModule.cc.

43 {}