#include "DataFormats/Provenance/interface/BranchType.h"
#include "DataFormats/Provenance/interface/EventSelectionID.h"
#include "DataFormats/Provenance/interface/History.h"
#include "DataFormats/Provenance/interface/ParameterSetBlob.h"
#include "DataFormats/Provenance/interface/ProcessConfigurationRegistry.h"
#include "DataFormats/Provenance/interface/ParameterSetID.h"
#include "DataFormats/Provenance/interface/ProcessHistoryRegistry.h"
#include "DataFormats/Provenance/interface/ProcessConfigurationID.h"
#include "DataFormats/Provenance/interface/ProductRegistry.h"
#include "DataFormats/Provenance/interface/Parentage.h"
#include "DataFormats/Provenance/interface/ProductProvenance.h"
#include "DataFormats/Provenance/interface/StoredProductProvenance.h"
#include "DataFormats/Provenance/interface/ParentageRegistry.h"
#include "FWCore/Catalog/interface/InputFileCatalog.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/ParameterSet/interface/Registry.h"
#include "FWCore/ParameterSet/interface/FillProductRegistryTransients.h"
#include "FWCore/ServiceRegistry/interface/ServiceRegistry.h"
#include "FWCore/Services/src/SiteLocalConfigService.h"
#include "FWCore/Utilities/interface/Algorithms.h"
#include "FWCore/Utilities/interface/Exception.h"
#include "Cintex/Cintex.h"
#include "TError.h"
#include "TFile.h"
#include "TTree.h"
#include "boost/program_options.hpp"
#include <assert.h>
#include <iostream>
#include <memory>
#include <map>
#include <set>
#include <sstream>
#include <vector>
Go to the source code of this file.
Classes | |
class | ProvenanceDumper |
Typedefs | |
typedef std::map< std::string, std::vector < edm::BranchDescription > > | IdToBranches |
typedef std::map< std::pair < std::string, std::string > , IdToBranches > | ModuleToIdBranches |
Functions | |
static void | appendToSet (std::set< std::string > &iSet, std::vector< std::string > const &iFrom) |
std::string | eventSetupComponent (char const *iType, std::string const &iCompName, edm::ParameterSet const &iProcessConfig, std::string const &iProcessName) |
int | main (int argc, char *argv[]) |
std::string | nonProducerComponent (std::string const &iCompName, edm::ParameterSet const &iProcessConfig, std::string const &iProcessName) |
std::ostream & | operator<< (std::ostream &os, edm::ProcessHistory &iHist) |
static std::ostream & | prettyPrint (std::ostream &os, edm::VParameterSetEntry const &vpsetEntry, std::string const &iIndent, std::string const &iIndentDelta) |
static std::ostream & | prettyPrint (std::ostream &oStream, edm::ParameterSet const &iPSet, std::string const &iIndent, std::string const &iIndentDelta) |
static std::ostream & | prettyPrint (std::ostream &os, edm::ParameterSetEntry const &psetEntry, std::string const &iIndent, std::string const &iIndentDelta) |
static std::string | topLevelPSet (std::string const &iName, edm::ParameterSet const &iProcessConfig, std::string const &iProcessName) |
Variables | |
static char const *const | kDependenciesCommandOpt = "dependencies,d" |
static char const *const | kDependenciesOpt = "dependencies" |
static char const *const | kExcludeESModulesCommandOpt = "excludeESModules,e" |
static char const *const | kExcludeESModulesOpt = "excludeESModules" |
static char const *const | kFileNameCommandOpt = "input-file" |
static char const *const | kFileNameOpt = "input-file" |
static char const *const | kFindMatchCommandOpt = "findMatch,f" |
static char const *const | kFindMatchOpt = "findMatch" |
static char const *const | kHelpCommandOpt = "help,h" |
static char const *const | kHelpOpt = "help" |
static char const *const | kShowAllModulesCommandOpt = "showAllModules,a" |
static char const *const | kShowAllModulesOpt = "showAllModules" |
static char const *const | kShowTopLevelPSetsCommandOpt = "showTopLevelPSets,t" |
static char const *const | kShowTopLevelPSetsOpt = "showTopLevelPSets" |
static char const *const | kSortCommandOpt = "sort,s" |
static char const *const | kSortOpt = "sort" |
typedef std::map<std::string, std::vector<edm::BranchDescription> > IdToBranches |
Definition at line 39 of file EdmProvDump.cc.
typedef std::map<std::pair<std::string, std::string>, IdToBranches> ModuleToIdBranches |
Definition at line 40 of file EdmProvDump.cc.
static void appendToSet | ( | std::set< std::string > & | iSet, |
std::vector< std::string > const & | iFrom | ||
) | [static] |
Definition at line 277 of file EdmProvDump.cc.
References n.
std::string eventSetupComponent | ( | char const * | iType, |
std::string const & | iCompName, | ||
edm::ParameterSet const & | iProcessConfig, | ||
std::string const & | iProcessName | ||
) |
Definition at line 161 of file EdmProvDump.cc.
References edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterSet(), mergeVDriftHistosByStation::name, prettyPrint(), query::result, and AlCaHLTBitMon_QueryRunRegistry::string.
{ std::ostringstream result; edm::ParameterSet const& pset = iProcessConfig.getParameterSet(iCompName); std::string name(pset.getParameter<std::string>("@module_label")); if(0 == name.size()) { name = pset.getParameter<std::string>("@module_type"); } result << iType << ": " << name << " " << iProcessName << "\n" << " parameters: "; prettyPrint(result, pset, " ", " "); return result.str(); }
int main | ( | int | argc, |
char * | argv[] | ||
) |
Definition at line 922 of file EdmProvDump.cc.
References dtNoiseDBValidation_cfg::cerr, gather_cfg::cout, ProvenanceDumper::dump(), alignCSCRings::e, error, exception, ProvenanceDumper::exitCode(), convertXMLtoSQLite_cfg::fileName, kDependenciesCommandOpt, fwlog::kError, kFileNameOpt, kFindMatchCommandOpt, kFindMatchOpt, kHelpCommandOpt, kShowAllModulesCommandOpt, AlCaHLTBitMon_ParallelJobs::options, AlCaHLTBitMon_ParallelJobs::p, ProvenanceDumper::printErrors(), DTTTrigCorrFirst::run, AlCaHLTBitMon_QueryRunRegistry::string, cms::Exception::what(), and x.
{ using namespace boost::program_options; std::string descString(argv[0]); descString += " [options] <filename>"; descString += "\nAllowed options"; options_description desc(descString); desc.add_options() (kHelpCommandOpt, "show help message") (kSortCommandOpt , "alphabetially sort EventSetup components") (kDependenciesCommandOpt , "print what data each EDProducer is dependent upon") (kExcludeESModulesCommandOpt , "do not print ES module information") (kShowAllModulesCommandOpt , "show all modules (not just those that created data in the file)") (kShowTopLevelPSetsCommandOpt,"show all top level PSets") (kFindMatchCommandOpt, boost::program_options::value<std::string>(), "show only modules whose information contains the matching string") ; //we don't want users to see these in the help messages since this // name only exists since the parser needs it options_description hidden; hidden.add_options()(kFileNameOpt, value<std::string>(), "file name"); //full list of options for the parser options_description cmdline_options; cmdline_options.add(desc).add(hidden); positional_options_description p; p.add(kFileNameOpt, -1); variables_map vm; try { store(command_line_parser(argc, argv).options(cmdline_options).positional(p).run(), vm); notify(vm); } catch(error const& iException) { std::cerr << iException.what(); return 1; } if(vm.count(kHelpOpt)) { std::cout << desc << std::endl; return 0; } if(vm.count(kSortOpt)) { HistoryNode::sort_ = true; } bool showDependencies = false; if(vm.count(kDependenciesOpt)) { showDependencies = true; } bool excludeESModules = false; if(vm.count(kExcludeESModulesOpt)) { excludeESModules = true; } bool showAllModules = false; if(vm.count(kShowAllModulesOpt)) { showAllModules = true; } bool showTopLevelPSets = false; if(vm.count(kShowTopLevelPSetsOpt)) { showTopLevelPSets=true; } std::string fileName; if(vm.count(kFileNameOpt)) { try { fileName = vm[kFileNameOpt].as<std::string>(); } catch(boost::bad_any_cast const& e) { std::cout << e.what() << std::endl; return 2; } } else { std::cout << "Data file not specified." << std::endl; std::cout << desc << std::endl; return 2; } std::string findMatch; if(vm.count(kFindMatchOpt)) { try { findMatch = vm[kFindMatchOpt].as<std::string>(); } catch(boost::bad_any_cast const& e) { std::cout << e.what() << std::endl; return 2; } } //silence ROOT warnings about missing dictionaries gErrorIgnoreLevel = kError; //make sure dictionaries can be used for reading ROOT::Cintex::Cintex::Enable(); ProvenanceDumper dumper(fileName, showDependencies, excludeESModules, showAllModules, showTopLevelPSets, findMatch); int exitCode(0); try { dumper.dump(); exitCode = dumper.exitCode(); } catch (cms::Exception const& x) { std::cerr << "cms::Exception caught\n"; std::cerr << x.what() << '\n'; exitCode = 2; } catch (std::exception& x) { std::cerr << "std::exception caught\n"; std::cerr << x.what() << '\n'; exitCode = 3; } catch (...) { std::cerr << "Unknown exception caught\n"; exitCode = 4; } dumper.printErrors(std::cerr); return exitCode; }
std::string nonProducerComponent | ( | std::string const & | iCompName, |
edm::ParameterSet const & | iProcessConfig, | ||
std::string const & | iProcessName | ||
) |
Definition at line 227 of file EdmProvDump.cc.
References edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterSet(), diffTwoXMLs::label, prettyPrint(), query::result, and AlCaHLTBitMon_QueryRunRegistry::string.
{ std::ostringstream result; edm::ParameterSet const& pset = iProcessConfig.getParameterSet(iCompName); std::string label(pset.getParameter<std::string>("@module_label")); result << "Module: " << label << " " << iProcessName << "\n" << " parameters: "; prettyPrint(result, pset, " ", " "); return result.str(); }
std::ostream& operator<< | ( | std::ostream & | os, |
edm::ProcessHistory & | iHist | ||
) |
Definition at line 133 of file EdmProvDump.cc.
References edm::ProcessHistory::begin(), alignCSCRings::e, edm::ProcessHistory::end(), i, tablePrinter::indent(), and AlCaHLTBitMon_QueryRunRegistry::string.
{ std::string const indentDelta(" "); std::string indent = indentDelta; for(edm::ProcessHistory::const_iterator i = iHist.begin(), e = iHist.end(); i != e; ++i) { os << indent << i->processName() << " '" << i->passID() << "' '" << i->releaseVersion() << "' (" << i->parameterSetID() << ")" << std::endl; indent += indentDelta; } return os; }
static std::ostream& prettyPrint | ( | std::ostream & | os, |
edm::VParameterSetEntry const & | vpsetEntry, | ||
std::string const & | iIndent, | ||
std::string const & | iIndentDelta | ||
) | [static] |
Definition at line 395 of file EdmProvDump.cc.
References alignCSCRings::e, i, edm::VParameterSetEntry::isTracked(), prettyPrint(), dqm_diff::start, AlCaHLTBitMon_QueryRunRegistry::string, and edm::VParameterSetEntry::vpset().
{ std::vector<edm::ParameterSet> const& vps = vpsetEntry.vpset(); os << "VPSet " << (vpsetEntry.isTracked() ? "tracked" : "untracked") << " = ({" << std::endl; std::string newIndent = iIndent+iIndentDelta; std::string start; std::string const between(",\n"); for(std::vector<edm::ParameterSet>::const_iterator i = vps.begin(), e = vps.end(); i != e; ++i) { os << start << newIndent; prettyPrint(os, *i, newIndent, iIndentDelta); start = between; } if(!vps.empty()) { os << std::endl; } os << iIndent<< "})"; return os; }
static std::ostream & prettyPrint | ( | std::ostream & | oStream, |
edm::ParameterSet const & | iPSet, | ||
std::string const & | iIndent, | ||
std::string const & | iIndentDelta | ||
) | [static] |
Definition at line 414 of file EdmProvDump.cc.
References alignCSCRings::e, i, edm::ParameterSet::psetTable(), AlCaHLTBitMon_QueryRunRegistry::string, edm::ParameterSet::tbl(), and edm::ParameterSet::vpsetTable().
Referenced by ProvenanceDumper::dumpParameterSetForID_(), eventSetupComponent(), nonProducerComponent(), prettyPrint(), topLevelPSet(), and ProvenanceDumper::work_().
{ std::string newIndent = iIndent+iIndentDelta; oStream << "{" << std::endl; for(edm::ParameterSet::table::const_iterator i = iPSet.tbl().begin(), e = iPSet.tbl().end(); i != e; ++i) { // indent a bit oStream << newIndent<< i->first << ": " << i->second << std::endl; } for(edm::ParameterSet::psettable::const_iterator i = iPSet.psetTable().begin(), e = iPSet.psetTable().end(); i != e; ++i) { // indent a bit edm::ParameterSetEntry const& pe = i->second; oStream << newIndent << i->first << ": "; prettyPrint(oStream, pe, iIndent, iIndentDelta); oStream<< std::endl; } for(edm::ParameterSet::vpsettable::const_iterator i = iPSet.vpsetTable().begin(), e = iPSet.vpsetTable().end(); i != e; ++i) { // indent a bit edm::VParameterSetEntry const& pe = i->second; oStream << newIndent << i->first << ": "; prettyPrint(oStream, pe, newIndent, iIndentDelta); oStream<< std::endl; } oStream << iIndent<< "}"; return oStream; }
static std::ostream& prettyPrint | ( | std::ostream & | os, |
edm::ParameterSetEntry const & | psetEntry, | ||
std::string const & | iIndent, | ||
std::string const & | iIndentDelta | ||
) | [static] |
Definition at line 387 of file EdmProvDump.cc.
References edm::ParameterSetEntry::isTracked(), prettyPrint(), and edm::ParameterSetEntry::pset().
{ char const* trackiness = (psetEntry.isTracked()?"tracked":"untracked"); os << "PSet " << trackiness << " = ("; prettyPrint(os, psetEntry.pset(), iIndent + iIndentDelta, iIndentDelta); os << ")"; return os; }
static std::string topLevelPSet | ( | std::string const & | iName, |
edm::ParameterSet const & | iProcessConfig, | ||
std::string const & | iProcessName | ||
) | [static] |
Definition at line 283 of file EdmProvDump.cc.
References edm::ParameterSet::getParameterSet(), prettyPrint(), and query::result.
{ std::ostringstream result; edm::ParameterSet const& pset = iProcessConfig.getParameterSet(iName); result << "PSet: " << iName << " " << iProcessName << "\n" << " parameters: "; prettyPrint(result, pset, " ", " "); return result.str(); }
char const* const kDependenciesCommandOpt = "dependencies,d" [static] |
Definition at line 908 of file EdmProvDump.cc.
Referenced by main().
char const* const kDependenciesOpt = "dependencies" [static] |
Definition at line 907 of file EdmProvDump.cc.
char const* const kExcludeESModulesCommandOpt = "excludeESModules,e" [static] |
Definition at line 910 of file EdmProvDump.cc.
char const* const kExcludeESModulesOpt = "excludeESModules" [static] |
Definition at line 909 of file EdmProvDump.cc.
char const* const kFileNameCommandOpt = "input-file" [static] |
Definition at line 920 of file EdmProvDump.cc.
char const* const kFileNameOpt = "input-file" [static] |
Definition at line 919 of file EdmProvDump.cc.
Referenced by main().
char const* const kFindMatchCommandOpt = "findMatch,f" [static] |
Definition at line 914 of file EdmProvDump.cc.
Referenced by main().
char const* const kFindMatchOpt = "findMatch" [static] |
Definition at line 913 of file EdmProvDump.cc.
Referenced by main().
char const* const kHelpCommandOpt = "help,h" [static] |
Definition at line 918 of file EdmProvDump.cc.
Referenced by main().
char const* const kHelpOpt = "help" [static] |
Definition at line 917 of file EdmProvDump.cc.
char const* const kShowAllModulesCommandOpt = "showAllModules,a" [static] |
Definition at line 912 of file EdmProvDump.cc.
Referenced by main().
char const* const kShowAllModulesOpt = "showAllModules" [static] |
Definition at line 911 of file EdmProvDump.cc.
char const* const kShowTopLevelPSetsCommandOpt = "showTopLevelPSets,t" [static] |
Definition at line 916 of file EdmProvDump.cc.
char const* const kShowTopLevelPSetsOpt = "showTopLevelPSets" [static] |
Definition at line 915 of file EdmProvDump.cc.
char const* const kSortCommandOpt = "sort,s" [static] |
Definition at line 906 of file EdmProvDump.cc.
char const* const kSortOpt = "sort" [static] |
Definition at line 905 of file EdmProvDump.cc.