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)
 
std::string data () const
 
cond::persistency::Session dbSession ()
 
bool exec_process (const std::string &connectionString, const std::vector< std::tuple< std::string, cond::Time_t, cond::Time_t >> &tagsWithTimeBoundaries)
 
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 ()
 
boost::python::list inputParams () const
 
const std::map< std::string, std::string > & inputParamValues () const
 
bool isSingleIov () const
 
bool isTwoTags () const
 
unsigned int ntags () const
 
std::string payloadType () const
 
 PlotBase ()
 
bool process (const std::string &connectionString, const boost::python::list &tagsWithTimeBoundaries)
 
void setInputParamValues (const boost::python::dict &values)
 
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 293 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.

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  }

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

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.

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  }

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_, listHistos::legend, cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >::m_imageFileName, SiPixelPI::makeNicePlotStyle(), jets_cff::payload, AlCaHLTBitMon_QueryRunRegistry::string, gainCalibHelper::gainCalibPI::t_gain, gainCalibHelper::gainCalibPI::t_pedestal, makeGlobalPositionRcd_cfg::tag, and gainCalibHelper::TypeName.

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
gainCalibHelper::gainCalibPI::t_pedestal
Definition: SiPixelGainCalibHelper.h:40
svgfig.canvas
def canvas(*sub, **attr)
Definition: svgfig.py:482
cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >::m_imageFileName
std::string m_imageFileName
Definition: PayloadInspector.h:910
gainCalibHelper::gainCalibPI::t_gain
Definition: SiPixelGainCalibHelper.h:40
MillePedeFileConverter_cfg.fileName
fileName
Definition: MillePedeFileConverter_cfg.py:32
gainCalibHelper::TypeName
constexpr char const * TypeName[2]
Definition: SiPixelGainCalibHelper.h:288
jets_cff.payload
payload
Definition: jets_cff.py:32
makeGlobalPositionRcd_cfg.tag
tag
Definition: makeGlobalPositionRcd_cfg.py:6
cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >::fetchPayload
std::shared_ptr< PayloadType > fetchPayload(const cond::Hash &payloadHash)
Definition: PayloadInspector.h:905
listHistos.legend
legend
Definition: listHistos.py:41
gainCalibHelper::gainCalibPI::fillTheHisto
static void fillTheHisto(const std::shared_ptr< PayloadType > &payload, std::shared_ptr< TH1F > h1, gainCalibPI::type theType, const std::vector< uint32_t > &wantedIds={})
Definition: SiPixelGainCalibHelper.h:130
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
SiPixelPI::adjustStats
void adjustStats(TPaveStats *stats, float X1, float Y1, float X2, float Y2)
Definition: SiPixelPayloadInspectorHelper.h:522
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
gainCalibHelper::SiPixelGainCalibrationValues::isForHLT_
bool isForHLT_
Definition: SiPixelGainCalibHelper.h:393
cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >
SiPixelPI::makeNicePlotStyle
void makeNicePlotStyle(TH1 *hist)
Definition: SiPixelPayloadInspectorHelper.h:548
gainCalibHelper::SiPixelGainCalibrationValues::label_
std::string label_
Definition: SiPixelGainCalibHelper.h:394
SiPixelPI::adjustCanvasMargins
void adjustCanvasMargins(TVirtualPad *pad, float top, float bottom, float left, float right)
Definition: SiPixelPayloadInspectorHelper.h:508