CMS 3D CMS Logo

DropBoxMetaDataPayloadInspectorHelper.h
Go to the documentation of this file.
1 #ifndef DropBoxMetaDataPayloadInspectorHelper_H
2 #define DropBoxMetaDataPayloadInspectorHelper_H
3 
4 #include "TH1.h"
5 #include "TH2.h"
6 #include "TStyle.h"
7 #include "TCanvas.h"
8 #include "TLatex.h"
9 #include "TLine.h"
10 
11 #include <fmt/printf.h>
12 #include <fstream>
13 #include <boost/tokenizer.hpp>
14 #include <boost/range/adaptor/indexed.hpp>
17 
18 namespace DBoxMetadataHelper {
20  public:
23  const auto& theParameters = params.getParameterMap();
24  for (const auto& [key, val] : theParameters) {
25  if (key.find("prep") != std::string::npos) {
27  } else if (key.find("prod") != std::string::npos) {
29  } else if (key.find("mult") != std::string::npos) {
31  }
32  }
33  }
35  ~RecordMetaDataInfo() = default;
36 
37  public:
38  const std::string getPrepMetaData() const { return m_prepmetadata; }
39  const std::string getProdMetaData() const { return m_prodmetadata; }
40  const std::string getMultiMetaData() const { return m_multimetadata; }
41  const bool hasMultiMetaData() const { return !m_multimetadata.empty(); }
42 
43  private:
47  };
48 
49  using recordMap = std::map<std::string, RecordMetaDataInfo>;
50 
51  inline const std::vector<std::string> getAllRecords(const DBoxMetadataHelper::recordMap& recordSet) {
52  std::vector<std::string> records;
53  std::transform(recordSet.begin(),
54  recordSet.end(),
55  std::inserter(records, records.end()),
56  [](std::pair<std::string, DBoxMetadataHelper::RecordMetaDataInfo> recordSetEntry) -> std::string {
57  return recordSetEntry.first;
58  });
59  return records;
60  }
61 
62  inline std::vector<std::string> set_difference(std::vector<std::string> const& v1,
63  std::vector<std::string> const& v2) {
64  std::vector<std::string> diff;
65  std::set_difference(std::begin(v1), std::end(v1), std::begin(v2), std::end(v2), std::back_inserter(diff));
66  return diff;
67  }
68 
69  inline std::vector<std::string> set_intersection(std::vector<std::string> const& v1,
70  std::vector<std::string> const& v2) {
71  std::vector<std::string> common;
72  std::set_intersection(std::begin(v1), std::end(v1), std::begin(v2), std::end(v2), std::back_inserter(common));
73  return common;
74  }
75 
77  public:
79  ~DBMetaDataTableDisplay() = default;
80 
81  void printMetaDatas() {
82  for (const auto& [key, val] : m_Map) {
83  edm::LogPrint("DropBoxMetadataPIHelper") << "key: " << key;
84  edm::LogPrint("DropBoxMetadataPIHelper") << "prep: " << cleanJson(val.getPrepMetaData());
85  edm::LogPrint("DropBoxMetadataPIHelper") << "prod: " << cleanJson(val.getProdMetaData());
86  // check, since it's optional
87  if (val.hasMultiMetaData()) {
88  edm::LogPrint("DropBoxMetadataPIHelper") << "multi: " << cleanJson(val.getMultiMetaData());
89  }
90  edm::LogPrint("DropBoxMetadataPIHelper") << "\n";
91  }
92  }
93 
95  edm::LogPrint("DropBoxMetadataPIHelper") << "prep: " << cleanJson(oneKey.getPrepMetaData());
96  edm::LogPrint("DropBoxMetadataPIHelper") << "prod: " << cleanJson(oneKey.getProdMetaData());
97  // check, since it's optional
98  if (oneKey.hasMultiMetaData()) {
99  edm::LogPrint("DropBoxMetadataPIHelper") << "multi: " << cleanJson(oneKey.getMultiMetaData());
100  }
101  edm::LogPrint("DropBoxMetadataPIHelper") << "\n";
102  }
103 
105  edm::LogPrint("DropBoxMetadataPIHelper")
106  << "Target has: " << m_Map.size() << " records, reference has: " << theRefMap.size() << " records";
107 
108  const auto& ref_records = DBoxMetadataHelper::getAllRecords(theRefMap);
109  const auto& tar_records = DBoxMetadataHelper::getAllRecords(m_Map);
110 
111  const auto& diff = DBoxMetadataHelper::set_difference(ref_records, tar_records);
112  const auto& common = DBoxMetadataHelper::set_intersection(ref_records, tar_records);
113 
114  // do first the common parts
115  for (const auto& key : common) {
116  edm::LogPrint("DropBoxMetadataPIHelper") << "key: " << key;
117  const auto& val = m_Map.at(key);
118  const auto& refval = theRefMap.at(key);
119 
120  if ((val.getPrepMetaData()).compare(refval.getPrepMetaData()) != 0) {
121  edm::LogPrint("DropBoxMetadataPIHelper") << "found difference in prep metadata!";
122  edm::LogPrint("DropBoxMetadataPIHelper") << " in target : " << cleanJson(val.getPrepMetaData());
123  edm::LogPrint("DropBoxMetadataPIHelper") << " in reference: " << cleanJson(refval.getPrepMetaData());
124  }
125  if ((val.getProdMetaData()).compare(refval.getProdMetaData()) != 0) {
126  edm::LogPrint("DropBoxMetadataPIHelper") << "found difference in prod metadata!";
127  edm::LogPrint("DropBoxMetadataPIHelper") << " in target : " << cleanJson(val.getProdMetaData());
128  edm::LogPrint("DropBoxMetadataPIHelper") << " in reference: " << cleanJson(refval.getProdMetaData());
129  }
130  if ((val.getMultiMetaData()).compare(refval.getMultiMetaData()) != 0) {
131  edm::LogPrint("DropBoxMetadataPIHelper") << "found difference in multi metadata!";
132  edm::LogPrint("DropBoxMetadataPIHelper") << " in target : " << cleanJson(val.getMultiMetaData());
133  edm::LogPrint("DropBoxMetadataPIHelper") << " in reference: " << cleanJson(refval.getMultiMetaData());
134  }
135  edm::LogPrint("DropBoxMetadataPIHelper") << "\n";
136  }
137 
138  // if interesction is not the union check for extra differences
139  if (!diff.empty()) {
140  // check if the reference has more records than target
141  if (ref_records.size() > tar_records.size()) {
142  for (const auto& ref : ref_records) {
143  if (std::find(tar_records.begin(), tar_records.end(), ref) == tar_records.end()) {
144  const auto& refval = theRefMap.at(ref);
145  edm::LogPrint("DropBoxMetadataPIHelper") << "key: " << ref << " not present in target!";
146  printOneKey(refval);
147  }
148  }
149  }
150  // then check if the target has more records than the reference
151  else if (tar_records.size() > ref_records.size()) {
152  for (const auto& tar : tar_records) {
153  if (std::find(ref_records.begin(), ref_records.end(), tar) == ref_records.end()) {
154  const auto& tarval = m_Map.at(tar);
155  edm::LogPrint("DropBoxMetadataPIHelper") << "key: " << tar << " not present in reference!";
156  printOneKey(tarval);
157  }
158  }
159  }
160  }
161  }
162 
163  private:
165 
167  size_t start_pos = 0;
168  while ((start_pos = str.find(from, start_pos)) != std::string::npos) {
169  str.replace(start_pos, from.length(), to);
170  start_pos += to.length(); // Handles case where 'to' is a substring of 'from'
171  }
172  return str;
173  }
174 
176  std::string out = replaceAll(str, std::string("&quot;"), std::string("'"));
177  return out;
178  }
179  };
180 
182  public:
184  : m_Map(theMap), m_tagName(theTag), m_IOVsinceDisplay(theIOV) {}
185  ~DBMetaDataPlotDisplay() = default;
186 
187  void setImageFileName(const std::string& theFileName) {
188  m_imageFileName = theFileName;
189  return;
190  }
191 
192  //___________________________________________________________________
193  void plotMetaDatas() {
194  unsigned int mapsize = m_Map.size();
195  float pitch = 1. / (mapsize * 1.1);
196 
197  float y, x1, x2;
198  std::vector<float> y_x1, y_x2, y_line;
199  std::vector<std::string> s_x1, s_x2, s_x3;
200 
201  // starting table at y=1.0 (top of the canvas)
202  // first column is at 0.02, second column at 0.32 NDC
203  y = 1.0;
204  x1 = 0.02;
205  x2 = x1 + 0.30;
206 
207  y -= pitch;
208  y_x1.push_back(y);
209  s_x1.push_back("#scale[1.2]{Key}");
210  y_x2.push_back(y);
211  s_x2.push_back("#scale[1.2]{tag: " + m_tagName + " in IOV: " + m_IOVsinceDisplay + "}");
212 
213  y -= pitch / 2.;
214  y_line.push_back(y);
215 
216  for (const auto& element : m_Map) {
217  y -= pitch;
218  y_x1.push_back(y);
219  s_x1.push_back(element.first);
220 
221  std::vector<std::string> output;
222  std::string toAppend = "";
223 
224  std::string prepMetaData = element.second.getPrepMetaData();
225  std::string prodMetaData = element.second.getProdMetaData();
226 
227  // Remove &quot and uninteresting text from output for sake of clarity
228  cleanPrepString(prepMetaData);
229  cleanProdString(prodMetaData);
230 
231  const std::vector<std::string> pathsPrep = decompose(prepMetaData);
232  const std::vector<std::string> pathsProd = decompose(prodMetaData);
233 
234  const int colWidth = 80;
235 
236  toAppend = "PREP: ";
237  output.push_back(toAppend);
238  toAppend.clear();
239  for (unsigned int iPath = 0; iPath < pathsPrep.size(); ++iPath) {
240  const std::string& thisString = pathsPrep[iPath];
241  // skip userText since we want to see actual contents, not metadata
242  if (thisString.find("userText") == std::string::npos) {
243  // if the line to be added has less than colWidth chars, and is not a new tag ("inputTag"), append to current
244  if ((toAppend + thisString).length() < colWidth && thisString.find("inputTag") != 0) {
245  toAppend += thisString;
246  } else {
247  // else if the line exceeds colWidth chars or this is a new tag ("inputTag"), dump in the vector and resume from scratch
248  output.push_back(toAppend);
249  toAppend.clear();
250  toAppend += thisString;
251  }
252  }
253  // if it's the last, dump it
254  if (iPath == pathsPrep.size() - 1) {
255  output.push_back(toAppend);
256  }
257  }
258 
259  toAppend = "PROD: ";
260  output.push_back(toAppend);
261  toAppend.clear();
262  for (unsigned int iPath = 0; iPath < pathsProd.size(); ++iPath) {
263  const std::string& thisString = pathsProd[iPath];
264 
265  if (thisString.find("userText") == std::string::npos) {
266  // if the line to be added has less than colWidth chars append to current
267  if ((toAppend + thisString).length() < colWidth && thisString.find("inputTag") != 0) {
268  toAppend += thisString;
269  } else {
270  // else if the line exceeds colWidth chars or this is a new tag ("inputTag"), dump in the vector and resume from scratch
271  output.push_back(toAppend);
272  toAppend.clear();
273  toAppend += thisString;
274  }
275  }
276  // if it's the last, dump it
277  if (iPath == pathsProd.size() - 1)
278  output.push_back(toAppend);
279  }
280 
281  for (unsigned int br = 0; br < output.size(); br++) {
282  y_x2.push_back(y);
283  // do not use red color since colors get mixed if output[br]
284  // contains a right curly brace (I could not find a way to circumvent that)
285  s_x2.push_back(output[br]);
286 
287  if (br != output.size() - 1)
288  y -= pitch;
289  }
290 
291  y_line.push_back(y - (pitch / 2.));
292  }
293 
294  TCanvas canvas("DropBoxMetaData", "DropBoxMetaData", 2000, std::max(y_x1.size(), y_x2.size()) * 40);
295  TLatex l;
296 
297  // Draw the columns titles
298  l.SetTextAlign(12);
299  float newpitch = 1 / (std::max(y_x1.size(), y_x2.size()) * 1.1);
300  float factor = newpitch / pitch;
301  l.SetTextSize(newpitch - 0.002);
302  canvas.cd();
303  for (unsigned int i = 0; i < y_x1.size(); i++) {
304  l.DrawLatexNDC(x1, 1 - (1 - y_x1[i]) * factor, s_x1[i].c_str());
305  }
306 
307  for (unsigned int i = 0; i < y_x2.size(); i++) {
308  l.DrawLatexNDC(x2, 1 - (1 - y_x2[i]) * factor, s_x2[i].c_str());
309  }
310  canvas.cd();
311  canvas.Update();
312 
313  // Draw horizontal lines separating records
314  TLine lines[y_line.size()];
315  unsigned int iL = 0;
316  for (const auto& line : y_line) {
317  lines[iL] = TLine(gPad->GetUxmin(), 1 - (1 - line) * factor, gPad->GetUxmax(), 1 - (1 - line) * factor);
318  lines[iL].SetLineWidth(1);
319  lines[iL].SetLineStyle(9);
320  lines[iL].SetLineColor(2);
321  lines[iL].Draw("same");
322  iL++;
323  }
324 
325  std::string fileName("DropBoxMetadata_Display.png");
326  if (!m_imageFileName.empty())
328  canvas.SaveAs(fileName.c_str());
329  }
330 
331  //___________________________________________________________________
333  std::string theRefTag,
334  std::string theRefIOV) {
335  const auto& ref_records = DBoxMetadataHelper::getAllRecords(theRefMap);
336  const auto& tar_records = DBoxMetadataHelper::getAllRecords(m_Map);
337 
338  // const auto& diff = DBoxMetadataHelper::set_difference(ref_records, tar_records);
339  const auto& common = DBoxMetadataHelper::set_intersection(ref_records, tar_records);
340 
341  // preparations for plotting
342  // starting table at y=1.0 (top of the canvas)
343  // first column is at 0.03, second column at 0.22 NDC
344  unsigned int mapsize = 2 * m_Map.size();
345  float pitch = 1. / (mapsize * 1.1);
346  float y, x1, x2;
347  std::vector<float> y_x1, y_x2, y_line;
348  std::vector<std::string> s_x1, s_x2, s_x3;
349  y = 1.0;
350  x1 = 0.02;
351  x2 = x1 + 0.30;
352  y -= pitch;
353 
354  // title for plot
355  y_x1.push_back(y);
356  s_x1.push_back("#scale[1.2]{Key}");
357  y_x2.push_back(y);
358  s_x2.push_back("#scale[1.2]{Target tag / IOV :" + m_tagName + " / " + m_IOVsinceDisplay + "}");
359 
360  y -= pitch;
361  y_x1.push_back(y);
362  s_x1.push_back("");
363  y_x2.push_back(y);
364  s_x2.push_back("#scale[1.2]{Reference tag / IOV :" + theRefTag + " / " + theRefIOV + "}");
365 
366  y -= pitch / 2.;
367  y_line.push_back(y);
368 
369  // do first the common parts
370  for (const auto& key : common) {
371  const auto& val = m_Map.at(key);
372  const auto& refval = theRefMap.at(key);
373 
374  y -= pitch;
375  y_x1.push_back(y);
376  s_x1.push_back(key);
377 
378  std::vector<std::string> output;
379 
380  std::string tarPrepMetaData = val.getPrepMetaData();
381  std::string tarProdMetaData = val.getProdMetaData();
382  std::string refPrepMetaData = refval.getPrepMetaData();
383  std::string refProdMetaData = refval.getProdMetaData();
384 
385  // Remove &quot and uninteresting text from output for sake of clarity
386  cleanPrepString(tarPrepMetaData);
387  cleanPrepString(refPrepMetaData);
388  cleanProdString(tarProdMetaData);
389  cleanProdString(refProdMetaData);
390 
391  const std::vector<std::string> tarPathsPrep = decompose(tarPrepMetaData);
392  const std::vector<std::string> refPathsPrep = decompose(refPrepMetaData);
393  const std::vector<std::string> tarPathsProd = decompose(tarProdMetaData);
394  const std::vector<std::string> refPathsProd = decompose(refProdMetaData);
395 
396  bool refAndTarIdentical = true;
397  std::string tmpTar = "";
398  std::string tmpRef = "";
399 
400  prepareLine(tarPathsPrep, output, tmpTar, "PREP/tar");
401  prepareLine(refPathsPrep, output, tmpRef, "PREP/ref");
402 
403  // check if printouts are identical for PREP
404  eraseAllSubStr(tmpTar, "PREP/tar: ");
405  eraseAllSubStr(tmpRef, "PREP/ref: ");
406  if (tmpTar != tmpRef) {
407  refAndTarIdentical = false;
408  } else {
409  output.clear();
410  }
411 
412  // determine the size after having filled the prep- metadata
413  size_t lenAfterPrep = output.size();
414 
415  // clear the tmps
416  tmpTar = "";
417  tmpRef = "";
418 
419  prepareLine(tarPathsProd, output, tmpTar, "PROD/tar");
420  prepareLine(refPathsProd, output, tmpRef, "PROD/ref");
421 
422  // check if printouts are identical for PROD
423  eraseAllSubStr(tmpTar, "PROD/tar: ");
424  eraseAllSubStr(tmpRef, "PROD/ref: ");
425  if (tmpTar != tmpRef) {
426  refAndTarIdentical = false;
427  } else {
428  // remove everything after the prep one
429  output.erase(output.end() - lenAfterPrep, output.end());
430  }
431 
432  // print either "identical" or contents of tags
433  if (refAndTarIdentical) {
434  y_x2.push_back(y);
435  s_x2.push_back("#color[4]{identical}");
436  } else {
437  for (unsigned int br = 0; br < output.size(); br++) {
438  y_x2.push_back(y);
439  // do not use red color since colors get mixed if output[br]
440  // contains a right curly brace (I could not find a way to circumvent that)
441  s_x2.push_back(output[br]);
442 
443  if (br != output.size() - 1)
444  y -= pitch;
445  }
446  }
447  y_line.push_back(y - (pitch / 2.));
448  }
449 
450  // now when common parts are handled, check if there are additional records
451  // (one could check if diff is empty, but his doesn't seem to work as expected)
452 
453  // First, check if there are records in reference which are not in target
454  for (const auto& ref : ref_records) {
455  if (std::find(tar_records.begin(), tar_records.end(), ref) == tar_records.end()) {
456  y -= pitch;
457  y_x1.push_back(y);
458  s_x1.push_back(ref);
459  y_x2.push_back(y);
460  s_x2.push_back("#bf{Only in reference, not in target.}");
461  y_line.push_back(y - (pitch / 2.));
462  }
463  }
464 
465  // Second, check if there are records in target which are not in reference
466  for (const auto& tar : tar_records) {
467  if (std::find(ref_records.begin(), ref_records.end(), tar) == ref_records.end()) {
468  y -= pitch;
469  y_x1.push_back(y);
470  s_x1.push_back(tar);
471  y_x2.push_back(y);
472  s_x2.push_back("#bf{Only in target, not in reference.}");
473  y_line.push_back(y - (pitch / 2.));
474  }
475  }
476 
477  // Finally, print text to TCanvas
478 
479  TCanvas canvas("DropBoxMetaData", "DropBoxMetaData", 2000, std::max(y_x1.size(), y_x2.size()) * 40);
480  TLatex l;
481  // Draw the columns titles
482  l.SetTextAlign(12);
483 
484  float newpitch = 1 / (std::max(y_x1.size(), y_x2.size()) * 1.1);
485  float factor = newpitch / pitch;
486  l.SetTextSize(newpitch - 0.002);
487  canvas.cd();
488  for (unsigned int i = 0; i < y_x1.size(); i++) {
489  l.DrawLatexNDC(x1, 1 - (1 - y_x1[i]) * factor, s_x1[i].c_str());
490  }
491 
492  for (unsigned int i = 0; i < y_x2.size(); i++) {
493  l.DrawLatexNDC(x2, 1 - (1 - y_x2[i]) * factor, s_x2[i].c_str());
494  }
495 
496  canvas.cd();
497  canvas.Update();
498 
499  // Draw horizontal lines separating records
500  TLine lines[y_line.size()];
501  unsigned int iL = 0;
502  for (const auto& line : y_line) {
503  lines[iL] = TLine(gPad->GetUxmin(), 1 - (1 - line) * factor, gPad->GetUxmax(), 1 - (1 - line) * factor);
504  lines[iL].SetLineWidth(1);
505  lines[iL].SetLineStyle(9);
506  lines[iL].SetLineColor(2);
507  lines[iL].Draw("same");
508  iL++;
509  }
510 
511  std::string fileName("DropBoxMetadata_Compare.png");
512  if (!m_imageFileName.empty())
514  canvas.SaveAs(fileName.c_str());
515  }
516 
517  private:
522 
523  //___________________________________________________________________
525  size_t start_pos = 0;
526  while ((start_pos = str.find(from, start_pos)) != std::string::npos) {
527  str.replace(start_pos, from.length(), to);
528  start_pos += to.length(); // Handles case where 'to' is a substring of 'from'
529  }
530  return str;
531  }
532 
533  //___________________________________________________________________
535  std::string out = replaceAll(str, std::string("&quot;"), std::string("'"));
536  return out;
537  }
538 
539  //___________________________________________________________________
540  void eraseAllSubStr(std::string& s, const std::string& toErase) {
541  size_t pos = std::string::npos;
542  // Search for the substring in string in a loop until nothing is found
543  while ((pos = s.find(toErase)) != std::string::npos) {
544  // If found then erase it from string
545  s.erase(pos, toErase.length());
546  }
547  return;
548  }
549 
550  //___________________________________________________________________
551  void cleanPrepString(std::string& myString) {
552  eraseAllSubStr(myString, "&quot;");
553  eraseAllSubStr(myString, "destinationDatabase: oracle://cms_orcoff_prep/CMS_CONDITIONS, ");
554  eraseAllSubStr(myString, "since: null, ");
555  eraseAllSubStr(myString, "{");
556  eraseAllSubStr(myString, "}");
557  eraseAllSubStr(myString, ":");
558  myString = replaceAll(myString, "destinationTags", "destinationTags:");
559  myString = replaceAll(myString, "inputTag", "inputTag:");
560  return;
561  }
562 
563  //___________________________________________________________________
564  void cleanProdString(std::string& myString) {
565  eraseAllSubStr(myString, "&quot;");
566  eraseAllSubStr(myString, "destinationDatabase: oracle://cms_orcon_prod/CMS_CONDITIONS, ");
567  eraseAllSubStr(myString, "since: null, ");
568  eraseAllSubStr(myString, "{");
569  eraseAllSubStr(myString, "}");
570  eraseAllSubStr(myString, ":");
571  myString = replaceAll(myString, "destinationTags", "destinationTags:");
572  myString = replaceAll(myString, "inputTag", "inputTag:");
573  return;
574  }
575 
576  //___________________________________________________________________
577  std::vector<std::string> decompose(const std::string& s) const {
578  // decompose 's' into its parts that are separated by 'delimeter_'
579  // (similar as in
580  // Alignment/CommonAlignmentAlgorithm/src/AlignmentParameterSelector.cc)
581 
582  const std::string::value_type delimeter_ = ','; // separator
583  const std::string::value_type space_ = ' '; // separator
584 
585  std::vector<std::string> result;
586  if (!(s.size() == 1 && s[0] == delimeter_)) {
587  // delimeter_ only indicates an empty list as DB cannot store empty strings
588  std::string::size_type previousPos = 0;
589  while (true) {
590  const std::string::size_type delimiterPos = s.find(delimeter_, previousPos);
591  if (delimiterPos == std::string::npos) {
592  result.push_back(s.substr(previousPos)); // until end
593  break;
594  }
595  result.push_back(s.substr(previousPos, delimiterPos - previousPos));
596  previousPos = delimiterPos + 1; // +1: skip delim
597  if (s[previousPos] == space_)
598  previousPos++; // remove space
599  }
600  }
601  return result;
602  }
603 
604  //___________________________________________________________________
605  void prepareLine(const std::vector<std::string>& thePaths,
606  std::vector<std::string>& output,
607  std::string& tmp,
608  const std::string& header) {
609  const int color = (header.find("tar") == std::string::npos) ? 2 /*kRed*/ : 3 /*kGreen*/;
610  const int colWidth = 80; // maximum width of column
611 
612  std::string toAppend = "";
613  toAppend = header;
614  output.push_back("#color[" + std::to_string(color) + "]{" + toAppend + "}");
615  toAppend.clear();
616  for (unsigned int iPath = 0; iPath < thePaths.size(); ++iPath) {
617  const std::string& thisString = thePaths[iPath];
618  // skip userText since we want to compare actual contents, not metadata
619  if (thisString.find("userText") == std::string::npos) {
620  // if the line to be added has less than colWidth chars, and is not a new tag ("inputTag"), append to current
621  if ((toAppend + thisString).length() < colWidth && thisString.find("inputTag") != 0) {
622  toAppend += thisString;
623  } else {
624  // else if the line exceeds colWidth chars or this is a new tag ("inputTag"), dump in the vector and resume from scratch
625  output.push_back("#color[" + std::to_string(color) + "]{" + toAppend + "}");
626  tmp += toAppend;
627  toAppend.clear();
628  toAppend += thisString;
629  }
630  }
631  if (iPath == thePaths.size() - 1) {
632  output.push_back("#color[" + std::to_string(color) + "]{" + toAppend + "}");
633  tmp += toAppend;
634  }
635  }
636  }
637  };
638 } // namespace DBoxMetadataHelper
639 #endif
bool compare(const P &i, const P &j)
std::string replaceAll(std::string str, const std::string &from, const std::string &to)
std::string replaceAll(std::string str, const std::string &from, const std::string &to)
const std::vector< std::string > getAllRecords(const DBoxMetadataHelper::recordMap &recordSet)
std::map< std::string, RecordMetaDataInfo > recordMap
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
uint16_t size_type
DBMetaDataTableDisplay(DBoxMetadataHelper::recordMap theMap)
static std::string to_string(const XMLCh *ch)
std::vector< std::string > decompose(const std::string &s) const
void printDiffWithMetadata(const DBoxMetadataHelper::recordMap &theRefMap)
DBoxMetadataHelper::recordMap m_Map
map of the record / metadata associations
DBMetaDataPlotDisplay(DBoxMetadataHelper::recordMap theMap, std::string theTag, std::string theIOV)
Log< level::Warning, true > LogPrint
void eraseAllSubStr(std::string &s, const std::string &toErase)
Definition: common.py:1
RecordMetaDataInfo(DropBoxMetadata::Parameters params)
Constructor.
void printOneKey(const DBoxMetadataHelper::RecordMetaDataInfo &oneKey)
def canvas(sub, attr)
Definition: svgfig.py:482
~RecordMetaDataInfo()=default
Destructor.
void prepareLine(const std::vector< std::string > &thePaths, std::vector< std::string > &output, std::string &tmp, const std::string &header)
#define str(s)
tmp
align.sh
Definition: createJobs.py:716
std::vector< std::string > set_difference(std::vector< std::string > const &v1, std::vector< std::string > const &v2)
void plotDiffWithMetadata(const DBoxMetadataHelper::recordMap &theRefMap, std::string theRefTag, std::string theRefIOV)
std::vector< std::string > set_intersection(std::vector< std::string > const &v1, std::vector< std::string > const &v2)
unsigned transform(const HcalDetId &id, unsigned transformCode)