CMS 3D CMS Logo

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