CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Attributes
templateHelper::SiPixelTitles_Display< PayloadType, StoreType, TransientType > Class Template Reference

#include <SiPixelTemplateHelper.h>

Inheritance diagram for templateHelper::SiPixelTitles_Display< PayloadType, StoreType, TransientType >:
cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV > cond::payloadInspector::PlotImpl< IOV_M, 0 > cond::payloadInspector::PlotBase

Public Member Functions

bool fill () override
 
 SiPixelTitles_Display ()
 
- Public Member Functions inherited from cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >
std::shared_ptr< PayloadType > fetchPayload (const cond::Hash &payloadHash)
 
 PlotImage (const std::string &title)
 
std::string serializeData () override
 
- Public Member Functions inherited from cond::payloadInspector::PlotImpl< IOV_M, 0 >
 PlotImpl (const std::string &type, const std::string &title)
 
std::string processData () override
 
 ~PlotImpl () override=default
 
- Public Member Functions inherited from cond::payloadInspector::PlotBase
void addInputParam (const std::string &paramName)
 
cond::persistency::Session dbSession ()
 
template<typename PayloadType >
std::shared_ptr< PayloadType > fetchPayload (const cond::Hash &payloadHash)
 
template<int index>
TagReference getTag ()
 
cond::Tag_t getTagInfo (const std::string &tag)
 
virtual void init ()
 
const std::map< std::string, std::string > & inputParamValues () const
 
bool isSingleIov () const
 
bool isTwoTags () const
 
unsigned int ntags () const
 
std::string payloadType () const
 
 PlotBase ()
 
std::string title () const
 
std::string type () const
 
virtual ~PlotBase ()=default
 

Protected Attributes

bool isTemplate_
 
std::string label_
 
- Protected Attributes inherited from cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >
std::string m_imageFileName
 
- Protected Attributes inherited from cond::payloadInspector::PlotBase
std::set< std::string > m_inputParams
 
std::map< std::string, std::string > m_inputParamValues
 
PlotAnnotations m_plotAnnotations
 
std::vector< std::pair< cond::Time_t, cond::Time_t > > m_tagBoundaries
 
std::vector< std::vector< std::tuple< cond::Time_t, cond::Hash > > > m_tagIovs
 
std::vector< std::string > m_tagNames
 

Additional Inherited Members

- Public Types inherited from cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >
typedef PlotImpl< IOV_M, 0 > Base
 

Detailed Description

template<class PayloadType, class StoreType, class TransientType>
class templateHelper::SiPixelTitles_Display< PayloadType, StoreType, TransientType >

Definition at line 39 of file SiPixelTemplateHelper.h.

Constructor & Destructor Documentation

◆ SiPixelTitles_Display()

template<class PayloadType , class StoreType , class TransientType >
templateHelper::SiPixelTitles_Display< PayloadType, StoreType, TransientType >::SiPixelTitles_Display ( )
inline

Definition at line 42 of file SiPixelTemplateHelper.h.

References templateHelper::SiPixelTitles_Display< PayloadType, StoreType, TransientType >::isTemplate_, and templateHelper::SiPixelTitles_Display< PayloadType, StoreType, TransientType >::label_.

44  "Table of SiPixelTemplate/GenError titles") {
45  if constexpr (std::is_same_v<PayloadType, SiPixelGenErrorDBObject>) {
46  isTemplate_ = false;
47  label_ = "SiPixelGenErrorDBObject_PayloadInspector";
48  } else {
49  isTemplate_ = true;
50  label_ = "SiPixelTemplateDBObject_PayloadInspector";
51  }
52  }

Member Function Documentation

◆ fill()

template<class PayloadType , class StoreType , class TransientType >
bool templateHelper::SiPixelTitles_Display< PayloadType, StoreType, TransientType >::fill ( )
inlineoverridevirtual

Implements cond::payloadInspector::PlotImpl< IOV_M, 0 >.

Definition at line 54 of file SiPixelTemplateHelper.h.

References svgfig::canvas(), Exception, cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >::fetchPayload(), MillePedeFileConverter_cfg::fileName, mps_fire::i, templateHelper::SiPixelTitles_Display< PayloadType, StoreType, TransientType >::isTemplate_, cmsLHEtoEOSManager::l, templateHelper::SiPixelTitles_Display< PayloadType, StoreType, TransientType >::label_, mps_splice::line, groupFilesInBlocks::lines, cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >::m_imageFileName, SiStripPI::max, jetsAK4_Puppi_cff::payload, AlCaHLTBitMon_QueryRunRegistry::string, makeGlobalPositionRcd_cfg::tag, createPayload::tagname, and cond::impl::to_string().

54  {
55  auto tag = cond::payloadInspector::PlotBase::getTag<0>();
56  auto iov = tag.iovs.front();
57  auto tagname = tag.name;
58  std::vector<StoreType> thePixelTemp_;
59  std::shared_ptr<PayloadType> payload = this->fetchPayload(std::get<1>(iov));
60 
61  std::string IOVsince = std::to_string(std::get<0>(iov));
62 
63  if (payload.get()) {
64  if (!TransientType::pushfile(*payload, thePixelTemp_)) {
65  throw cms::Exception(label_) << "\nERROR:" << (isTemplate_ ? "Templates" : "GenErrors")
66  << " not filled correctly."
67  << " Check the conditions. Using "
68  << (isTemplate_ ? "SiPixelTemplateDBObject" : "SiPixelGenErrorDBObject")
69  << " version " << payload->version() << "\n\n";
70  }
71 
72  unsigned int mapsize = thePixelTemp_.size();
73  float pitch = 1. / (mapsize * 1.1);
74 
75  float y, x1, x2;
76  std::vector<float> y_x1, y_x2, y_line;
77  std::vector<std::string> s_x1, s_x2, s_x3;
78 
79  // starting table at y=1.0 (top of the canvas)
80  // first column is at 0.02, second column at 0.32 NDC
81  y = 1.0;
82  x1 = 0.02;
83  x2 = x1 + 0.30;
84 
85  y -= pitch;
86  y_x1.push_back(y);
87  s_x1.push_back(Form("#scale[1.2]{%s}", (isTemplate_ ? "Template ID" : "GenError ID")));
88  y_x2.push_back(y);
89  s_x2.push_back(Form("#scale[1.2]{#color[4]{%s} in IOV: #color[4]{%s}}", tagname.c_str(), IOVsince.c_str()));
90 
91  y -= pitch / 2.;
92  y_line.push_back(y);
93 
94  for (const auto& element : thePixelTemp_) {
95  y -= pitch;
96  y_x1.push_back(y);
97  s_x1.push_back(std::to_string(element.head.ID));
98 
99  y_x2.push_back(y);
100  s_x2.push_back(Form("#color[2]{%s}", element.head.title));
101 
102  y_line.push_back(y - (pitch / 2.));
103  }
104 
105  const auto& c_title = fmt::sprintf("%s titles", (isTemplate_ ? "Template" : "GenError"));
106  TCanvas canvas(c_title.c_str(), c_title.c_str(), 2000, std::max(y_x1.size(), y_x2.size()) * 40);
107  TLatex l;
108  // Draw the columns titles
109  l.SetTextAlign(12);
110 
111  float newpitch = 1 / (std::max(y_x1.size(), y_x2.size()) * 1.1);
112  float factor = newpitch / pitch;
113  l.SetTextSize(newpitch - 0.002);
114  canvas.cd();
115  for (unsigned int i = 0; i < y_x1.size(); i++) {
116  l.DrawLatexNDC(x1, 1 - (1 - y_x1[i]) * factor, s_x1[i].c_str());
117  }
118 
119  for (unsigned int i = 0; i < y_x2.size(); i++) {
120  l.DrawLatexNDC(x2, 1 - (1 - y_x2[i]) * factor, s_x2[i].c_str());
121  }
122 
123  canvas.cd();
124  canvas.Update();
125 
126  TLine lines[y_line.size()];
127  unsigned int iL = 0;
128  for (const auto& line : y_line) {
129  lines[iL] = TLine(gPad->GetUxmin(), 1 - (1 - line) * factor, gPad->GetUxmax(), 1 - (1 - line) * factor);
130  lines[iL].SetLineWidth(1);
131  lines[iL].SetLineStyle(9);
132  lines[iL].SetLineColor(2);
133  lines[iL].Draw("same");
134  iL++;
135  }
136 
138  canvas.SaveAs(fileName.c_str());
139 
140  } // if payload.get()
141  return true;
142  }
std::string to_string(const V &value)
Definition: OMSAccess.h:71
def canvas(sub, attr)
Definition: svgfig.py:482
std::shared_ptr< PayloadType > fetchPayload(const cond::Hash &payloadHash)

Member Data Documentation

◆ isTemplate_

template<class PayloadType , class StoreType , class TransientType >
bool templateHelper::SiPixelTitles_Display< PayloadType, StoreType, TransientType >::isTemplate_
protected

◆ label_

template<class PayloadType , class StoreType , class TransientType >
std::string templateHelper::SiPixelTitles_Display< PayloadType, StoreType, TransientType >::label_
protected