CMS 3D CMS Logo

EdmProvDump.cc
Go to the documentation of this file.
17 
21 
22 #include "TError.h"
23 #include "TFile.h"
24 #include "TTree.h"
25 
26 #include "boost/program_options.hpp"
27 
28 #include <cassert>
29 #include <iostream>
30 #include <memory>
31 #include <map>
32 #include <set>
33 #include <sstream>
34 #include <vector>
35 
36 typedef std::map<std::string, std::vector<edm::BranchDescription>> IdToBranches;
37 typedef std::map<std::pair<std::string, std::string>, IdToBranches> ModuleToIdBranches;
38 
39 static std::ostream& prettyPrint(std::ostream& oStream,
40  edm::ParameterSet const& iPSet,
41  std::string const& iIndent,
42  std::string const& iIndentDelta);
43 
44 static std::string const triggerResults = std::string("TriggerResults");
45 static std::string const triggerPaths = std::string("@trigger_paths");
46 static std::string const source = std::string("source");
47 static std::string const input = std::string("@main_input");
48 
49 namespace {
50  typedef std::map<edm::ParameterSetID, edm::ParameterSetBlob> ParameterSetMap;
51 
52  class HistoryNode {
53  public:
54  HistoryNode() : config_(), simpleId_(0) {}
55 
56  HistoryNode(edm::ProcessConfiguration const& iConfig, unsigned int iSimpleId)
57  : config_(iConfig), simpleId_(iSimpleId) {}
58 
59  void addChild(HistoryNode const& child) { children_.push_back(child); }
60 
61  edm::ParameterSetID const& parameterSetID() const { return config_.parameterSetID(); }
62 
63  std::string const& processName() const { return config_.processName(); }
64 
65  std::size_t size() const { return children_.size(); }
66 
67  HistoryNode* lastChildAddress() { return &children_.back(); }
68 
69  typedef std::vector<HistoryNode>::const_iterator const_iterator;
70  typedef std::vector<HistoryNode>::iterator iterator;
71 
72  iterator begin() { return children_.begin(); }
73  iterator end() { return children_.end(); }
74 
75  const_iterator begin() const { return children_.begin(); }
76  const_iterator end() const { return children_.end(); }
77 
78  void print(std::ostream& os) const {
79  os << config_.processName() << " '" << config_.passID() << "' '" << config_.releaseVersion() << "' [" << simpleId_
80  << "] (" << config_.parameterSetID() << ")" << std::endl;
81  }
82 
83  void printHistory(std::string const& iIndent = std::string(" ")) const;
84  void printEventSetupHistory(ParameterSetMap const& iPSM,
85  std::vector<std::string> const& iFindMatch,
86  std::ostream& oErrorLog) const;
87  void printOtherModulesHistory(ParameterSetMap const& iPSM,
88  ModuleToIdBranches const&,
89  std::vector<std::string> const& iFindMatch,
90  std::ostream& oErrorLog) const;
91  void printTopLevelPSetsHistory(ParameterSetMap const& iPSM,
92  std::vector<std::string> const& iFindMatch,
93  std::ostream& oErrorLog) const;
94 
95  edm::ProcessConfigurationID configurationID() const { return config_.id(); }
96 
97  static bool sort_;
98 
99  private:
101  std::vector<HistoryNode> children_;
102  unsigned int simpleId_;
103  };
104 
105  std::ostream& operator<<(std::ostream& os, HistoryNode const& node) {
106  node.print(os);
107  return os;
108  }
109  bool HistoryNode::sort_ = false;
110 } // namespace
111 
112 std::ostream& operator<<(std::ostream& os, edm::ProcessHistory& iHist) {
113  std::string const indentDelta(" ");
114  std::string indent = indentDelta;
115  for (auto const& process : iHist) {
116  os << indent << process.processName() << " '" << process.passID() << "' '" << process.releaseVersion() << "' ("
117  << process.parameterSetID() << ")" << std::endl;
118  indent += indentDelta;
119  }
120  return os;
121 }
122 
123 void HistoryNode::printHistory(std::string const& iIndent) const {
124  std::string const indentDelta(" ");
125  const std::string& indent = iIndent;
126  for (auto const& item : *this) {
127  std::cout << indent << item;
128  item.printHistory(indent + indentDelta);
129  }
130 }
131 
133  std::string const& iCompName,
134  edm::ParameterSet const& iProcessConfig,
135  std::string const& iProcessName) {
136  std::ostringstream result;
137  edm::ParameterSet const& pset = iProcessConfig.getParameterSet(iCompName);
138  std::string name(pset.getParameter<std::string>("@module_label"));
139  if (name.empty()) {
140  name = pset.getParameter<std::string>("@module_type");
141  }
142 
143  result << iType << ": " << name << " " << iProcessName << "\n"
144  << " parameters: ";
145  prettyPrint(result, pset, " ", " ");
146  return result.str();
147 }
148 
149 void HistoryNode::printEventSetupHistory(ParameterSetMap const& iPSM,
150  std::vector<std::string> const& iFindMatch,
151  std::ostream& oErrorLog) const {
152  for (auto const& itH : *this) {
153  //Get ParameterSet for process
154  ParameterSetMap::const_iterator itFind = iPSM.find(itH.parameterSetID());
155  if (itFind == iPSM.end()) {
156  oErrorLog << "No ParameterSetID for " << itH.parameterSetID() << std::endl;
157  } else {
158  edm::ParameterSet processConfig(itFind->second.pset());
159  std::vector<std::string> sourceStrings, moduleStrings;
160  //get the sources
161  std::vector<std::string> sources = processConfig.getParameter<std::vector<std::string>>("@all_essources");
162  for (auto& itM : sources) {
163  std::string retValue = eventSetupComponent("ESSource", itM, processConfig, itH.processName());
164  bool foundMatch = true;
165  if (!iFindMatch.empty()) {
166  for (auto const& stringToFind : iFindMatch) {
167  if (retValue.find(stringToFind) == std::string::npos) {
168  foundMatch = false;
169  break;
170  }
171  }
172  }
173  if (foundMatch) {
174  sourceStrings.push_back(std::move(retValue));
175  }
176  }
177  //get the modules
178  std::vector<std::string> modules = processConfig.getParameter<std::vector<std::string>>("@all_esmodules");
179  for (auto& itM : modules) {
180  std::string retValue = eventSetupComponent("ESModule", itM, processConfig, itH.processName());
181  bool foundMatch = true;
182  if (!iFindMatch.empty()) {
183  for (auto const& stringToFind : iFindMatch) {
184  if (retValue.find(stringToFind) == std::string::npos) {
185  foundMatch = false;
186  break;
187  }
188  }
189  }
190  if (foundMatch) {
191  moduleStrings.push_back(std::move(retValue));
192  }
193  }
194  if (sort_) {
195  std::sort(sourceStrings.begin(), sourceStrings.end());
196  std::sort(moduleStrings.begin(), moduleStrings.end());
197  }
198  std::copy(sourceStrings.begin(), sourceStrings.end(), std::ostream_iterator<std::string>(std::cout, "\n"));
199  std::copy(moduleStrings.begin(), moduleStrings.end(), std::ostream_iterator<std::string>(std::cout, "\n"));
200  }
201  itH.printEventSetupHistory(iPSM, iFindMatch, oErrorLog);
202  }
203 }
204 
206  edm::ParameterSet const& iProcessConfig,
207  std::string const& iProcessName) {
208  std::ostringstream result;
209  edm::ParameterSet const& pset = iProcessConfig.getParameterSet(iCompName);
210  std::string label(pset.getParameter<std::string>("@module_label"));
211 
212  result << "Module: " << label << " " << iProcessName << "\n"
213  << " parameters: ";
214  prettyPrint(result, pset, " ", " ");
215  return result.str();
216 }
217 
218 void HistoryNode::printOtherModulesHistory(ParameterSetMap const& iPSM,
219  ModuleToIdBranches const& iModules,
220  std::vector<std::string> const& iFindMatch,
221  std::ostream& oErrorLog) const {
222  for (auto const& itH : *this) {
223  //Get ParameterSet for process
224  ParameterSetMap::const_iterator itFind = iPSM.find(itH.parameterSetID());
225  if (itFind == iPSM.end()) {
226  oErrorLog << "No ParameterSetID for " << itH.parameterSetID() << std::endl;
227  } else {
228  edm::ParameterSet processConfig(itFind->second.pset());
229  std::vector<std::string> moduleStrings;
230  //get all modules
231  std::vector<std::string> modules = processConfig.getParameter<std::vector<std::string>>("@all_modules");
232  for (auto& itM : modules) {
233  //if we didn't already handle this from the branches
234  if (iModules.end() == iModules.find(std::make_pair(itH.processName(), itM))) {
235  std::string retValue(nonProducerComponent(itM, processConfig, itH.processName()));
236  bool foundMatch = true;
237  if (!iFindMatch.empty()) {
238  for (auto const& stringToFind : iFindMatch) {
239  if (retValue.find(stringToFind) == std::string::npos) {
240  foundMatch = false;
241  break;
242  }
243  }
244  }
245  if (foundMatch) {
246  moduleStrings.push_back(std::move(retValue));
247  }
248  }
249  }
250  if (sort_) {
251  std::sort(moduleStrings.begin(), moduleStrings.end());
252  }
253  std::copy(moduleStrings.begin(), moduleStrings.end(), std::ostream_iterator<std::string>(std::cout, "\n"));
254  }
255  itH.printOtherModulesHistory(iPSM, iModules, iFindMatch, oErrorLog);
256  }
257 }
258 
259 static void appendToSet(std::set<std::string>& iSet, std::vector<std::string> const& iFrom) {
260  for (auto const& n : iFrom) {
261  iSet.insert(n);
262  }
263 }
264 
266  edm::ParameterSet const& iProcessConfig,
267  std::string const& iProcessName) {
268  std::ostringstream result;
269  edm::ParameterSet const& pset = iProcessConfig.getParameterSet(iName);
270 
271  result << "PSet: " << iName << " " << iProcessName << "\n"
272  << " parameters: ";
273  prettyPrint(result, pset, " ", " ");
274  return result.str();
275 }
276 
277 void HistoryNode::printTopLevelPSetsHistory(ParameterSetMap const& iPSM,
278  std::vector<std::string> const& iFindMatch,
279  std::ostream& oErrorLog) const {
280  for (auto const& itH : *this) {
281  //Get ParameterSet for process
282  ParameterSetMap::const_iterator itFind = iPSM.find(itH.parameterSetID());
283  if (itFind == iPSM.end()) {
284  oErrorLog << "No ParameterSetID for " << itH.parameterSetID() << std::endl;
285  } else {
286  edm::ParameterSet processConfig(itFind->second.pset());
287  //Need to get the names of PSets which are used by the framework (e.g. names of modules)
288  std::set<std::string> namesToExclude;
289  appendToSet(namesToExclude, processConfig.getParameter<std::vector<std::string>>("@all_modules"));
290  appendToSet(namesToExclude, processConfig.getParameter<std::vector<std::string>>("@all_sources"));
291  appendToSet(namesToExclude, processConfig.getParameter<std::vector<std::string>>("@all_loopers"));
292  //appendToSet(namesToExclude,processConfig.getParameter<std::vector<std::string> >("@all_subprocesses"));//untracked
293  appendToSet(namesToExclude, processConfig.getParameter<std::vector<std::string>>("@all_esmodules"));
294  appendToSet(namesToExclude, processConfig.getParameter<std::vector<std::string>>("@all_essources"));
295  appendToSet(namesToExclude, processConfig.getParameter<std::vector<std::string>>("@all_esprefers"));
296  if (processConfig.existsAs<std::vector<std::string>>("all_aliases")) {
297  appendToSet(namesToExclude, processConfig.getParameter<std::vector<std::string>>("@all_aliases"));
298  }
299 
300  std::vector<std::string> allNames{};
301  processConfig.getParameterSetNames(allNames);
302 
303  std::vector<std::string> results;
304  for (auto const& name : allNames) {
305  if (name.empty() || '@' == name[0] || namesToExclude.find(name) != namesToExclude.end()) {
306  continue;
307  }
308  std::string retValue = topLevelPSet(name, processConfig, itH.processName());
309 
310  bool foundMatch = true;
311  if (!iFindMatch.empty()) {
312  for (auto const& stringToFind : iFindMatch) {
313  if (retValue.find(stringToFind) == std::string::npos) {
314  foundMatch = false;
315  break;
316  }
317  }
318  }
319  if (foundMatch) {
320  results.push_back(std::move(retValue));
321  }
322  }
323  if (sort_) {
324  std::sort(results.begin(), results.end());
325  }
326  std::copy(results.begin(), results.end(), std::ostream_iterator<std::string>(std::cout, "\n"));
327  }
328  itH.printTopLevelPSetsHistory(iPSM, iFindMatch, oErrorLog);
329  }
330 }
331 
332 namespace {
333  std::unique_ptr<TFile> makeTFileWithLookup(std::string const& filename) {
334  // See if it is a logical file name.
335  auto operate = edm::setupSiteLocalConfig();
336  std::string override;
337  std::vector<std::string> fileNames;
338  fileNames.push_back(filename);
339  edm::InputFileCatalog catalog(fileNames, override, true);
340  if (catalog.fileNames(0)[0] == filename) {
341  throw cms::Exception("FileNotFound", "RootFile::RootFile()")
342  << "File " << filename << " was not found or could not be opened.\n";
343  }
344  // filename is a valid LFN.
345  std::unique_ptr<TFile> result(TFile::Open(catalog.fileNames(0)[0].c_str()));
346  if (!result.get()) {
347  throw cms::Exception("FileNotFound", "RootFile::RootFile()")
348  << "File " << fileNames[0] << " was not found or could not be opened.\n";
349  }
350  return result;
351  }
352 
353  // Open the input file, returning the TFile object that represents it.
354  // The returned unique_ptr will not be null. The argument must not be null.
355  // We first try the file name as a PFN, so that the catalog and related
356  // services are not loaded unless needed.
357  std::unique_ptr<TFile> makeTFile(std::string const& filename) {
358  gErrorIgnoreLevel = kFatal;
359  std::unique_ptr<TFile> result(TFile::Open(filename.c_str()));
361  if (!result.get()) {
362  // Try again with catalog.
363  return makeTFileWithLookup(filename);
364  }
365  return result;
366  }
367 } // namespace
368 
369 static std::ostream& prettyPrint(std::ostream& os,
370  edm::ParameterSetEntry const& psetEntry,
371  std::string const& iIndent,
372  std::string const& iIndentDelta) {
373  char const* trackiness = (psetEntry.isTracked() ? "tracked" : "untracked");
374  os << "PSet " << trackiness << " = (";
375  prettyPrint(os, psetEntry.pset(), iIndent + iIndentDelta, iIndentDelta);
376  os << ")";
377  return os;
378 }
379 
380 static std::ostream& prettyPrint(std::ostream& os,
381  edm::VParameterSetEntry const& vpsetEntry,
382  std::string const& iIndent,
383  std::string const& iIndentDelta) {
384  std::vector<edm::ParameterSet> const& vps = vpsetEntry.vpset();
385  os << "VPSet " << (vpsetEntry.isTracked() ? "tracked" : "untracked") << " = ({" << std::endl;
386  std::string newIndent = iIndent + iIndentDelta;
388  std::string const between(",\n");
389  for (auto const& item : vps) {
390  os << start << newIndent;
391  prettyPrint(os, item, newIndent, iIndentDelta);
392  start = between;
393  }
394  if (!vps.empty()) {
395  os << std::endl;
396  }
397  os << iIndent << "})";
398  return os;
399 }
400 
401 static std::ostream& prettyPrint(std::ostream& oStream,
402  edm::ParameterSet const& iPSet,
403  std::string const& iIndent,
404  std::string const& iIndentDelta) {
405  std::string newIndent = iIndent + iIndentDelta;
406 
407  oStream << "{" << std::endl;
408  for (auto const& item : iPSet.tbl()) {
409  // indent a bit
410  oStream << newIndent << item.first << ": " << item.second << std::endl;
411  }
412  for (auto const& item : iPSet.psetTable()) {
413  // indent a bit
414  edm::ParameterSetEntry const& pe = item.second;
415  oStream << newIndent << item.first << ": ";
416  prettyPrint(oStream, pe, iIndent, iIndentDelta);
417  oStream << std::endl;
418  }
419  for (auto const& item : iPSet.vpsetTable()) {
420  // indent a bit
421  edm::VParameterSetEntry const& pe = item.second;
422  oStream << newIndent << item.first << ": ";
423  prettyPrint(oStream, pe, newIndent, iIndentDelta);
424  oStream << std::endl;
425  }
426  oStream << iIndent << "}";
427 
428  return oStream;
429 }
430 
432 public:
433  // It is illegal to call this constructor with a null pointer; a
434  // legal C-style string is required.
436  bool showDependencies,
437  bool extendedAncestors,
438  bool extendedDescendants,
439  bool excludeESModules,
440  bool showAllModules,
441  bool showTopLevelPSets,
442  std::vector<std::string> const& findMatch,
443  bool dontPrintProducts,
444  std::string const& dumpPSetID);
445 
446  ProvenanceDumper(ProvenanceDumper const&) = delete; // Disallow copying and moving
447  ProvenanceDumper& operator=(ProvenanceDumper const&) = delete; // Disallow copying and moving
448 
449  // Write the provenenace information to the given stream.
450  void dump();
451  void printErrors(std::ostream& os);
452  int exitCode() const;
453 
454 private:
455  void addAncestors(edm::BranchID const& branchID,
456  std::set<edm::BranchID>& ancestorBranchIDs,
457  std::ostringstream& sout,
458  std::map<edm::BranchID, std::set<edm::ParentageID>>& perProductParentage) const;
459 
460  void addDescendants(edm::BranchID const& branchID,
461  std::set<edm::BranchID>& descendantBranchIDs,
462  std::ostringstream& sout,
463  std::map<edm::BranchID, std::set<edm::BranchID>>& parentToChildren) const;
464 
468  std::stringstream errorLog_;
474  HistoryNode historyGraph_;
482  std::vector<std::string> findMatch_;
485 
486  void work_();
487  void dumpProcessHistory_();
491 };
492 
494  bool showDependencies,
495  bool extendedAncestors,
496  bool extendedDescendants,
497  bool excludeESModules,
498  bool showOtherModules,
499  bool showTopLevelPSets,
500  std::vector<std::string> const& findMatch,
501  bool dontPrintProducts,
502  std::string const& dumpPSetID)
503  : filename_(filename),
504  inputFile_(makeTFile(filename)),
505  exitCode_(0),
506  errorLog_(),
507  errorCount_(0),
508  showDependencies_(showDependencies),
509  extendedAncestors_(extendedAncestors),
510  extendedDescendants_(extendedDescendants),
511  excludeESModules_(excludeESModules),
512  showOtherModules_(showOtherModules),
513  productRegistryPresent_(true),
514  showTopLevelPSets_(showTopLevelPSets),
515  findMatch_(findMatch),
516  dontPrintProducts_(dontPrintProducts),
517  dumpPSetID_(dumpPSetID) {}
518 
520 
521 void ProvenanceDumper::printErrors(std::ostream& os) {
522  if (errorCount_ > 0)
523  os << errorLog_.str() << std::endl;
524 }
525 
526 int ProvenanceDumper::exitCode() const { return exitCode_; }
527 
529  edm::EventSelectionIDVector::size_type num_ids = ids.size();
530  if (num_ids == 0) {
531  std::cout << "No event filtering information is available.\n";
532  std::cout << "------------------------------\n";
533  } else {
534  std::cout << "Event filtering information for " << num_ids << " processing steps is available.\n"
535  << "The ParameterSets will be printed out, "
536  << "with the oldest printed first.\n";
537  for (edm::EventSelectionIDVector::size_type i = 0; i != num_ids; ++i) {
539  }
540  }
541 }
542 
544  TTree* history = dynamic_cast<TTree*>(file->Get(edm::poolNames::eventHistoryTreeName().c_str()));
545  if (history != nullptr) {
546  edm::History h;
547  edm::History* ph = &h;
548 
549  history->SetBranchAddress(edm::poolNames::eventHistoryBranchName().c_str(), &ph);
550  if (history->GetEntry(0) <= 0) {
551  std::cout << "No event filtering information is available; the event history tree has no entries\n";
552  } else {
553  dumpEventFilteringParameterSets(h.eventSelectionIDs());
554  }
555  } else {
556  TTree* events = dynamic_cast<TTree*>(file->Get(edm::poolNames::eventTreeName().c_str()));
557  assert(events != nullptr);
558  TBranch* eventSelectionsBranch = events->GetBranch(edm::poolNames::eventSelectionsBranchName().c_str());
559  if (eventSelectionsBranch == nullptr)
560  return;
562  edm::EventSelectionIDVector* pids = &ids;
563  eventSelectionsBranch->SetAddress(&pids);
564  if (eventSelectionsBranch->GetEntry(0) <= 0) {
565  std::cout << "No event filtering information is available; the event selections branch has no entries\n";
566  } else {
568  }
569  }
570 }
571 
573  std::cout << "ParameterSetID: " << id << '\n';
574  if (id.isValid()) {
575  ParameterSetMap::const_iterator i = psm_.find(id);
576  if (i == psm_.end()) {
577  std::cout << "We are unable to find the corresponding ParameterSet\n";
579  empty.registerIt();
580  if (id == empty.id()) {
581  std::cout << "But it would have been empty anyway\n";
582  }
583  } else {
584  edm::ParameterSet ps(i->second.pset());
585  prettyPrint(std::cout, ps, " ", " ");
586  std::cout << '\n';
587  }
588  } else {
589  std::cout << "This ID is not valid\n";
590  }
591  std::cout << " -------------------------\n";
592 }
593 
595  std::cout << "Processing History:" << std::endl;
596  std::map<edm::ProcessConfigurationID, unsigned int> simpleIDs;
597  for (auto const& ph : phv_) {
598  //loop over the history entries looking for matches
599  HistoryNode* parent = &historyGraph_;
600  for (auto const& pc : ph) {
601  if (parent->size() == 0) {
602  unsigned int id = simpleIDs[pc.id()];
603  if (0 == id) {
604  id = 1;
605  simpleIDs[pc.id()] = id;
606  }
607  parent->addChild(HistoryNode(pc, id));
608  parent = parent->lastChildAddress();
609  } else {
610  //see if this is unique
611  bool isUnique = true;
612  for (auto& child : *parent) {
613  if (child.configurationID() == pc.id()) {
614  isUnique = false;
615  parent = &child;
616  break;
617  }
618  }
619  if (isUnique) {
620  simpleIDs[pc.id()] = parent->size() + 1;
621  parent->addChild(HistoryNode(pc, simpleIDs[pc.id()]));
622  parent = parent->lastChildAddress();
623  }
624  }
625  }
626  }
627  historyGraph_.printHistory();
628 }
629 
631  TTree* meta = dynamic_cast<TTree*>(inputFile_->Get(edm::poolNames::metaDataTreeName().c_str()));
632  assert(nullptr != meta);
633 
634  edm::ProductRegistry* pReg = &reg_;
635  if (meta->FindBranch(edm::poolNames::productDescriptionBranchName().c_str()) != nullptr) {
636  meta->SetBranchAddress(edm::poolNames::productDescriptionBranchName().c_str(), &pReg);
637  } else {
638  productRegistryPresent_ = false;
639  }
640 
641  ParameterSetMap* pPsm = &psm_;
642  if (meta->FindBranch(edm::poolNames::parameterSetMapBranchName().c_str()) != nullptr) {
643  meta->SetBranchAddress(edm::poolNames::parameterSetMapBranchName().c_str(), &pPsm);
644  } else {
645  TTree* psetTree = dynamic_cast<TTree*>(inputFile_->Get(edm::poolNames::parameterSetsTreeName().c_str()));
646  assert(nullptr != psetTree);
647  typedef std::pair<edm::ParameterSetID, edm::ParameterSetBlob> IdToBlobs;
648  IdToBlobs idToBlob;
649  IdToBlobs* pIdToBlob = &idToBlob;
650  psetTree->SetBranchAddress(edm::poolNames::idToParameterSetBlobsBranchName().c_str(), &pIdToBlob);
651  for (long long i = 0; i != psetTree->GetEntries(); ++i) {
652  psetTree->GetEntry(i);
653  psm_.insert(idToBlob);
654  }
655  }
656 
658  if (meta->FindBranch(edm::poolNames::processHistoryBranchName().c_str()) != nullptr) {
659  meta->SetBranchAddress(edm::poolNames::processHistoryBranchName().c_str(), &pPhv);
660  }
661 
663  edm::ProcessHistoryMap* pPhm = &phm;
664  if (meta->FindBranch(edm::poolNames::processHistoryMapBranchName().c_str()) != nullptr) {
665  meta->SetBranchAddress(edm::poolNames::processHistoryMapBranchName().c_str(), &pPhm);
666  }
667 
668  if (meta->FindBranch(edm::poolNames::moduleDescriptionMapBranchName().c_str()) != nullptr) {
669  if (meta->GetBranch(edm::poolNames::moduleDescriptionMapBranchName().c_str())->GetSplitLevel() != 0) {
670  meta->SetBranchStatus((edm::poolNames::moduleDescriptionMapBranchName() + ".*").c_str(), false);
671  } else {
672  meta->SetBranchStatus(edm::poolNames::moduleDescriptionMapBranchName().c_str(), false);
673  }
674  }
675 
676  meta->GetEntry(0);
677  assert(nullptr != pReg);
678 
680  for (auto const& item : psm_) {
681  edm::ParameterSet pset(item.second.pset());
682  pset.setID(item.first);
683  psetRegistry.insertMapped(pset);
684  }
685 
686  if (!phv_.empty()) {
687  for (auto const& history : phv_) {
688  for (auto const& process : history) {
689  phc_.push_back(process);
690  }
691  }
693  phc_.erase(std::unique(phc_.begin(), phc_.end()), phc_.end());
694 
695  }
696  // backward compatibility
697  else if (!phm.empty()) {
698  for (auto const& history : phm) {
699  phv_.push_back(history.second);
700  for (auto const& process : history.second) {
701  phc_.push_back(process);
702  }
703  }
705  phc_.erase(std::unique(phc_.begin(), phc_.end()), phc_.end());
706  }
707 
708  if (!dumpPSetID_.empty()) {
709  edm::ParameterSetID psetID;
710  try {
712  } catch (cms::Exception const& x) {
713  throw cms::Exception("Command Line Argument")
714  << "Illegal ParameterSetID string. It should contain 32 hexadecimal characters";
715  }
716  dumpParameterSetForID_(psetID);
717  return;
718  }
719 
720  //Prepare the parentage information if requested
721  std::map<edm::BranchID, std::set<edm::ParentageID>> perProductParentage;
722 
724  TTree* parentageTree = dynamic_cast<TTree*>(inputFile_->Get(edm::poolNames::parentageTreeName().c_str()));
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";
729  showDependencies_ = false;
730  extendedAncestors_ = false;
731  extendedDescendants_ = false;
732  } else {
734 
735  std::vector<edm::ParentageID> orderedParentageIDs;
736  orderedParentageIDs.reserve(parentageTree->GetEntries());
737  for (Long64_t i = 0, numEntries = parentageTree->GetEntries(); i < numEntries; ++i) {
738  edm::Parentage parentageBuffer;
739  edm::Parentage* pParentageBuffer = &parentageBuffer;
740  parentageTree->SetBranchAddress(edm::poolNames::parentageBranchName().c_str(), &pParentageBuffer);
741  parentageTree->GetEntry(i);
742  registry.insertMapped(parentageBuffer);
743  orderedParentageIDs.push_back(parentageBuffer.id());
744  }
745  parentageTree->SetBranchAddress(edm::poolNames::parentageBranchName().c_str(), nullptr);
746 
747  TTree* eventMetaTree =
748  dynamic_cast<TTree*>(inputFile_->Get(edm::BranchTypeToMetaDataTreeName(edm::InEvent).c_str()));
749  if (nullptr == eventMetaTree) {
750  eventMetaTree = dynamic_cast<TTree*>(inputFile_->Get(edm::BranchTypeToProductTreeName(edm::InEvent).c_str()));
751  }
752  if (nullptr == eventMetaTree) {
754  << "' Tree in file so can not show dependencies\n";
755  showDependencies_ = false;
756  extendedAncestors_ = false;
757  extendedDescendants_ = false;
758  } else {
759  TBranch* storedProvBranch =
760  eventMetaTree->GetBranch(edm::BranchTypeToProductProvenanceBranchName(edm::InEvent).c_str());
761 
762  if (nullptr != storedProvBranch) {
763  std::vector<edm::StoredProductProvenance> info;
764  std::vector<edm::StoredProductProvenance>* pInfo = &info;
765  storedProvBranch->SetAddress(&pInfo);
766  for (Long64_t i = 0, numEntries = eventMetaTree->GetEntries(); i < numEntries; ++i) {
767  storedProvBranch->GetEntry(i);
768  for (auto const& item : info) {
769  edm::BranchID bid(item.branchID_);
770  perProductParentage[bid].insert(orderedParentageIDs.at(item.parentageIDIndex_));
771  }
772  }
773  } else {
774  //backwards compatible check
775  TBranch* productProvBranch =
776  eventMetaTree->GetBranch(edm::BranchTypeToBranchEntryInfoBranchName(edm::InEvent).c_str());
777  if (nullptr != productProvBranch) {
778  std::vector<edm::ProductProvenance> info;
779  std::vector<edm::ProductProvenance>* pInfo = &info;
780  productProvBranch->SetAddress(&pInfo);
781  for (Long64_t i = 0, numEntries = eventMetaTree->GetEntries(); i < numEntries; ++i) {
782  productProvBranch->GetEntry(i);
783  for (auto const& item : info) {
784  perProductParentage[item.branchID()].insert(item.parentageID());
785  }
786  }
787  } else {
788  std::cerr << " ERROR, could not find provenance information so can not show dependencies\n";
789  showDependencies_ = false;
790  extendedAncestors_ = false;
791  extendedDescendants_ = false;
792  }
793  }
794  }
795  }
796  }
797 
798  std::map<edm::BranchID, std::set<edm::BranchID>> parentToChildren;
800 
801  if (extendedDescendants_) {
802  for (auto const& itParentageSet : perProductParentage) {
803  edm::BranchID childBranchID = itParentageSet.first;
804  for (auto const& itParentageID : itParentageSet.second) {
805  edm::Parentage const* parentage = registry.getMapped(itParentageID);
806  if (nullptr != parentage) {
807  for (auto const& branch : parentage->parents()) {
808  parentToChildren[branch].insert(childBranchID);
809  }
810  } else {
811  std::cerr << " ERROR:parentage info not in registry ParentageID=" << itParentageID << std::endl;
812  }
813  }
814  }
815  }
816 
818 
820 
822  std::cout << "---------Producers with data in file---------" << std::endl;
823  }
824 
825  //using edm::ParameterSetID as the key does not work
826  // typedef std::map<edm::ParameterSetID, std::vector<edm::BranchDescription> > IdToBranches
827  ModuleToIdBranches moduleToIdBranches;
828  //IdToBranches idToBranches;
829 
830  std::map<edm::BranchID, std::string> branchIDToBranchName;
831 
832  for (auto const& processConfig : phc_) {
833  edm::ParameterSet const* processParameterSet =
834  edm::pset::Registry::instance()->getMapped(processConfig.parameterSetID());
835  if (nullptr == processParameterSet || processParameterSet->empty()) {
836  continue;
837  }
838  for (auto& item : reg_.productListUpdator()) {
839  auto& product = item.second;
840  if (product.processName() != processConfig.processName()) {
841  continue;
842  }
843  //force it to rebuild the branch name
844  product.init();
845  setIsMergeable(product);
846 
848  branchIDToBranchName[product.branchID()] = product.branchName();
849  }
850  /*
851  std::cout << product.branchName()
852  << " id " << product.productID() << std::endl;
853  */
854  std::string moduleLabel = product.moduleLabel();
855  if (moduleLabel == source) {
856  moduleLabel = input;
857  } else if (moduleLabel == triggerResults) {
859  }
860 
861  std::stringstream s;
862 
863  if (processParameterSet->existsAs<edm::ParameterSet>(moduleLabel)) {
864  edm::ParameterSet const& moduleParameterSet = processParameterSet->getParameterSet(moduleLabel);
865  if (!moduleParameterSet.isRegistered()) {
866  edm::ParameterSet moduleParameterSetCopy = processParameterSet->getParameterSet(moduleLabel);
867  moduleParameterSetCopy.registerIt();
868  s << moduleParameterSetCopy.id();
869  } else {
870  s << moduleParameterSet.id();
871  }
872  moduleToIdBranches[std::make_pair(product.processName(), product.moduleLabel())][s.str()].push_back(product);
873  }
874  }
875  }
876 
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;
881  IdToBranches const& idToBranches = item.second;
882  for (auto const& idBranch : idToBranches) {
883  sout << " PSet id:" << idBranch.first << std::endl;
884  if (!dontPrintProducts_) {
885  sout << " products: {" << std::endl;
886  }
887  std::set<edm::BranchID> branchIDs;
888  for (auto const& branch : idBranch.second) {
889  if (!dontPrintProducts_) {
890  sout << " " << branch.branchName() << std::endl;
891  }
892  branchIDs.insert(branch.branchID());
893  allBranchIDsForLabelAndProcess.insert(branch.branchID());
894  }
895  sout << " }" << std::endl;
896  edm::ParameterSetID psid(idBranch.first);
897  ParameterSetMap::const_iterator itpsm = psm_.find(psid);
898  if (psm_.end() == itpsm) {
899  ++errorCount_;
900  errorLog_ << "No ParameterSetID for " << psid << std::endl;
901  exitCode_ = 1;
902  } else {
903  sout << " parameters: ";
904  prettyPrint(sout, edm::ParameterSet((*itpsm).second.pset()), " ", " ");
905  sout << std::endl;
906  }
907  if (showDependencies_) {
908  sout << " dependencies: {" << std::endl;
909  std::set<edm::ParentageID> parentageIDs;
910  for (auto const& branch : branchIDs) {
911  //Save these BranchIDs
912  std::set<edm::ParentageID> const& temp = perProductParentage[branch];
913  parentageIDs.insert(temp.begin(), temp.end());
914  }
915  for (auto const& parentID : parentageIDs) {
916  edm::Parentage const* parentage = registry.getMapped(parentID);
917  if (nullptr != parentage) {
918  for (auto const& branch : parentage->parents()) {
919  sout << " " << branchIDToBranchName[branch] << std::endl;
920  }
921  } else {
922  sout << " ERROR:parentage info not in registry ParentageID=" << parentID << std::endl;
923  }
924  }
925  if (parentageIDs.empty()) {
926  sout << " no dependencies recorded (event may not contain data from this module)" << std::endl;
927  }
928  sout << " }" << std::endl;
929  }
930  } // end loop over PSetIDs
931  if (extendedAncestors_) {
932  sout << " extendedAncestors: {" << std::endl;
933  std::set<edm::BranchID> ancestorBranchIDs;
934  for (auto const& branchID : allBranchIDsForLabelAndProcess) {
935  addAncestors(branchID, ancestorBranchIDs, sout, perProductParentage);
936  }
937  for (auto const& ancestorBranchID : ancestorBranchIDs) {
938  sout << " " << branchIDToBranchName[ancestorBranchID] << "\n";
939  }
940  sout << " }" << std::endl;
941  }
942 
943  if (extendedDescendants_) {
944  sout << " extendedDescendants: {" << std::endl;
945  std::set<edm::BranchID> descendantBranchIDs;
946  for (auto const& branchID : allBranchIDsForLabelAndProcess) {
947  addDescendants(branchID, descendantBranchIDs, sout, parentToChildren);
948  }
949  for (auto const& descendantBranchID : descendantBranchIDs) {
950  sout << " " << branchIDToBranchName[descendantBranchID] << "\n";
951  }
952  sout << " }" << std::endl;
953  }
954  bool foundMatch = true;
955  if (!findMatch_.empty()) {
956  for (auto const& stringToFind : findMatch_) {
957  if (sout.str().find(stringToFind) == std::string::npos) {
958  foundMatch = false;
959  break;
960  }
961  }
962  }
963  if (foundMatch) {
964  std::cout << sout.str() << std::endl;
965  }
966  } // end loop over module label/process
967 
969  std::cout << "---------Other Modules---------" << std::endl;
970  historyGraph_.printOtherModulesHistory(psm_, moduleToIdBranches, findMatch_, errorLog_);
971  } else if (!productRegistryPresent_) {
972  std::cout << "---------All Modules---------" << std::endl;
973  historyGraph_.printOtherModulesHistory(psm_, moduleToIdBranches, findMatch_, errorLog_);
974  }
975 
976  if (!excludeESModules_) {
977  std::cout << "---------EventSetup---------" << std::endl;
978  historyGraph_.printEventSetupHistory(psm_, findMatch_, errorLog_);
979  }
980 
981  if (showTopLevelPSets_) {
982  std::cout << "---------Top Level PSets---------" << std::endl;
983  historyGraph_.printTopLevelPSetsHistory(psm_, findMatch_, errorLog_);
984  }
985  if (errorCount_ != 0) {
986  exitCode_ = 1;
987  }
988 }
989 
991  std::set<edm::BranchID>& ancestorBranchIDs,
992  std::ostringstream& sout,
993  std::map<edm::BranchID, std::set<edm::ParentageID>>& perProductParentage) const {
995 
996  std::set<edm::ParentageID> const& parentIDs = perProductParentage[branchID];
997  for (auto const& parentageID : parentIDs) {
998  edm::Parentage const* parentage = registry.getMapped(parentageID);
999  if (nullptr != parentage) {
1000  for (auto const& branch : parentage->parents()) {
1001  if (ancestorBranchIDs.insert(branch).second) {
1002  addAncestors(branch, ancestorBranchIDs, sout, perProductParentage);
1003  }
1004  }
1005  } else {
1006  sout << " ERROR:parentage info not in registry ParentageID=" << parentageID << std::endl;
1007  }
1008  }
1009 }
1010 
1012  std::set<edm::BranchID>& descendantBranchIDs,
1013  std::ostringstream& sout,
1014  std::map<edm::BranchID, std::set<edm::BranchID>>& parentToChildren) const {
1015  for (auto const& childBranchID : parentToChildren[branchID]) {
1016  if (descendantBranchIDs.insert(childBranchID).second) {
1017  addDescendants(childBranchID, descendantBranchIDs, sout, parentToChildren);
1018  }
1019  }
1020 }
1021 
1022 static char const* const kSortOpt = "sort";
1023 static char const* const kSortCommandOpt = "sort,s";
1024 static char const* const kDependenciesOpt = "dependencies";
1025 static char const* const kDependenciesCommandOpt = "dependencies,d";
1026 static char const* const kExtendedAncestorsOpt = "extendedAncestors";
1027 static char const* const kExtendedAncestorsCommandOpt = "extendedAncestors,x";
1028 static char const* const kExtendedDescendantsOpt = "extendedDescendants";
1029 static char const* const kExtendedDescendantsCommandOpt = "extendedDescendants,c";
1030 static char const* const kExcludeESModulesOpt = "excludeESModules";
1031 static char const* const kExcludeESModulesCommandOpt = "excludeESModules,e";
1032 static char const* const kShowAllModulesOpt = "showAllModules";
1033 static char const* const kShowAllModulesCommandOpt = "showAllModules,a";
1034 static char const* const kFindMatchOpt = "findMatch";
1035 static char const* const kFindMatchCommandOpt = "findMatch,f";
1036 static char const* const kDontPrintProductsOpt = "dontPrintProducts";
1037 static char const* const kDontPrintProductsCommandOpt = "dontPrintProducts,p";
1038 static char const* const kShowTopLevelPSetsOpt = "showTopLevelPSets";
1039 static char const* const kShowTopLevelPSetsCommandOpt = "showTopLevelPSets,t";
1040 static char const* const kHelpOpt = "help";
1041 static char const* const kHelpCommandOpt = "help,h";
1042 static char const* const kFileNameOpt = "input-file";
1043 static char const* const kDumpPSetIDOpt = "dumpPSetID";
1044 static char const* const kDumpPSetIDCommandOpt = "dumpPSetID,i";
1045 
1046 int main(int argc, char* argv[]) {
1047  using namespace boost::program_options;
1048 
1049  std::string descString(argv[0]);
1050  descString += " [options] <filename>";
1051  descString += "\nAllowed options";
1052  options_description desc(descString);
1053 
1054  // clang-format off
1055  desc.add_options()(kHelpCommandOpt, "show help message")(kSortCommandOpt, "alphabetially sort EventSetup components")(
1056  kDependenciesCommandOpt, "print what data each EDProducer is directly dependent upon")(
1057  kExtendedAncestorsCommandOpt, "print what data each EDProducer is dependent upon including indirect dependences")(
1059  "print what data depends on the data each EDProducer produces including indirect dependences")(
1060  kExcludeESModulesCommandOpt, "do not print ES module information")(
1061  kShowAllModulesCommandOpt, "show all modules (not just those that created data in the file)")(
1062  kShowTopLevelPSetsCommandOpt, "show all top level PSets")(
1064  boost::program_options::value<std::vector<std::string>>(),
1065  "show only modules whose information contains the matching string (or all the matching strings, this option can "
1066  "be repeated with different strings)")(kDontPrintProductsCommandOpt, "do not print products produced by module")(
1068  value<std::string>(),
1069  "print the parameter set associated with the parameter set ID string (and print nothing else)");
1070  // clang-format on
1071 
1072  //we don't want users to see these in the help messages since this
1073  // name only exists since the parser needs it
1074  options_description hidden;
1075  hidden.add_options()(kFileNameOpt, value<std::string>(), "file name");
1076 
1077  //full list of options for the parser
1078  options_description cmdline_options;
1079  cmdline_options.add(desc).add(hidden);
1080 
1081  positional_options_description p;
1082  p.add(kFileNameOpt, -1);
1083 
1084  variables_map vm;
1085  try {
1086  store(command_line_parser(argc, argv).options(cmdline_options).positional(p).run(), vm);
1087  notify(vm);
1088  } catch (error const& iException) {
1089  std::cerr << iException.what();
1090  return 1;
1091  }
1092 
1093  if (vm.count(kHelpOpt)) {
1094  std::cout << desc << std::endl;
1095  return 0;
1096  }
1097 
1098  if (vm.count(kSortOpt)) {
1099  HistoryNode::sort_ = true;
1100  }
1101 
1102  bool showDependencies = false;
1103  if (vm.count(kDependenciesOpt)) {
1104  showDependencies = true;
1105  }
1106 
1107  bool extendedAncestors = false;
1108  if (vm.count(kExtendedAncestorsOpt)) {
1109  extendedAncestors = true;
1110  }
1111 
1112  bool extendedDescendants = false;
1113  if (vm.count(kExtendedDescendantsOpt)) {
1114  extendedDescendants = true;
1115  }
1116 
1117  bool excludeESModules = false;
1118  if (vm.count(kExcludeESModulesOpt)) {
1119  excludeESModules = true;
1120  }
1121 
1122  bool showAllModules = false;
1123  if (vm.count(kShowAllModulesOpt)) {
1124  showAllModules = true;
1125  }
1126 
1127  bool showTopLevelPSets = false;
1128  if (vm.count(kShowTopLevelPSetsOpt)) {
1129  showTopLevelPSets = true;
1130  }
1131 
1133  if (vm.count(kFileNameOpt)) {
1134  try {
1135  fileName = vm[kFileNameOpt].as<std::string>();
1136  } catch (boost::bad_any_cast const& e) {
1137  std::cout << e.what() << std::endl;
1138  return 2;
1139  }
1140  } else {
1141  std::cout << "Data file not specified." << std::endl;
1142  std::cout << desc << std::endl;
1143  return 2;
1144  }
1145 
1146  std::string dumpPSetID;
1147  if (vm.count(kDumpPSetIDOpt)) {
1148  try {
1149  dumpPSetID = vm[kDumpPSetIDOpt].as<std::string>();
1150  } catch (boost::bad_any_cast const& e) {
1151  std::cout << e.what() << std::endl;
1152  return 2;
1153  }
1154  }
1155 
1156  std::vector<std::string> findMatch;
1157  if (vm.count(kFindMatchOpt)) {
1158  try {
1159  findMatch = vm[kFindMatchOpt].as<std::vector<std::string>>();
1160  } catch (boost::bad_any_cast const& e) {
1161  std::cout << e.what() << std::endl;
1162  return 2;
1163  }
1164  }
1165 
1166  bool dontPrintProducts = false;
1167  if (vm.count(kDontPrintProductsOpt)) {
1168  dontPrintProducts = true;
1169  }
1170 
1171  //silence ROOT warnings about missing dictionaries
1173 
1174  ProvenanceDumper dumper(fileName,
1175  showDependencies,
1176  extendedAncestors,
1177  extendedDescendants,
1178  excludeESModules,
1179  showAllModules,
1180  showTopLevelPSets,
1181  findMatch,
1182  dontPrintProducts,
1183  dumpPSetID);
1184  int exitCode(0);
1185  try {
1186  dumper.dump();
1187  exitCode = dumper.exitCode();
1188  } catch (cms::Exception const& x) {
1189  std::cerr << "cms::Exception caught\n";
1190  std::cerr << x.what() << '\n';
1191  exitCode = 2;
1192  } catch (std::exception& x) {
1193  std::cerr << "std::exception caught\n";
1194  std::cerr << x.what() << '\n';
1195  exitCode = 3;
1196  } catch (...) {
1197  std::cerr << "Unknown exception caught\n";
1198  exitCode = 4;
1199  }
1200 
1201  dumper.printErrors(std::cerr);
1202  return exitCode;
1203 }
std::stringstream errorLog_
Definition: EdmProvDump.cc:468
static char const *const kDontPrintProductsCommandOpt
std::vector< ProcessHistory > ProcessHistoryVector
size
Write out results.
Definition: start.py:1
std::vector< ProcessConfiguration > ProcessConfigurationVector
std::string const & metaDataTreeName()
Definition: BranchType.cc:159
static const TGPicture * info(bool iBackgroundIsBlack)
static char const *const kDumpPSetIDOpt
static char const *const kDependenciesOpt
bool getMapped(key_type const &k, value_type &result) const
Definition: Registry.cc:17
static char const *const kFindMatchCommandOpt
table const & tbl() const
Definition: ParameterSet.h:233
std::string dumpPSetID_
Definition: EdmProvDump.cc:484
const bool isValid(const Frame &aFrame, const FrameQuality &aQuality, const uint16_t aExpectedPos)
static char const *const kShowTopLevelPSetsCommandOpt
bool productRegistryPresent_
Definition: EdmProvDump.cc:480
std::string const & BranchTypeToBranchEntryInfoBranchName(BranchType const &branchType)
Definition: BranchType.cc:134
std::string const & moduleDescriptionMapBranchName()
Definition: BranchType.cc:171
edm::ProductRegistry reg_
Definition: EdmProvDump.cc:470
ParameterSetMap psm_
Definition: EdmProvDump.cc:473
ParameterSet const & getParameterSet(std::string const &) const
void dumpParameterSetForID_(edm::ParameterSetID const &id)
Definition: EdmProvDump.cc:572
static char const *const kHelpOpt
HistoryNode historyGraph_
Definition: EdmProvDump.cc:474
std::string const & processHistoryBranchName()
Definition: BranchType.cc:177
std::vector< ParameterSet > const & vpset() const
returns the VPSet
std::vector< BranchID > const & parents() const
Definition: Parentage.h:44
static char const *const kDontPrintProductsOpt
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:171
void dumpEventFilteringParameterSets_(TFile *file)
Definition: EdmProvDump.cc:543
ParameterSet const & pset() const
returns the PSet
assert(be >=bs)
std::string const & parameterSetMapBranchName()
Definition: BranchType.cc:168
uint16_t size_type
edm::ProcessHistoryVector phv_
Definition: EdmProvDump.cc:472
static char const *const kDependenciesCommandOpt
std::vector< EventSelectionID > EventSelectionIDVector
std::string const & productDescriptionBranchName()
Definition: BranchType.cc:162
static char const *const kHelpCommandOpt
static std::string const input
Definition: EdmProvDump.cc:47
static char const *const kShowTopLevelPSetsOpt
std::ostream & operator<<(std::ostream &os, edm::ProcessHistory &iHist)
Definition: EdmProvDump.cc:112
constexpr element_type const * get() const
std::string const & BranchTypeToMetaDataTreeName(BranchType const &branchType)
Definition: BranchType.cc:105
bool getMapped(key_type const &k, value_type &result) const
std::string const & processHistoryMapBranchName()
Definition: BranchType.cc:174
char const * label
static char const *const kShowAllModulesCommandOpt
ParameterSetID id() const
static char const *const kExcludeESModulesCommandOpt
ParameterSet const & registerIt()
edm::propagate_const< std::unique_ptr< TFile > > inputFile_
Definition: EdmProvDump.cc:466
static char const *const kSortOpt
std::string const & BranchTypeToProductTreeName(BranchType const &branchType)
Definition: BranchType.cc:95
static char const *const kExcludeESModulesOpt
std::map< std::pair< std::string, std::string >, IdToBranches > ModuleToIdBranches
Definition: EdmProvDump.cc:37
void dumpEventFilteringParameterSets(edm::EventSelectionIDVector const &ids)
Definition: EdmProvDump.cc:528
bool empty() const
Definition: ParameterSet.h:201
Long64_t numEntries(TFile *hdl, std::string const &trname)
Definition: CollUtil.cc:50
def unique(seq, keepstr=True)
Definition: tier0.py:24
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()
Definition: BranchType.cc:216
static char const *const kSortCommandOpt
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
std::string eventSetupComponent(char const *iType, std::string const &iCompName, edm::ParameterSet const &iProcessConfig, std::string const &iProcessName)
Definition: EdmProvDump.cc:132
std::string const & BranchTypeToProductProvenanceBranchName(BranchType const &BranchType)
Definition: BranchType.cc:139
std::string nonProducerComponent(std::string const &iCompName, edm::ParameterSet const &iProcessConfig, std::string const &iProcessName)
Definition: EdmProvDump.cc:205
bool insertMapped(value_type const &v, bool forceUpdate=false)
Definition: Registry.cc:32
ProvenanceDumper(std::string const &filename, bool showDependencies, bool extendedAncestors, bool extendedDescendants, bool excludeESModules, bool showAllModules, bool showTopLevelPSets, std::vector< std::string > const &findMatch, bool dontPrintProducts, std::string const &dumpPSetID)
Definition: EdmProvDump.cc:493
std::string const & parentageBranchName()
Definition: BranchType.cc:156
ProvenanceDumper & operator=(ProvenanceDumper const &)=delete
static char const *const kExtendedAncestorsCommandOpt
static std::string const triggerResults
Definition: EdmProvDump.cc:44
Hash< ParameterSetType > ParameterSetID
std::string const & idToParameterSetBlobsBranchName()
Definition: BranchType.cc:218
std::string const & eventHistoryTreeName()
Definition: BranchType.cc:224
static void appendToSet(std::set< std::string > &iSet, std::vector< std::string > const &iFrom)
Definition: EdmProvDump.cc:259
static std::ostream & prettyPrint(std::ostream &oStream, edm::ParameterSet const &iPSet, std::string const &iIndent, std::string const &iIndentDelta)
Definition: EdmProvDump.cc:401
ServiceRegistry::Operate setupSiteLocalConfig()
std::map< std::string, std::vector< edm::BranchDescription > > IdToBranches
Definition: EdmProvDump.cc:36
int main(int argc, char *argv[])
void dumpProcessHistory_()
Definition: EdmProvDump.cc:594
std::string const & eventSelectionsBranchName()
Definition: BranchType.cc:210
edm::ProcessConfigurationVector phc_
Definition: EdmProvDump.cc:471
void sort_all(RandomAccessSequence &s)
wrappers for std::sort
Definition: Algorithms.h:92
std::string filename_
Definition: EdmProvDump.cc:465
static char const *const kShowAllModulesOpt
std::string const & parentageTreeName()
Definition: BranchType.cc:154
ProductList & productListUpdator()
gErrorIgnoreLevel
Definition: utils.py:27
std::vector< std::string > findMatch_
Definition: EdmProvDump.cc:482
std::map< ParameterSetID, ParameterSetBlob > ParameterSetMap
static char const *const kExtendedDescendantsOpt
ParentageID id() const
Definition: Parentage.cc:17
std::string const & eventHistoryBranchName()
Definition: BranchType.cc:207
std::string const & eventTreeName()
Definition: BranchType.cc:220
static char const *const kFileNameOpt
float x
bool isRegistered() const
Definition: ParameterSet.h:71
static char const *const kExtendedAncestorsOpt
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
static ParentageRegistry * instance()
static std::string const triggerPaths
Definition: EdmProvDump.cc:45
int exitCode() const
Definition: EdmProvDump.cc:526
static std::string const source
Definition: EdmProvDump.cc:46
void setIsMergeable(BranchDescription &)
int events
std::map< ProcessHistoryID, ProcessHistory > ProcessHistoryMap
bool insertMapped(value_type const &v)
def move(src, dest)
Definition: eostools.py:511
static Registry * instance()
Definition: Registry.cc:12
void addAncestors(edm::BranchID const &branchID, std::set< edm::BranchID > &ancestorBranchIDs, std::ostringstream &sout, std::map< edm::BranchID, std::set< edm::ParentageID >> &perProductParentage) const
Definition: EdmProvDump.cc:990
static std::string topLevelPSet(std::string const &iName, edm::ParameterSet const &iProcessConfig, std::string const &iProcessName)
Definition: EdmProvDump.cc:265
vpsettable const & vpsetTable() const
Definition: ParameterSet.h:239
static char const *const kDumpPSetIDCommandOpt
static char const *const kExtendedDescendantsCommandOpt
psettable const & psetTable() const
Definition: ParameterSet.h:236
void printErrors(std::ostream &os)
Definition: EdmProvDump.cc:521
static char const *const kFindMatchOpt