CMS 3D CMS Logo

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