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
BranchChildren const & branchChildren () const
 
BranchIDLists const * branchIDLists () const
 
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 (const std::string &iProcessName, std::vector< const char * > &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
 
- 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 (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  :
57  OutputModule(pset)
58  {
59  }
OutputModule(ParameterSet const &pset)
Definition: OutputModule.cc:33
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 223 of file ProvenanceCheckerOutputModule.cc.

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

223  {
226  descriptions.add("provenanceChecker", desc);
227  }
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 edm::Principal::begin(), edm::Principal::end(), edm::hlt::Exception, edm::Principal::getForOutput(), edm::ProductRegistry::productList(), edm::EventPrincipal::productProvenanceRetrieverPtr(), and edm::Principal::productRegistry().

Referenced by pkg.AbstractPkg::generate().

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