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

403  :
405  : cond::payloadInspector::PlotImage<PayloadType, cond::payloadInspector::SINGLE_IOV>(
406  Form("SiPixelGainCalibration %s Values Per Region", TypeName[myType])) {
408 
409  if constexpr (std::is_same_v<PayloadType, SiPixelGainCalibrationOffline>) {
410  isForHLT_ = false;
411  label_ = "SiPixelGainCalibrationOffline_PayloadInspector";
412  } else {
413  isForHLT_ = true;
414  label_ = "SiPixelGainCalibrationForHLT_PayloadInspector";
415  }

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

418  {
419  gStyle->SetOptStat("mr");
420 
421  auto tag = cond::payloadInspector::PlotBase::getTag<0>();
422  auto iov = tag.iovs.front();
423 
424  // parse first if log
425  bool setLog(true);
427  auto ip = paramValues.find("SetLog");
428  if (ip != paramValues.end()) {
429  auto answer = boost::lexical_cast<std::string>(ip->second);
430  if (!SiPixelPI::checkAnswerOK(answer, setLog)) {
431  throw cms::Exception(label_)
432  << "\nERROR: " << answer
433  << " is not a valid setting for this parameter, please use True,False,1,0,Yes,No \n\n";
434  }
435  }
436 
437  std::shared_ptr<PayloadType> payload = this->fetchPayload(std::get<1>(iov));
438 
439  std::vector<uint32_t> detids;
440  payload->getDetIds(detids);
441 
442  float minimum(9999.);
443  float maximum(-9999.);
444 
445  switch (myType) {
446  case gainCalibPI::t_gain:
447  maximum = payload->getGainHigh();
448  minimum = payload->getGainLow();
449  break;
451  maximum = payload->getPedHigh();
452  minimum = payload->getPedLow();
453  break;
454  default:
455  edm::LogError(label_) << "Unrecognized type " << myType << std::endl;
456  break;
457  }
458 
459  TCanvas canvas("Canv", "Canv", isBarrel ? 1400 : 1800, 1200);
460  if (detids.size() > SiPixelPI::phase1size) {
461  SiPixelPI::displayNotSupported(canvas, detids.size());
463  canvas.SaveAs(fileName.c_str());
464  return false;
465  }
466 
467  canvas.cd();
468 
469  SiPixelPI::PhaseInfo phaseInfo(detids.size());
470  const char* path_toTopologyXML = phaseInfo.pathToTopoXML();
471 
472  TrackerTopology tTopo =
474 
475  auto myPlots = PixelRegions::PixelRegionContainers(&tTopo, phaseInfo.phase());
476  myPlots.bookAll(Form("SiPixel Gain Calibration %s - %s", (isForHLT_ ? "ForHLT" : "Offline"), TypeName[myType]),
477  Form("per %s %s", (isForHLT_ ? "Column" : "Pixel"), TypeName[myType]),
478  Form("# %ss", (isForHLT_ ? "column" : "pixel")),
479  200,
480  minimum,
481  maximum);
482 
483  canvas.Modified();
484 
485  // fill the histograms
486  for (const auto& pixelId : PixelRegions::PixelIDs) {
487  auto wantedDets = PixelRegions::attachedDets(pixelId, &tTopo, phaseInfo.phase());
488  gainCalibPI::fillTheHisto(payload, myPlots.getHistoFromMap(pixelId), myType, wantedDets);
489  }
490 
491  if (setLog) {
492  myPlots.setLogScale();
493  }
494  myPlots.beautify(kBlue, -1);
495  myPlots.draw(canvas, isBarrel, "HIST");
496 
497  TLegend legend = TLegend(0.45, 0.88, 0.91, 0.92);
498  legend.SetHeader(("hash: #bf{" + (std::get<1>(iov)) + "}").c_str(),
499  "C"); // option "C" allows to center the header
500  //legend.AddEntry(h1.get(), ("IOV: " + std::to_string(std::get<0>(iov))).c_str(), "PL");
501  legend.SetLineColor(10);
502  legend.SetTextSize(0.025);
503  legend.Draw("same");
504 
505  unsigned int maxPads = isBarrel ? 4 : 12;
506  for (unsigned int c = 1; c <= maxPads; c++) {
507  canvas.cd(c);
508  SiPixelPI::adjustCanvasMargins(canvas.cd(c), 0.06, 0.12, 0.12, 0.05);
509  legend.Draw("same");
510  canvas.cd(c)->Update();
511  }
512 
513  myPlots.stats();
514 
515  auto ltx = TLatex();
516  ltx.SetTextFont(62);
517  ltx.SetTextSize(0.05);
518  ltx.SetTextAlign(11);
519 
520  for (unsigned int c = 1; c <= maxPads; c++) {
521  auto index = isBarrel ? c - 1 : c + 3;
522  canvas.cd(c);
523  auto leftX = setLog ? 0. : 0.1;
524  ltx.DrawLatexNDC(gPad->GetLeftMargin() + leftX,
525  1 - gPad->GetTopMargin() + 0.01,
526  (PixelRegions::IDlabels.at(index) + ", IOV:" + std::to_string(std::get<0>(iov))).c_str());
527  }
528 
530  canvas.SaveAs(fileName.c_str());
531 
532  return true;

References SiPixelPI::adjustCanvasMargins(), PixelRegions::attachedDets(), PixelRegions::PixelRegionContainers::bookAll(), 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, SiPixelPI::PhaseInfo::pathToTopoXML(), jets_cff::payload, SiPixelPI::phase1size, PixelRegions::PixelIDs, AlCaHLTBitMon_QueryRunRegistry::string, gainCalibHelper::gainCalibPI::t_gain, gainCalibHelper::gainCalibPI::t_pedestal, makeGlobalPositionRcd_cfg::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:40
svgfig.canvas
def canvas(*sub, **attr)
Definition: svgfig.py:482
gainCalibHelper::SiPixelGainCalibrationValuesPerRegion::label_
std::string label_
Definition: SiPixelGainCalibHelper.h:536
cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >::m_imageFileName
std::string m_imageFileName
Definition: PayloadInspector.h:910
SiPixelPI::PhaseInfo::pathToTopoXML
const char * pathToTopoXML()
Definition: SiPixelPayloadInspectorHelper.h:81
gainCalibHelper::gainCalibPI::t_gain
Definition: SiPixelGainCalibHelper.h:40
PixelRegions::PixelIDs
const std::vector< PixelId > PixelIDs
Definition: PixelRegionContainers.h:45
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:897
MillePedeFileConverter_cfg.fileName
fileName
Definition: MillePedeFileConverter_cfg.py:32
SiPixelPI::displayNotSupported
void displayNotSupported(TCanvas &canv, const unsigned int size)
Definition: SiPixelPayloadInspectorHelper.h:782
SiPixelPI::checkAnswerOK
bool checkAnswerOK(std::string &answer, bool &result)
Definition: SiPixelPayloadInspectorHelper.h:809
gainCalibHelper::SiPixelGainCalibrationValuesPerRegion::isForHLT_
bool isForHLT_
Definition: SiPixelGainCalibHelper.h:535
edm::FileInPath
Definition: FileInPath.h:61
gainCalibHelper::TypeName
constexpr char const * TypeName[2]
Definition: SiPixelGainCalibHelper.h:288
PixelRegions::attachedDets
static const std::vector< uint32_t > attachedDets(const PixelRegions::PixelId theId, const TrackerTopology *trackTopo, const SiPixelPI::phase &ph)
Definition: PixelRegionContainers.h:187
PixelRegions::PixelRegionContainers
Definition: PixelRegionContainers.h:238
jets_cff.payload
payload
Definition: jets_cff.py:32
cond
Definition: plugin.cc:23
PixelPluginsPhase0_cfi.isBarrel
isBarrel
Definition: PixelPluginsPhase0_cfi.py:17
makeGlobalPositionRcd_cfg.tag
tag
Definition: makeGlobalPositionRcd_cfg.py:6
SiPixelPI::phase1size
static const unsigned int phase1size
Definition: SiPixelPayloadInspectorHelper.h:43
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
PixelRegions::IDlabels
const std::vector< std::string > IDlabels
Definition: PixelRegionContainers.h:62
SiPixelPI::PhaseInfo
Definition: SiPixelPayloadInspectorHelper.h:48
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
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
gainCalibHelper::SiPixelGainCalibrationValuesPerRegion::SiPixelGainCalibrationValuesPerRegion
SiPixelGainCalibrationValuesPerRegion()
Definition: SiPixelGainCalibHelper.h:403
Exception
Definition: hltDiff.cc:245
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
cond::payloadInspector::PlotBase::addInputParam
void addInputParam(const std::string &paramName)
Definition: PayloadInspector.cc:35
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:56
cond::payloadInspector::SINGLE_IOV
Definition: PayloadInspector.h:295
StandaloneTrackerTopology::fromTrackerParametersXMLFile
TrackerTopology fromTrackerParametersXMLFile(const std::string &xmlFileName)
Definition: StandaloneTrackerTopology.cc:168
PixelRegions::PixelRegionContainers::bookAll
void bookAll(std::string title_label, std::string x_label, std::string y_label, const int nbins, const float xmin, const float xmax)
Definition: PixelRegionContainers.h:263
SiPixelPI::adjustCanvasMargins
void adjustCanvasMargins(TVirtualPad *pad, float top, float bottom, float left, float right)
Definition: SiPixelPayloadInspectorHelper.h:508