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