CMS 3D CMS Logo

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

#include <SiPixelGainCalibHelper.h>

Inheritance diagram for gainCalibHelper::SiPixelGainCalibrationValuesPerRegion< isBarrel, 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
 
 SiPixelGainCalibrationValuesPerRegion ()
 
- 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<bool isBarrel, gainCalibPI::type myType, class PayloadType>
class gainCalibHelper::SiPixelGainCalibrationValuesPerRegion< isBarrel, myType, PayloadType >

Definition at line 311 of file SiPixelGainCalibHelper.h.

Constructor & Destructor Documentation

◆ SiPixelGainCalibrationValuesPerRegion()

template<bool isBarrel, gainCalibPI::type myType, class PayloadType >
gainCalibHelper::SiPixelGainCalibrationValuesPerRegion< isBarrel, myType, PayloadType >::SiPixelGainCalibrationValuesPerRegion ( )
inline

Definition at line 315 of file SiPixelGainCalibHelper.h.

315  :
317  : cond::payloadInspector::PlotImage<PayloadType, cond::payloadInspector::SINGLE_IOV>(
318  Form("SiPixelGainCalibration %s Values Per Region", TypeName[myType])) {
320 
321  if constexpr (std::is_same_v<PayloadType, SiPixelGainCalibrationOffline>) {
322  isForHLT_ = false;
323  label_ = "SiPixelGainCalibrationOffline_PayloadInspector";
324  } else {
325  isForHLT_ = true;
326  label_ = "SiPixelGainCalibrationForHLT_PayloadInspector";
327  }

References cond::payloadInspector::PlotBase::addInputParam(), gainCalibHelper::SiPixelGainCalibrationValuesPerRegion< isBarrel, myType, PayloadType >::isForHLT_, and gainCalibHelper::SiPixelGainCalibrationValuesPerRegion< isBarrel, myType, PayloadType >::label_.

Member Function Documentation

◆ fill()

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

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

Definition at line 329 of file SiPixelGainCalibHelper.h.

330  {
331  gStyle->SetOptStat("mr");
332 
333  auto tag = cond::payloadInspector::PlotBase::getTag<0>();
334  auto iov = tag.iovs.front();
335 
336  // parse first if log
337  bool setLog(true);
339  auto ip = paramValues.find("SetLog");
340  if (ip != paramValues.end()) {
341  auto answer = boost::lexical_cast<std::string>(ip->second);
342  if (!SiPixelPI::checkAnswerOK(answer, setLog)) {
343  throw cms::Exception(label_)
344  << "\nERROR: " << answer
345  << " is not a valid setting for this parameter, please use True,False,1,0,Yes,No \n\n";
346  }
347  }
348 
349  std::shared_ptr<PayloadType> payload = this->fetchPayload(std::get<1>(iov));
350 
351  std::vector<uint32_t> detids;
352  payload->getDetIds(detids);
353 
354  float minimum(9999.);
355  float maximum(-9999.);
356 
357  switch (myType) {
358  case gainCalibPI::t_gain:
359  maximum = payload->getGainHigh();
360  minimum = payload->getGainLow();
361  break;
363  maximum = payload->getPedHigh();
364  minimum = payload->getPedLow();
365  break;
366  default:
367  edm::LogError(label_) << "Unrecognized type " << myType << std::endl;
368  break;
369  }
370 
371  TCanvas canvas("Canv", "Canv", isBarrel ? 1400 : 1800, 1200);
372  if (detids.size() > SiPixelPI::phase1size) {
373  SiPixelPI::displayNotSupported(canvas, detids.size());
375  canvas.SaveAs(fileName.c_str());
376  return false;
377  }
378 
379  canvas.Divide(isBarrel ? 2 : 4, isBarrel ? 2 : 3);
380  canvas.cd();
381 
382  const char* path_toTopologyXML = (detids.size() == SiPixelPI::phase0size)
383  ? "Geometry/TrackerCommonData/data/trackerParameters.xml"
384  : "Geometry/TrackerCommonData/data/PhaseI/trackerParameters.xml";
385  TrackerTopology tTopo =
387 
388  auto myPlots = PixelRegions::PixelRegionContainers(&tTopo, (detids.size() == SiPixelPI::phase1size));
389  myPlots.bookAll(Form("SiPixel Gain Calibration %s - %s", (isForHLT_ ? "ForHLT" : "Offline"), TypeName[myType]),
390  Form("per %s %s", (isForHLT_ ? "Column" : "Pixel"), TypeName[myType]),
391  Form("# %ss", (isForHLT_ ? "column" : "pixel")),
392  200,
393  minimum,
394  maximum);
395 
396  canvas.Modified();
397 
398  // fill the histograms
399  for (const auto& pixelId : PixelRegions::PixelIDs) {
400  auto wantedDets = PixelRegions::attachedDets(pixelId, &tTopo, (detids.size() == SiPixelPI::phase1size));
401  gainCalibPI::fillTheHisto(payload, myPlots.getHistoFromMap(pixelId), myType, wantedDets);
402  }
403 
404  if (setLog) {
405  myPlots.setLogScale();
406  }
407  myPlots.beautify(kBlue, -1);
408  myPlots.draw(canvas, isBarrel, "HIST");
409 
410  TLegend legend = TLegend(0.45, 0.88, 0.91, 0.92);
411  legend.SetHeader(("hash: #bf{" + (std::get<1>(iov)) + "}").c_str(),
412  "C"); // option "C" allows to center the header
413  //legend.AddEntry(h1.get(), ("IOV: " + std::to_string(std::get<0>(iov))).c_str(), "PL");
414  legend.SetLineColor(10);
415  legend.SetTextSize(0.025);
416  legend.Draw("same");
417 
418  unsigned int maxPads = isBarrel ? 4 : 12;
419  for (unsigned int c = 1; c <= maxPads; c++) {
420  canvas.cd(c);
421  SiPixelPI::adjustCanvasMargins(canvas.cd(c), 0.06, 0.12, 0.12, 0.05);
422  legend.Draw("same");
423  canvas.cd(c)->Update();
424  }
425 
426  myPlots.stats();
427 
428  auto ltx = TLatex();
429  ltx.SetTextFont(62);
430  ltx.SetTextSize(0.05);
431  ltx.SetTextAlign(11);
432 
433  for (unsigned int c = 1; c <= maxPads; c++) {
434  auto index = isBarrel ? c - 1 : c + 3;
435  canvas.cd(c);
436  auto leftX = setLog ? 0. : 0.1;
437  ltx.DrawLatexNDC(gPad->GetLeftMargin() + leftX,
438  1 - gPad->GetTopMargin() + 0.01,
439  (PixelRegions::IDlabels.at(index) + ", IOV:" + std::to_string(std::get<0>(iov))).c_str());
440  }
441 
443  canvas.SaveAs(fileName.c_str());
444 
445  return true;

References SiPixelPI::adjustCanvasMargins(), submit::answer, PixelRegions::attachedDets(), HltBtagPostValidation_cff::c, svgfig::canvas(), SiPixelPI::checkAnswerOK(), SiPixelPI::displayNotSupported(), Exception, cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >::fetchPayload(), MillePedeFileConverter_cfg::fileName, gainCalibHelper::gainCalibPI::fillTheHisto(), StandaloneTrackerTopology::fromTrackerParametersXMLFile(), contentValuesFiles::fullPath, PixelRegions::IDlabels, cond::payloadInspector::PlotBase::inputParamValues(), PixelPluginsPhase0_cfi::isBarrel, gainCalibHelper::SiPixelGainCalibrationValuesPerRegion< isBarrel, myType, PayloadType >::isForHLT_, gainCalibHelper::SiPixelGainCalibrationValuesPerRegion< isBarrel, myType, PayloadType >::label_, listHistos::legend, cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >::m_imageFileName, jets_cff::payload, SiPixelPI::phase0size, SiPixelPI::phase1size, PixelRegions::PixelIDs, AlCaHLTBitMon_QueryRunRegistry::string, gainCalibHelper::gainCalibPI::t_gain, gainCalibHelper::gainCalibPI::t_pedestal, GlobalPosition_Frontier_DevDB_cff::tag, and gainCalibHelper::TypeName.

Member Data Documentation

◆ isForHLT_

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

◆ label_

template<bool isBarrel, gainCalibPI::type myType, class PayloadType >
std::string gainCalibHelper::SiPixelGainCalibrationValuesPerRegion< isBarrel, myType, PayloadType >::label_
protected
gainCalibHelper::gainCalibPI::t_pedestal
Definition: SiPixelGainCalibHelper.h:37
svgfig.canvas
def canvas(*sub, **attr)
Definition: svgfig.py:482
gainCalibHelper::SiPixelGainCalibrationValuesPerRegion::label_
std::string label_
Definition: SiPixelGainCalibHelper.h:449
cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >::m_imageFileName
std::string m_imageFileName
Definition: PayloadInspector.h:845
gainCalibHelper::gainCalibPI::t_gain
Definition: SiPixelGainCalibHelper.h:37
PixelRegions::PixelIDs
const std::vector< PixelId > PixelIDs
Definition: PixelRegionContainers.h:46
contentValuesFiles.fullPath
fullPath
Definition: contentValuesFiles.py:64
TrackerTopology
Definition: TrackerTopology.h:16
cond::payloadInspector::PlotBase::inputParamValues
const std::map< std::string, std::string > & inputParamValues() const
Definition: PayloadInspector.cc:139
cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >::PlotImage
PlotImage(const std::string &title)
Definition: PayloadInspector.h:832
MillePedeFileConverter_cfg.fileName
fileName
Definition: MillePedeFileConverter_cfg.py:32
SiPixelPI::displayNotSupported
void displayNotSupported(TCanvas &canv, const unsigned int size)
Definition: SiPixelPayloadInspectorHelper.h:971
SiPixelPI::phase0size
static const unsigned int phase0size
Definition: SiPixelPayloadInspectorHelper.h:40
SiPixelPI::checkAnswerOK
bool checkAnswerOK(std::string &answer, bool &result)
Definition: SiPixelPayloadInspectorHelper.h:998
gainCalibHelper::SiPixelGainCalibrationValuesPerRegion::isForHLT_
bool isForHLT_
Definition: SiPixelGainCalibHelper.h:448
edm::FileInPath
Definition: FileInPath.h:64
gainCalibHelper::TypeName
constexpr char const * TypeName[2]
Definition: SiPixelGainCalibHelper.h:200
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition: GlobalPosition_Frontier_DevDB_cff.py:11
PixelRegions::PixelRegionContainers
Definition: PixelRegionContainers.h:160
jets_cff.payload
payload
Definition: jets_cff.py:34
submit.answer
answer
Definition: submit.py:45
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cond
Definition: plugin.cc:23
PixelPluginsPhase0_cfi.isBarrel
isBarrel
Definition: PixelPluginsPhase0_cfi.py:17
edm::LogError
Definition: MessageLogger.h:183
SiPixelPI::phase1size
static const unsigned int phase1size
Definition: SiPixelPayloadInspectorHelper.h:41
cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >::fetchPayload
std::shared_ptr< PayloadType > fetchPayload(const cond::Hash &payloadHash)
Definition: PayloadInspector.h:840
listHistos.legend
legend
Definition: listHistos.py:41
PixelRegions::IDlabels
const std::vector< std::string > IDlabels
Definition: PixelRegionContainers.h:64
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:42
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
gainCalibHelper::SiPixelGainCalibrationValuesPerRegion::SiPixelGainCalibrationValuesPerRegion
SiPixelGainCalibrationValuesPerRegion()
Definition: SiPixelGainCalibHelper.h:315
Exception
Definition: hltDiff.cc:246
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
PixelRegions::attachedDets
const std::vector< uint32_t > attachedDets(const PixelRegions::PixelId theId, const TrackerTopology *trackTopo, const bool phase1)
Definition: PixelRegionContainers.h:119
cond::payloadInspector::PlotBase::addInputParam
void addInputParam(const std::string &paramName)
Definition: PayloadInspector.cc:35
cond::payloadInspector::SINGLE_IOV
Definition: PayloadInspector.h:265
StandaloneTrackerTopology::fromTrackerParametersXMLFile
TrackerTopology fromTrackerParametersXMLFile(const std::string &xmlFileName)
Definition: StandaloneTrackerTopology.cc:168
SiPixelPI::adjustCanvasMargins
void adjustCanvasMargins(TVirtualPad *pad, float top, float bottom, float left, float right)
Definition: SiPixelPayloadInspectorHelper.h:435