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 292 of file SiPixelGainCalibHelper.h.

Constructor & Destructor Documentation

◆ SiPixelGainCalibrationValues()

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

Definition at line 296 of file SiPixelGainCalibHelper.h.

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

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 308 of file SiPixelGainCalibHelper.h.

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

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, GlobalPosition_Frontier_DevDB_cff::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:287
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition: GlobalPosition_Frontier_DevDB_cff.py:11
jets_cff.payload
payload
Definition: jets_cff.py:32
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
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:129
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
gainCalibHelper::SiPixelGainCalibrationValues::isForHLT_
bool isForHLT_
Definition: SiPixelGainCalibHelper.h:392
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:393
SiPixelPI::adjustCanvasMargins
void adjustCanvasMargins(TVirtualPad *pad, float top, float bottom, float left, float right)
Definition: SiPixelPayloadInspectorHelper.h:508