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)
 
virtual ~ProvenanceCheckerOutputModule ()
 
- Public Member Functions inherited from edm::OutputModule
BranchIDLists const * branchIDLists ()
 
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 &)
 
ThinnedAssociationsHelper const * thinnedAssociationsHelper () const
 
bool wantAllEvents () const
 
virtual ~OutputModule ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 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 & itemsToGetFromEvent () 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
 
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 &)
 

Private Member Functions

virtual void write (EventForOutput const &e) override
 
virtual void writeLuminosityBlock (LuminosityBlockForOutput const &) override
 
virtual 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 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:39
edm::ProvenanceCheckerOutputModule::~ProvenanceCheckerOutputModule ( )
virtual

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.size()) {
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.size()) {
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.size()) {
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.size() || missingProductProvenance.size() || missingFromReg.size()) {
181  throw cms::Exception("ProvenanceError")
182  << (missingFromMapper.size() ? "Having missing ancestors from ProductProvenanceRetriever.\n" : "")
183  << (missingProductProvenance.size() ? " Have missing ProductProvenance's from ProductResolver in Event.\n" : "")
184  << (missingFromReg.size() ? " Have missing info from ProductRegistry.\n" : "");
185  }
186  }
std::map< BranchKey, BranchDescription > ProductList
SelectedProductsForBranchType const & keptProducts() const
Definition: OutputModule.h:76
virtual void edm::ProvenanceCheckerOutputModule::writeLuminosityBlock ( LuminosityBlockForOutput const &  )
inlineoverrideprivatevirtual

Implements edm::OutputModule.

Definition at line 42 of file ProvenanceCheckerOutputModule.cc.

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

Implements edm::OutputModule.

Definition at line 43 of file ProvenanceCheckerOutputModule.cc.

43 {}