CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
L1TUtmTriggerMenuInspectorHelper::L1TUtmTriggerMenuDisplay< T > Class Template Reference

#include <L1TUtmTriggerMenuPayloadInspectorHelper.h>

Public Member Functions

std::string getLabel () const
 
template<>
std::string getLabel () const
 
template<>
std::string getLabel () const
 
 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

template<typename T>
class L1TUtmTriggerMenuInspectorHelper::L1TUtmTriggerMenuDisplay< T >

Definition at line 143 of file L1TUtmTriggerMenuPayloadInspectorHelper.h.

Constructor & Destructor Documentation

◆ L1TUtmTriggerMenuDisplay()

template<typename T >
L1TUtmTriggerMenuInspectorHelper::L1TUtmTriggerMenuDisplay< T >::L1TUtmTriggerMenuDisplay ( const L1TUtmTriggerMenu thisMenu,
std::string  theTag,
std::string  theIOV 
)
inline

◆ ~L1TUtmTriggerMenuDisplay()

Member Function Documentation

◆ getLabel() [1/3]

template<typename T >
std::string L1TUtmTriggerMenuInspectorHelper::L1TUtmTriggerMenuDisplay< T >::getLabel ( ) const

◆ getLabel() [2/3]

template<>
std::string L1TUtmTriggerMenuInspectorHelper::L1TUtmTriggerMenuDisplay< L1TUtmCondition >::getLabel ( ) const

Definition at line 258 of file L1TUtmTriggerMenuPayloadInspectorHelper.h.

258  {
259  return "#scale[1.1]{Condition Name}";
260  }

◆ getLabel() [3/3]

template<>
std::string L1TUtmTriggerMenuInspectorHelper::L1TUtmTriggerMenuDisplay< L1TUtmAlgorithm >::getLabel ( ) const

Definition at line 263 of file L1TUtmTriggerMenuPayloadInspectorHelper.h.

263  {
264  return "#scale[1.1]{Algo Name}";
265  }

◆ plotDiffWithOtherMenu()

template<typename T >
void L1TUtmTriggerMenuInspectorHelper::L1TUtmTriggerMenuDisplay< T >::plotDiffWithOtherMenu ( const L1TUtmTriggerMenu other,
std::string  theRefTag,
std::string  theRefIOV 
)
inline

Definition at line 158 of file L1TUtmTriggerMenuPayloadInspectorHelper.h.

References svgfig::canvas(), MillePedeFileConverter_cfg::fileName, L1TUtmTriggerMenuInspectorHelper::L1TUtmTriggerMenuDisplay< T >::getLabel(), mps_fire::i, MainPageGenerator::l, mps_splice::line, groupFilesInBlocks::lines, L1TUtmTriggerMenuInspectorHelper::L1TUtmTriggerMenuDisplay< T >::m_imageFileName, L1TUtmTriggerMenuInspectorHelper::L1TUtmTriggerMenuDisplay< T >::m_info, L1TUtmTriggerMenuInspectorHelper::L1TUtmTriggerMenuDisplay< T >::m_IOVsinceDisplay, L1TUtmTriggerMenuInspectorHelper::L1TUtmTriggerMenuDisplay< T >::m_tagName, SiStripPI::max, trackingPlots::other, and AlCaHLTBitMon_QueryRunRegistry::string.

158  {
159  const auto& vec_only_in_this = m_info.template onlyInThis<T>(other);
160  const auto& vec_only_in_other = m_info.template onlyInOther<T>(other);
161 
162  // preparations for plotting
163  // starting table at y=1.0 (top of the canvas)
164  // first column is at 0.03, second column at 0.22 NDC
165  unsigned int mapsize = vec_only_in_this.size() + vec_only_in_other.size();
166  float pitch = 1. / (mapsize * 1.1);
167  float y, x1, x2;
168  std::vector<float> y_x1, y_x2, y_line;
169  std::vector<std::string> s_x1, s_x2, s_x3;
170  y = 1.0;
171  x1 = 0.02;
172  x2 = x1 + 0.37;
173  y -= pitch;
174 
175  // title for plot
176  y_x1.push_back(y);
177  s_x1.push_back(getLabel());
178  y_x2.push_back(y);
179  s_x2.push_back("#scale[1.1]{Target tag / IOV: #color[2]{" + m_tagName + "} / " + m_IOVsinceDisplay + "}");
180 
181  y -= pitch;
182  y_x1.push_back(y);
183  s_x1.push_back("");
184  y_x2.push_back(y);
185  s_x2.push_back("#scale[1.1]{Refer tag / IOV: #color[4]{" + theRefTag + "} / " + theRefIOV + "}");
186 
187  y -= pitch / 2.;
188  y_line.push_back(y);
189 
190  // First, check if there are records in reference which are not in target
191  for (const auto& ref : vec_only_in_other) {
192  y -= pitch;
193  y_x1.push_back(y);
194  s_x1.push_back("#scale[0.7]{" + ref + "}");
195  y_x2.push_back(y);
196  s_x2.push_back("#color[4]{#bf{Only in reference, not in target.}}");
197  y_line.push_back(y - (pitch / 2.));
198  }
199 
200  // Second, check if there are records in target which are not in reference
201  for (const auto& tar : vec_only_in_this) {
202  y -= pitch;
203  y_x1.push_back(y);
204  s_x1.push_back("#scale[0.7]{" + tar + "}");
205  y_x2.push_back(y);
206  s_x2.push_back("#color[2]{#bf{Only in target, not in reference.}}");
207  y_line.push_back(y - (pitch / 2.));
208  }
209 
210  // Finally, print text to TCanvas
211  TCanvas canvas("L1TUtmMenuData", "L1TUtmMenuData", 2000, std::max(y_x1.size(), y_x2.size()) * 40);
212  TLatex l;
213  // Draw the columns titles
214  l.SetTextAlign(12);
215 
216  float newpitch = 1 / (std::max(y_x1.size(), y_x2.size()) * 1.1);
217  float factor = newpitch / pitch;
218  l.SetTextSize(newpitch - 0.002);
219  canvas.cd();
220  for (unsigned int i = 0; i < y_x1.size(); i++) {
221  l.DrawLatexNDC(x1, 1 - (1 - y_x1[i]) * factor, s_x1[i].c_str());
222  }
223 
224  for (unsigned int i = 0; i < y_x2.size(); i++) {
225  l.DrawLatexNDC(x2, 1 - (1 - y_x2[i]) * factor, s_x2[i].c_str());
226  }
227 
228  canvas.cd();
229  canvas.Update();
230 
231  // Draw horizontal lines separating records
232  TLine lines[y_line.size()];
233  unsigned int iL = 0;
234  for (const auto& line : y_line) {
235  lines[iL] = TLine(gPad->GetUxmin(), 1 - (1 - line) * factor, gPad->GetUxmax(), 1 - (1 - line) * factor);
236  lines[iL].SetLineWidth(1);
237  lines[iL].SetLineStyle(9);
238  lines[iL].SetLineColor(2);
239  lines[iL].Draw("same");
240  iL++;
241  }
242 
243  std::string fileName("L1UtmMenuData_Compare.png");
244  if (!m_imageFileName.empty())
246  canvas.SaveAs(fileName.c_str());
247  }
L1UtmTriggerMenuInfo m_info
map of the record / metadata associations
def canvas(sub, attr)
Definition: svgfig.py:482

◆ setImageFileName()

template<typename T >
void L1TUtmTriggerMenuInspectorHelper::L1TUtmTriggerMenuDisplay< T >::setImageFileName ( const std::string &  theFileName)
inline

Member Data Documentation

◆ m_imageFileName

template<typename T >
std::string L1TUtmTriggerMenuInspectorHelper::L1TUtmTriggerMenuDisplay< T >::m_imageFileName
private

◆ m_info

map of the record / metadata associations

Definition at line 250 of file L1TUtmTriggerMenuPayloadInspectorHelper.h.

Referenced by L1TUtmTriggerMenuInspectorHelper::L1TUtmTriggerMenuDisplay< T >::plotDiffWithOtherMenu().

◆ m_IOVsinceDisplay

template<typename T >
std::string L1TUtmTriggerMenuInspectorHelper::L1TUtmTriggerMenuDisplay< T >::m_IOVsinceDisplay
private

◆ m_tagName

template<typename T >
std::string L1TUtmTriggerMenuInspectorHelper::L1TUtmTriggerMenuDisplay< T >::m_tagName
private