CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
L1TUtmTriggerMenuInspectorHelper::L1TUtmTriggerMenuDisplay Class Reference

#include <L1TUtmTriggerMenuPayloadInspectorHelper.h>

Public Member Functions

 L1TUtmTriggerMenuDisplay (const L1TUtmTriggerMenu *thisMenu, std::string theTag, std::string theIOV)
 
void plotDiffWithOtherMenu (const L1TUtmTriggerMenu *other, std::string theRefTag, std::string theRefIOV)
 
void setImageFileName (const std::string &theFileName)
 
 ~L1TUtmTriggerMenuDisplay ()=default
 

Private Attributes

std::string m_imageFileName
 image file name More...
 
L1UtmTriggerMenuInfo m_info
 map of the record / metadata associations More...
 
std::string m_IOVsinceDisplay
 iov since More...
 
std::string m_tagName
 tag name More...
 

Detailed Description

Definition at line 102 of file L1TUtmTriggerMenuPayloadInspectorHelper.h.

Constructor & Destructor Documentation

◆ L1TUtmTriggerMenuDisplay()

L1TUtmTriggerMenuInspectorHelper::L1TUtmTriggerMenuDisplay::L1TUtmTriggerMenuDisplay ( const L1TUtmTriggerMenu thisMenu,
std::string  theTag,
std::string  theIOV 
)
inline

◆ ~L1TUtmTriggerMenuDisplay()

L1TUtmTriggerMenuInspectorHelper::L1TUtmTriggerMenuDisplay::~L1TUtmTriggerMenuDisplay ( )
default

Member Function Documentation

◆ plotDiffWithOtherMenu()

void L1TUtmTriggerMenuInspectorHelper::L1TUtmTriggerMenuDisplay::plotDiffWithOtherMenu ( const L1TUtmTriggerMenu other,
std::string  theRefTag,
std::string  theRefIOV 
)
inline

Definition at line 114 of file L1TUtmTriggerMenuPayloadInspectorHelper.h.

References svgfig::canvas(), MillePedeFileConverter_cfg::fileName, mps_fire::i, MainPageGenerator::l, mps_splice::line, groupFilesInBlocks::lines, m_imageFileName, m_info, m_IOVsinceDisplay, m_tagName, SiStripPI::max, L1TUtmTriggerMenuInspectorHelper::L1UtmTriggerMenuInfo::onlyInOther(), L1TUtmTriggerMenuInspectorHelper::L1UtmTriggerMenuInfo::onlyInThis(), trackingPlots::other, and AlCaHLTBitMon_QueryRunRegistry::string.

114  {
115  const auto& vec_only_in_this = m_info.onlyInThis(other);
116  const auto& vec_only_in_other = m_info.onlyInOther(other);
117 
118  // preparations for plotting
119  // starting table at y=1.0 (top of the canvas)
120  // first column is at 0.03, second column at 0.22 NDC
121  unsigned int mapsize = vec_only_in_this.size() + vec_only_in_other.size();
122  float pitch = 1. / (mapsize * 1.1);
123  float y, x1, x2;
124  std::vector<float> y_x1, y_x2, y_line;
125  std::vector<std::string> s_x1, s_x2, s_x3;
126  y = 1.0;
127  x1 = 0.02;
128  x2 = x1 + 0.45;
129  y -= pitch;
130 
131  // title for plot
132  y_x1.push_back(y);
133  s_x1.push_back("#scale[1.1]{Key}");
134  y_x2.push_back(y);
135  s_x2.push_back("#scale[1.1]{Target tag / IOV: #color[2]{" + m_tagName + "} / " + m_IOVsinceDisplay + "}");
136 
137  y -= pitch;
138  y_x1.push_back(y);
139  s_x1.push_back("");
140  y_x2.push_back(y);
141  s_x2.push_back("#scale[1.1]{Refer tag / IOV: #color[4]{" + theRefTag + "} / " + theRefIOV + "}");
142 
143  y -= pitch / 2.;
144  y_line.push_back(y);
145 
146  // First, check if there are records in reference which are not in target
147  for (const auto& ref : vec_only_in_other) {
148  y -= pitch;
149  y_x1.push_back(y);
150  s_x1.push_back(ref);
151  y_x2.push_back(y);
152  s_x2.push_back("#color[4]{#bf{Only in reference, not in target.}}");
153  y_line.push_back(y - (pitch / 2.));
154  }
155 
156  // Second, check if there are records in target which are not in reference
157  for (const auto& tar : vec_only_in_this) {
158  y -= pitch;
159  y_x1.push_back(y);
160  s_x1.push_back(tar);
161  y_x2.push_back(y);
162  s_x2.push_back("#color[2]{#bf{Only in target, not in reference.}}");
163  y_line.push_back(y - (pitch / 2.));
164  }
165 
166  // Finally, print text to TCanvas
167  TCanvas canvas("L1TUtmMenuData", "L1TUtmMenuData", 2000, std::max(y_x1.size(), y_x2.size()) * 40);
168  TLatex l;
169  // Draw the columns titles
170  l.SetTextAlign(12);
171 
172  float newpitch = 1 / (std::max(y_x1.size(), y_x2.size()) * 1.1);
173  float factor = newpitch / pitch;
174  l.SetTextSize(newpitch - 0.002);
175  canvas.cd();
176  for (unsigned int i = 0; i < y_x1.size(); i++) {
177  l.DrawLatexNDC(x1, 1 - (1 - y_x1[i]) * factor, s_x1[i].c_str());
178  }
179 
180  for (unsigned int i = 0; i < y_x2.size(); i++) {
181  l.DrawLatexNDC(x2, 1 - (1 - y_x2[i]) * factor, s_x2[i].c_str());
182  }
183 
184  canvas.cd();
185  canvas.Update();
186 
187  // Draw horizontal lines separating records
188  TLine lines[y_line.size()];
189  unsigned int iL = 0;
190  for (const auto& line : y_line) {
191  lines[iL] = TLine(gPad->GetUxmin(), 1 - (1 - line) * factor, gPad->GetUxmax(), 1 - (1 - line) * factor);
192  lines[iL].SetLineWidth(1);
193  lines[iL].SetLineStyle(9);
194  lines[iL].SetLineColor(2);
195  lines[iL].Draw("same");
196  iL++;
197  }
198 
199  std::string fileName("L1UtmMenuData_Compare.png");
200  if (!m_imageFileName.empty())
202  canvas.SaveAs(fileName.c_str());
203  }
const std::vector< std::string > onlyInOther(const L1TUtmTriggerMenu *other) const
const std::vector< std::string > onlyInThis(const L1TUtmTriggerMenu *other) const
L1UtmTriggerMenuInfo m_info
map of the record / metadata associations
def canvas(sub, attr)
Definition: svgfig.py:482

◆ setImageFileName()

void L1TUtmTriggerMenuInspectorHelper::L1TUtmTriggerMenuDisplay::setImageFileName ( const std::string &  theFileName)
inline

Definition at line 108 of file L1TUtmTriggerMenuPayloadInspectorHelper.h.

References m_imageFileName.

108  {
109  m_imageFileName = theFileName;
110  return;
111  }

Member Data Documentation

◆ m_imageFileName

std::string L1TUtmTriggerMenuInspectorHelper::L1TUtmTriggerMenuDisplay::m_imageFileName
private

image file name

Definition at line 209 of file L1TUtmTriggerMenuPayloadInspectorHelper.h.

Referenced by plotDiffWithOtherMenu(), and setImageFileName().

◆ m_info

L1UtmTriggerMenuInfo L1TUtmTriggerMenuInspectorHelper::L1TUtmTriggerMenuDisplay::m_info
private

map of the record / metadata associations

Definition at line 206 of file L1TUtmTriggerMenuPayloadInspectorHelper.h.

Referenced by plotDiffWithOtherMenu().

◆ m_IOVsinceDisplay

std::string L1TUtmTriggerMenuInspectorHelper::L1TUtmTriggerMenuDisplay::m_IOVsinceDisplay
private

iov since

Definition at line 208 of file L1TUtmTriggerMenuPayloadInspectorHelper.h.

Referenced by plotDiffWithOtherMenu().

◆ m_tagName

std::string L1TUtmTriggerMenuInspectorHelper::L1TUtmTriggerMenuDisplay::m_tagName
private

tag name

Definition at line 207 of file L1TUtmTriggerMenuPayloadInspectorHelper.h.

Referenced by plotDiffWithOtherMenu().