CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Attributes
gainCalibHelper::SiPixelGainCalibrationValues< myType, PayloadType > Class Template Reference

#include <SiPixelGainCalibHelper.h>

Inheritance diagram for gainCalibHelper::SiPixelGainCalibrationValues< myType, PayloadType >:
cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV > cond::payloadInspector::PlotImpl< IOV_M, 0 > cond::payloadInspector::PlotBase

Public Member Functions

bool fill () override
 
 SiPixelGainCalibrationValues ()
 
- 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 isForHLT_
 
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<gainCalibPI::type myType, class PayloadType>
class gainCalibHelper::SiPixelGainCalibrationValues< myType, PayloadType >

Definition at line 294 of file SiPixelGainCalibHelper.h.

Constructor & Destructor Documentation

◆ SiPixelGainCalibrationValues()

template<gainCalibPI::type myType, class PayloadType >
gainCalibHelper::SiPixelGainCalibrationValues< myType, PayloadType >::SiPixelGainCalibrationValues ( )
inline

Definition at line 297 of file SiPixelGainCalibHelper.h.

References gainCalibHelper::SiPixelGainCalibrationValues< myType, PayloadType >::isForHLT_, and gainCalibHelper::SiPixelGainCalibrationValues< myType, PayloadType >::label_.

299  Form("SiPixelGainCalibration %s Values", TypeName[myType])) {
300  if constexpr (std::is_same_v<PayloadType, SiPixelGainCalibrationOffline>) {
301  isForHLT_ = false;
302  label_ = "SiPixelGainCalibrationOffline_PayloadInspector";
303  } else {
304  isForHLT_ = true;
305  label_ = "SiPixelGainCalibrationForHLT_PayloadInspector";
306  }
307  }
constexpr char const * TypeName[2]

Member Function Documentation

◆ fill()

template<gainCalibPI::type myType, class PayloadType >
bool gainCalibHelper::SiPixelGainCalibrationValues< myType, PayloadType >::fill ( )
inlineoverridevirtual

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

Definition at line 309 of file SiPixelGainCalibHelper.h.

References SiPixelPI::adjustCanvasMargins(), SiPixelPI::adjustStats(), svgfig::canvas(), cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >::fetchPayload(), MillePedeFileConverter_cfg::fileName, gainCalibHelper::gainCalibPI::fillTheHisto(), gainCalibHelper::SiPixelGainCalibrationValues< myType, PayloadType >::isForHLT_, gainCalibHelper::SiPixelGainCalibrationValues< myType, PayloadType >::label_, compareTotals::legend, cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >::m_imageFileName, SiPixelPI::makeNicePlotStyle(), jetsAK4_Puppi_cff::payload, AlCaHLTBitMon_QueryRunRegistry::string, gainCalibHelper::gainCalibPI::t_gain, gainCalibHelper::gainCalibPI::t_pedestal, makeGlobalPositionRcd_cfg::tag, cond::impl::to_string(), and gainCalibHelper::TypeName.

309  {
310  auto tag = cond::payloadInspector::PlotBase::getTag<0>();
311  auto iov = tag.iovs.front();
312 
313  std::shared_ptr<PayloadType> payload = this->fetchPayload(std::get<1>(iov));
314 
315  gStyle->SetOptStat("emr");
316 
317  float minimum(9999.);
318  float maximum(-9999.);
319 
320  switch (myType) {
321  case gainCalibPI::t_gain:
322  maximum = payload->getGainHigh();
323  minimum = payload->getGainLow();
324  break;
326  maximum = payload->getPedHigh();
327  minimum = payload->getPedLow();
328  break;
329  default:
330  edm::LogError(label_) << "Unrecognized type " << myType << std::endl;
331  break;
332  }
333 
334  TCanvas canvas("Canv", "Canv", 1200, 1000);
335  auto h1 = std::make_shared<TH1F>(Form("%s values", TypeName[myType]),
336  Form("SiPixel Gain Calibration %s - %s;per %s %s;# %ss",
337  (isForHLT_ ? "ForHLT" : "Offline"),
338  TypeName[myType],
339  (isForHLT_ ? "Column" : "Pixel"),
340  TypeName[myType],
341  (isForHLT_ ? "column" : "pixel")),
342  200,
343  minimum,
344  maximum);
345  canvas.cd();
346  SiPixelPI::adjustCanvasMargins(canvas.cd(), 0.06, 0.12, 0.12, 0.05);
347  canvas.Modified();
348 
349  // fill the histogram
350  gainCalibPI::fillTheHisto(payload, h1, myType);
351 
352  canvas.cd()->SetLogy();
353  h1->SetTitle("");
354  h1->GetYaxis()->SetRangeUser(0.1, h1->GetMaximum() * 10.);
355  h1->SetFillColor(kBlue);
356  h1->SetMarkerStyle(20);
357  h1->SetMarkerSize(1);
358  h1->Draw("bar2");
359 
361  h1->SetStats(true);
362 
363  canvas.Update();
364 
365  TLegend legend = TLegend(0.40, 0.88, 0.94, 0.93);
366  legend.SetHeader(("Payload hash: #bf{" + (std::get<1>(iov)) + "}").c_str(),
367  "C"); // option "C" allows to center the header
368  //legend.AddEntry(h1.get(), ("IOV: " + std::to_string(std::get<0>(iov))).c_str(), "PL");
369  legend.SetLineColor(10);
370  legend.SetTextSize(0.025);
371  legend.Draw("same");
372 
373  TPaveStats* st = (TPaveStats*)h1->FindObject("stats");
374  st->SetTextSize(0.03);
375  SiPixelPI::adjustStats(st, 0.15, 0.83, 0.39, 0.93);
376 
377  auto ltx = TLatex();
378  ltx.SetTextFont(62);
379  //ltx.SetTextColor(kBlue);
380  ltx.SetTextSize(0.05);
381  ltx.SetTextAlign(11);
382  ltx.DrawLatexNDC(gPad->GetLeftMargin() + 0.1,
383  1 - gPad->GetTopMargin() + 0.01,
384  ("SiPixel Gain Calibration IOV:" + std::to_string(std::get<0>(iov))).c_str());
385 
387  canvas.SaveAs(fileName.c_str());
388 
389  return true;
390  }
std::string to_string(const V &value)
Definition: OMSAccess.h:71
Log< level::Error, false > LogError
constexpr char const * TypeName[2]
static void fillTheHisto(const std::shared_ptr< PayloadType > &payload, std::shared_ptr< TH1F > h1, gainCalibPI::type theType, const std::vector< uint32_t > &wantedIds={})
void adjustCanvasMargins(TVirtualPad *pad, float top, float bottom, float left, float right)
void adjustStats(TPaveStats *stats, float X1, float Y1, float X2, float Y2)
void makeNicePlotStyle(TH1 *hist)
def canvas(sub, attr)
Definition: svgfig.py:482
std::shared_ptr< PayloadType > fetchPayload(const cond::Hash &payloadHash)

Member Data Documentation

◆ isForHLT_

template<gainCalibPI::type myType, class PayloadType >
bool gainCalibHelper::SiPixelGainCalibrationValues< myType, PayloadType >::isForHLT_
protected

◆ label_

template<gainCalibPI::type myType, class PayloadType >
std::string gainCalibHelper::SiPixelGainCalibrationValues< myType, PayloadType >::label_
protected