CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
ProvenanceDumper Class Reference

Public Member Functions

void dump ()
 
int exitCode () const
 
ProvenanceDumperoperator= (ProvenanceDumper const &)=delete
 
void printErrors (std::ostream &os)
 
 ProvenanceDumper (std::string const &filename, bool showDependencies, bool extendedAncestors, bool extendedDescendants, bool excludeESModules, bool showAllModules, bool showTopLevelPSets, std::vector< std::string > const &findMatch, bool dontPrintProducts)
 
 ProvenanceDumper (ProvenanceDumper const &)=delete
 

Private Member Functions

void addAncestors (edm::BranchID const &branchID, std::set< edm::BranchID > &ancestorBranchIDs, std::ostringstream &sout, std::map< edm::BranchID, std::set< edm::ParentageID > > &perProductParentage) const
 
void addDescendants (edm::BranchID const &branchID, std::set< edm::BranchID > &descendantBranchIDs, std::ostringstream &sout, std::map< edm::BranchID, std::set< edm::BranchID > > &parentToChildren) const
 
void dumpEventFilteringParameterSets (edm::EventSelectionIDVector const &ids)
 
void dumpEventFilteringParameterSets_ (TFile *file)
 
void dumpParameterSetForID_ (edm::ParameterSetID const &id)
 
void dumpProcessHistory_ ()
 
void work_ ()
 

Private Attributes

bool dontPrintProducts_
 
int errorCount_
 
std::stringstream errorLog_
 
bool excludeESModules_
 
int exitCode_
 
bool extendedAncestors_
 
bool extendedDescendants_
 
std::string filename_
 
std::vector< std::string > findMatch_
 
HistoryNode historyGraph_
 
std::unique_ptr< TFile > inputFile_
 
edm::ProcessConfigurationVector phc_
 
edm::ProcessHistoryVector phv_
 
ParameterSetMap psm_
 
edm::ProductRegistry reg_
 
bool showDependencies_
 
bool showOtherModules_
 
bool showTopLevelPSets_
 

Detailed Description

Definition at line 479 of file EdmProvDump.cc.

Constructor & Destructor Documentation

ProvenanceDumper::ProvenanceDumper ( std::string const &  filename,
bool  showDependencies,
bool  extendedAncestors,
bool  extendedDescendants,
bool  excludeESModules,
bool  showAllModules,
bool  showTopLevelPSets,
std::vector< std::string > const &  findMatch,
bool  dontPrintProducts 
)

Definition at line 538 of file EdmProvDump.cc.

546  :
548  inputFile_(makeTFile(filename)),
549  exitCode_(0),
550  errorLog_(),
551  errorCount_(0),
552  showDependencies_(showDependencies),
553  extendedAncestors_(extendedAncestors),
554  extendedDescendants_(extendedDescendants),
555  excludeESModules_(excludeESModules),
556  showOtherModules_(showOtherModules),
557  showTopLevelPSets_(showTopLevelPSets),
558  findMatch_(findMatch),
559  dontPrintProducts_(dontPrintProducts) {
560 }
std::stringstream errorLog_
Definition: EdmProvDump.cc:515
std::unique_ptr< TFile > inputFile_
Definition: EdmProvDump.cc:513
std::string filename_
Definition: EdmProvDump.cc:512
std::vector< std::string > findMatch_
Definition: EdmProvDump.cc:528
tuple filename
Definition: lut2db_cfg.py:20
ProvenanceDumper::ProvenanceDumper ( ProvenanceDumper const &  )
delete

Member Function Documentation

void ProvenanceDumper::addAncestors ( edm::BranchID const &  branchID,
std::set< edm::BranchID > &  ancestorBranchIDs,
std::ostringstream &  sout,
std::map< edm::BranchID, std::set< edm::ParentageID > > &  perProductParentage 
) const
private

Definition at line 1031 of file EdmProvDump.cc.

References edm::detail::ThreadSafeRegistry< KEY, T, E >::getMapped(), edm::detail::ThreadSafeRegistry< KEY, T, E >::instance(), edm::Parentage::parents(), and PhysicsTools::registry.

Referenced by work_().

1032  {
1033 
1035 
1036  std::set<edm::ParentageID> const& parentIDs = perProductParentage[branchID];
1037  for (auto const& parentageID : parentIDs) {
1038  edm::Parentage const* parentage = registry.getMapped(parentageID);
1039  if(0 != parentage) {
1040  for(std::vector<edm::BranchID>::const_iterator itBranch = parentage->parents().begin(), itEndBranch = parentage->parents().end();
1041  itBranch != itEndBranch;
1042  ++itBranch) {
1043 
1044  if (ancestorBranchIDs.insert(*itBranch).second) {
1045  addAncestors(*itBranch, ancestorBranchIDs, sout, perProductParentage);
1046  }
1047  }
1048  } else {
1049  sout << " ERROR:parentage info not in registry ParentageID=" << parentageID << std::endl;
1050  }
1051  }
1052 }
static ThreadSafeRegistry * instance()
void addAncestors(edm::BranchID const &branchID, std::set< edm::BranchID > &ancestorBranchIDs, std::ostringstream &sout, std::map< edm::BranchID, std::set< edm::ParentageID > > &perProductParentage) const
bool getMapped(key_type const &k, value_type &result) const
std::vector< BranchID > const & parents() const
Definition: Parentage.h:38
static Interceptor::Registry registry("Interceptor")
void ProvenanceDumper::addDescendants ( edm::BranchID const &  branchID,
std::set< edm::BranchID > &  descendantBranchIDs,
std::ostringstream &  sout,
std::map< edm::BranchID, std::set< edm::BranchID > > &  parentToChildren 
) const
private

Definition at line 1055 of file EdmProvDump.cc.

Referenced by work_().

1056  {
1057 
1058  for (auto const& childBranchID : parentToChildren[branchID]) {
1059  if (descendantBranchIDs.insert(childBranchID).second) {
1060  addDescendants(childBranchID, descendantBranchIDs, sout, parentToChildren);
1061  }
1062  }
1063 }
void addDescendants(edm::BranchID const &branchID, std::set< edm::BranchID > &descendantBranchIDs, std::ostringstream &sout, std::map< edm::BranchID, std::set< edm::BranchID > > &parentToChildren) const
void ProvenanceDumper::dump ( void  )

Definition at line 563 of file EdmProvDump.cc.

References work_().

Referenced by main().

563  {
564  work_();
565 }
void ProvenanceDumper::dumpEventFilteringParameterSets ( edm::EventSelectionIDVector const &  ids)
private

Definition at line 578 of file EdmProvDump.cc.

References gather_cfg::cout, dumpParameterSetForID_(), and i.

Referenced by dumpEventFilteringParameterSets_().

578  {
579  edm::EventSelectionIDVector::size_type num_ids = ids.size();
580  if(num_ids == 0) {
581  std::cout << "No event filtering information is available.\n";
582  std::cout << "------------------------------\n";
583  } else {
584  std::cout << "Event filtering information for "
585  << num_ids
586  << " processing steps is available.\n"
587  << "The ParameterSets will be printed out, "
588  << "with the oldest printed first.\n";
589  for(edm::EventSelectionIDVector::size_type i = 0; i != num_ids; ++i) {
591  }
592  }
593 }
int i
Definition: DBlmapReader.cc:9
void dumpParameterSetForID_(edm::ParameterSetID const &id)
Definition: EdmProvDump.cc:626
uint16_t size_type
tuple cout
Definition: gather_cfg.py:121
void ProvenanceDumper::dumpEventFilteringParameterSets_ ( TFile *  file)
private

Definition at line 596 of file EdmProvDump.cc.

References gather_cfg::cout, dumpEventFilteringParameterSets(), edm::poolNames::eventHistoryBranchName(), edm::poolNames::eventHistoryTreeName(), patZpeak::events, edm::History::eventSelectionIDs(), edm::poolNames::eventSelectionsBranchName(), edm::poolNames::eventTreeName(), and h.

Referenced by work_().

596  {
597 
598  TTree* history = dynamic_cast<TTree*>(file->Get(edm::poolNames::eventHistoryTreeName().c_str()));
599  if(history != 0) {
600  edm::History h;
601  edm::History* ph = &h;
602 
603  history->SetBranchAddress(edm::poolNames::eventHistoryBranchName().c_str(), &ph);
604  if(history->GetEntry(0) <= 0) {
605  std::cout << "No event filtering information is available; the event history tree has no entries\n";
606  } else {
608  }
609  } else {
610  TTree* events = dynamic_cast<TTree*>(file->Get(edm::poolNames::eventTreeName().c_str()));
611  assert (events != 0);
612  TBranch* eventSelectionsBranch = events->GetBranch(edm::poolNames::eventSelectionsBranchName().c_str());
613  assert (eventSelectionsBranch != 0);
615  edm::EventSelectionIDVector* pids = &ids;
616  eventSelectionsBranch->SetAddress(&pids);
617  if(eventSelectionsBranch->GetEntry(0) <= 0) {
618  std::cout << "No event filtering information is available; the event selections branch has no entries\n";
619  } else {
621  }
622  }
623 }
std::string const & eventSelectionsBranchName()
Definition: BranchType.cc:237
std::vector< EventSelectionID > EventSelectionIDVector
EventSelectionIDVector const & eventSelectionIDs() const
Definition: History.h:42
void dumpEventFilteringParameterSets(edm::EventSelectionIDVector const &ids)
Definition: EdmProvDump.cc:578
std::string const & eventHistoryBranchName()
Definition: BranchType.cc:232
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
tuple events
Definition: patZpeak.py:19
std::string const & eventTreeName()
Definition: BranchType.cc:254
tuple cout
Definition: gather_cfg.py:121
std::string const & eventHistoryTreeName()
Definition: BranchType.cc:262
void ProvenanceDumper::dumpParameterSetForID_ ( edm::ParameterSetID const &  id)
private

Definition at line 626 of file EdmProvDump.cc.

References gather_cfg::cout, relativeConstraints::empty, i, edm::ParameterSet::id(), prettyPrint(), and psm_.

Referenced by dumpEventFilteringParameterSets().

626  {
627  std::cout << "ParameterSetID: " << id << '\n';
628  if(id.isValid()) {
629  ParameterSetMap::const_iterator i = psm_.find(id);
630  if(i == psm_.end()) {
631  std::cout << "We are unable to find the corresponding ParameterSet\n";
633  if(id == empty.id()) {
634  std::cout << "But it would have been empty anyway\n";
635  }
636  } else {
637  edm::ParameterSet ps(i->second.pset());
638  prettyPrint(std::cout, ps, " ", " ");
639  std::cout<< '\n';
640  }
641  } else {
642  std::cout << "This ID is not valid\n";
643  }
644  std::cout << " -------------------------\n";
645 }
int i
Definition: DBlmapReader.cc:9
ParameterSetID id() const
ParameterSetMap psm_
Definition: EdmProvDump.cc:520
static std::ostream & prettyPrint(std::ostream &oStream, edm::ParameterSet const &iPSet, std::string const &iIndent, std::string const &iIndentDelta)
Definition: EdmProvDump.cc:451
tuple cout
Definition: gather_cfg.py:121
void ProvenanceDumper::dumpProcessHistory_ ( )
private

Definition at line 648 of file EdmProvDump.cc.

References gather_cfg::cout, alignCSCRings::e, historyGraph_, dbtoconf::parent, and phv_.

Referenced by work_().

648  {
649  std::cout << "Processing History:" << std::endl;
650  if(1 == phv_.size()) {
651  std::cout << *phv_.begin();
652  historyGraph_.addChild(HistoryNode(*(phv_.begin()->begin()), 1));
653  } else {
654  std::map<edm::ProcessConfigurationID, unsigned int> simpleIDs;
655  for(edm::ProcessHistoryVector::const_iterator it = phv_.begin(), itEnd = phv_.end();
656  it != itEnd;
657  ++it) {
658  //loop over the history entries looking for matches
659  HistoryNode* parent = &historyGraph_;
660  for(edm::ProcessHistory::const_iterator itH = it->begin(), e = it->end();
661  itH != e;
662  ++itH) {
663  if(parent->size() == 0) {
664  unsigned int id = simpleIDs[itH->id()];
665  if(0 == id) {
666  id = 1;
667  simpleIDs[itH->id()] = id;
668  }
669  parent->addChild(HistoryNode(*itH, id));
670  parent = parent->lastChildAddress();
671  } else {
672  //see if this is unique
673  bool isUnique = true;
674  for(HistoryNode::iterator itChild = parent->begin(), itChildEnd = parent->end();
675  itChild != itChildEnd;
676  ++itChild) {
677  if(itChild->configurationID() == itH->id()) {
678  isUnique = false;
679  parent = &(*itChild);
680  break;
681  }
682  }
683  if(isUnique) {
684  simpleIDs[itH->id()] = parent->size() + 1;
685  parent->addChild(HistoryNode(*itH, simpleIDs[itH->id()]));
686  parent = parent->lastChildAddress();
687  }
688  }
689  }
690  }
691  historyGraph_.printHistory();
692  }
693 }
collection_type::const_iterator const_iterator
list parent
Definition: dbtoconf.py:74
HistoryNode historyGraph_
Definition: EdmProvDump.cc:521
edm::ProcessHistoryVector phv_
Definition: EdmProvDump.cc:519
tuple cout
Definition: gather_cfg.py:121
int ProvenanceDumper::exitCode ( ) const

Definition at line 573 of file EdmProvDump.cc.

References exitCode_.

Referenced by main().

573  {
574  return exitCode_;
575 }
ProvenanceDumper& ProvenanceDumper::operator= ( ProvenanceDumper const &  )
delete
void ProvenanceDumper::printErrors ( std::ostream &  os)

Definition at line 568 of file EdmProvDump.cc.

References errorCount_, and errorLog_.

Referenced by main().

568  {
569  if(errorCount_ > 0) os << errorLog_.str() << std::endl;
570 }
std::stringstream errorLog_
Definition: EdmProvDump.cc:515
void ProvenanceDumper::work_ ( )
private

Definition at line 696 of file EdmProvDump.cc.

References addAncestors(), addDescendants(), edm::BranchTypeToBranchEntryInfoBranchName(), edm::BranchTypeToMetaDataTreeName(), edm::BranchTypeToProductProvenanceBranchName(), edm::BranchTypeToProductTreeName(), dtNoiseDBValidation_cfg::cerr, gather_cfg::cout, dontPrintProducts_, dumpEventFilteringParameterSets_(), dumpProcessHistory_(), alignCSCRings::e, errorCount_, errorLog_, excludeESModules_, exitCode_, extendedAncestors_, extendedDescendants_, f, edm::fillProductRegistryTransients(), findMatch_, edm::detail::ThreadSafeRegistry< KEY, T, E >::getMapped(), historyGraph_, i, edm::Parentage::id(), edm::poolNames::idToParameterSetBlobsBranchName(), edm::InEvent, info, inputFile_, edm::detail::ThreadSafeRegistry< KEY, T, E >::insertMapped(), edm::detail::ThreadSafeRegistry< KEY, T, E >::instance(), j, edm::poolNames::metaDataTreeName(), edm::poolNames::moduleDescriptionMapBranchName(), edm::numEntries(), edm::poolNames::parameterSetMapBranchName(), edm::poolNames::parameterSetsTreeName(), edm::poolNames::parentageBranchName(), edm::poolNames::parentageTreeName(), edm::Parentage::parents(), phc_, phv_, prettyPrint(), edm::poolNames::processConfigurationBranchName(), edm::poolNames::processHistoryBranchName(), edm::poolNames::processHistoryMapBranchName(), edm::poolNames::productDescriptionBranchName(), edm::ProductRegistry::productList(), psm_, reg_, PhysicsTools::registry, alignCSCRings::s, edm::ParameterSet::setID(), showDependencies_, showOtherModules_, showTopLevelPSets_, edm::sort_all(), and groupFilesInBlocks::temp.

Referenced by dump().

696  {
697 
698  TTree* meta = dynamic_cast<TTree*>(inputFile_->Get(edm::poolNames::metaDataTreeName().c_str()));
699  assert(0 != meta);
700 
701  edm::ProductRegistry* pReg = &reg_;
702  meta->SetBranchAddress(edm::poolNames::productDescriptionBranchName().c_str(), &pReg);
703 
704  ParameterSetMap* pPsm = &psm_;
705  if(meta->FindBranch(edm::poolNames::parameterSetMapBranchName().c_str()) != 0) {
706  meta->SetBranchAddress(edm::poolNames::parameterSetMapBranchName().c_str(), &pPsm);
707  } else {
708  TTree* psetTree = dynamic_cast<TTree *>(inputFile_->Get(edm::poolNames::parameterSetsTreeName().c_str()));
709  assert(0 != psetTree);
710  typedef std::pair<edm::ParameterSetID, edm::ParameterSetBlob> IdToBlobs;
711  IdToBlobs idToBlob;
712  IdToBlobs* pIdToBlob = &idToBlob;
713  psetTree->SetBranchAddress(edm::poolNames::idToParameterSetBlobsBranchName().c_str(), &pIdToBlob);
714  for(long long i = 0; i != psetTree->GetEntries(); ++i) {
715  psetTree->GetEntry(i);
716  psm_.insert(idToBlob);
717  }
718  }
720  if(meta->FindBranch(edm::poolNames::processConfigurationBranchName().c_str()) != 0) {
721  meta->SetBranchAddress(edm::poolNames::processConfigurationBranchName().c_str(), &pPhc);
722  }
723 
725  if(meta->FindBranch(edm::poolNames::processHistoryBranchName().c_str()) != 0) {
726  meta->SetBranchAddress(edm::poolNames::processHistoryBranchName().c_str(), &pPhv);
727  }
728 
730  edm::ProcessHistoryMap* pPhm = &phm;
731  if(meta->FindBranch(edm::poolNames::processHistoryMapBranchName().c_str()) != 0) {
732  meta->SetBranchAddress(edm::poolNames::processHistoryMapBranchName().c_str(), &pPhm);
733  }
734 
735  if(meta->FindBranch(edm::poolNames::moduleDescriptionMapBranchName().c_str()) != 0) {
736  if(meta->GetBranch(edm::poolNames::moduleDescriptionMapBranchName().c_str())->GetSplitLevel() != 0) {
737  meta->SetBranchStatus((edm::poolNames::moduleDescriptionMapBranchName() + ".*").c_str(), 0);
738  } else {
739  meta->SetBranchStatus(edm::poolNames::moduleDescriptionMapBranchName().c_str(), 0);
740  }
741  }
742 
743  meta->GetEntry(0);
744  assert(0 != pReg);
745 
747  for(ParameterSetMap::const_iterator i = psm_.begin(), iEnd = psm_.end(); i != iEnd; ++i) {
748  edm::ParameterSet pset(i->second.pset());
749  pset.setID(i->first);
750  psetRegistry.insertMapped(pset);
751  }
752 
753 
754  // backward compatibility
755  if(!phm.empty()) {
756  for(edm::ProcessHistoryMap::const_iterator i = phm.begin(), e = phm.end(); i != e; ++i) {
757  phv_.push_back(i->second);
758  for(edm::ProcessConfigurationVector::const_iterator j = i->second.begin(), f = i->second.end(); j != f; ++j) {
759  phc_.push_back(*j);
760  }
761  }
763  phc_.erase(std::unique(phc_.begin(), phc_.end()), phc_.end());
764  }
765 
767 
768  //Prepare the parentage information if requested
769  std::map<edm::BranchID, std::set<edm::ParentageID> > perProductParentage;
770 
772  TTree* parentageTree = dynamic_cast<TTree*>(inputFile_->Get(edm::poolNames::parentageTreeName().c_str()));
773  if(0 == parentageTree) {
774  std::cerr << "ERROR, no Parentage tree available so can not show dependencies/n";
775  showDependencies_ = false;
776  extendedAncestors_ = false;
777  extendedDescendants_ = false;
778  } else {
779 
781 
782  std::vector<edm::ParentageID> orderedParentageIDs;
783  orderedParentageIDs.reserve(parentageTree->GetEntries());
784  for(Long64_t i = 0, numEntries = parentageTree->GetEntries(); i < numEntries; ++i) {
785  edm::Parentage parentageBuffer;
786  edm::Parentage *pParentageBuffer = &parentageBuffer;
787  parentageTree->SetBranchAddress(edm::poolNames::parentageBranchName().c_str(), &pParentageBuffer);
788  parentageTree->GetEntry(i);
789  registry.insertMapped(parentageBuffer);
790  orderedParentageIDs.push_back(parentageBuffer.id());
791  }
792  parentageTree->SetBranchAddress(edm::poolNames::parentageBranchName().c_str(), 0);
793 
794  TTree* eventMetaTree = dynamic_cast<TTree*>(inputFile_->Get(edm::BranchTypeToMetaDataTreeName(edm::InEvent).c_str()));
795  if(0 == eventMetaTree) {
796  eventMetaTree = dynamic_cast<TTree*>(inputFile_->Get(edm::BranchTypeToProductTreeName(edm::InEvent).c_str()));
797  }
798  if(0 == eventMetaTree) {
799  std::cerr << "ERROR, no '" << edm::BranchTypeToProductTreeName(edm::InEvent)<< "' Tree in file so can not show dependencies\n";
800  showDependencies_ = false;
801  extendedAncestors_ = false;
802  extendedDescendants_ = false;
803  } else {
804  TBranch* storedProvBranch = eventMetaTree->GetBranch(edm::BranchTypeToProductProvenanceBranchName(edm::InEvent).c_str());
805 
806  if(0!=storedProvBranch) {
807  std::vector<edm::StoredProductProvenance> info;
808  std::vector<edm::StoredProductProvenance>* pInfo = &info;
809  storedProvBranch->SetAddress(&pInfo);
810  for(Long64_t i = 0, numEntries = eventMetaTree->GetEntries(); i < numEntries; ++i) {
811  storedProvBranch->GetEntry(i);
812  for(std::vector<edm::StoredProductProvenance>::const_iterator it = info.begin(), itEnd = info.end();
813  it != itEnd; ++it) {
814  edm::BranchID bid(it->branchID_);
815  perProductParentage[bid].insert(orderedParentageIDs[it->parentageIDIndex_]);
816  }
817  }
818  } else {
819  //backwards compatible check
820  TBranch* productProvBranch = eventMetaTree->GetBranch(edm::BranchTypeToBranchEntryInfoBranchName(edm::InEvent).c_str());
821  if (0 != productProvBranch) {
822  std::vector<edm::ProductProvenance> info;
823  std::vector<edm::ProductProvenance>* pInfo = &info;
824  productProvBranch->SetAddress(&pInfo);
825  for(Long64_t i = 0, numEntries = eventMetaTree->GetEntries(); i < numEntries; ++i) {
826  productProvBranch->GetEntry(i);
827  for(std::vector<edm::ProductProvenance>::const_iterator it = info.begin(), itEnd = info.end();
828  it != itEnd; ++it) {
829  perProductParentage[it->branchID()].insert(it->parentageID());
830  }
831  }
832  } else {
833  std::cerr <<" ERROR, could not find provenance information so can not show dependencies\n";
834  showDependencies_=false;
835  extendedAncestors_ = false;
836  extendedDescendants_ = false;
837  }
838  }
839  }
840  }
841  }
842 
843  std::map<edm::BranchID, std::set<edm::BranchID> > parentToChildren;
845 
846  if (extendedDescendants_) {
847  for (auto const& itParentageSet : perProductParentage) {
848  edm::BranchID childBranchID = itParentageSet.first;
849  for (auto const& itParentageID : itParentageSet.second) {
850  edm::Parentage const* parentage = registry.getMapped(itParentageID);
851  if(0 != parentage) {
852  for(std::vector<edm::BranchID>::const_iterator itBranch = parentage->parents().begin(), itEndBranch = parentage->parents().end();
853  itBranch != itEndBranch;
854  ++itBranch) {
855  parentToChildren[*itBranch].insert(childBranchID);
856  }
857  } else {
858  std::cerr << " ERROR:parentage info not in registry ParentageID=" << itParentageID << std::endl;
859  }
860  }
861  }
862  }
863 
865 
867 
868  std::cout << "---------Producers with data in file---------" << std::endl;
869 
870  //using edm::ParameterSetID as the key does not work
871  // typedef std::map<edm::ParameterSetID, std::vector<edm::BranchDescription> > IdToBranches
872  ModuleToIdBranches moduleToIdBranches;
873  //IdToBranches idToBranches;
874 
875  std::map<edm::BranchID, std::string> branchIDToBranchName;
876 
877  for(edm::ProductRegistry::ProductList::const_iterator it =
878  reg_.productList().begin(), itEnd = reg_.productList().end();
879  it != itEnd;
880  ++it) {
881  //force it to rebuild the branch name
882  it->second.init();
883 
885  branchIDToBranchName[it->second.branchID()] = it->second.branchName();
886  }
887  /*
888  std::cout << it->second.branchName()
889  << " id " << it->second.productID() << std::endl;
890  */
891  for(std::map<edm::ProcessConfigurationID, edm::ParameterSetID>::const_iterator
892  itId = it->second.parameterSetIDs().begin(),
893  itIdEnd = it->second.parameterSetIDs().end();
894  itId != itIdEnd;
895  ++itId) {
896 
897  std::stringstream s;
898  s << itId->second;
899  moduleToIdBranches[std::make_pair(it->second.processName(), it->second.moduleLabel())][s.str()].push_back(it->second);
900  //idToBranches[*itId].push_back(it->second);
901  }
902  }
903 
904  for(ModuleToIdBranches::const_iterator it = moduleToIdBranches.begin(),
905  itEnd = moduleToIdBranches.end();
906  it != itEnd;
907  ++it) {
908  std::ostringstream sout;
909  sout << "Module: " << it->first.second << " " << it->first.first << std::endl;
910  std::set<edm::BranchID> allBranchIDsForLabelAndProcess;
911  IdToBranches const& idToBranches = it->second;
912  for(IdToBranches::const_iterator itIdBranch = idToBranches.begin(),
913  itIdBranchEnd = idToBranches.end();
914  itIdBranch != itIdBranchEnd;
915  ++itIdBranch) {
916  sout << " PSet id:" << itIdBranch->first << std::endl;
917  if(!dontPrintProducts_) {
918  sout << " products: {" << std::endl;
919  }
920  std::set<edm::BranchID> branchIDs;
921  for(std::vector<edm::BranchDescription>::const_iterator itBranch = itIdBranch->second.begin(),
922  itBranchEnd = itIdBranch->second.end();
923  itBranch != itBranchEnd;
924  ++itBranch) {
925  if(!dontPrintProducts_) {
926  sout << " " << itBranch->branchName() << std::endl;
927  }
928  branchIDs.insert(itBranch->branchID());
929  allBranchIDsForLabelAndProcess.insert(itBranch->branchID());
930  }
931  sout << " }" << std::endl;
932  edm::ParameterSetID psid(itIdBranch->first);
933  ParameterSetMap::const_iterator itpsm = psm_.find(psid);
934  if(psm_.end() == itpsm) {
935  ++errorCount_;
936  errorLog_ << "No ParameterSetID for " << psid << std::endl;
937  exitCode_ = 1;
938  } else {
939  sout << " parameters: ";
940  prettyPrint(sout, edm::ParameterSet((*itpsm).second.pset()), " ", " ");
941  sout << std::endl;
942  }
943  if(showDependencies_) {
944 
945  sout << " dependencies: {" << std::endl;
946  std::set<edm::ParentageID> parentageIDs;
947  for(std::set<edm::BranchID>::const_iterator itBranch = branchIDs.begin(), itBranchEnd = branchIDs.end();
948  itBranch != itBranchEnd;
949  ++itBranch) {
950 
951  //Save these BranchIDs
952  std::set<edm::ParentageID> const& temp = perProductParentage[*itBranch];
953  parentageIDs.insert(temp.begin(), temp.end());
954  }
955  for(std::set<edm::ParentageID>::const_iterator itParentID = parentageIDs.begin(), itEndParentID = parentageIDs.end();
956  itParentID != itEndParentID;
957  ++itParentID) {
958  edm::Parentage const* parentage = registry.getMapped(*itParentID);
959  if(0 != parentage) {
960  for(std::vector<edm::BranchID>::const_iterator itBranch = parentage->parents().begin(), itEndBranch = parentage->parents().end();
961  itBranch != itEndBranch;
962  ++itBranch) {
963  sout << " " << branchIDToBranchName[*itBranch] << std::endl;
964  }
965  } else {
966  sout << " ERROR:parentage info not in registry ParentageID=" << *itParentID << std::endl;
967  }
968  }
969  if(parentageIDs.empty()) {
970  sout << " no dependencies recorded (event may not contain data from this module)" << std::endl;
971  }
972  sout << " }" << std::endl;
973  }
974  } // end loop over PSetIDs
975  if (extendedAncestors_) {
976  sout << " extendedAncestors: {" << std::endl;
977  std::set<edm::BranchID> ancestorBranchIDs;
978  for (auto const& branchID : allBranchIDsForLabelAndProcess) {
979  addAncestors(branchID, ancestorBranchIDs, sout, perProductParentage);
980  }
981  for (auto const& ancestorBranchID : ancestorBranchIDs) {
982  sout << " " << branchIDToBranchName[ancestorBranchID] << "\n";
983  }
984  sout << " }" << std::endl;
985  }
986 
987  if (extendedDescendants_) {
988  sout << " extendedDescendants: {" << std::endl;
989  std::set<edm::BranchID> descendantBranchIDs;
990  for (auto const& branchID : allBranchIDsForLabelAndProcess) {
991  addDescendants(branchID, descendantBranchIDs, sout, parentToChildren);
992  }
993  for (auto const& descendantBranchID : descendantBranchIDs) {
994  sout << " " << branchIDToBranchName[descendantBranchID] << "\n";
995  }
996  sout << " }" << std::endl;
997  }
998  bool foundMatch = true;
999  if(!findMatch_.empty()) {
1000  for (auto const& stringToFind : findMatch_) {
1001  if (sout.str().find(stringToFind) == std::string::npos) {
1002  foundMatch = false;
1003  break;
1004  }
1005  }
1006  }
1007  if (foundMatch) {
1008  std::cout <<sout.str()<<std::endl;
1009  }
1010  } // end loop over module label/process
1011  if(showOtherModules_) {
1012  std::cout << "---------Other Modules---------" << std::endl;
1013  historyGraph_.printOtherModulesHistory(psm_, moduleToIdBranches, findMatch_, errorLog_);
1014  }
1015 
1016  if(!excludeESModules_) {
1017  std::cout << "---------EventSetup---------" << std::endl;
1018  historyGraph_.printEventSetupHistory(psm_, findMatch_, errorLog_);
1019  }
1020 
1021  if(showTopLevelPSets_) {
1022  std::cout << "---------Top Level PSets---------" << std::endl;
1023  historyGraph_.printTopLevelPSetsHistory(psm_, findMatch_, errorLog_);
1024  }
1025  if(errorCount_ != 0) {
1026  exitCode_ = 1;
1027  }
1028 }
std::stringstream errorLog_
Definition: EdmProvDump.cc:515
std::string const & idToParameterSetBlobsBranchName()
Definition: BranchType.cc:249
int i
Definition: DBlmapReader.cc:9
std::string const & BranchTypeToMetaDataTreeName(BranchType const &branchType)
Definition: BranchType.cc:106
std::string const & parentageTreeName()
Definition: BranchType.cc:158
static ThreadSafeRegistry * instance()
ParentageID id() const
Definition: Parentage.cc:20
edm::ProductRegistry reg_
Definition: EdmProvDump.cc:517
ParameterSetMap psm_
Definition: EdmProvDump.cc:520
void addAncestors(edm::BranchID const &branchID, std::set< edm::BranchID > &ancestorBranchIDs, std::ostringstream &sout, std::map< edm::BranchID, std::set< edm::ParentageID > > &perProductParentage) const
bool getMapped(key_type const &k, value_type &result) const
HistoryNode historyGraph_
Definition: EdmProvDump.cc:521
ProcessHistoryRegistry::collection_type ProcessHistoryMap
void dumpEventFilteringParameterSets_(TFile *file)
Definition: EdmProvDump.cc:596
bool insertMapped(value_type const &v)
edm::ProcessHistoryVector phv_
Definition: EdmProvDump.cc:519
void fillProductRegistryTransients(std::vector< ProcessConfiguration > const &pcVec, ProductRegistry const &preg, bool okToRegister=false)
std::string const & parameterSetsTreeName()
Definition: BranchType.cc:245
void setID(ParameterSetID const &id) const
ProcessConfigurationRegistry::vector_type ProcessConfigurationVector
std::vector< BranchID > const & parents() const
Definition: Parentage.h:38
ProductList const & productList() const
std::string const & processHistoryMapBranchName()
Definition: BranchType.cc:192
std::map< std::pair< std::string, std::string >, IdToBranches > ModuleToIdBranches
Definition: EdmProvDump.cc:40
Long64_t numEntries(TFile *hdl, std::string const &trname)
Definition: CollUtil.cc:50
int j
Definition: DBlmapReader.cc:9
double f[11][100]
ProcessHistoryRegistry::vector_type ProcessHistoryVector
std::string const & BranchTypeToBranchEntryInfoBranchName(BranchType const &branchType)
Definition: BranchType.cc:126
std::string const & metaDataTreeName()
Definition: BranchType.cc:167
std::string const & BranchTypeToProductTreeName(BranchType const &branchType)
Definition: BranchType.cc:102
std::unique_ptr< TFile > inputFile_
Definition: EdmProvDump.cc:513
std::string const & parameterSetMapBranchName()
Definition: BranchType.cc:182
static std::ostream & prettyPrint(std::ostream &oStream, edm::ParameterSet const &iPSet, std::string const &iIndent, std::string const &iIndentDelta)
Definition: EdmProvDump.cc:451
std::string const & processHistoryBranchName()
Definition: BranchType.cc:197
std::map< std::string, std::vector< edm::BranchDescription > > IdToBranches
Definition: EdmProvDump.cc:39
void dumpProcessHistory_()
Definition: EdmProvDump.cc:648
edm::ProcessConfigurationVector phc_
Definition: EdmProvDump.cc:518
void sort_all(RandomAccessSequence &s)
wrappers for std::sort
Definition: Algorithms.h:120
std::string const & parentageBranchName()
Definition: BranchType.cc:162
void addDescendants(edm::BranchID const &branchID, std::set< edm::BranchID > &descendantBranchIDs, std::ostringstream &sout, std::map< edm::BranchID, std::set< edm::BranchID > > &parentToChildren) const
std::vector< std::string > findMatch_
Definition: EdmProvDump.cc:528
std::map< ParameterSetID, ParameterSetBlob > ParameterSetMap
std::string const & productDescriptionBranchName()
Definition: BranchType.cc:172
std::string const & processConfigurationBranchName()
Definition: BranchType.cc:202
std::string const & BranchTypeToProductProvenanceBranchName(BranchType const &BranchType)
Definition: BranchType.cc:130
tuple cout
Definition: gather_cfg.py:121
static Interceptor::Registry registry("Interceptor")
std::string const & moduleDescriptionMapBranchName()
Definition: BranchType.cc:187

Member Data Documentation

bool ProvenanceDumper::dontPrintProducts_
private

Definition at line 529 of file EdmProvDump.cc.

Referenced by work_().

int ProvenanceDumper::errorCount_
private

Definition at line 516 of file EdmProvDump.cc.

Referenced by printErrors(), and work_().

std::stringstream ProvenanceDumper::errorLog_
private

Definition at line 515 of file EdmProvDump.cc.

Referenced by printErrors(), and work_().

bool ProvenanceDumper::excludeESModules_
private

Definition at line 525 of file EdmProvDump.cc.

Referenced by work_().

int ProvenanceDumper::exitCode_
private

Definition at line 514 of file EdmProvDump.cc.

Referenced by exitCode(), and work_().

bool ProvenanceDumper::extendedAncestors_
private

Definition at line 523 of file EdmProvDump.cc.

Referenced by work_().

bool ProvenanceDumper::extendedDescendants_
private

Definition at line 524 of file EdmProvDump.cc.

Referenced by work_().

std::string ProvenanceDumper::filename_
private

Definition at line 512 of file EdmProvDump.cc.

std::vector<std::string> ProvenanceDumper::findMatch_
private

Definition at line 528 of file EdmProvDump.cc.

Referenced by work_().

HistoryNode ProvenanceDumper::historyGraph_
private

Definition at line 521 of file EdmProvDump.cc.

Referenced by dumpProcessHistory_(), and work_().

std::unique_ptr<TFile> ProvenanceDumper::inputFile_
private

Definition at line 513 of file EdmProvDump.cc.

Referenced by work_().

edm::ProcessConfigurationVector ProvenanceDumper::phc_
private

Definition at line 518 of file EdmProvDump.cc.

Referenced by work_().

edm::ProcessHistoryVector ProvenanceDumper::phv_
private

Definition at line 519 of file EdmProvDump.cc.

Referenced by dumpProcessHistory_(), and work_().

ParameterSetMap ProvenanceDumper::psm_
private

Definition at line 520 of file EdmProvDump.cc.

Referenced by dumpParameterSetForID_(), and work_().

edm::ProductRegistry ProvenanceDumper::reg_
private

Definition at line 517 of file EdmProvDump.cc.

Referenced by work_().

bool ProvenanceDumper::showDependencies_
private

Definition at line 522 of file EdmProvDump.cc.

Referenced by work_().

bool ProvenanceDumper::showOtherModules_
private

Definition at line 526 of file EdmProvDump.cc.

Referenced by work_().

bool ProvenanceDumper::showTopLevelPSets_
private

Definition at line 527 of file EdmProvDump.cc.

Referenced by work_().