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_
 
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 470 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 531 of file EdmProvDump.cc.

540  :
542  inputFile_(makeTFile(filename)),
543  exitCode_(0),
544  errorLog_(),
545  errorCount_(0),
546  showDependencies_(showDependencies),
547  extendedAncestors_(extendedAncestors),
548  extendedDescendants_(extendedDescendants),
549  excludeESModules_(excludeESModules),
550  showOtherModules_(showOtherModules),
551  showTopLevelPSets_(showTopLevelPSets),
552  findMatch_(findMatch),
553  dontPrintProducts_(dontPrintProducts),
554  dumpPSetID_(dumpPSetID) {
555 }
std::stringstream errorLog_
Definition: EdmProvDump.cc:507
std::string dumpPSetID_
Definition: EdmProvDump.cc:522
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 1033 of file EdmProvDump.cc.

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

Referenced by work_().

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

Referenced by work_().

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

Definition at line 558 of file EdmProvDump.cc.

References work_().

Referenced by main().

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

Definition at line 573 of file EdmProvDump.cc.

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

Referenced by dumpEventFilteringParameterSets_().

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

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

591  {
592 
593  TTree* history = dynamic_cast<TTree*>(file->Get(edm::poolNames::eventHistoryTreeName().c_str()));
594  if(history != 0) {
595  edm::History h;
596  edm::History* ph = &h;
597 
598  history->SetBranchAddress(edm::poolNames::eventHistoryBranchName().c_str(), &ph);
599  if(history->GetEntry(0) <= 0) {
600  std::cout << "No event filtering information is available; the event history tree has no entries\n";
601  } else {
603  }
604  } else {
605  TTree* events = dynamic_cast<TTree*>(file->Get(edm::poolNames::eventTreeName().c_str()));
606  assert (events != 0);
607  TBranch* eventSelectionsBranch = events->GetBranch(edm::poolNames::eventSelectionsBranchName().c_str());
608  assert (eventSelectionsBranch != 0);
610  edm::EventSelectionIDVector* pids = &ids;
611  eventSelectionsBranch->SetAddress(&pids);
612  if(eventSelectionsBranch->GetEntry(0) <= 0) {
613  std::cout << "No event filtering information is available; the event selections branch has no entries\n";
614  } else {
616  }
617  }
618 }
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:573
std::string const & eventHistoryBranchName()
Definition: BranchType.cc:238
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:260
tuple cout
Definition: gather_cfg.py:121
std::string const & eventHistoryTreeName()
Definition: BranchType.cc:268
void ProvenanceDumper::dumpParameterSetForID_ ( edm::ParameterSetID const &  id)
private

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

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

Definition at line 644 of file EdmProvDump.cc.

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

Referenced by work_().

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

References exitCode_.

Referenced by main().

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

Definition at line 563 of file EdmProvDump.cc.

References errorCount_, and errorLog_.

Referenced by main().

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

Definition at line 686 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::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, triggerResults, and x.

Referenced by dump().

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

Referenced by work_().

std::string ProvenanceDumper::dumpPSetID_
private

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