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

Public Member Functions

 ProvenanceCheckerOutputModule (ParameterSet const &pset)
 
virtual ~ProvenanceCheckerOutputModule ()
 
- Public Member Functions inherited from edm::OutputModule
BranchChildren const & branchChildren () const
 
boost::array< bool,
NumBranchTypes > const & 
hasNewlyDroppedBranch () const
 
SelectionsArray const & keptProducts () const
 
int maxEvents () const
 
 OutputModule (ParameterSet const &pset)
 
std::string const & processName () const
 
int remainingEvents () const
 
bool selected (BranchDescription const &desc) const
 
void selectProducts ()
 
bool wantAllEvents () const
 
virtual ~OutputModule ()
 

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)
 
virtual void writeLuminosityBlock (LuminosityBlockPrincipal const &)
 
virtual void writeRun (RunPrincipal const &)
 

Additional Inherited Members

- Public Types inherited from edm::OutputModule
typedef OutputModule ModuleType
 
typedef OutputWorker WorkerType
 
- Protected Member Functions inherited from edm::OutputModule
CurrentProcessingContext const * currentContext () const
 
ModuleDescription const & description () const
 
void doBeginJob ()
 
bool doBeginLuminosityBlock (LuminosityBlockPrincipal const &lbp, EventSetup const &c, CurrentProcessingContext const *cpc)
 
bool doBeginRun (RunPrincipal const &rp, EventSetup const &c, CurrentProcessingContext const *cpc)
 
void doEndJob ()
 
bool doEndLuminosityBlock (LuminosityBlockPrincipal const &lbp, EventSetup const &c, CurrentProcessingContext const *cpc)
 
bool doEndRun (RunPrincipal const &rp, EventSetup const &c, CurrentProcessingContext const *cpc)
 
bool doEvent (EventPrincipal const &ep, EventSetup const &c, CurrentProcessingContext const *cpc)
 
Trig getTriggerResults (Event const &ep) const
 
Trig getTriggerResults (EventPrincipal const &ep) const
 
ParameterSetID selectorConfig () const
 
void setEventSelectionInfo (std::map< std::string, std::vector< std::pair< std::string, int > > > const &outputModulePathPositions, bool anyProductProduced)
 

Detailed Description

Definition at line 28 of file ProvenanceCheckerOutputModule.cc.

Constructor & Destructor Documentation

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

Definition at line 53 of file ProvenanceCheckerOutputModule.cc.

53  :
54  OutputModule(pset)
55  {
56  }
OutputModule(ParameterSet const &pset)
edm::ProvenanceCheckerOutputModule::~ProvenanceCheckerOutputModule ( )
virtual

Definition at line 63 of file ProvenanceCheckerOutputModule.cc.

64  {
65  }

Member Function Documentation

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

Definition at line 220 of file ProvenanceCheckerOutputModule.cc.

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

220  {
223  descriptions.add("provenanceChecker", desc);
224  }
static void fillDescription(ParameterSetDescription &desc)
void edm::ProvenanceCheckerOutputModule::write ( EventPrincipal const &  e)
privatevirtual

Implements edm::OutputModule.

Definition at line 104 of file ProvenanceCheckerOutputModule.cc.

References edm::Principal::begin(), edm::EventPrincipal::branchMapperPtr(), edm::Principal::end(), edm::hlt::Exception, edm::Principal::getForOutput(), edm::ProductRegistry::productList(), and edm::Principal::productRegistry().

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

Implements edm::OutputModule.

Definition at line 37 of file ProvenanceCheckerOutputModule.cc.

37 {}
virtual void edm::ProvenanceCheckerOutputModule::writeRun ( RunPrincipal const &  )
inlineprivatevirtual

Implements edm::OutputModule.

Definition at line 38 of file ProvenanceCheckerOutputModule.cc.

38 {}