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

538  :
540  inputFile_(makeTFile(filename)),
541  exitCode_(0),
542  errorLog_(),
543  errorCount_(0),
544  showDependencies_(showDependencies),
545  extendedAncestors_(extendedAncestors),
546  extendedDescendants_(extendedDescendants),
547  excludeESModules_(excludeESModules),
548  showOtherModules_(showOtherModules),
549  showTopLevelPSets_(showTopLevelPSets),
550  findMatch_(findMatch),
551  dontPrintProducts_(dontPrintProducts) {
552 }
std::stringstream errorLog_
Definition: EdmProvDump.cc:507
std::unique_ptr< TFile > inputFile_
Definition: EdmProvDump.cc:505
std::string filename_
Definition: EdmProvDump.cc:504
std::vector< std::string > findMatch_
Definition: EdmProvDump.cc:520
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 1018 of file EdmProvDump.cc.

References edm::ParentageRegistry::getMapped(), edm::ParentageRegistry::instance(), edm::Parentage::parents(), and PhysicsTools::registry.

Referenced by work_().

1019  {
1020 
1022 
1023  std::set<edm::ParentageID> const& parentIDs = perProductParentage[branchID];
1024  for (auto const& parentageID : parentIDs) {
1025  edm::Parentage const* parentage = registry.getMapped(parentageID);
1026  if(0 != parentage) {
1027  for(auto const& branch : parentage->parents()) {
1028 
1029  if(ancestorBranchIDs.insert(branch).second) {
1030  addAncestors(branch, ancestorBranchIDs, sout, perProductParentage);
1031  }
1032  }
1033  } else {
1034  sout << " ERROR:parentage info not in registry ParentageID=" << parentageID << std::endl;
1035  }
1036  }
1037 }
void addAncestors(edm::BranchID const &branchID, std::set< edm::BranchID > &ancestorBranchIDs, std::ostringstream &sout, std::map< edm::BranchID, std::set< edm::ParentageID > > &perProductParentage) const
std::vector< BranchID > const & parents() const
Definition: Parentage.h:37
bool getMapped(key_type const &k, value_type &result) const
static Interceptor::Registry registry("Interceptor")
static ParentageRegistry * instance()
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 1040 of file EdmProvDump.cc.

Referenced by work_().

1041  {
1042 
1043  for (auto const& childBranchID : parentToChildren[branchID]) {
1044  if (descendantBranchIDs.insert(childBranchID).second) {
1045  addDescendants(childBranchID, descendantBranchIDs, sout, parentToChildren);
1046  }
1047  }
1048 }
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 555 of file EdmProvDump.cc.

References work_().

Referenced by main().

555  {
556  work_();
557 }
void ProvenanceDumper::dumpEventFilteringParameterSets ( edm::EventSelectionIDVector const &  ids)
private

Definition at line 570 of file EdmProvDump.cc.

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

Referenced by dumpEventFilteringParameterSets_().

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

Definition at line 588 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_().

588  {
589 
590  TTree* history = dynamic_cast<TTree*>(file->Get(edm::poolNames::eventHistoryTreeName().c_str()));
591  if(history != 0) {
592  edm::History h;
593  edm::History* ph = &h;
594 
595  history->SetBranchAddress(edm::poolNames::eventHistoryBranchName().c_str(), &ph);
596  if(history->GetEntry(0) <= 0) {
597  std::cout << "No event filtering information is available; the event history tree has no entries\n";
598  } else {
600  }
601  } else {
602  TTree* events = dynamic_cast<TTree*>(file->Get(edm::poolNames::eventTreeName().c_str()));
603  assert (events != 0);
604  TBranch* eventSelectionsBranch = events->GetBranch(edm::poolNames::eventSelectionsBranchName().c_str());
605  assert (eventSelectionsBranch != 0);
607  edm::EventSelectionIDVector* pids = &ids;
608  eventSelectionsBranch->SetAddress(&pids);
609  if(eventSelectionsBranch->GetEntry(0) <= 0) {
610  std::cout << "No event filtering information is available; the event selections branch has no entries\n";
611  } else {
613  }
614  }
615 }
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:570
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 618 of file EdmProvDump.cc.

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

Referenced by dumpEventFilteringParameterSets().

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

Definition at line 640 of file EdmProvDump.cc.

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

Referenced by work_().

640  {
641  std::cout << "Processing History:" << std::endl;
642  if(1 == phv_.size()) {
643  std::cout << *phv_.begin();
644  historyGraph_.addChild(HistoryNode(*(phv_.begin()->begin()), 1));
645  } else {
646  std::map<edm::ProcessConfigurationID, unsigned int> simpleIDs;
647  for(auto const& ph : phv_) {
648  //loop over the history entries looking for matches
649  HistoryNode* parent = &historyGraph_;
650  for(auto const& pc : ph) {
651  if(parent->size() == 0) {
652  unsigned int id = simpleIDs[pc.id()];
653  if(0 == id) {
654  id = 1;
655  simpleIDs[pc.id()] = id;
656  }
657  parent->addChild(HistoryNode(pc, id));
658  parent = parent->lastChildAddress();
659  } else {
660  //see if this is unique
661  bool isUnique = true;
662  for(auto& child : *parent) {
663  if(child.configurationID() == pc.id()) {
664  isUnique = false;
665  parent = &child;
666  break;
667  }
668  }
669  if(isUnique) {
670  simpleIDs[pc.id()] = parent->size() + 1;
671  parent->addChild(HistoryNode(pc, simpleIDs[pc.id()]));
672  parent = parent->lastChildAddress();
673  }
674  }
675  }
676  }
677  historyGraph_.printHistory();
678  }
679 }
list parent
Definition: dbtoconf.py:74
HistoryNode historyGraph_
Definition: EdmProvDump.cc:513
edm::ProcessHistoryVector phv_
Definition: EdmProvDump.cc:511
tuple cout
Definition: gather_cfg.py:121
int ProvenanceDumper::exitCode ( ) const

Definition at line 565 of file EdmProvDump.cc.

References exitCode_.

Referenced by main().

565  {
566  return exitCode_;
567 }
ProvenanceDumper& ProvenanceDumper::operator= ( ProvenanceDumper const &  )
delete
void ProvenanceDumper::printErrors ( std::ostream &  os)

Definition at line 560 of file EdmProvDump.cc.

References errorCount_, and errorLog_.

Referenced by main().

560  {
561  if(errorCount_ > 0) os << errorLog_.str() << std::endl;
562 }
std::stringstream errorLog_
Definition: EdmProvDump.cc:507
void ProvenanceDumper::work_ ( )
private

Definition at line 682 of file EdmProvDump.cc.

References addAncestors(), addDescendants(), edm::BranchTypeToBranchEntryInfoBranchName(), edm::BranchTypeToMetaDataTreeName(), edm::BranchTypeToProductProvenanceBranchName(), edm::BranchTypeToProductTreeName(), dtNoiseDBValidation_cfg::cerr, gather_cfg::cout, dontPrintProducts_, dumpEventFilteringParameterSets_(), dumpProcessHistory_(), edm::ParameterSet::empty(), errorCount_, errorLog_, excludeESModules_, edm::ParameterSet::existsAs(), exitCode_, extendedAncestors_, extendedDescendants_, findMatch_, edm::ParentageRegistry::getMapped(), edm::pset::Registry::getMapped(), edm::ParameterSet::getParameterSet(), historyGraph_, 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(), 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(), LaserDQM_cfg::process, edm::poolNames::processHistoryBranchName(), edm::poolNames::processHistoryMapBranchName(), edm::poolNames::productDescriptionBranchName(), edm::ProductRegistry::productListUpdator(), psm_, reg_, edm::ParameterSet::registerIt(), PhysicsTools::registry, alignCSCRings::s, edm::ParameterSet::setID(), showDependencies_, showOtherModules_, showTopLevelPSets_, edm::sort_all(), source, AlCaHLTBitMon_QueryRunRegistry::string, groupFilesInBlocks::temp, triggerPaths, and triggerResults.

Referenced by dump().

682  {
683 
684  TTree* meta = dynamic_cast<TTree*>(inputFile_->Get(edm::poolNames::metaDataTreeName().c_str()));
685  assert(0 != meta);
686 
687  edm::ProductRegistry* pReg = &reg_;
688  meta->SetBranchAddress(edm::poolNames::productDescriptionBranchName().c_str(), &pReg);
689 
690  ParameterSetMap* pPsm = &psm_;
691  if(meta->FindBranch(edm::poolNames::parameterSetMapBranchName().c_str()) != 0) {
692  meta->SetBranchAddress(edm::poolNames::parameterSetMapBranchName().c_str(), &pPsm);
693  } else {
694  TTree* psetTree = dynamic_cast<TTree *>(inputFile_->Get(edm::poolNames::parameterSetsTreeName().c_str()));
695  assert(0 != psetTree);
696  typedef std::pair<edm::ParameterSetID, edm::ParameterSetBlob> IdToBlobs;
697  IdToBlobs idToBlob;
698  IdToBlobs* pIdToBlob = &idToBlob;
699  psetTree->SetBranchAddress(edm::poolNames::idToParameterSetBlobsBranchName().c_str(), &pIdToBlob);
700  for(long long i = 0; i != psetTree->GetEntries(); ++i) {
701  psetTree->GetEntry(i);
702  psm_.insert(idToBlob);
703  }
704  }
705 
707  if(meta->FindBranch(edm::poolNames::processHistoryBranchName().c_str()) != 0) {
708  meta->SetBranchAddress(edm::poolNames::processHistoryBranchName().c_str(), &pPhv);
709  }
710 
712  edm::ProcessHistoryMap* pPhm = &phm;
713  if(meta->FindBranch(edm::poolNames::processHistoryMapBranchName().c_str()) != 0) {
714  meta->SetBranchAddress(edm::poolNames::processHistoryMapBranchName().c_str(), &pPhm);
715  }
716 
717  if(meta->FindBranch(edm::poolNames::moduleDescriptionMapBranchName().c_str()) != 0) {
718  if(meta->GetBranch(edm::poolNames::moduleDescriptionMapBranchName().c_str())->GetSplitLevel() != 0) {
719  meta->SetBranchStatus((edm::poolNames::moduleDescriptionMapBranchName() + ".*").c_str(), 0);
720  } else {
721  meta->SetBranchStatus(edm::poolNames::moduleDescriptionMapBranchName().c_str(), 0);
722  }
723  }
724 
725  meta->GetEntry(0);
726  assert(nullptr != pReg);
727 
729  for(auto const& item : psm_) {
730  edm::ParameterSet pset(item.second.pset());
731  pset.setID(item.first);
732  psetRegistry.insertMapped(pset);
733  }
734 
735 
736  if(!phv_.empty()) {
737  for(auto const& history : phv_) {
738  for(auto const& process : history) {
739  phc_.push_back(process);
740  }
741  }
743  phc_.erase(std::unique(phc_.begin(), phc_.end()), phc_.end());
744 
745  }
746  // backward compatibility
747  else if(!phm.empty()) {
748  for(auto const& history : phm) {
749  phv_.push_back(history.second);
750  for(auto const& process : history.second) {
751  phc_.push_back(process);
752  }
753  }
755  phc_.erase(std::unique(phc_.begin(), phc_.end()), phc_.end());
756  }
757 
758  //Prepare the parentage information if requested
759  std::map<edm::BranchID, std::set<edm::ParentageID> > perProductParentage;
760 
762  TTree* parentageTree = dynamic_cast<TTree*>(inputFile_->Get(edm::poolNames::parentageTreeName().c_str()));
763  if(nullptr == parentageTree) {
764  std::cerr << "ERROR, no Parentage tree available so can not show dependencies/n";
765  showDependencies_ = false;
766  extendedAncestors_ = false;
767  extendedDescendants_ = false;
768  } else {
769 
771 
772  std::vector<edm::ParentageID> orderedParentageIDs;
773  orderedParentageIDs.reserve(parentageTree->GetEntries());
774  for(Long64_t i = 0, numEntries = parentageTree->GetEntries(); i < numEntries; ++i) {
775  edm::Parentage parentageBuffer;
776  edm::Parentage *pParentageBuffer = &parentageBuffer;
777  parentageTree->SetBranchAddress(edm::poolNames::parentageBranchName().c_str(), &pParentageBuffer);
778  parentageTree->GetEntry(i);
779  registry.insertMapped(parentageBuffer);
780  orderedParentageIDs.push_back(parentageBuffer.id());
781  }
782  parentageTree->SetBranchAddress(edm::poolNames::parentageBranchName().c_str(), 0);
783 
784  TTree* eventMetaTree = dynamic_cast<TTree*>(inputFile_->Get(edm::BranchTypeToMetaDataTreeName(edm::InEvent).c_str()));
785  if(0 == eventMetaTree) {
786  eventMetaTree = dynamic_cast<TTree*>(inputFile_->Get(edm::BranchTypeToProductTreeName(edm::InEvent).c_str()));
787  }
788  if(0 == eventMetaTree) {
789  std::cerr << "ERROR, no '" << edm::BranchTypeToProductTreeName(edm::InEvent)<< "' Tree in file so can not show dependencies\n";
790  showDependencies_ = false;
791  extendedAncestors_ = false;
792  extendedDescendants_ = false;
793  } else {
794  TBranch* storedProvBranch = eventMetaTree->GetBranch(edm::BranchTypeToProductProvenanceBranchName(edm::InEvent).c_str());
795 
796  if(0!=storedProvBranch) {
797  std::vector<edm::StoredProductProvenance> info;
798  std::vector<edm::StoredProductProvenance>* pInfo = &info;
799  storedProvBranch->SetAddress(&pInfo);
800  for(Long64_t i = 0, numEntries = eventMetaTree->GetEntries(); i < numEntries; ++i) {
801  storedProvBranch->GetEntry(i);
802  for(auto const& item : info) {
803  edm::BranchID bid(item.branchID_);
804  perProductParentage[bid].insert(orderedParentageIDs[item.parentageIDIndex_]);
805  }
806  }
807  } else {
808  //backwards compatible check
809  TBranch* productProvBranch = eventMetaTree->GetBranch(edm::BranchTypeToBranchEntryInfoBranchName(edm::InEvent).c_str());
810  if (0 != productProvBranch) {
811  std::vector<edm::ProductProvenance> info;
812  std::vector<edm::ProductProvenance>* pInfo = &info;
813  productProvBranch->SetAddress(&pInfo);
814  for(Long64_t i = 0, numEntries = eventMetaTree->GetEntries(); i < numEntries; ++i) {
815  productProvBranch->GetEntry(i);
816  for(auto const& item : info) {
817  perProductParentage[item.branchID()].insert(item.parentageID());
818  }
819  }
820  } else {
821  std::cerr <<" ERROR, could not find provenance information so can not show dependencies\n";
822  showDependencies_=false;
823  extendedAncestors_ = false;
824  extendedDescendants_ = false;
825  }
826  }
827  }
828  }
829  }
830 
831  std::map<edm::BranchID, std::set<edm::BranchID> > parentToChildren;
833 
834  if (extendedDescendants_) {
835  for (auto const& itParentageSet : perProductParentage) {
836  edm::BranchID childBranchID = itParentageSet.first;
837  for (auto const& itParentageID : itParentageSet.second) {
838  edm::Parentage const* parentage = registry.getMapped(itParentageID);
839  if(0 != parentage) {
840  for(auto const& branch : parentage->parents()) {
841  parentToChildren[branch].insert(childBranchID);
842  }
843  } else {
844  std::cerr << " ERROR:parentage info not in registry ParentageID=" << itParentageID << std::endl;
845  }
846  }
847  }
848  }
849 
851 
853 
854  std::cout << "---------Producers with data in file---------" << std::endl;
855 
856  //using edm::ParameterSetID as the key does not work
857  // typedef std::map<edm::ParameterSetID, std::vector<edm::BranchDescription> > IdToBranches
858  ModuleToIdBranches moduleToIdBranches;
859  //IdToBranches idToBranches;
860 
861  std::map<edm::BranchID, std::string> branchIDToBranchName;
862 
863  for(auto const& processConfig : phc_) {
864  edm::ParameterSet const* processParameterSet = edm::pset::Registry::instance()->getMapped(processConfig.parameterSetID());
865  if(nullptr == processParameterSet || processParameterSet->empty()) {
866  continue;
867  }
868  for(auto& item : reg_.productListUpdator()) {
869  auto& product = item.second;
870  if(product.processName() != processConfig.processName()) {
871  continue;
872  }
873  //force it to rebuild the branch name
874  product.init();
875 
877  branchIDToBranchName[product.branchID()] = product.branchName();
878  }
879  /*
880  std::cout << product.branchName()
881  << " id " << product.productID() << std::endl;
882  */
883  std::string moduleLabel = product.moduleLabel();
884  if(moduleLabel == source) {
885  moduleLabel = input;
886  } else if (moduleLabel == triggerResults) {
887  moduleLabel = triggerPaths;
888  }
889 
890  std::stringstream s;
891 
892  if(processParameterSet->existsAs<edm::ParameterSet>(moduleLabel)) {
893  edm::ParameterSet const& moduleParameterSet = processParameterSet->getParameterSet(moduleLabel);
894  if(!moduleParameterSet.isRegistered()) {
895  edm::ParameterSet moduleParameterSetCopy = processParameterSet->getParameterSet(moduleLabel);
896  moduleParameterSetCopy.registerIt();
897  s << moduleParameterSetCopy.id();
898  } else {
899  s << moduleParameterSet.id();
900  }
901  moduleToIdBranches[std::make_pair(product.processName(), product.moduleLabel())][s.str()].push_back(product);
902  }
903  }
904  }
905 
906  for(auto const& item : moduleToIdBranches) {
907  std::ostringstream sout;
908  sout << "Module: " << item.first.second << " " << item.first.first << std::endl;
909  std::set<edm::BranchID> allBranchIDsForLabelAndProcess;
910  IdToBranches const& idToBranches = item.second;
911  for(auto const& idBranch : idToBranches) {
912  sout << " PSet id:" << idBranch.first << std::endl;
913  if(!dontPrintProducts_) {
914  sout << " products: {" << std::endl;
915  }
916  std::set<edm::BranchID> branchIDs;
917  for(auto const& branch : idBranch.second) {
918  if(!dontPrintProducts_) {
919  sout << " " << branch.branchName() << std::endl;
920  }
921  branchIDs.insert(branch.branchID());
922  allBranchIDsForLabelAndProcess.insert(branch.branchID());
923  }
924  sout << " }" << std::endl;
925  edm::ParameterSetID psid(idBranch.first);
926  ParameterSetMap::const_iterator itpsm = psm_.find(psid);
927  if(psm_.end() == itpsm) {
928  ++errorCount_;
929  errorLog_ << "No ParameterSetID for " << psid << std::endl;
930  exitCode_ = 1;
931  } else {
932  sout << " parameters: ";
933  prettyPrint(sout, edm::ParameterSet((*itpsm).second.pset()), " ", " ");
934  sout << std::endl;
935  }
936  if(showDependencies_) {
937 
938  sout << " dependencies: {" << std::endl;
939  std::set<edm::ParentageID> parentageIDs;
940  for(auto const& branch : branchIDs) {
941 
942  //Save these BranchIDs
943  std::set<edm::ParentageID> const& temp = perProductParentage[branch];
944  parentageIDs.insert(temp.begin(), temp.end());
945  }
946  for(auto const& parentID : parentageIDs) {
947  edm::Parentage const* parentage = registry.getMapped(parentID);
948  if(nullptr != parentage) {
949  for(auto const& branch : parentage->parents()) {
950  sout << " " << branchIDToBranchName[branch] << std::endl;
951  }
952  } else {
953  sout << " ERROR:parentage info not in registry ParentageID=" << parentID << std::endl;
954  }
955  }
956  if(parentageIDs.empty()) {
957  sout << " no dependencies recorded (event may not contain data from this module)" << std::endl;
958  }
959  sout << " }" << std::endl;
960  }
961  } // end loop over PSetIDs
962  if (extendedAncestors_) {
963  sout << " extendedAncestors: {" << std::endl;
964  std::set<edm::BranchID> ancestorBranchIDs;
965  for (auto const& branchID : allBranchIDsForLabelAndProcess) {
966  addAncestors(branchID, ancestorBranchIDs, sout, perProductParentage);
967  }
968  for (auto const& ancestorBranchID : ancestorBranchIDs) {
969  sout << " " << branchIDToBranchName[ancestorBranchID] << "\n";
970  }
971  sout << " }" << std::endl;
972  }
973 
974  if (extendedDescendants_) {
975  sout << " extendedDescendants: {" << std::endl;
976  std::set<edm::BranchID> descendantBranchIDs;
977  for (auto const& branchID : allBranchIDsForLabelAndProcess) {
978  addDescendants(branchID, descendantBranchIDs, sout, parentToChildren);
979  }
980  for (auto const& descendantBranchID : descendantBranchIDs) {
981  sout << " " << branchIDToBranchName[descendantBranchID] << "\n";
982  }
983  sout << " }" << std::endl;
984  }
985  bool foundMatch = true;
986  if(!findMatch_.empty()) {
987  for (auto const& stringToFind : findMatch_) {
988  if (sout.str().find(stringToFind) == std::string::npos) {
989  foundMatch = false;
990  break;
991  }
992  }
993  }
994  if (foundMatch) {
995  std::cout <<sout.str()<<std::endl;
996  }
997  } // end loop over module label/process
998  if(showOtherModules_) {
999  std::cout << "---------Other Modules---------" << std::endl;
1000  historyGraph_.printOtherModulesHistory(psm_, moduleToIdBranches, findMatch_, errorLog_);
1001  }
1002 
1003  if(!excludeESModules_) {
1004  std::cout << "---------EventSetup---------" << std::endl;
1005  historyGraph_.printEventSetupHistory(psm_, findMatch_, errorLog_);
1006  }
1007 
1008  if(showTopLevelPSets_) {
1009  std::cout << "---------Top Level PSets---------" << std::endl;
1010  historyGraph_.printTopLevelPSetsHistory(psm_, findMatch_, errorLog_);
1011  }
1012  if(errorCount_ != 0) {
1013  exitCode_ = 1;
1014  }
1015 }
std::stringstream errorLog_
Definition: EdmProvDump.cc:507
std::vector< ProcessHistory > ProcessHistoryVector
void setID(ParameterSetID const &id)
bool empty() const
Definition: ParameterSet.h:216
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
static const TGPicture * info(bool iBackgroundIsBlack)
std::string const & parentageTreeName()
Definition: BranchType.cc:158
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:184
ParameterSetID id() const
ParentageID id() const
Definition: Parentage.cc:19
edm::ProductRegistry reg_
Definition: EdmProvDump.cc:509
ParameterSetMap psm_
Definition: EdmProvDump.cc:512
void addAncestors(edm::BranchID const &branchID, std::set< edm::BranchID > &ancestorBranchIDs, std::ostringstream &sout, std::map< edm::BranchID, std::set< edm::ParentageID > > &perProductParentage) const
HistoryNode historyGraph_
Definition: EdmProvDump.cc:513
void dumpEventFilteringParameterSets_(TFile *file)
Definition: EdmProvDump.cc:588
edm::ProcessHistoryVector phv_
Definition: EdmProvDump.cc:511
std::string const & parameterSetsTreeName()
Definition: BranchType.cc:245
static std::string const input
Definition: EdmProvDump.cc:44
std::vector< BranchID > const & parents() const
Definition: Parentage.h:37
std::string const & processHistoryMapBranchName()
Definition: BranchType.cc:192
bool getMapped(key_type const &k, value_type &result) const
std::map< std::pair< std::string, std::string >, IdToBranches > ModuleToIdBranches
Definition: EdmProvDump.cc:37
Long64_t numEntries(TFile *hdl, std::string const &trname)
Definition: CollUtil.cc:50
bool getMapped(key_type const &k, value_type &result) const
Definition: Registry.cc:20
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:505
static std::string const triggerResults
Definition: EdmProvDump.cc:41
bool isRegistered() const
Definition: ParameterSet.h:63
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:443
std::string const & processHistoryBranchName()
Definition: BranchType.cc:197
std::map< std::string, std::vector< edm::BranchDescription > > IdToBranches
Definition: EdmProvDump.cc:36
void dumpProcessHistory_()
Definition: EdmProvDump.cc:640
edm::ProcessConfigurationVector phc_
Definition: EdmProvDump.cc:510
void sort_all(RandomAccessSequence &s)
wrappers for std::sort
Definition: Algorithms.h:120
ParameterSet const & getParameterSet(std::string const &) const
std::string const & parentageBranchName()
Definition: BranchType.cc:162
ProductList & productListUpdator()
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:520
std::map< ParameterSetID, ParameterSetBlob > ParameterSetMap
std::string const & productDescriptionBranchName()
Definition: BranchType.cc:172
std::string const & BranchTypeToProductProvenanceBranchName(BranchType const &BranchType)
Definition: BranchType.cc:130
tuple cout
Definition: gather_cfg.py:121
static Interceptor::Registry registry("Interceptor")
bool insertMapped(value_type const &v)
Definition: Registry.cc:37
tuple process
Definition: LaserDQM_cfg.py:3
static ParentageRegistry * instance()
static std::string const triggerPaths
Definition: EdmProvDump.cc:42
ParameterSet const & registerIt()
static std::string const source
Definition: EdmProvDump.cc:43
std::map< ProcessHistoryID, ProcessHistory > ProcessHistoryMap
std::string const & moduleDescriptionMapBranchName()
Definition: BranchType.cc:187
bool insertMapped(value_type const &v)
static Registry * instance()
Definition: Registry.cc:14

Member Data Documentation

bool ProvenanceDumper::dontPrintProducts_
private

Definition at line 521 of file EdmProvDump.cc.

Referenced by work_().

int ProvenanceDumper::errorCount_
private

Definition at line 508 of file EdmProvDump.cc.

Referenced by printErrors(), and work_().

std::stringstream ProvenanceDumper::errorLog_
private

Definition at line 507 of file EdmProvDump.cc.

Referenced by printErrors(), and work_().

bool ProvenanceDumper::excludeESModules_
private

Definition at line 517 of file EdmProvDump.cc.

Referenced by work_().

int ProvenanceDumper::exitCode_
private

Definition at line 506 of file EdmProvDump.cc.

Referenced by exitCode(), and work_().

bool ProvenanceDumper::extendedAncestors_
private

Definition at line 515 of file EdmProvDump.cc.

Referenced by work_().

bool ProvenanceDumper::extendedDescendants_
private

Definition at line 516 of file EdmProvDump.cc.

Referenced by work_().

std::string ProvenanceDumper::filename_
private

Definition at line 504 of file EdmProvDump.cc.

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

Definition at line 520 of file EdmProvDump.cc.

Referenced by work_().

HistoryNode ProvenanceDumper::historyGraph_
private

Definition at line 513 of file EdmProvDump.cc.

Referenced by dumpProcessHistory_(), and work_().

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

Definition at line 505 of file EdmProvDump.cc.

Referenced by work_().

edm::ProcessConfigurationVector ProvenanceDumper::phc_
private

Definition at line 510 of file EdmProvDump.cc.

Referenced by work_().

edm::ProcessHistoryVector ProvenanceDumper::phv_
private

Definition at line 511 of file EdmProvDump.cc.

Referenced by dumpProcessHistory_(), and work_().

ParameterSetMap ProvenanceDumper::psm_
private

Definition at line 512 of file EdmProvDump.cc.

Referenced by dumpParameterSetForID_(), and work_().

edm::ProductRegistry ProvenanceDumper::reg_
private

Definition at line 509 of file EdmProvDump.cc.

Referenced by work_().

bool ProvenanceDumper::showDependencies_
private

Definition at line 514 of file EdmProvDump.cc.

Referenced by work_().

bool ProvenanceDumper::showOtherModules_
private

Definition at line 518 of file EdmProvDump.cc.

Referenced by work_().

bool ProvenanceDumper::showTopLevelPSets_
private

Definition at line 519 of file EdmProvDump.cc.

Referenced by work_().