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)
 

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
 

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  :
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 213 of file ProvenanceCheckerOutputModule.cc.

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

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