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