687 assert(
nullptr != meta);
701 assert(
nullptr != psetTree);
702 typedef std::pair<edm::ParameterSetID, edm::ParameterSetBlob> IdToBlobs;
704 IdToBlobs* pIdToBlob = &idToBlob;
706 for(
long long i = 0;
i != psetTree->GetEntries(); ++
i) {
707 psetTree->GetEntry(
i);
708 psm_.insert(idToBlob);
732 assert(
nullptr != pReg);
735 for(
auto const& item :
psm_) {
737 pset.setID(item.first);
743 for(
auto const& history :
phv_) {
744 for(
auto const&
process : history) {
753 else if(!phm.empty()) {
754 for(
auto const& history : phm) {
755 phv_.push_back(history.second);
756 for(
auto const&
process : history.second) {
769 throw cms::Exception(
"Command Line Argument") <<
"Illegal ParameterSetID string. It should contain 32 hexadecimal characters";
776 std::map<edm::BranchID, std::set<edm::ParentageID> > perProductParentage;
780 if(
nullptr == parentageTree) {
781 std::cerr <<
"ERROR, no Parentage tree available so cannot show dependencies, ancestors, or descendants.\n";
782 std::cerr <<
"Possibly this is not a standard EDM format file. For example, dependency, ancestor, and\n";
783 std::cerr <<
"descendant options to edmProvDump will not work with nanoAOD format files.\n\n";
791 std::vector<edm::ParentageID> orderedParentageIDs;
792 orderedParentageIDs.reserve(parentageTree->GetEntries());
797 parentageTree->GetEntry(
i);
799 orderedParentageIDs.push_back(parentageBuffer.
id());
804 if(
nullptr == eventMetaTree) {
807 if(
nullptr == eventMetaTree) {
815 if(
nullptr!=storedProvBranch) {
816 std::vector<edm::StoredProductProvenance>
info;
817 std::vector<edm::StoredProductProvenance>* pInfo = &
info;
818 storedProvBranch->SetAddress(&pInfo);
819 for(Long64_t
i = 0, numEntries = eventMetaTree->GetEntries();
i <
numEntries; ++
i) {
820 storedProvBranch->GetEntry(
i);
821 for(
auto const& item : info) {
823 perProductParentage[bid].insert(orderedParentageIDs.at(item.parentageIDIndex_));
829 if (
nullptr != productProvBranch) {
830 std::vector<edm::ProductProvenance>
info;
831 std::vector<edm::ProductProvenance>* pInfo = &
info;
832 productProvBranch->SetAddress(&pInfo);
833 for(Long64_t
i = 0, numEntries = eventMetaTree->GetEntries();
i <
numEntries; ++
i) {
834 productProvBranch->GetEntry(
i);
835 for(
auto const& item : info) {
836 perProductParentage[item.branchID()].insert(item.parentageID());
840 std::cerr <<
" ERROR, could not find provenance information so can not show dependencies\n";
850 std::map<edm::BranchID, std::set<edm::BranchID> > parentToChildren;
854 for (
auto const& itParentageSet : perProductParentage) {
856 for (
auto const& itParentageID : itParentageSet.second) {
858 if(
nullptr != parentage) {
860 parentToChildren[
branch].insert(childBranchID);
863 std::cerr <<
" ERROR:parentage info not in registry ParentageID=" << itParentageID << std::endl;
875 std::cout <<
"---------Producers with data in file---------" << std::endl;
883 std::map<edm::BranchID, std::string> branchIDToBranchName;
885 for(
auto const& processConfig :
phc_) {
887 if(
nullptr == processParameterSet || processParameterSet->
empty()) {
891 auto& product = item.second;
892 if(product.processName() != processConfig.processName()) {
899 branchIDToBranchName[product.branchID()] = product.branchName();
906 if(moduleLabel ==
source) {
919 s << moduleParameterSetCopy.
id();
921 s << moduleParameterSet.
id();
923 moduleToIdBranches[std::make_pair(product.processName(), product.moduleLabel())][s.str()].push_back(product);
928 for(
auto const& item : moduleToIdBranches) {
929 std::ostringstream sout;
930 sout <<
"Module: " << item.first.second <<
" " << item.first.first << std::endl;
931 std::set<edm::BranchID> allBranchIDsForLabelAndProcess;
933 for(
auto const& idBranch : idToBranches) {
934 sout <<
" PSet id:" << idBranch.first << std::endl;
936 sout <<
" products: {" << std::endl;
938 std::set<edm::BranchID> branchIDs;
939 for(
auto const&
branch : idBranch.second) {
941 sout <<
" " <<
branch.branchName() << std::endl;
943 branchIDs.insert(
branch.branchID());
944 allBranchIDsForLabelAndProcess.insert(
branch.branchID());
946 sout <<
" }" << std::endl;
948 ParameterSetMap::const_iterator itpsm = psm_.find(psid);
949 if(psm_.end() == itpsm) {
951 errorLog_ <<
"No ParameterSetID for " << psid << std::endl;
954 sout <<
" parameters: ";
960 sout <<
" dependencies: {" << std::endl;
961 std::set<edm::ParentageID> parentageIDs;
962 for(
auto const&
branch : branchIDs) {
965 std::set<edm::ParentageID>
const&
temp = perProductParentage[
branch];
966 parentageIDs.insert(temp.begin(), temp.end());
968 for(
auto const& parentID : parentageIDs) {
970 if(
nullptr != parentage) {
972 sout <<
" " << branchIDToBranchName[
branch] << std::endl;
975 sout <<
" ERROR:parentage info not in registry ParentageID=" << parentID << std::endl;
978 if(parentageIDs.empty()) {
979 sout <<
" no dependencies recorded (event may not contain data from this module)" << std::endl;
981 sout <<
" }" << std::endl;
985 sout <<
" extendedAncestors: {" << std::endl;
986 std::set<edm::BranchID> ancestorBranchIDs;
987 for (
auto const& branchID : allBranchIDsForLabelAndProcess) {
988 addAncestors(branchID, ancestorBranchIDs, sout, perProductParentage);
990 for (
auto const& ancestorBranchID : ancestorBranchIDs) {
991 sout <<
" " << branchIDToBranchName[ancestorBranchID] <<
"\n";
993 sout <<
" }" << std::endl;
997 sout <<
" extendedDescendants: {" << std::endl;
998 std::set<edm::BranchID> descendantBranchIDs;
999 for (
auto const& branchID : allBranchIDsForLabelAndProcess) {
1000 addDescendants(branchID, descendantBranchIDs, sout, parentToChildren);
1002 for (
auto const& descendantBranchID : descendantBranchIDs) {
1003 sout <<
" " << branchIDToBranchName[descendantBranchID] <<
"\n";
1005 sout <<
" }" << std::endl;
1007 bool foundMatch =
true;
1009 for (
auto const& stringToFind :
findMatch_) {
1010 if (sout.str().find(stringToFind) == std::string::npos) {
1022 std::cout <<
"---------Other Modules---------" << std::endl;
1025 std::cout <<
"---------All Modules---------" << std::endl;
1030 std::cout <<
"---------EventSetup---------" << std::endl;
1035 std::cout <<
"---------Top Level PSets---------" << std::endl;
std::stringstream errorLog_
std::vector< ProcessHistory > ProcessHistoryVector
std::string const & idToParameterSetBlobsBranchName()
std::string const & BranchTypeToMetaDataTreeName(BranchType const &branchType)
std::string const & parentageTreeName()
bool existsAs(std::string const ¶meterName, bool trackiness=true) const
checks if a parameter exists as a given type
bool productRegistryPresent_
ParameterSetID id() const
edm::ProductRegistry reg_
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)
HistoryNode historyGraph_
void dumpEventFilteringParameterSets_(TFile *file)
edm::ProcessHistoryVector phv_
std::string const & parameterSetsTreeName()
static std::string const input
std::vector< BranchID > const & parents() const
std::string const & processHistoryMapBranchName()
edm::propagate_const< std::unique_ptr< TFile > > inputFile_
bool extendedDescendants_
bool getMapped(key_type const &k, value_type &result) const
std::map< std::pair< std::string, std::string >, IdToBranches > ModuleToIdBranches
Long64_t numEntries(TFile *hdl, std::string const &trname)
def unique(seq, keepstr=True)
bool getMapped(key_type const &k, value_type &result) const
std::string const & BranchTypeToBranchEntryInfoBranchName(BranchType const &branchType)
bool insertMapped(value_type const &v, bool forceUpdate=false)
std::string const & metaDataTreeName()
std::string const & BranchTypeToProductTreeName(BranchType const &branchType)
static std::string const triggerResults
bool isRegistered() const
Hash< ParameterSetType > ParameterSetID
std::string const & parameterSetMapBranchName()
element_type const * get() const
static std::ostream & prettyPrint(std::ostream &oStream, edm::ParameterSet const &iPSet, std::string const &iIndent, std::string const &iIndentDelta)
std::string const & processHistoryBranchName()
std::map< std::string, std::vector< edm::BranchDescription > > IdToBranches
void dumpProcessHistory_()
edm::ProcessConfigurationVector phc_
void sort_all(RandomAccessSequence &s)
wrappers for std::sort
ParameterSet const & getParameterSet(std::string const &) const
std::string const & parentageBranchName()
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_
std::map< ParameterSetID, ParameterSetBlob > ParameterSetMap
std::string const & productDescriptionBranchName()
std::string const & BranchTypeToProductProvenanceBranchName(BranchType const &BranchType)
static ParentageRegistry * instance()
static std::string const triggerPaths
ParameterSet const & registerIt()
static std::string const source
std::map< ProcessHistoryID, ProcessHistory > ProcessHistoryMap
std::string const & moduleDescriptionMapBranchName()
bool insertMapped(value_type const &v)
static Registry * instance()