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

Definition at line 532 of file EdmProvDump.cc.

541  :
543  inputFile_(makeTFile(filename)),
544  exitCode_(0),
545  errorLog_(),
546  errorCount_(0),
547  showDependencies_(showDependencies),
548  extendedAncestors_(extendedAncestors),
549  extendedDescendants_(extendedDescendants),
550  excludeESModules_(excludeESModules),
551  showOtherModules_(showOtherModules),
552  showTopLevelPSets_(showTopLevelPSets),
553  findMatch_(findMatch),
554  dontPrintProducts_(dontPrintProducts),
555  dumpPSetID_(dumpPSetID) {
556 }
std::stringstream errorLog_
Definition: EdmProvDump.cc:508
std::string dumpPSetID_
Definition: EdmProvDump.cc:523
edm::propagate_const< std::unique_ptr< TFile > > inputFile_
Definition: EdmProvDump.cc:506
std::string filename_
Definition: EdmProvDump.cc:505
std::vector< std::string > findMatch_
Definition: EdmProvDump.cc:521
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 1034 of file EdmProvDump.cc.

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

Referenced by work_().

1035  {
1036 
1038 
1039  std::set<edm::ParentageID> const& parentIDs = perProductParentage[branchID];
1040  for (auto const& parentageID : parentIDs) {
1041  edm::Parentage const* parentage = registry.getMapped(parentageID);
1042  if(0 != parentage) {
1043  for(auto const& branch : parentage->parents()) {
1044 
1045  if(ancestorBranchIDs.insert(branch).second) {
1046  addAncestors(branch, ancestorBranchIDs, sout, perProductParentage);
1047  }
1048  }
1049  } else {
1050  sout << " ERROR:parentage info not in registry ParentageID=" << parentageID << std::endl;
1051  }
1052  }
1053 }
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:44
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 1056 of file EdmProvDump.cc.

Referenced by work_().

1057  {
1058 
1059  for (auto const& childBranchID : parentToChildren[branchID]) {
1060  if (descendantBranchIDs.insert(childBranchID).second) {
1061  addDescendants(childBranchID, descendantBranchIDs, sout, parentToChildren);
1062  }
1063  }
1064 }
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 559 of file EdmProvDump.cc.

References work_().

Referenced by main().

559  {
560  work_();
561 }
void ProvenanceDumper::dumpEventFilteringParameterSets ( edm::EventSelectionIDVector const &  ids)
private

Definition at line 574 of file EdmProvDump.cc.

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

Referenced by dumpEventFilteringParameterSets_().

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

Definition at line 592 of file EdmProvDump.cc.

References assert(), 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_().

592  {
593 
594  TTree* history = dynamic_cast<TTree*>(file->Get(edm::poolNames::eventHistoryTreeName().c_str()));
595  if(history != 0) {
596  edm::History h;
597  edm::History* ph = &h;
598 
599  history->SetBranchAddress(edm::poolNames::eventHistoryBranchName().c_str(), &ph);
600  if(history->GetEntry(0) <= 0) {
601  std::cout << "No event filtering information is available; the event history tree has no entries\n";
602  } else {
604  }
605  } else {
606  TTree* events = dynamic_cast<TTree*>(file->Get(edm::poolNames::eventTreeName().c_str()));
607  assert (events != 0);
608  TBranch* eventSelectionsBranch = events->GetBranch(edm::poolNames::eventSelectionsBranchName().c_str());
609  assert (eventSelectionsBranch != 0);
611  edm::EventSelectionIDVector* pids = &ids;
612  eventSelectionsBranch->SetAddress(&pids);
613  if(eventSelectionsBranch->GetEntry(0) <= 0) {
614  std::cout << "No event filtering information is available; the event selections branch has no entries\n";
615  } else {
617  }
618  }
619 }
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
assert(m_qm.get())
std::string const & eventSelectionsBranchName()
Definition: BranchType.cc:243
std::vector< EventSelectionID > EventSelectionIDVector
EventSelectionIDVector const & eventSelectionIDs() const
Definition: History.h:42
void dumpEventFilteringParameterSets(edm::EventSelectionIDVector const &ids)
Definition: EdmProvDump.cc:574
std::string const & eventHistoryBranchName()
Definition: BranchType.cc:238
tuple events
Definition: patZpeak.py:19
std::string const & eventTreeName()
Definition: BranchType.cc:260
tuple cout
Definition: gather_cfg.py:145
std::string const & eventHistoryTreeName()
Definition: BranchType.cc:268
void ProvenanceDumper::dumpParameterSetForID_ ( edm::ParameterSetID const &  id)
private

Definition at line 622 of file EdmProvDump.cc.

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

Referenced by dumpEventFilteringParameterSets(), and work_().

622  {
623  std::cout << "ParameterSetID: " << id << '\n';
624  if(id.isValid()) {
625  ParameterSetMap::const_iterator i = psm_.find(id);
626  if(i == psm_.end()) {
627  std::cout << "We are unable to find the corresponding ParameterSet\n";
629  empty.registerIt();
630  if(id == empty.id()) {
631  std::cout << "But it would have been empty anyway\n";
632  }
633  } else {
634  edm::ParameterSet ps(i->second.pset());
635  prettyPrint(std::cout, ps, " ", " ");
636  std::cout<< '\n';
637  }
638  } else {
639  std::cout << "This ID is not valid\n";
640  }
641  std::cout << " -------------------------\n";
642 }
int i
Definition: DBlmapReader.cc:9
ParameterSetID id() const
ParameterSetMap psm_
Definition: EdmProvDump.cc:513
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:145
ParameterSet const & registerIt()
void ProvenanceDumper::dumpProcessHistory_ ( )
private

Definition at line 645 of file EdmProvDump.cc.

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

Referenced by work_().

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

Definition at line 569 of file EdmProvDump.cc.

References exitCode_.

Referenced by main().

569  {
570  return exitCode_;
571 }
ProvenanceDumper& ProvenanceDumper::operator= ( ProvenanceDumper const &  )
delete
void ProvenanceDumper::printErrors ( std::ostream &  os)

Definition at line 564 of file EdmProvDump.cc.

References errorCount_, and errorLog_.

Referenced by main().

564  {
565  if(errorCount_ > 0) os << errorLog_.str() << std::endl;
566 }
std::stringstream errorLog_
Definition: EdmProvDump.cc:508
void ProvenanceDumper::work_ ( )
private

Definition at line 687 of file EdmProvDump.cc.

References addAncestors(), addDescendants(), assert(), edm::BranchTypeToBranchEntryInfoBranchName(), edm::BranchTypeToMetaDataTreeName(), edm::BranchTypeToProductProvenanceBranchName(), edm::BranchTypeToProductTreeName(), ecal_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_, 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(), TrackValidation_cff::pset, psm_, reg_, edm::ParameterSet::registerIt(), PhysicsTools::registry, alignCSCRings::s, showDependencies_, showOtherModules_, showTopLevelPSets_, edm::sort_all(), source, AlCaHLTBitMon_QueryRunRegistry::string, groupFilesInBlocks::temp, triggerPaths, triggerResults, and x.

Referenced by dump().

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

Member Data Documentation

bool ProvenanceDumper::dontPrintProducts_
private

Definition at line 522 of file EdmProvDump.cc.

Referenced by work_().

std::string ProvenanceDumper::dumpPSetID_
private

Definition at line 523 of file EdmProvDump.cc.

Referenced by work_().

int ProvenanceDumper::errorCount_
private

Definition at line 509 of file EdmProvDump.cc.

Referenced by printErrors(), and work_().

std::stringstream ProvenanceDumper::errorLog_
private

Definition at line 508 of file EdmProvDump.cc.

Referenced by printErrors(), and work_().

bool ProvenanceDumper::excludeESModules_
private

Definition at line 518 of file EdmProvDump.cc.

Referenced by work_().

int ProvenanceDumper::exitCode_
private

Definition at line 507 of file EdmProvDump.cc.

Referenced by exitCode(), and work_().

bool ProvenanceDumper::extendedAncestors_
private

Definition at line 516 of file EdmProvDump.cc.

Referenced by work_().

bool ProvenanceDumper::extendedDescendants_
private

Definition at line 517 of file EdmProvDump.cc.

Referenced by work_().

std::string ProvenanceDumper::filename_
private

Definition at line 505 of file EdmProvDump.cc.

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

Definition at line 521 of file EdmProvDump.cc.

Referenced by work_().

HistoryNode ProvenanceDumper::historyGraph_
private

Definition at line 514 of file EdmProvDump.cc.

Referenced by dumpProcessHistory_(), and work_().

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

Definition at line 506 of file EdmProvDump.cc.

Referenced by work_().

edm::ProcessConfigurationVector ProvenanceDumper::phc_
private

Definition at line 511 of file EdmProvDump.cc.

Referenced by work_().

edm::ProcessHistoryVector ProvenanceDumper::phv_
private

Definition at line 512 of file EdmProvDump.cc.

Referenced by dumpProcessHistory_(), and work_().

ParameterSetMap ProvenanceDumper::psm_
private

Definition at line 513 of file EdmProvDump.cc.

Referenced by dumpParameterSetForID_(), and work_().

edm::ProductRegistry ProvenanceDumper::reg_
private

Definition at line 510 of file EdmProvDump.cc.

Referenced by work_().

bool ProvenanceDumper::showDependencies_
private

Definition at line 515 of file EdmProvDump.cc.

Referenced by work_().

bool ProvenanceDumper::showOtherModules_
private

Definition at line 519 of file EdmProvDump.cc.

Referenced by work_().

bool ProvenanceDumper::showTopLevelPSets_
private

Definition at line 520 of file EdmProvDump.cc.

Referenced by work_().