646 assert(
nullptr != psetTree);
647 typedef std::pair<edm::ParameterSetID, edm::ParameterSetBlob> IdToBlobs;
649 IdToBlobs* pIdToBlob = &idToBlob;
651 for (
long long i = 0;
i != psetTree->GetEntries(); ++
i) {
652 psetTree->GetEntry(
i);
653 psm_.insert(idToBlob);
687 for (
auto const& history :
phv_) {
688 for (
auto const&
process : history) {
697 else if (!phm.empty()) {
698 for (
auto const& history : phm) {
699 phv_.push_back(history.second);
700 for (
auto const&
process : history.second) {
714 <<
"Illegal ParameterSetID string. It should contain 32 hexadecimal characters";
721 std::map<edm::BranchID, std::set<edm::ParentageID>> perProductParentage;
725 if (
nullptr == parentageTree) {
726 std::cerr <<
"ERROR, no Parentage tree available so cannot show dependencies, ancestors, or descendants.\n";
727 std::cerr <<
"Possibly this is not a standard EDM format file. For example, dependency, ancestor, and\n";
728 std::cerr <<
"descendant options to edmProvDump will not work with nanoAOD format files.\n\n";
735 std::vector<edm::ParentageID> orderedParentageIDs;
736 orderedParentageIDs.reserve(parentageTree->GetEntries());
741 parentageTree->GetEntry(
i);
743 orderedParentageIDs.push_back(parentageBuffer.
id());
747 TTree* eventMetaTree =
749 if (
nullptr == eventMetaTree) {
752 if (
nullptr == eventMetaTree) {
754 <<
"' Tree in file so can not show dependencies\n";
759 TBranch* storedProvBranch =
762 if (
nullptr != storedProvBranch) {
763 std::vector<edm::StoredProductProvenance>
info;
764 std::vector<edm::StoredProductProvenance>* pInfo = &
info;
765 storedProvBranch->SetAddress(&pInfo);
767 storedProvBranch->GetEntry(
i);
770 perProductParentage[bid].insert(orderedParentageIDs.at(
item.parentageIDIndex_));
775 TBranch* productProvBranch =
777 if (
nullptr != productProvBranch) {
778 std::vector<edm::ProductProvenance>
info;
779 std::vector<edm::ProductProvenance>* pInfo = &
info;
780 productProvBranch->SetAddress(&pInfo);
782 productProvBranch->GetEntry(
i);
784 perProductParentage[
item.branchID()].insert(
item.parentageID());
788 std::cerr <<
" ERROR, could not find provenance information so can not show dependencies\n";
798 std::map<edm::BranchID, std::set<edm::BranchID>> parentToChildren;
802 for (
auto const& itParentageSet : perProductParentage) {
804 for (
auto const& itParentageID : itParentageSet.second) {
806 if (
nullptr != parentage) {
808 parentToChildren[
branch].insert(childBranchID);
811 std::cerr <<
" ERROR:parentage info not in registry ParentageID=" << itParentageID << std::endl;
822 std::cout <<
"---------Producers with data in file---------" << std::endl;
830 std::map<edm::BranchID, std::string> branchIDToBranchName;
832 for (
auto const& processConfig :
phc_) {
835 if (
nullptr == processParameterSet || processParameterSet->
empty()) {
839 auto& product =
item.second;
840 if (product.processName() != processConfig.processName()) {
848 branchIDToBranchName[product.branchID()] = product.branchName();
868 s << moduleParameterSetCopy.
id();
870 s << moduleParameterSet.
id();
872 moduleToIdBranches[std::make_pair(product.processName(), product.moduleLabel())][
s.str()].push_back(product);
877 for (
auto const&
item : moduleToIdBranches) {
878 std::ostringstream sout;
879 sout <<
"Module: " <<
item.first.second <<
" " <<
item.first.first << std::endl;
880 std::set<edm::BranchID> allBranchIDsForLabelAndProcess;
882 for (
auto const& idBranch : idToBranches) {
883 sout <<
" PSet id:" << idBranch.first << std::endl;
885 sout <<
" products: {" << std::endl;
887 std::set<edm::BranchID> branchIDs;
888 for (
auto const&
branch : idBranch.second) {
890 sout <<
" " <<
branch.branchName() << std::endl;
892 branchIDs.insert(
branch.branchID());
893 allBranchIDsForLabelAndProcess.insert(
branch.branchID());
895 sout <<
" }" << std::endl;
897 ParameterSetMap::const_iterator itpsm =
psm_.find(psid);
898 if (
psm_.end() == itpsm) {
900 errorLog_ <<
"No ParameterSetID for " << psid << std::endl;
903 sout <<
" parameters: ";
908 sout <<
" dependencies: {" << std::endl;
909 std::set<edm::ParentageID> parentageIDs;
910 for (
auto const&
branch : branchIDs) {
912 std::set<edm::ParentageID>
const&
temp = perProductParentage[
branch];
913 parentageIDs.insert(
temp.begin(),
temp.end());
915 for (
auto const& parentID : parentageIDs) {
917 if (
nullptr != parentage) {
919 sout <<
" " << branchIDToBranchName[
branch] << std::endl;
922 sout <<
" ERROR:parentage info not in registry ParentageID=" << parentID << std::endl;
925 if (parentageIDs.empty()) {
926 sout <<
" no dependencies recorded (event may not contain data from this module)" << std::endl;
928 sout <<
" }" << std::endl;
932 sout <<
" extendedAncestors: {" << std::endl;
933 std::set<edm::BranchID> ancestorBranchIDs;
934 for (
auto const& branchID : allBranchIDsForLabelAndProcess) {
935 addAncestors(branchID, ancestorBranchIDs, sout, perProductParentage);
937 for (
auto const& ancestorBranchID : ancestorBranchIDs) {
938 sout <<
" " << branchIDToBranchName[ancestorBranchID] <<
"\n";
940 sout <<
" }" << std::endl;
944 sout <<
" extendedDescendants: {" << std::endl;
945 std::set<edm::BranchID> descendantBranchIDs;
946 for (
auto const& branchID : allBranchIDsForLabelAndProcess) {
947 addDescendants(branchID, descendantBranchIDs, sout, parentToChildren);
949 for (
auto const& descendantBranchID : descendantBranchIDs) {
950 sout <<
" " << branchIDToBranchName[descendantBranchID] <<
"\n";
952 sout <<
" }" << std::endl;
954 bool foundMatch =
true;
957 if (sout.str().find(stringToFind) == std::string::npos) {
969 std::cout <<
"---------Other Modules---------" << std::endl;
972 std::cout <<
"---------All Modules---------" << std::endl;
977 std::cout <<
"---------EventSetup---------" << std::endl;
982 std::cout <<
"---------Top Level PSets---------" << std::endl;
std::stringstream errorLog_
std::vector< ProcessHistory > ProcessHistoryVector
std::string const & metaDataTreeName()
bool getMapped(key_type const &k, value_type &result) const
bool productRegistryPresent_
std::string const & BranchTypeToBranchEntryInfoBranchName(BranchType const &branchType)
std::string const & moduleDescriptionMapBranchName()
edm::ProductRegistry reg_
ParameterSet const & getParameterSet(std::string const &) const
void dumpParameterSetForID_(edm::ParameterSetID const &id)
HistoryNode historyGraph_
std::string const & processHistoryBranchName()
std::vector< BranchID > const & parents() const
bool existsAs(std::string const ¶meterName, bool trackiness=true) const
checks if a parameter exists as a given type
void dumpEventFilteringParameterSets_(TFile *file)
std::string const & parameterSetMapBranchName()
edm::ProcessHistoryVector phv_
std::string const & productDescriptionBranchName()
static std::string const input
constexpr element_type const * get() const
std::string const & BranchTypeToMetaDataTreeName(BranchType const &branchType)
bool getMapped(key_type const &k, value_type &result) const
std::string const & processHistoryMapBranchName()
ParameterSetID id() const
ParameterSet const & registerIt()
edm::propagate_const< std::unique_ptr< TFile > > inputFile_
bool extendedDescendants_
std::string const & BranchTypeToProductTreeName(BranchType const &branchType)
std::map< std::pair< std::string, std::string >, IdToBranches > ModuleToIdBranches
Long64_t numEntries(TFile *hdl, std::string const &trname)
def unique(seq, keepstr=True)
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 & parameterSetsTreeName()
std::string const & BranchTypeToProductProvenanceBranchName(BranchType const &BranchType)
bool insertMapped(value_type const &v, bool forceUpdate=false)
std::string const & parentageBranchName()
static std::string const triggerResults
Hash< ParameterSetType > ParameterSetID
std::string const & idToParameterSetBlobsBranchName()
static std::ostream & prettyPrint(std::ostream &oStream, edm::ParameterSet const &iPSet, std::string const &iIndent, std::string const &iIndentDelta)
std::map< std::string, std::vector< edm::BranchDescription > > IdToBranches
void dumpProcessHistory_()
edm::ProcessConfigurationVector phc_
void sort_all(RandomAccessSequence &s)
wrappers for std::sort
std::string const & parentageTreeName()
ProductList & productListUpdator()
std::vector< std::string > findMatch_
std::map< ParameterSetID, ParameterSetBlob > ParameterSetMap
bool isRegistered() const
static ParentageRegistry * instance()
static std::string const triggerPaths
static std::string const source
void setIsMergeable(BranchDescription &)
std::map< ProcessHistoryID, ProcessHistory > ProcessHistoryMap
bool insertMapped(value_type const &v)
static Registry * instance()
void addAncestors(edm::BranchID const &branchID, std::set< edm::BranchID > &ancestorBranchIDs, std::ostringstream &sout, std::map< edm::BranchID, std::set< edm::ParentageID >> &perProductParentage) const