692 assert(
nullptr != meta);
706 assert(
nullptr != psetTree);
707 typedef std::pair<edm::ParameterSetID, edm::ParameterSetBlob> IdToBlobs;
709 IdToBlobs* pIdToBlob = &idToBlob;
711 for(
long long i = 0;
i != psetTree->GetEntries(); ++
i) {
712 psetTree->GetEntry(
i);
713 psm_.insert(idToBlob);
737 assert(
nullptr != pReg);
740 for(
auto const& item :
psm_) {
742 pset.setID(item.first);
748 for(
auto const& history :
phv_) {
749 for(
auto const&
process : history) {
758 else if(!phm.empty()) {
759 for(
auto const& history : phm) {
760 phv_.push_back(history.second);
761 for(
auto const&
process : history.second) {
774 throw cms::Exception(
"Command Line Argument") <<
"Illegal ParameterSetID string. It should contain 32 hexadecimal characters";
781 std::map<edm::BranchID, std::set<edm::ParentageID> > perProductParentage;
785 if(
nullptr == parentageTree) {
786 std::cerr <<
"ERROR, no Parentage tree available so cannot show dependencies, ancestors, or descendants.\n";
787 std::cerr <<
"Possibly this is not a standard EDM format file. For example, dependency, ancestor, and\n";
788 std::cerr <<
"descendant options to edmProvDump will not work with nanoAOD format files.\n\n";
796 std::vector<edm::ParentageID> orderedParentageIDs;
797 orderedParentageIDs.reserve(parentageTree->GetEntries());
802 parentageTree->GetEntry(
i);
804 orderedParentageIDs.push_back(parentageBuffer.
id());
809 if(
nullptr == eventMetaTree) {
812 if(
nullptr == eventMetaTree) {
820 if(
nullptr!=storedProvBranch) {
821 std::vector<edm::StoredProductProvenance>
info;
822 std::vector<edm::StoredProductProvenance>* pInfo = &
info;
823 storedProvBranch->SetAddress(&pInfo);
824 for(Long64_t
i = 0, numEntries = eventMetaTree->GetEntries();
i <
numEntries; ++
i) {
825 storedProvBranch->GetEntry(
i);
826 for(
auto const& item : info) {
828 perProductParentage[bid].insert(orderedParentageIDs.at(item.parentageIDIndex_));
834 if (
nullptr != productProvBranch) {
835 std::vector<edm::ProductProvenance>
info;
836 std::vector<edm::ProductProvenance>* pInfo = &
info;
837 productProvBranch->SetAddress(&pInfo);
838 for(Long64_t
i = 0, numEntries = eventMetaTree->GetEntries();
i <
numEntries; ++
i) {
839 productProvBranch->GetEntry(
i);
840 for(
auto const& item : info) {
841 perProductParentage[item.branchID()].insert(item.parentageID());
845 std::cerr <<
" ERROR, could not find provenance information so can not show dependencies\n";
855 std::map<edm::BranchID, std::set<edm::BranchID> > parentToChildren;
859 for (
auto const& itParentageSet : perProductParentage) {
861 for (
auto const& itParentageID : itParentageSet.second) {
863 if(
nullptr != parentage) {
865 parentToChildren[
branch].insert(childBranchID);
868 std::cerr <<
" ERROR:parentage info not in registry ParentageID=" << itParentageID << std::endl;
879 std::cout <<
"---------Producers with data in file---------" << std::endl;
887 std::map<edm::BranchID, std::string> branchIDToBranchName;
889 for(
auto const& processConfig :
phc_) {
891 if(
nullptr == processParameterSet || processParameterSet->
empty()) {
895 auto& product = item.second;
896 if(product.processName() != processConfig.processName()) {
903 branchIDToBranchName[product.branchID()] = product.branchName();
910 if(moduleLabel ==
source) {
923 s << moduleParameterSetCopy.
id();
925 s << moduleParameterSet.
id();
927 moduleToIdBranches[std::make_pair(product.processName(), product.moduleLabel())][s.str()].push_back(product);
932 for(
auto const& item : moduleToIdBranches) {
933 std::ostringstream sout;
934 sout <<
"Module: " << item.first.second <<
" " << item.first.first << std::endl;
935 std::set<edm::BranchID> allBranchIDsForLabelAndProcess;
937 for(
auto const& idBranch : idToBranches) {
938 sout <<
" PSet id:" << idBranch.first << std::endl;
940 sout <<
" products: {" << std::endl;
942 std::set<edm::BranchID> branchIDs;
943 for(
auto const&
branch : idBranch.second) {
945 sout <<
" " <<
branch.branchName() << std::endl;
947 branchIDs.insert(
branch.branchID());
948 allBranchIDsForLabelAndProcess.insert(
branch.branchID());
950 sout <<
" }" << std::endl;
952 ParameterSetMap::const_iterator itpsm = psm_.find(psid);
953 if(psm_.end() == itpsm) {
955 errorLog_ <<
"No ParameterSetID for " << psid << std::endl;
958 sout <<
" parameters: ";
964 sout <<
" dependencies: {" << std::endl;
965 std::set<edm::ParentageID> parentageIDs;
966 for(
auto const&
branch : branchIDs) {
969 std::set<edm::ParentageID>
const&
temp = perProductParentage[
branch];
970 parentageIDs.insert(temp.begin(), temp.end());
972 for(
auto const& parentID : parentageIDs) {
974 if(
nullptr != parentage) {
976 sout <<
" " << branchIDToBranchName[
branch] << std::endl;
979 sout <<
" ERROR:parentage info not in registry ParentageID=" << parentID << std::endl;
982 if(parentageIDs.empty()) {
983 sout <<
" no dependencies recorded (event may not contain data from this module)" << std::endl;
985 sout <<
" }" << std::endl;
989 sout <<
" extendedAncestors: {" << std::endl;
990 std::set<edm::BranchID> ancestorBranchIDs;
991 for (
auto const& branchID : allBranchIDsForLabelAndProcess) {
992 addAncestors(branchID, ancestorBranchIDs, sout, perProductParentage);
994 for (
auto const& ancestorBranchID : ancestorBranchIDs) {
995 sout <<
" " << branchIDToBranchName[ancestorBranchID] <<
"\n";
997 sout <<
" }" << std::endl;
1001 sout <<
" extendedDescendants: {" << std::endl;
1002 std::set<edm::BranchID> descendantBranchIDs;
1003 for (
auto const& branchID : allBranchIDsForLabelAndProcess) {
1004 addDescendants(branchID, descendantBranchIDs, sout, parentToChildren);
1006 for (
auto const& descendantBranchID : descendantBranchIDs) {
1007 sout <<
" " << branchIDToBranchName[descendantBranchID] <<
"\n";
1009 sout <<
" }" << std::endl;
1011 bool foundMatch =
true;
1013 for (
auto const& stringToFind :
findMatch_) {
1014 if (sout.str().find(stringToFind) == std::string::npos) {
1025 std::cout <<
"---------Other Modules---------" << std::endl;
1028 std::cout <<
"---------All Modules---------" << std::endl;
1033 std::cout <<
"---------EventSetup---------" << std::endl;
1038 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()