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 254 of file L1TUtmTriggerMenuPayloadInspectorHelper.h.

254  {
255  return "#scale[1.1]{Condition Name}";
256  }

◆ getLabel() [3/3]

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

Definition at line 259 of file L1TUtmTriggerMenuPayloadInspectorHelper.h.

259  {
260  return "#scale[1.1]{Algo Name}";
261  }

◆ 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(), f, MillePedeFileConverter_cfg::fileName, L1TUtmTriggerMenuInspectorHelper::L1TUtmTriggerMenuDisplay< T >::getLabel(), mps_fire::i, MainPageGenerator::l, groupFilesInBlocks::lines, L1TUtmTriggerMenuInspectorHelper::L1TUtmTriggerMenuDisplay< T >::m_imageFileName, L1TUtmTriggerMenuInspectorHelper::L1TUtmTriggerMenuDisplay< T >::m_info, L1TUtmTriggerMenuInspectorHelper::L1TUtmTriggerMenuDisplay< T >::m_IOVsinceDisplay, L1TUtmTriggerMenuInspectorHelper::L1TUtmTriggerMenuDisplay< T >::m_tagName, WZElectronSkims53X_cff::max, trackingPlots::other, AlCaHLTBitMon_QueryRunRegistry::string, and RecoTauValidation_cfi::textSize.

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  // Calculate the total number of entries
163  unsigned int mapsize = vec_only_in_this.size() + vec_only_in_other.size();
164 
165  // Dynamically calculate the pitch based on the number of entries
166  float canvasHeight = std::max(800.0f, mapsize * 30.0f); // Adjust canvas height based on the number of entries
167  float pitch = 1.0 / (mapsize + 3.0); // Pitch for spacing between lines (extra space for headers)
168 
169  float y = 1.0;
170  float x1 = 0.02, x2 = x1 + 0.37;
171  std::vector<float> y_x1, y_x2, y_line;
172  std::vector<std::string> s_x1, s_x2;
173 
174  // Title for plot
175  y -= pitch;
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.0;
188  y_line.push_back(y);
189 
190  // Records only in reference (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.0));
198  }
199 
200  // Records only in target (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.0));
208  }
209 
210  // Adjust canvas size dynamically
211  TCanvas canvas("L1TUtmMenuData", "L1TUtmMenuData", 2000, static_cast<int>(canvasHeight));
212  TLatex l;
213  l.SetTextAlign(12);
214 
215  // Set the text size dynamically based on pitch
216  float textSize = std::clamp(pitch, 0.015f, 0.035f);
217  l.SetTextSize(textSize);
218 
219  canvas.cd();
220  for (unsigned int i = 0; i < y_x1.size(); i++) {
221  l.DrawLatexNDC(x1, y_x1[i], s_x1[i].c_str());
222  }
223  for (unsigned int i = 0; i < y_x2.size(); i++) {
224  l.DrawLatexNDC(x2, y_x2[i], s_x2[i].c_str());
225  }
226 
227  // Draw horizontal lines separating records
228  TLine lines[y_line.size()];
229  for (unsigned int i = 0; i < y_line.size(); i++) {
230  lines[i] = TLine(gPad->GetUxmin(), y_line[i], gPad->GetUxmax(), y_line[i]);
231  lines[i].SetLineWidth(1);
232  lines[i].SetLineStyle(9);
233  lines[i].SetLineColor(2);
234  lines[i].Draw("same");
235  }
236 
237  // Save the canvas as an image
238  std::string fileName = "L1UtmMenuData_Compare.png";
239  if (!m_imageFileName.empty()) {
241  }
242  canvas.SaveAs(fileName.c_str());
243  }
L1UtmTriggerMenuInfo m_info
map of the record / metadata associations
double f[11][100]
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 246 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