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

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

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

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

References SiPixelPI::adjustCanvasMargins(), submit::answer, 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, 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:40
svgfig.canvas
def canvas(*sub, **attr)
Definition: svgfig.py:482
gainCalibHelper::SiPixelGainCalibrationValuesPerRegion::label_
std::string label_
Definition: SiPixelGainCalibHelper.h:535
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:781
SiPixelPI::checkAnswerOK
bool checkAnswerOK(std::string &answer, bool &result)
Definition: SiPixelPayloadInspectorHelper.h:808
gainCalibHelper::SiPixelGainCalibrationValuesPerRegion::isForHLT_
bool isForHLT_
Definition: SiPixelGainCalibHelper.h:534
edm::FileInPath
Definition: FileInPath.h:64
gainCalibHelper::TypeName
constexpr char const * TypeName[2]
Definition: SiPixelGainCalibHelper.h:287
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition: GlobalPosition_Frontier_DevDB_cff.py:11
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
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
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:129
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
gainCalibHelper::SiPixelGainCalibrationValuesPerRegion::SiPixelGainCalibrationValuesPerRegion
SiPixelGainCalibrationValuesPerRegion()
Definition: SiPixelGainCalibHelper.h:402
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:46
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