637 assert(
nullptr != meta);
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);
682 assert(
nullptr != pReg);
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);
771 for (Long64_t
i = 0, numEntries = eventMetaTree->GetEntries();
i <
numEntries; ++
i) {
772 storedProvBranch->GetEntry(
i);
773 for (
auto const&
item : info) {
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);
786 for (Long64_t
i = 0, numEntries = eventMetaTree->GetEntries();
i <
numEntries; ++
i) {
787 productProvBranch->GetEntry(
i);
788 for (
auto const&
item : info) {
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();
860 if (moduleLabel ==
source) {
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;
std::stringstream errorLog_
std::vector< ProcessHistory > ProcessHistoryVector
std::string const & idToParameterSetBlobsBranchName()
std::string const & BranchTypeToMetaDataTreeName(BranchType const &branchType)
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::string const & parentageTreeName()
bool existsAs(std::string const ¶meterName, bool trackiness=true) const
checks if a parameter exists as a given type
void addAncestors(edm::BranchID const &branchID, std::set< edm::BranchID > &ancestorBranchIDs, std::ostringstream &sout, std::map< edm::BranchID, std::set< edm::ParentageID >> &perProductParentage) const
bool productRegistryPresent_
ParameterSetID id() const
edm::ProductRegistry reg_
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()
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
void setIsMergeable(BranchDescription &)
std::map< ProcessHistoryID, ProcessHistory > ProcessHistoryMap
std::string const & moduleDescriptionMapBranchName()
bool insertMapped(value_type const &v)
static Registry * instance()