CMS 3D CMS Logo

edm::ProvenanceCheckerOutputModule Class Reference

Inheritance diagram for edm::ProvenanceCheckerOutputModule:

edm::OutputModule

List of all members.

Public Member Functions

 ProvenanceCheckerOutputModule (ParameterSet const &pset)
virtual ~ProvenanceCheckerOutputModule ()

Private Member Functions

virtual void write (EventPrincipal const &e)
virtual void writeLuminosityBlock (LuminosityBlockPrincipal const &)
virtual void writeRun (RunPrincipal const &)


Detailed Description

Definition at line 27 of file ProvenanceCheckerOutputModule.cc.


Constructor & Destructor Documentation

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

Definition at line 51 of file ProvenanceCheckerOutputModule.cc.

00051                                                                                         :
00052    OutputModule(pset)
00053    {
00054    }

edm::ProvenanceCheckerOutputModule::~ProvenanceCheckerOutputModule (  )  [virtual]

Definition at line 61 of file ProvenanceCheckerOutputModule.cc.

00062    {
00063    }


Member Function Documentation

void edm::ProvenanceCheckerOutputModule::write ( EventPrincipal const &  e  )  [private, virtual]

Implements edm::OutputModule.

Definition at line 103 of file ProvenanceCheckerOutputModule.cc.

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

00103                                                                {
00104       //check EventEntryInfo's parents to see if they are in the EventEntryInfo list
00105       boost::shared_ptr<BranchMapper> mapperPtr= e.branchMapperPtr();
00106                        
00107       std::map<BranchID,bool> seenParentInPrincipal;
00108       std::set<BranchID> missingFromMapper;
00109       std::set<BranchID> missingEventEntryInfo;
00110 
00111       for(EventPrincipal::const_iterator it = e.begin(), itEnd = e.end();
00112           it != itEnd;
00113           ++it) {
00114          if(it->second && !it->second->productUnavailable()) {
00115             //This call seems to have a side effect of filling the 'EventEntryInfo' in the Group
00116             OutputHandle<EventEntryInfo> const oh = e.getForOutput<EventEntryInfo>(it->first, false);
00117 
00118             if(not it->second->entryInfoPtr().get() ) {
00119                missingEventEntryInfo.insert(it->first);
00120                continue;
00121             }
00122             boost::shared_ptr<EventEntryInfo> pInfo = mapperPtr->branchToEntryInfo(it->first);
00123             if(!pInfo.get()) {
00124                missingFromMapper.insert(it->first);
00125             }
00126             markAncestors(*(it->second->entryInfoPtr()),*mapperPtr,seenParentInPrincipal, missingFromMapper);
00127          }
00128          seenParentInPrincipal[it->first]=true;
00129       }
00130       
00131       //Determine what BranchIDs are in the product registry
00132       const ProductRegistry& reg = e.productRegistry();
00133       const ProductRegistry::ProductList prodList = reg.productList();
00134       std::set<BranchID> branchesInReg;
00135       for(ProductRegistry::ProductList::const_iterator it = prodList.begin(), itEnd = prodList.end();
00136           it != itEnd;
00137           ++it) {
00138          branchesInReg.insert(it->second.branchID());
00139       }
00140       
00141       
00142       std::set<BranchID> missingFromPrincipal;
00143       std::set<BranchID> missingFromReg;
00144       for(std::map<BranchID,bool>::iterator it=seenParentInPrincipal.begin(), itEnd = seenParentInPrincipal.end();
00145           it != itEnd;
00146           ++it) {
00147          if(!it->second) {
00148             missingFromPrincipal.insert(it->first);
00149          }
00150          if(branchesInReg.find(it->first) == branchesInReg.end()) {
00151             missingFromReg.insert(it->first);
00152          }
00153       }
00154       
00155       
00156       if(missingFromMapper.size()) {
00157          edm::LogError("ProvenanceChecker") <<"Missing the following BranchIDs from BranchMapper\n";
00158          for(std::set<BranchID>::iterator it=missingFromMapper.begin(), itEnd = missingFromMapper.end();
00159              it!=itEnd;
00160              ++it) {
00161             edm::LogProblem("ProvenanceChecker")<<*it;
00162          }
00163       }
00164       if(missingFromPrincipal.size()) {
00165          edm::LogError("ProvenanceChecker") <<"Missing the following BranchIDs from EventPrincipal\n";
00166          for(std::set<BranchID>::iterator it=missingFromPrincipal.begin(), itEnd = missingFromPrincipal.end();
00167              it!=itEnd;
00168              ++it) {
00169             edm::LogProblem("ProvenanceChecker")<<*it;
00170          }
00171       }
00172       
00173       if(missingEventEntryInfo.size()) {
00174          edm::LogError("ProvenanceChecker") <<"The Groups for the following BranchIDs have no EventEntryInfo\n";
00175          for(std::set<BranchID>::iterator it=missingEventEntryInfo.begin(), itEnd = missingEventEntryInfo.end();
00176              it!=itEnd;
00177              ++it) {
00178             edm::LogProblem("ProvenanceChecker")<<*it;
00179          }      
00180       }
00181 
00182       if(missingFromReg.size()) {
00183          edm::LogError("ProvenanceChecker") <<"Missing the following BranchIDs from ProductRegistry\n";
00184          for(std::set<BranchID>::iterator it=missingFromReg.begin(), itEnd = missingFromReg.end();
00185              it!=itEnd;
00186              ++it) {
00187             edm::LogProblem("ProvenanceChecker")<<*it;
00188          }
00189       }
00190       
00191       
00192       if(missingFromMapper.size() or missingFromPrincipal.size() or missingEventEntryInfo.size() or missingFromReg.size()) {
00193          throw cms::Exception("ProvenanceError")
00194          <<(missingFromMapper.size() or missingFromPrincipal.size()?"Having missing ancestors": "")
00195          <<(missingFromMapper.size()?" from BranchMapper":"")
00196          <<(missingFromMapper.size() and missingFromPrincipal.size()?" and":"")
00197          <<(missingFromPrincipal.size()?" from EventPrincipal":"")
00198          <<(missingFromMapper.size() or missingFromPrincipal.size()?".\n":"")
00199          <<(missingEventEntryInfo.size()?" Have missing EventEntryInfo's from Group in EventPrincipal.\n":"")
00200          <<(missingFromReg.size()?" Have missing info from ProductRegistry.\n":"");
00201       }
00202    }

virtual void edm::ProvenanceCheckerOutputModule::writeLuminosityBlock ( LuminosityBlockPrincipal const &   )  [inline, private, virtual]

Implements edm::OutputModule.

Definition at line 35 of file ProvenanceCheckerOutputModule.cc.

00035 {}

virtual void edm::ProvenanceCheckerOutputModule::writeRun ( RunPrincipal const &   )  [inline, private, virtual]

Implements edm::OutputModule.

Definition at line 36 of file ProvenanceCheckerOutputModule.cc.

00036 {}


The documentation for this class was generated from the following file:
Generated on Tue Jun 9 18:43:10 2009 for CMSSW by  doxygen 1.5.4