651 assert(
nullptr != psetTree);
652 typedef std::pair<edm::ParameterSetID, edm::ParameterSetBlob> IdToBlobs;
654 IdToBlobs* pIdToBlob = &idToBlob;
656 for (
long long i = 0;
i != psetTree->GetEntries(); ++
i) {
657 psetTree->GetEntry(
i);
658 psm_.insert(idToBlob);
692 for (
auto const& history :
phv_) {
693 for (
auto const&
process : history) {
702 else if (!phm.empty()) {
703 for (
auto const& history : phm) {
704 phv_.push_back(history.second);
705 for (
auto const&
process : history.second) {
719 <<
"Illegal ParameterSetID string. It should contain 32 hexadecimal characters";
726 std::map<edm::BranchID, std::set<edm::ParentageID>> perProductParentage;
730 if (
nullptr == parentageTree) {
731 std::cerr <<
"ERROR, no Parentage tree available so cannot show dependencies, ancestors, or descendants.\n";
732 std::cerr <<
"Possibly this is not a standard EDM format file. For example, dependency, ancestor, and\n";
733 std::cerr <<
"descendant options to edmProvDump will not work with nanoAOD format files.\n\n";
740 std::vector<edm::ParentageID> orderedParentageIDs;
741 orderedParentageIDs.reserve(parentageTree->GetEntries());
746 parentageTree->GetEntry(
i);
748 orderedParentageIDs.push_back(parentageBuffer.
id());
752 TTree* eventMetaTree =
754 if (
nullptr == eventMetaTree) {
757 if (
nullptr == eventMetaTree) {
759 <<
"' Tree in file so can not show dependencies\n";
764 TBranch* storedProvBranch =
767 if (
nullptr != storedProvBranch) {
768 std::vector<edm::StoredProductProvenance>
info;
769 std::vector<edm::StoredProductProvenance>* pInfo = &
info;
770 storedProvBranch->SetAddress(&pInfo);
772 storedProvBranch->GetEntry(
i);
775 perProductParentage[bid].insert(orderedParentageIDs.at(
item.parentageIDIndex_));
780 TBranch* productProvBranch =
782 if (
nullptr != productProvBranch) {
783 std::vector<edm::ProductProvenance>
info;
784 std::vector<edm::ProductProvenance>* pInfo = &
info;
785 productProvBranch->SetAddress(&pInfo);
787 productProvBranch->GetEntry(
i);
789 perProductParentage[
item.branchID()].insert(
item.parentageID());
793 std::cerr <<
" ERROR, could not find provenance information so can not show dependencies\n";
803 std::map<edm::BranchID, std::set<edm::BranchID>> parentToChildren;
807 for (
auto const& itParentageSet : perProductParentage) {
809 for (
auto const& itParentageID : itParentageSet.second) {
811 if (
nullptr != parentage) {
813 parentToChildren[
branch].insert(childBranchID);
816 std::cerr <<
" ERROR:parentage info not in registry ParentageID=" << itParentageID << std::endl;
827 std::cout <<
"---------Producers with data in file---------" << std::endl;
835 std::map<edm::BranchID, std::string> branchIDToBranchName;
837 for (
auto const& processConfig :
phc_) {
840 if (
nullptr == processParameterSet || processParameterSet->
empty()) {
844 auto& product =
item.second;
845 if (product.processName() != processConfig.processName()) {
853 branchIDToBranchName[product.branchID()] = product.branchName();
873 s << moduleParameterSetCopy.
id();
875 s << moduleParameterSet.
id();
877 moduleToIdBranches[std::make_pair(product.processName(), product.moduleLabel())][
s.str()].push_back(product);
882 for (
auto const&
item : moduleToIdBranches) {
883 std::ostringstream sout;
884 sout <<
"Module: " <<
item.first.second <<
" " <<
item.first.first << std::endl;
885 std::set<edm::BranchID> allBranchIDsForLabelAndProcess;
887 for (
auto const& idBranch : idToBranches) {
888 sout <<
" PSet id:" << idBranch.first << std::endl;
890 sout <<
" products: {" << std::endl;
892 std::set<edm::BranchID> branchIDs;
893 for (
auto const&
branch : idBranch.second) {
895 sout <<
" " <<
branch.branchName() << std::endl;
897 branchIDs.insert(
branch.branchID());
898 allBranchIDsForLabelAndProcess.insert(
branch.branchID());
900 sout <<
" }" << std::endl;
902 ParameterSetMap::const_iterator itpsm =
psm_.find(psid);
903 if (
psm_.end() == itpsm) {
905 errorLog_ <<
"No ParameterSetID for " << psid << std::endl;
908 sout <<
" parameters: ";
913 sout <<
" dependencies: {" << std::endl;
914 std::set<edm::ParentageID> parentageIDs;
915 for (
auto const&
branch : branchIDs) {
917 std::set<edm::ParentageID>
const&
temp = perProductParentage[
branch];
918 parentageIDs.insert(
temp.begin(),
temp.end());
920 for (
auto const& parentID : parentageIDs) {
922 if (
nullptr != parentage) {
924 sout <<
" " << branchIDToBranchName[
branch] << std::endl;
927 sout <<
" ERROR:parentage info not in registry ParentageID=" << parentID << std::endl;
930 if (parentageIDs.empty()) {
931 sout <<
" no dependencies recorded (event may not contain data from this module)" << std::endl;
933 sout <<
" }" << std::endl;
937 sout <<
" extendedAncestors: {" << std::endl;
938 std::set<edm::BranchID> ancestorBranchIDs;
939 for (
auto const& branchID : allBranchIDsForLabelAndProcess) {
940 addAncestors(branchID, ancestorBranchIDs, sout, perProductParentage);
942 for (
auto const& ancestorBranchID : ancestorBranchIDs) {
943 sout <<
" " << branchIDToBranchName[ancestorBranchID] <<
"\n";
945 sout <<
" }" << std::endl;
949 sout <<
" extendedDescendants: {" << std::endl;
950 std::set<edm::BranchID> descendantBranchIDs;
951 for (
auto const& branchID : allBranchIDsForLabelAndProcess) {
952 addDescendants(branchID, descendantBranchIDs, sout, parentToChildren);
954 for (
auto const& descendantBranchID : descendantBranchIDs) {
955 sout <<
" " << branchIDToBranchName[descendantBranchID] <<
"\n";
957 sout <<
" }" << std::endl;
959 bool foundMatch =
true;
962 if (sout.str().find(stringToFind) == std::string::npos) {
974 std::cout <<
"---------Other Modules---------" << std::endl;
977 std::cout <<
"---------All Modules---------" << std::endl;
982 std::cout <<
"---------EventSetup---------" << std::endl;
987 std::cout <<
"---------Top Level PSets---------" << std::endl;