@@ -83,6 +83,8 @@ namespace {
8383
8484 class HistoryChain {
8585 public:
86+ explicit HistoryChain (edm::ProcessHistoryID id) : historyId_(id) {}
87+
8688 void addChild (HistoryNode const & child) { children_.push_back (child); }
8789
8890 void reserve (std::size_t s) { children_.reserve (s); }
@@ -98,10 +100,11 @@ namespace {
98100 const_iterator begin () const { return children_.begin (); }
99101 const_iterator end () const { return children_.end (); }
100102
101- void printHistory () const ;
103+ void printHistory (bool showHistoryID ) const ;
102104
103105 private:
104106 std::vector<HistoryNode> children_;
107+ edm::ProcessHistoryID historyId_;
105108 };
106109
107110 std::ostream& operator <<(std::ostream& os, HistoryNode const & node) {
@@ -115,11 +118,17 @@ namespace {
115118 }
116119} // namespace
117120
118- void HistoryChain::printHistory () const {
121+ void HistoryChain::printHistory (bool showHistoryID ) const {
119122 constexpr std::string_view indent = " " ;
120123 std::cout << " History: {" << std::endl;
124+ if (showHistoryID) {
125+ std::cout << indent << " History id: " << historyId_ << std::endl;
126+ }
121127 for (auto const & item : children_) {
122128 std::cout << indent << item << std::endl;
129+ if (showHistoryID) {
130+ std::cout << indent << indent << " Configuration id: " << item.configurationID () << std::endl;
131+ }
123132 }
124133 std::cout << " }" << std::endl;
125134}
@@ -282,6 +291,7 @@ class ProvenanceDumper {
282291 bool excludeESModules,
283292 bool showAllModules,
284293 bool showTopLevelPSets,
294+ bool showHistoryID,
285295 std::vector<std::string> const & findMatch,
286296 bool dontPrintProducts,
287297 std::string const & dumpPSetID,
@@ -324,6 +334,7 @@ class ProvenanceDumper {
324334 bool showOtherModules_;
325335 bool productRegistryPresent_;
326336 bool showTopLevelPSets_;
337+ bool showHistoryID_;
327338 std::vector<std::string> findMatch_;
328339 bool dontPrintProducts_;
329340 std::string dumpPSetID_;
@@ -368,6 +379,7 @@ ProvenanceDumper::ProvenanceDumper(std::string const& filename,
368379 bool excludeESModules,
369380 bool showOtherModules,
370381 bool showTopLevelPSets,
382+ bool showHistoryID,
371383 std::vector<std::string> const & findMatch,
372384 bool dontPrintProducts,
373385 std::string const & dumpPSetID,
@@ -385,6 +397,7 @@ ProvenanceDumper::ProvenanceDumper(std::string const& filename,
385397 showOtherModules_(showOtherModules),
386398 productRegistryPresent_(true ),
387399 showTopLevelPSets_(showTopLevelPSets),
400+ showHistoryID_(showHistoryID),
388401 findMatch_(findMatch),
389402 dontPrintProducts_(dontPrintProducts),
390403 dumpPSetID_(dumpPSetID),
@@ -484,7 +497,7 @@ ProvenanceDumper::ProcessSimpleIDsType ProvenanceDumper::dumpProcessHistory_() {
484497 for (auto const & ph : phv_) {
485498 // loop over the history entries to find ProcessConfigurations that are the same
486499 // use a simple count ID for each process that have the same name, but different ProcessConfigurationID
487- histories_.emplace_back ();
500+ histories_.emplace_back (ph. id () );
488501 HistoryChain& chain = histories_.back ();
489502 chain.reserve (ph.size ());
490503
@@ -506,7 +519,7 @@ ProvenanceDumper::ProcessSimpleIDsType ProvenanceDumper::dumpProcessHistory_() {
506519
507520 chain.addChild (HistoryNode (pc, id));
508521 }
509- chain.printHistory ();
522+ chain.printHistory (showHistoryID_ );
510523 }
511524
512525 std::cout << formatHeader (" Processes" ) << std::endl;
@@ -1147,6 +1160,7 @@ static char const* const kDontPrintProductsOpt = "dontPrintProducts";
11471160static char const * const kDontPrintProductsCommandOpt = " dontPrintProducts,p" ;
11481161static char const * const kShowTopLevelPSetsOpt = " showTopLevelPSets" ;
11491162static char const * const kShowTopLevelPSetsCommandOpt = " showTopLevelPSets,t" ;
1163+ static char const * const kShowHistoryIDOpt = " showHistoryID" ;
11501164static char const * const kHelpOpt = " help" ;
11511165static char const * const kHelpCommandOpt = " help,h" ;
11521166static char const * const kFileNameOpt = " input-file" ;
@@ -1170,7 +1184,8 @@ int main(int argc, char* argv[]) {
11701184 " print what data depends on the data each EDProducer produces including indirect dependences" )(
11711185 kExcludeESModulesCommandOpt , " do not print ES module information" )(
11721186 kShowAllModulesCommandOpt , " show all modules (not just those that created data in the file)" )(
1173- kShowTopLevelPSetsCommandOpt , " show all top level PSets" )(
1187+ kShowTopLevelPSetsCommandOpt , " show all top level PSets" )
1188+ (kShowHistoryIDOpt , " show process history and configuration IDs" )(
11741189 kFindMatchCommandOpt ,
11751190 boost::program_options::value<std::vector<std::string>>(),
11761191 " show only modules whose information contains the matching string (or all the matching strings, this option can "
@@ -1200,7 +1215,7 @@ int main(int argc, char* argv[]) {
12001215 store (command_line_parser (argc, argv).options (cmdline_options).positional (p).run (), vm);
12011216 notify (vm);
12021217 } catch (error const & iException) {
1203- std::cerr << iException.what ();
1218+ std::cerr << iException.what () << std::endl ;
12041219 return 1 ;
12051220 }
12061221
@@ -1244,6 +1259,11 @@ int main(int argc, char* argv[]) {
12441259 showTopLevelPSets = true ;
12451260 }
12461261
1262+ bool showHistoryID = false ;
1263+ if (vm.count (kShowHistoryIDOpt )) {
1264+ showHistoryID = true ;
1265+ }
1266+
12471267 std::string fileName;
12481268 if (vm.count (kFileNameOpt )) {
12491269 try {
@@ -1303,6 +1323,7 @@ int main(int argc, char* argv[]) {
13031323 excludeESModules,
13041324 showAllModules,
13051325 showTopLevelPSets,
1326+ showHistoryID,
13061327 findMatch,
13071328 dontPrintProducts,
13081329 dumpPSetID,
0 commit comments