CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 291 of file SiPixelGainCalibHelper.h.

Constructor & Destructor Documentation

◆ SiPixelGainCalibrationValues()

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

Definition at line 295 of file SiPixelGainCalibHelper.h.

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

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

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

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:39
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:868
gainCalibHelper::gainCalibPI::t_gain
Definition: SiPixelGainCalibHelper.h:39
MillePedeFileConverter_cfg.fileName
fileName
Definition: MillePedeFileConverter_cfg.py:32
gainCalibHelper::TypeName
constexpr char const * TypeName[2]
Definition: SiPixelGainCalibHelper.h:286
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:863
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:128
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:519
gainCalibHelper::SiPixelGainCalibrationValues::isForHLT_
bool isForHLT_
Definition: SiPixelGainCalibHelper.h:391
cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >
SiPixelPI::makeNicePlotStyle
void makeNicePlotStyle(TH1 *hist)
Definition: SiPixelPayloadInspectorHelper.h:545
gainCalibHelper::SiPixelGainCalibrationValues::label_
std::string label_
Definition: SiPixelGainCalibHelper.h:392
SiPixelPI::adjustCanvasMargins
void adjustCanvasMargins(TVirtualPad *pad, float top, float bottom, float left, float right)
Definition: SiPixelPayloadInspectorHelper.h:505