CMS 3D CMS Logo

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 (ProvenanceDumper const &)=delete
 
 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, std::string const &dumpPSetID)
 

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_
 
std::string dumpPSetID_
 
int errorCount_
 
std::stringstream errorLog_
 
bool excludeESModules_
 
int exitCode_
 
bool extendedAncestors_
 
bool extendedDescendants_
 
std::string filename_
 
std::vector< std::string > findMatch_
 
HistoryNode historyGraph_
 
edm::propagate_const< std::unique_ptr< TFile > > inputFile_
 
edm::ProcessConfigurationVector phc_
 
edm::ProcessHistoryVector phv_
 
bool productRegistryPresent_
 
ParameterSetMap psm_
 
edm::ProductRegistry reg_
 
bool showDependencies_
 
bool showOtherModules_
 
bool showTopLevelPSets_
 

Detailed Description

Definition at line 436 of file EdmProvDump.cc.

Constructor & Destructor Documentation

◆ ProvenanceDumper() [1/2]

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,
std::string const &  dumpPSetID 
)

Definition at line 498 of file EdmProvDump.cc.

508  : filename_(filename),
509  inputFile_(makeTFile(filename)),
510  exitCode_(0),
511  errorLog_(),
512  errorCount_(0),
513  showDependencies_(showDependencies),
514  extendedAncestors_(extendedAncestors),
515  extendedDescendants_(extendedDescendants),
516  excludeESModules_(excludeESModules),
517  showOtherModules_(showOtherModules),
519  showTopLevelPSets_(showTopLevelPSets),
520  findMatch_(findMatch),
521  dontPrintProducts_(dontPrintProducts),
522  dumpPSetID_(dumpPSetID) {}

◆ ProvenanceDumper() [2/2]

ProvenanceDumper::ProvenanceDumper ( ProvenanceDumper const &  )
delete

Member Function Documentation

◆ addAncestors()

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 995 of file EdmProvDump.cc.

998  {
1000 
1001  std::set<edm::ParentageID> const& parentIDs = perProductParentage[branchID];
1002  for (auto const& parentageID : parentIDs) {
1003  edm::Parentage const* parentage = registry.getMapped(parentageID);
1004  if (nullptr != parentage) {
1005  for (auto const& branch : parentage->parents()) {
1006  if (ancestorBranchIDs.insert(branch).second) {
1007  addAncestors(branch, ancestorBranchIDs, sout, perProductParentage);
1008  }
1009  }
1010  } else {
1011  sout << " ERROR:parentage info not in registry ParentageID=" << parentageID << std::endl;
1012  }
1013  }
1014 }

References MicroEventContent_cff::branch, edm::ParentageRegistry::getMapped(), edm::ParentageRegistry::instance(), and edm::Parentage::parents().

Referenced by work_().

◆ addDescendants()

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 1016 of file EdmProvDump.cc.

1019  {
1020  for (auto const& childBranchID : parentToChildren[branchID]) {
1021  if (descendantBranchIDs.insert(childBranchID).second) {
1022  addDescendants(childBranchID, descendantBranchIDs, sout, parentToChildren);
1023  }
1024  }
1025 }

Referenced by work_().

◆ dump()

void ProvenanceDumper::dump ( void  )

Definition at line 524 of file EdmProvDump.cc.

524 { work_(); }

References work_().

Referenced by main().

◆ dumpEventFilteringParameterSets()

void ProvenanceDumper::dumpEventFilteringParameterSets ( edm::EventSelectionIDVector const &  ids)
private

Definition at line 533 of file EdmProvDump.cc.

533  {
534  edm::EventSelectionIDVector::size_type num_ids = ids.size();
535  if (num_ids == 0) {
536  std::cout << "No event filtering information is available.\n";
537  std::cout << "------------------------------\n";
538  } else {
539  std::cout << "Event filtering information for " << num_ids << " processing steps is available.\n"
540  << "The ParameterSets will be printed out, "
541  << "with the oldest printed first.\n";
542  for (edm::EventSelectionIDVector::size_type i = 0; i != num_ids; ++i) {
544  }
545  }
546 }

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

Referenced by dumpEventFilteringParameterSets_().

◆ dumpEventFilteringParameterSets_()

void ProvenanceDumper::dumpEventFilteringParameterSets_ ( TFile *  file)
private

Definition at line 548 of file EdmProvDump.cc.

548  {
549  TTree* history = dynamic_cast<TTree*>(file->Get(edm::poolNames::eventHistoryTreeName().c_str()));
550  if (history != nullptr) {
551  edm::History h;
552  edm::History* ph = &h;
553 
554  history->SetBranchAddress(edm::poolNames::eventHistoryBranchName().c_str(), &ph);
555  if (history->GetEntry(0) <= 0) {
556  std::cout << "No event filtering information is available; the event history tree has no entries\n";
557  } else {
558  dumpEventFilteringParameterSets(h.eventSelectionIDs());
559  }
560  } else {
561  TTree* events = dynamic_cast<TTree*>(file->Get(edm::poolNames::eventTreeName().c_str()));
562  assert(events != nullptr);
563  TBranch* eventSelectionsBranch = events->GetBranch(edm::poolNames::eventSelectionsBranchName().c_str());
564  if (eventSelectionsBranch == nullptr)
565  return;
567  edm::EventSelectionIDVector* pids = &ids;
568  eventSelectionsBranch->SetAddress(&pids);
569  if (eventSelectionsBranch->GetEntry(0) <= 0) {
570  std::cout << "No event filtering information is available; the event selections branch has no entries\n";
571  } else {
573  }
574  }
575 }

References cms::cuda::assert(), gather_cfg::cout, dumpEventFilteringParameterSets(), edm::poolNames::eventHistoryBranchName(), edm::poolNames::eventHistoryTreeName(), patZpeak::events, edm::poolNames::eventSelectionsBranchName(), edm::poolNames::eventTreeName(), FrontierConditions_GlobalTag_cff::file, and h.

Referenced by work_().

◆ dumpParameterSetForID_()

void ProvenanceDumper::dumpParameterSetForID_ ( edm::ParameterSetID const &  id)
private

Definition at line 577 of file EdmProvDump.cc.

577  {
578  std::cout << "ParameterSetID: " << id << '\n';
579  if (id.isValid()) {
580  ParameterSetMap::const_iterator i = psm_.find(id);
581  if (i == psm_.end()) {
582  std::cout << "We are unable to find the corresponding ParameterSet\n";
584  empty.registerIt();
585  if (id == empty.id()) {
586  std::cout << "But it would have been empty anyway\n";
587  }
588  } else {
589  edm::ParameterSet ps(i->second.pset());
590  prettyPrint(std::cout, ps, " ", " ");
591  std::cout << '\n';
592  }
593  } else {
594  std::cout << "This ID is not valid\n";
595  }
596  std::cout << " -------------------------\n";
597 }

References gather_cfg::cout, relativeConstraints::empty, mps_fire::i, prettyPrint(), and psm_.

Referenced by dumpEventFilteringParameterSets(), and work_().

◆ dumpProcessHistory_()

void ProvenanceDumper::dumpProcessHistory_ ( )
private

Definition at line 599 of file EdmProvDump.cc.

599  {
600  std::cout << "Processing History:" << std::endl;
601  std::map<edm::ProcessConfigurationID, unsigned int> simpleIDs;
602  for (auto const& ph : phv_) {
603  //loop over the history entries looking for matches
604  HistoryNode* parent = &historyGraph_;
605  for (auto const& pc : ph) {
606  if (parent->size() == 0) {
607  unsigned int id = simpleIDs[pc.id()];
608  if (0 == id) {
609  id = 1;
610  simpleIDs[pc.id()] = id;
611  }
612  parent->addChild(HistoryNode(pc, id));
613  parent = parent->lastChildAddress();
614  } else {
615  //see if this is unique
616  bool isUnique = true;
617  for (auto& child : *parent) {
618  if (child.configurationID() == pc.id()) {
619  isUnique = false;
620  parent = &child;
621  break;
622  }
623  }
624  if (isUnique) {
625  simpleIDs[pc.id()] = parent->size() + 1;
626  parent->addChild(HistoryNode(pc, simpleIDs[pc.id()]));
627  parent = parent->lastChildAddress();
628  }
629  }
630  }
631  }
632  historyGraph_.printHistory();
633 }

References class-composition::child, gather_cfg::cout, historyGraph_, triggerObjects_cff::id, class-composition::parent, and phv_.

Referenced by work_().

◆ exitCode()

int ProvenanceDumper::exitCode ( ) const

Definition at line 531 of file EdmProvDump.cc.

531 { return exitCode_; }

References exitCode_.

Referenced by main().

◆ operator=()

ProvenanceDumper& ProvenanceDumper::operator= ( ProvenanceDumper const &  )
delete

◆ printErrors()

void ProvenanceDumper::printErrors ( std::ostream &  os)

Definition at line 526 of file EdmProvDump.cc.

526  {
527  if (errorCount_ > 0)
528  os << errorLog_.str() << std::endl;
529 }

References errorCount_, and errorLog_.

Referenced by main().

◆ work_()

void ProvenanceDumper::work_ ( )
private

Definition at line 635 of file EdmProvDump.cc.

635  {
636  TTree* meta = dynamic_cast<TTree*>(inputFile_->Get(edm::poolNames::metaDataTreeName().c_str()));
637  assert(nullptr != meta);
638 
639  edm::ProductRegistry* pReg = &reg_;
640  if (meta->FindBranch(edm::poolNames::productDescriptionBranchName().c_str()) != nullptr) {
641  meta->SetBranchAddress(edm::poolNames::productDescriptionBranchName().c_str(), &pReg);
642  } else {
643  productRegistryPresent_ = false;
644  }
645 
646  ParameterSetMap* pPsm = &psm_;
647  if (meta->FindBranch(edm::poolNames::parameterSetMapBranchName().c_str()) != nullptr) {
648  meta->SetBranchAddress(edm::poolNames::parameterSetMapBranchName().c_str(), &pPsm);
649  } else {
650  TTree* psetTree = dynamic_cast<TTree*>(inputFile_->Get(edm::poolNames::parameterSetsTreeName().c_str()));
651  assert(nullptr != psetTree);
652  typedef std::pair<edm::ParameterSetID, edm::ParameterSetBlob> IdToBlobs;
653  IdToBlobs idToBlob;
654  IdToBlobs* pIdToBlob = &idToBlob;
655  psetTree->SetBranchAddress(edm::poolNames::idToParameterSetBlobsBranchName().c_str(), &pIdToBlob);
656  for (long long i = 0; i != psetTree->GetEntries(); ++i) {
657  psetTree->GetEntry(i);
658  psm_.insert(idToBlob);
659  }
660  }
661 
663  if (meta->FindBranch(edm::poolNames::processHistoryBranchName().c_str()) != nullptr) {
664  meta->SetBranchAddress(edm::poolNames::processHistoryBranchName().c_str(), &pPhv);
665  }
666 
668  edm::ProcessHistoryMap* pPhm = &phm;
669  if (meta->FindBranch(edm::poolNames::processHistoryMapBranchName().c_str()) != nullptr) {
670  meta->SetBranchAddress(edm::poolNames::processHistoryMapBranchName().c_str(), &pPhm);
671  }
672 
673  if (meta->FindBranch(edm::poolNames::moduleDescriptionMapBranchName().c_str()) != nullptr) {
674  if (meta->GetBranch(edm::poolNames::moduleDescriptionMapBranchName().c_str())->GetSplitLevel() != 0) {
675  meta->SetBranchStatus((edm::poolNames::moduleDescriptionMapBranchName() + ".*").c_str(), false);
676  } else {
677  meta->SetBranchStatus(edm::poolNames::moduleDescriptionMapBranchName().c_str(), false);
678  }
679  }
680 
681  meta->GetEntry(0);
682  assert(nullptr != pReg);
683 
685  for (auto const& item : psm_) {
686  edm::ParameterSet pset(item.second.pset());
687  pset.setID(item.first);
688  psetRegistry.insertMapped(pset);
689  }
690 
691  if (!phv_.empty()) {
692  for (auto const& history : phv_) {
693  for (auto const& process : history) {
694  phc_.push_back(process);
695  }
696  }
698  phc_.erase(std::unique(phc_.begin(), phc_.end()), phc_.end());
699 
700  }
701  // backward compatibility
702  else if (!phm.empty()) {
703  for (auto const& history : phm) {
704  phv_.push_back(history.second);
705  for (auto const& process : history.second) {
706  phc_.push_back(process);
707  }
708  }
710  phc_.erase(std::unique(phc_.begin(), phc_.end()), phc_.end());
711  }
712 
713  if (!dumpPSetID_.empty()) {
714  edm::ParameterSetID psetID;
715  try {
717  } catch (cms::Exception const& x) {
718  throw cms::Exception("Command Line Argument")
719  << "Illegal ParameterSetID string. It should contain 32 hexadecimal characters";
720  }
721  dumpParameterSetForID_(psetID);
722  return;
723  }
724 
725  //Prepare the parentage information if requested
726  std::map<edm::BranchID, std::set<edm::ParentageID>> perProductParentage;
727 
729  TTree* parentageTree = dynamic_cast<TTree*>(inputFile_->Get(edm::poolNames::parentageTreeName().c_str()));
730  if (nullptr == parentageTree) {
731  std::cerr << "ERROR, no Parentage tree available so cannot show dependencies, ancestors, or descendants.\n";
732  std::cerr << "Possibly this is not a standard EDM format file. For example, dependency, ancestor, and\n";
733  std::cerr << "descendant options to edmProvDump will not work with nanoAOD format files.\n\n";
734  showDependencies_ = false;
735  extendedAncestors_ = false;
736  extendedDescendants_ = false;
737  } else {
739 
740  std::vector<edm::ParentageID> orderedParentageIDs;
741  orderedParentageIDs.reserve(parentageTree->GetEntries());
742  for (Long64_t i = 0, numEntries = parentageTree->GetEntries(); i < numEntries; ++i) {
743  edm::Parentage parentageBuffer;
744  edm::Parentage* pParentageBuffer = &parentageBuffer;
745  parentageTree->SetBranchAddress(edm::poolNames::parentageBranchName().c_str(), &pParentageBuffer);
746  parentageTree->GetEntry(i);
747  registry.insertMapped(parentageBuffer);
748  orderedParentageIDs.push_back(parentageBuffer.id());
749  }
750  parentageTree->SetBranchAddress(edm::poolNames::parentageBranchName().c_str(), nullptr);
751 
752  TTree* eventMetaTree =
753  dynamic_cast<TTree*>(inputFile_->Get(edm::BranchTypeToMetaDataTreeName(edm::InEvent).c_str()));
754  if (nullptr == eventMetaTree) {
755  eventMetaTree = dynamic_cast<TTree*>(inputFile_->Get(edm::BranchTypeToProductTreeName(edm::InEvent).c_str()));
756  }
757  if (nullptr == eventMetaTree) {
759  << "' Tree in file so can not show dependencies\n";
760  showDependencies_ = false;
761  extendedAncestors_ = false;
762  extendedDescendants_ = false;
763  } else {
764  TBranch* storedProvBranch =
765  eventMetaTree->GetBranch(edm::BranchTypeToProductProvenanceBranchName(edm::InEvent).c_str());
766 
767  if (nullptr != storedProvBranch) {
768  std::vector<edm::StoredProductProvenance> info;
769  std::vector<edm::StoredProductProvenance>* pInfo = &info;
770  storedProvBranch->SetAddress(&pInfo);
771  for (Long64_t i = 0, numEntries = eventMetaTree->GetEntries(); i < numEntries; ++i) {
772  storedProvBranch->GetEntry(i);
773  for (auto const& item : info) {
774  edm::BranchID bid(item.branchID_);
775  perProductParentage[bid].insert(orderedParentageIDs.at(item.parentageIDIndex_));
776  }
777  }
778  } else {
779  //backwards compatible check
780  TBranch* productProvBranch =
781  eventMetaTree->GetBranch(edm::BranchTypeToBranchEntryInfoBranchName(edm::InEvent).c_str());
782  if (nullptr != productProvBranch) {
783  std::vector<edm::ProductProvenance> info;
784  std::vector<edm::ProductProvenance>* pInfo = &info;
785  productProvBranch->SetAddress(&pInfo);
786  for (Long64_t i = 0, numEntries = eventMetaTree->GetEntries(); i < numEntries; ++i) {
787  productProvBranch->GetEntry(i);
788  for (auto const& item : info) {
789  perProductParentage[item.branchID()].insert(item.parentageID());
790  }
791  }
792  } else {
793  std::cerr << " ERROR, could not find provenance information so can not show dependencies\n";
794  showDependencies_ = false;
795  extendedAncestors_ = false;
796  extendedDescendants_ = false;
797  }
798  }
799  }
800  }
801  }
802 
803  std::map<edm::BranchID, std::set<edm::BranchID>> parentToChildren;
805 
806  if (extendedDescendants_) {
807  for (auto const& itParentageSet : perProductParentage) {
808  edm::BranchID childBranchID = itParentageSet.first;
809  for (auto const& itParentageID : itParentageSet.second) {
810  edm::Parentage const* parentage = registry.getMapped(itParentageID);
811  if (nullptr != parentage) {
812  for (auto const& branch : parentage->parents()) {
813  parentToChildren[branch].insert(childBranchID);
814  }
815  } else {
816  std::cerr << " ERROR:parentage info not in registry ParentageID=" << itParentageID << std::endl;
817  }
818  }
819  }
820  }
821 
823 
825 
827  std::cout << "---------Producers with data in file---------" << std::endl;
828  }
829 
830  //using edm::ParameterSetID as the key does not work
831  // typedef std::map<edm::ParameterSetID, std::vector<edm::BranchDescription> > IdToBranches
832  ModuleToIdBranches moduleToIdBranches;
833  //IdToBranches idToBranches;
834 
835  std::map<edm::BranchID, std::string> branchIDToBranchName;
836 
837  for (auto const& processConfig : phc_) {
838  edm::ParameterSet const* processParameterSet =
839  edm::pset::Registry::instance()->getMapped(processConfig.parameterSetID());
840  if (nullptr == processParameterSet || processParameterSet->empty()) {
841  continue;
842  }
843  for (auto& item : reg_.productListUpdator()) {
844  auto& product = item.second;
845  if (product.processName() != processConfig.processName()) {
846  continue;
847  }
848  //force it to rebuild the branch name
849  product.init();
850  setIsMergeable(product);
851 
853  branchIDToBranchName[product.branchID()] = product.branchName();
854  }
855  /*
856  std::cout << product.branchName()
857  << " id " << product.productID() << std::endl;
858  */
859  std::string moduleLabel = product.moduleLabel();
860  if (moduleLabel == source) {
861  moduleLabel = input;
862  } else if (moduleLabel == triggerResults) {
864  }
865 
866  std::stringstream s;
867 
868  if (processParameterSet->existsAs<edm::ParameterSet>(moduleLabel)) {
869  edm::ParameterSet const& moduleParameterSet = processParameterSet->getParameterSet(moduleLabel);
870  if (!moduleParameterSet.isRegistered()) {
871  edm::ParameterSet moduleParameterSetCopy = processParameterSet->getParameterSet(moduleLabel);
872  moduleParameterSetCopy.registerIt();
873  s << moduleParameterSetCopy.id();
874  } else {
875  s << moduleParameterSet.id();
876  }
877  moduleToIdBranches[std::make_pair(product.processName(), product.moduleLabel())][s.str()].push_back(product);
878  }
879  }
880  }
881 
882  for (auto const& item : moduleToIdBranches) {
883  std::ostringstream sout;
884  sout << "Module: " << item.first.second << " " << item.first.first << std::endl;
885  std::set<edm::BranchID> allBranchIDsForLabelAndProcess;
886  IdToBranches const& idToBranches = item.second;
887  for (auto const& idBranch : idToBranches) {
888  sout << " PSet id:" << idBranch.first << std::endl;
889  if (!dontPrintProducts_) {
890  sout << " products: {" << std::endl;
891  }
892  std::set<edm::BranchID> branchIDs;
893  for (auto const& branch : idBranch.second) {
894  if (!dontPrintProducts_) {
895  sout << " " << branch.branchName() << std::endl;
896  }
897  branchIDs.insert(branch.branchID());
898  allBranchIDsForLabelAndProcess.insert(branch.branchID());
899  }
900  sout << " }" << std::endl;
901  edm::ParameterSetID psid(idBranch.first);
902  ParameterSetMap::const_iterator itpsm = psm_.find(psid);
903  if (psm_.end() == itpsm) {
904  ++errorCount_;
905  errorLog_ << "No ParameterSetID for " << psid << std::endl;
906  exitCode_ = 1;
907  } else {
908  sout << " parameters: ";
909  prettyPrint(sout, edm::ParameterSet((*itpsm).second.pset()), " ", " ");
910  sout << std::endl;
911  }
912  if (showDependencies_) {
913  sout << " dependencies: {" << std::endl;
914  std::set<edm::ParentageID> parentageIDs;
915  for (auto const& branch : branchIDs) {
916  //Save these BranchIDs
917  std::set<edm::ParentageID> const& temp = perProductParentage[branch];
918  parentageIDs.insert(temp.begin(), temp.end());
919  }
920  for (auto const& parentID : parentageIDs) {
921  edm::Parentage const* parentage = registry.getMapped(parentID);
922  if (nullptr != parentage) {
923  for (auto const& branch : parentage->parents()) {
924  sout << " " << branchIDToBranchName[branch] << std::endl;
925  }
926  } else {
927  sout << " ERROR:parentage info not in registry ParentageID=" << parentID << std::endl;
928  }
929  }
930  if (parentageIDs.empty()) {
931  sout << " no dependencies recorded (event may not contain data from this module)" << std::endl;
932  }
933  sout << " }" << std::endl;
934  }
935  } // end loop over PSetIDs
936  if (extendedAncestors_) {
937  sout << " extendedAncestors: {" << std::endl;
938  std::set<edm::BranchID> ancestorBranchIDs;
939  for (auto const& branchID : allBranchIDsForLabelAndProcess) {
940  addAncestors(branchID, ancestorBranchIDs, sout, perProductParentage);
941  }
942  for (auto const& ancestorBranchID : ancestorBranchIDs) {
943  sout << " " << branchIDToBranchName[ancestorBranchID] << "\n";
944  }
945  sout << " }" << std::endl;
946  }
947 
948  if (extendedDescendants_) {
949  sout << " extendedDescendants: {" << std::endl;
950  std::set<edm::BranchID> descendantBranchIDs;
951  for (auto const& branchID : allBranchIDsForLabelAndProcess) {
952  addDescendants(branchID, descendantBranchIDs, sout, parentToChildren);
953  }
954  for (auto const& descendantBranchID : descendantBranchIDs) {
955  sout << " " << branchIDToBranchName[descendantBranchID] << "\n";
956  }
957  sout << " }" << std::endl;
958  }
959  bool foundMatch = true;
960  if (!findMatch_.empty()) {
961  for (auto const& stringToFind : findMatch_) {
962  if (sout.str().find(stringToFind) == std::string::npos) {
963  foundMatch = false;
964  break;
965  }
966  }
967  }
968  if (foundMatch) {
969  std::cout << sout.str() << std::endl;
970  }
971  } // end loop over module label/process
972 
974  std::cout << "---------Other Modules---------" << std::endl;
975  historyGraph_.printOtherModulesHistory(psm_, moduleToIdBranches, findMatch_, errorLog_);
976  } else if (!productRegistryPresent_) {
977  std::cout << "---------All Modules---------" << std::endl;
978  historyGraph_.printOtherModulesHistory(psm_, moduleToIdBranches, findMatch_, errorLog_);
979  }
980 
981  if (!excludeESModules_) {
982  std::cout << "---------EventSetup---------" << std::endl;
983  historyGraph_.printEventSetupHistory(psm_, findMatch_, errorLog_);
984  }
985 
986  if (showTopLevelPSets_) {
987  std::cout << "---------Top Level PSets---------" << std::endl;
988  historyGraph_.printTopLevelPSetsHistory(psm_, findMatch_, errorLog_);
989  }
990  if (errorCount_ != 0) {
991  exitCode_ = 1;
992  }
993 }

References addAncestors(), addDescendants(), cms::cuda::assert(), MicroEventContent_cff::branch, edm::BranchTypeToBranchEntryInfoBranchName(), edm::BranchTypeToMetaDataTreeName(), edm::BranchTypeToProductProvenanceBranchName(), edm::BranchTypeToProductTreeName(), beam_dqm_sourceclient-live_cfg::cerr, gather_cfg::cout, dontPrintProducts_, dumpEventFilteringParameterSets_(), dumpParameterSetForID_(), dumpProcessHistory_(), dumpPSetID_, edm::ParameterSet::empty(), errorCount_, errorLog_, Exception, excludeESModules_, edm::ParameterSet::existsAs(), exitCode_, extendedAncestors_, extendedDescendants_, findMatch_, edm::propagate_const< T >::get(), edm::ParentageRegistry::getMapped(), edm::pset::Registry::getMapped(), edm::ParameterSet::getParameterSet(), historyGraph_, mps_fire::i, edm::Parentage::id(), edm::ParameterSet::id(), edm::poolNames::idToParameterSetBlobsBranchName(), edm::InEvent, info(), input, inputFile_, edm::ParentageRegistry::insertMapped(), edm::pset::Registry::insertMapped(), edm::ParentageRegistry::instance(), edm::pset::Registry::instance(), edm::ParameterSet::isRegistered(), B2GTnPMonitor_cfi::item, edm::poolNames::metaDataTreeName(), edm::poolNames::moduleDescriptionMapBranchName(), HerwigMaxPtPartonFilter_cfi::moduleLabel, edm::numEntries(), edm::poolNames::parameterSetMapBranchName(), edm::poolNames::parameterSetsTreeName(), edm::poolNames::parentageBranchName(), edm::poolNames::parentageTreeName(), edm::Parentage::parents(), phc_, phv_, prettyPrint(), LaserDQM_cfg::process, edm::poolNames::processHistoryBranchName(), edm::poolNames::processHistoryMapBranchName(), edm::poolNames::productDescriptionBranchName(), edm::ProductRegistry::productListUpdator(), productRegistryPresent_, muonDTDigis_cfi::pset, psm_, reg_, edm::ParameterSet::registerIt(), alignCSCRings::s, edm::setIsMergeable(), showDependencies_, showOtherModules_, showTopLevelPSets_, edm::sort_all(), source, AlCaHLTBitMon_QueryRunRegistry::string, groupFilesInBlocks::temp, triggerPaths, triggerResults, tier0::unique(), and x.

Referenced by dump().

Member Data Documentation

◆ dontPrintProducts_

bool ProvenanceDumper::dontPrintProducts_
private

Definition at line 488 of file EdmProvDump.cc.

Referenced by work_().

◆ dumpPSetID_

std::string ProvenanceDumper::dumpPSetID_
private

Definition at line 489 of file EdmProvDump.cc.

Referenced by work_().

◆ errorCount_

int ProvenanceDumper::errorCount_
private

Definition at line 474 of file EdmProvDump.cc.

Referenced by printErrors(), and work_().

◆ errorLog_

std::stringstream ProvenanceDumper::errorLog_
private

Definition at line 473 of file EdmProvDump.cc.

Referenced by printErrors(), and work_().

◆ excludeESModules_

bool ProvenanceDumper::excludeESModules_
private

Definition at line 483 of file EdmProvDump.cc.

Referenced by work_().

◆ exitCode_

int ProvenanceDumper::exitCode_
private

Definition at line 472 of file EdmProvDump.cc.

Referenced by exitCode(), and work_().

◆ extendedAncestors_

bool ProvenanceDumper::extendedAncestors_
private

Definition at line 481 of file EdmProvDump.cc.

Referenced by work_().

◆ extendedDescendants_

bool ProvenanceDumper::extendedDescendants_
private

Definition at line 482 of file EdmProvDump.cc.

Referenced by work_().

◆ filename_

std::string ProvenanceDumper::filename_
private

Definition at line 470 of file EdmProvDump.cc.

◆ findMatch_

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

Definition at line 487 of file EdmProvDump.cc.

Referenced by work_().

◆ historyGraph_

HistoryNode ProvenanceDumper::historyGraph_
private

Definition at line 479 of file EdmProvDump.cc.

Referenced by dumpProcessHistory_(), and work_().

◆ inputFile_

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

Definition at line 471 of file EdmProvDump.cc.

Referenced by work_().

◆ phc_

edm::ProcessConfigurationVector ProvenanceDumper::phc_
private

Definition at line 476 of file EdmProvDump.cc.

Referenced by work_().

◆ phv_

edm::ProcessHistoryVector ProvenanceDumper::phv_
private

Definition at line 477 of file EdmProvDump.cc.

Referenced by dumpProcessHistory_(), and work_().

◆ productRegistryPresent_

bool ProvenanceDumper::productRegistryPresent_
private

Definition at line 485 of file EdmProvDump.cc.

Referenced by work_().

◆ psm_

ParameterSetMap ProvenanceDumper::psm_
private

Definition at line 478 of file EdmProvDump.cc.

Referenced by dumpParameterSetForID_(), and work_().

◆ reg_

edm::ProductRegistry ProvenanceDumper::reg_
private

Definition at line 475 of file EdmProvDump.cc.

Referenced by work_().

◆ showDependencies_

bool ProvenanceDumper::showDependencies_
private

Definition at line 480 of file EdmProvDump.cc.

Referenced by work_().

◆ showOtherModules_

bool ProvenanceDumper::showOtherModules_
private

Definition at line 484 of file EdmProvDump.cc.

Referenced by work_().

◆ showTopLevelPSets_

bool ProvenanceDumper::showTopLevelPSets_
private

Definition at line 486 of file EdmProvDump.cc.

Referenced by work_().

edm::ParameterSet::registerIt
ParameterSet const & registerIt()
Definition: ParameterSet.cc:106
edm::poolNames::idToParameterSetBlobsBranchName
std::string const & idToParameterSetBlobsBranchName()
Definition: BranchType.cc:216
edm::ParameterSetID
Hash< ParameterSetType > ParameterSetID
Definition: ParameterSetID.h:21
edm::pset::Registry::instance
static Registry * instance()
Definition: Registry.cc:12
edm::Parentage::parents
std::vector< BranchID > const & parents() const
Definition: Parentage.h:44
mps_fire.i
i
Definition: mps_fire.py:355
input
static const std::string input
Definition: EdmProvDump.cc:48
ProvenanceDumper::reg_
edm::ProductRegistry reg_
Definition: EdmProvDump.cc:475
ProvenanceDumper::phv_
edm::ProcessHistoryVector phv_
Definition: EdmProvDump.cc:477
edm::poolNames::eventTreeName
std::string const & eventTreeName()
Definition: BranchType.cc:218
IdToBranches
std::map< std::string, std::vector< edm::BranchDescription > > IdToBranches
Definition: EdmProvDump.cc:37
ProvenanceDumper::findMatch_
std::vector< std::string > findMatch_
Definition: EdmProvDump.cc:487
edm::setIsMergeable
void setIsMergeable(BranchDescription &)
Definition: setIsMergeable.cc:15
edm::sort_all
void sort_all(RandomAccessSequence &s)
wrappers for std::sort
Definition: Algorithms.h:92
MicroEventContent_cff.branch
branch
Definition: MicroEventContent_cff.py:152
h
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
Definition: L1TUtmAlgorithmRcd.h:4
prettyPrint
static std::ostream & prettyPrint(std::ostream &oStream, edm::ParameterSet const &iPSet, std::string const &iIndent, std::string const &iIndentDelta)
Definition: EdmProvDump.cc:406
gather_cfg.cout
cout
Definition: gather_cfg.py:144
edm::ParentageRegistry::instance
static ParentageRegistry * instance()
Definition: ParentageRegistry.cc:4
triggerResults
static const std::string triggerResults
Definition: EdmProvDump.cc:45
edm::poolNames::parameterSetsTreeName
std::string const & parameterSetsTreeName()
Definition: BranchType.cc:214
ModuleToIdBranches
std::map< std::pair< std::string, std::string >, IdToBranches > ModuleToIdBranches
Definition: EdmProvDump.cc:38
cms::cuda::assert
assert(be >=bs)
ProvenanceDumper::dumpParameterSetForID_
void dumpParameterSetForID_(edm::ParameterSetID const &id)
Definition: EdmProvDump.cc:577
info
static const TGPicture * info(bool iBackgroundIsBlack)
Definition: FWCollectionSummaryWidget.cc:152
ProvenanceDumper::showTopLevelPSets_
bool showTopLevelPSets_
Definition: EdmProvDump.cc:486
edm::BranchTypeToProductTreeName
std::string const & BranchTypeToProductTreeName(BranchType const &branchType)
Definition: BranchType.cc:102
ProvenanceDumper::showOtherModules_
bool showOtherModules_
Definition: EdmProvDump.cc:484
DDAxes::x
edm::ParameterSet::id
ParameterSetID id() const
Definition: ParameterSet.cc:182
edm::ParameterSet::existsAs
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:160
patZpeak.events
events
Definition: patZpeak.py:20
groupFilesInBlocks.temp
list temp
Definition: groupFilesInBlocks.py:142
edm::BranchTypeToBranchEntryInfoBranchName
std::string const & BranchTypeToBranchEntryInfoBranchName(BranchType const &branchType)
Definition: BranchType.cc:129
ProvenanceDumper::phc_
edm::ProcessConfigurationVector phc_
Definition: EdmProvDump.cc:476
edm::ProductRegistry
Definition: ProductRegistry.h:34
edm::ParameterSetMap
std::map< ParameterSetID, ParameterSetBlob > ParameterSetMap
Definition: ParameterSetConverter.h:40
edm::ProcessHistoryMap
std::map< ProcessHistoryID, ProcessHistory > ProcessHistoryMap
Definition: ProcessHistoryRegistry.h:15
ProvenanceDumper::errorCount_
int errorCount_
Definition: EdmProvDump.cc:474
edm::propagate_const::get
element_type const * get() const
Definition: propagate_const.h:64
alignCSCRings.s
s
Definition: alignCSCRings.py:92
edm::poolNames::parentageBranchName
std::string const & parentageBranchName()
Definition: BranchType.cc:159
trigger::size_type
uint16_t size_type
Definition: TriggerTypeDefs.h:18
edm::ProductRegistry::productListUpdator
ProductList & productListUpdator()
Definition: ProductRegistry.h:78
edm::poolNames::processHistoryBranchName
std::string const & processHistoryBranchName()
Definition: BranchType.cc:180
ProvenanceDumper::inputFile_
edm::propagate_const< std::unique_ptr< TFile > > inputFile_
Definition: EdmProvDump.cc:471
edm::Parentage::id
ParentageID id() const
Definition: Parentage.cc:17
edm::BranchID
Definition: BranchID.h:14
ProvenanceDumper::extendedDescendants_
bool extendedDescendants_
Definition: EdmProvDump.cc:482
source
static const std::string source
Definition: EdmProvDump.cc:47
ProvenanceDumper::extendedAncestors_
bool extendedAncestors_
Definition: EdmProvDump.cc:481
corrVsCorr.filename
filename
Definition: corrVsCorr.py:123
edm::Hash< ParameterSetType >
edm::InEvent
Definition: BranchType.h:11
h
edm::poolNames::parameterSetMapBranchName
std::string const & parameterSetMapBranchName()
Definition: BranchType.cc:171
ProvenanceDumper::psm_
ParameterSetMap psm_
Definition: EdmProvDump.cc:478
edm::poolNames::parentageTreeName
std::string const & parentageTreeName()
Definition: BranchType.cc:157
ProvenanceDumper::addDescendants
void addDescendants(edm::BranchID const &branchID, std::set< edm::BranchID > &descendantBranchIDs, std::ostringstream &sout, std::map< edm::BranchID, std::set< edm::BranchID >> &parentToChildren) const
Definition: EdmProvDump.cc:1016
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::numEntries
Long64_t numEntries(TFile *hdl, std::string const &trname)
Definition: CollUtil.cc:50
edm::Parentage
Definition: Parentage.h:25
ProvenanceDumper::work_
void work_()
Definition: EdmProvDump.cc:635
ProvenanceDumper::productRegistryPresent_
bool productRegistryPresent_
Definition: EdmProvDump.cc:485
ProvenanceDumper::dontPrintProducts_
bool dontPrintProducts_
Definition: EdmProvDump.cc:488
edm::poolNames::eventSelectionsBranchName
std::string const & eventSelectionsBranchName()
Definition: BranchType.cc:210
edm::ParameterSet
Definition: ParameterSet.h:36
ProvenanceDumper::dumpEventFilteringParameterSets_
void dumpEventFilteringParameterSets_(TFile *file)
Definition: EdmProvDump.cc:548
edm::poolNames::productDescriptionBranchName
std::string const & productDescriptionBranchName()
Definition: BranchType.cc:165
edm::ParentageRegistry::getMapped
bool getMapped(key_type const &k, value_type &result) const
Definition: ParentageRegistry.cc:9
edm::ParentageRegistry
Definition: ParentageRegistry.h:12
LaserDQM_cfg.process
process
Definition: LaserDQM_cfg.py:3
beam_dqm_sourceclient-live_cfg.cerr
cerr
Definition: beam_dqm_sourceclient-live_cfg.py:17
edm::BranchTypeToMetaDataTreeName
std::string const & BranchTypeToMetaDataTreeName(BranchType const &branchType)
Definition: BranchType.cc:106
FrontierConditions_GlobalTag_cff.file
file
Definition: FrontierConditions_GlobalTag_cff.py:13
edm::ProcessHistoryVector
std::vector< ProcessHistory > ProcessHistoryVector
Definition: ProcessHistoryRegistry.h:16
ProvenanceDumper::addAncestors
void addAncestors(edm::BranchID const &branchID, std::set< edm::BranchID > &ancestorBranchIDs, std::ostringstream &sout, std::map< edm::BranchID, std::set< edm::ParentageID >> &perProductParentage) const
Definition: EdmProvDump.cc:995
edm::poolNames::processHistoryMapBranchName
std::string const & processHistoryMapBranchName()
Definition: BranchType.cc:177
ProvenanceDumper::excludeESModules_
bool excludeESModules_
Definition: EdmProvDump.cc:483
triggerPaths
static const std::string triggerPaths
Definition: EdmProvDump.cc:46
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
ProvenanceDumper::dumpProcessHistory_
void dumpProcessHistory_()
Definition: EdmProvDump.cc:599
ProvenanceDumper::showDependencies_
bool showDependencies_
Definition: EdmProvDump.cc:480
edm::ParameterSet::isRegistered
bool isRegistered() const
Definition: ParameterSet.h:60
edm::pset::Registry::insertMapped
bool insertMapped(value_type const &v, bool forceUpdate=false)
Definition: Registry.cc:32
edm::BranchTypeToProductProvenanceBranchName
std::string const & BranchTypeToProductProvenanceBranchName(BranchType const &BranchType)
Definition: BranchType.cc:134
edm::ParentageRegistry::insertMapped
bool insertMapped(value_type const &v)
Definition: ParentageRegistry.cc:24
tier0.unique
def unique(seq, keepstr=True)
Definition: tier0.py:24
edm::poolNames::metaDataTreeName
std::string const & metaDataTreeName()
Definition: BranchType.cc:162
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
ProvenanceDumper::dumpEventFilteringParameterSets
void dumpEventFilteringParameterSets(edm::EventSelectionIDVector const &ids)
Definition: EdmProvDump.cc:533
relativeConstraints.empty
bool empty
Definition: relativeConstraints.py:46
Exception
Definition: hltDiff.cc:246
ProvenanceDumper::exitCode_
int exitCode_
Definition: EdmProvDump.cc:472
edm::History
Definition: History.h:22
edm::poolNames::eventHistoryTreeName
std::string const & eventHistoryTreeName()
Definition: BranchType.cc:222
class-composition.child
child
Definition: class-composition.py:91
cms::Exception
Definition: Exception.h:70
HerwigMaxPtPartonFilter_cfi.moduleLabel
moduleLabel
Definition: HerwigMaxPtPartonFilter_cfi.py:4
edm::EventSelectionIDVector
std::vector< EventSelectionID > EventSelectionIDVector
Definition: EventSelectionID.h:16
ProvenanceDumper::filename_
std::string filename_
Definition: EdmProvDump.cc:470
child
Definition: simpleInheritance.h:11
edm::pset::Registry::getMapped
bool getMapped(key_type const &k, value_type &result) const
Definition: Registry.cc:17
class-composition.parent
parent
Definition: class-composition.py:88
edm::ParameterSet::empty
bool empty() const
Definition: ParameterSet.h:190
ProvenanceDumper::historyGraph_
HistoryNode historyGraph_
Definition: EdmProvDump.cc:479
edm::ParameterSet::getParameterSet
ParameterSet const & getParameterSet(std::string const &) const
Definition: ParameterSet.cc:2121
edm::pset::Registry
Definition: Registry.h:26
edm::poolNames::moduleDescriptionMapBranchName
std::string const & moduleDescriptionMapBranchName()
Definition: BranchType.cc:174
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
edm::poolNames::eventHistoryBranchName
std::string const & eventHistoryBranchName()
Definition: BranchType.cc:207
ProvenanceDumper::errorLog_
std::stringstream errorLog_
Definition: EdmProvDump.cc:473
ProvenanceDumper::dumpPSetID_
std::string dumpPSetID_
Definition: EdmProvDump.cc:489