test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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)
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 

Private Member Functions

virtual void write (EventPrincipal const &e, ModuleCallingContext const *) override
 
virtual void writeLuminosityBlock (LuminosityBlockPrincipal const &, ModuleCallingContext const *) override
 
virtual void writeRun (RunPrincipal const &, ModuleCallingContext 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, EventPrincipal const &ep, ModuleCallingContext const *) const
 
ModuleDescription const & moduleDescription () 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 31 of file ProvenanceCheckerOutputModule.cc.

Constructor & Destructor Documentation

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

Definition at line 56 of file ProvenanceCheckerOutputModule.cc.

56  :
58  {
59  }
OutputModule(ParameterSet const &pset)
Definition: OutputModule.cc:34
edm::ProvenanceCheckerOutputModule::~ProvenanceCheckerOutputModule ( )
virtual

Definition at line 66 of file ProvenanceCheckerOutputModule.cc.

67  {
68  }

Member Function Documentation

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

Definition at line 221 of file ProvenanceCheckerOutputModule.cc.

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

221  {
224  descriptions.add("provenanceChecker", desc);
225  }
static void fillDescription(ParameterSetDescription &desc)
void edm::ProvenanceCheckerOutputModule::write ( EventPrincipal const &  e,
ModuleCallingContext const *  mcc 
)
overrideprivatevirtual

Implements edm::OutputModule.

Definition at line 107 of file ProvenanceCheckerOutputModule.cc.

References Exception, edm::get_underlying_safe(), edm::ProductRegistry::productList(), and edm::EventPrincipal::productProvenanceRetrieverPtr().

Referenced by pkg.AbstractPkg::generate().

107  {
108  //check ProductProvenance's parents to see if they are in the ProductProvenance list
109  auto mapperPtr = e.productProvenanceRetrieverPtr();
110 
111  std::map<BranchID, bool> seenParentInPrincipal;
112  std::set<BranchID> missingFromMapper;
113  std::set<BranchID> missingProductProvenance;
114 
115  std::map<BranchID, std::shared_ptr<ProductHolderBase const>> idToProductHolder;
116  for(auto const& product : e) {
117  if(product && product->singleProduct()) {
118  BranchID branchID = product->branchDescription().branchID();
119  idToProductHolder[branchID] = get_underlying_safe(product);
120  if(product->productUnavailable()) {
121  //This call seems to have a side effect of filling the 'ProductProvenance' in the ProductHolder
122  OutputHandle const oh = e.getForOutput(branchID, false, mcc);
123 
124  bool cannotFindProductProvenance=false;
125  if(!product->productProvenancePtr()) {
126  missingProductProvenance.insert(branchID);
127  cannotFindProductProvenance=true;
128  }
129  ProductProvenance const* pInfo = mapperPtr->branchIDToProvenance(branchID);
130  if(!pInfo) {
131  missingFromMapper.insert(branchID);
132  continue;
133  }
134  if(cannotFindProductProvenance) {
135  continue;
136  }
137  markAncestors(*(product->productProvenancePtr()), *mapperPtr, seenParentInPrincipal, missingFromMapper);
138  }
139  seenParentInPrincipal[branchID] = true;
140  }
141  }
142 
143  //Determine what BranchIDs are in the product registry
144  ProductRegistry const& reg = e.productRegistry();
145  ProductRegistry::ProductList const prodList = reg.productList();
146  std::set<BranchID> branchesInReg;
147  for(ProductRegistry::ProductList::const_iterator it = prodList.begin(), itEnd = prodList.end();
148  it != itEnd;
149  ++it) {
150  branchesInReg.insert(it->second.branchID());
151  }
152 
153  std::set<BranchID> missingFromPrincipal;
154  std::set<BranchID> missingFromReg;
155  for(std::map<BranchID, bool>::iterator it = seenParentInPrincipal.begin(), itEnd = seenParentInPrincipal.end();
156  it != itEnd;
157  ++it) {
158  if(!it->second) {
159  missingFromPrincipal.insert(it->first);
160  }
161  if(branchesInReg.find(it->first) == branchesInReg.end()) {
162  missingFromReg.insert(it->first);
163  }
164  }
165 
166  if(missingFromMapper.size()) {
167  LogError("ProvenanceChecker") << "Missing the following BranchIDs from ProductProvenanceRetriever\n";
168  for(std::set<BranchID>::iterator it = missingFromMapper.begin(), itEnd = missingFromMapper.end();
169  it != itEnd;
170  ++it) {
171  LogProblem("ProvenanceChecker") << *it<<" "<<idToProductHolder[*it]->branchDescription();
172  }
173  }
174  if(missingFromPrincipal.size()) {
175  LogError("ProvenanceChecker") << "Missing the following BranchIDs from EventPrincipal\n";
176  for(std::set<BranchID>::iterator it = missingFromPrincipal.begin(), itEnd = missingFromPrincipal.end();
177  it != itEnd;
178  ++it) {
179  LogProblem("ProvenanceChecker") << *it;
180  }
181  }
182 
183  if(missingProductProvenance.size()) {
184  LogError("ProvenanceChecker") << "The ProductHolders for the following BranchIDs have no ProductProvenance\n";
185  for(std::set<BranchID>::iterator it = missingProductProvenance.begin(), itEnd = missingProductProvenance.end();
186  it != itEnd;
187  ++it) {
188  LogProblem("ProvenanceChecker") << *it<<" "<<idToProductHolder[*it]->branchDescription();
189  }
190  }
191 
192  if(missingFromReg.size()) {
193  LogError("ProvenanceChecker") << "Missing the following BranchIDs from ProductRegistry\n";
194  for(std::set<BranchID>::iterator it = missingFromReg.begin(), itEnd = missingFromReg.end();
195  it != itEnd;
196  ++it) {
197  LogProblem("ProvenanceChecker") << *it;
198  }
199  }
200 
201  if(missingFromMapper.size() || missingFromPrincipal.size() || missingProductProvenance.size() || missingFromReg.size()) {
202  throw cms::Exception("ProvenanceError")
203  << (missingFromMapper.size() || missingFromPrincipal.size() ? "Having missing ancestors" : "")
204  << (missingFromMapper.size() ? " from ProductProvenanceRetriever" : "")
205  << (missingFromMapper.size() && missingFromPrincipal.size() ? " and" : "")
206  << (missingFromPrincipal.size() ? " from EventPrincipal" : "")
207  << (missingFromMapper.size() || missingFromPrincipal.size() ? ".\n" : "")
208  << (missingProductProvenance.size() ? " Have missing ProductProvenance's from ProductHolder in EventPrincipal.\n" : "")
209  << (missingFromReg.size() ? " Have missing info from ProductRegistry.\n" : "");
210  }
211  }
std::map< BranchKey, BranchDescription > ProductList
std::shared_ptr< T > & get_underlying_safe(propagate_const< std::shared_ptr< T >> &iP)
virtual void edm::ProvenanceCheckerOutputModule::writeLuminosityBlock ( LuminosityBlockPrincipal const &  ,
ModuleCallingContext const *   
)
inlineoverrideprivatevirtual

Implements edm::OutputModule.

Definition at line 40 of file ProvenanceCheckerOutputModule.cc.

40 {}
virtual void edm::ProvenanceCheckerOutputModule::writeRun ( RunPrincipal const &  ,
ModuleCallingContext const *   
)
inlineoverrideprivatevirtual

Implements edm::OutputModule.

Definition at line 41 of file ProvenanceCheckerOutputModule.cc.

41 {}