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

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

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

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

References SiPixelPI::adjustCanvasMargins(), submit::answer, PixelRegions::attachedDets(), PixelRegions::PixelRegionContainers::bookAll(), 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, 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:39
svgfig.canvas
def canvas(*sub, **attr)
Definition: svgfig.py:482
gainCalibHelper::SiPixelGainCalibrationValuesPerRegion::label_
std::string label_
Definition: SiPixelGainCalibHelper.h:534
cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >::m_imageFileName
std::string m_imageFileName
Definition: PayloadInspector.h:868
SiPixelPI::PhaseInfo::pathToTopoXML
const char * pathToTopoXML()
Definition: SiPixelPayloadInspectorHelper.h:81
gainCalibHelper::gainCalibPI::t_gain
Definition: SiPixelGainCalibHelper.h:39
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:855
MillePedeFileConverter_cfg.fileName
fileName
Definition: MillePedeFileConverter_cfg.py:32
SiPixelPI::displayNotSupported
void displayNotSupported(TCanvas &canv, const unsigned int size)
Definition: SiPixelPayloadInspectorHelper.h:990
SiPixelPI::checkAnswerOK
bool checkAnswerOK(std::string &answer, bool &result)
Definition: SiPixelPayloadInspectorHelper.h:1017
gainCalibHelper::SiPixelGainCalibrationValuesPerRegion::isForHLT_
bool isForHLT_
Definition: SiPixelGainCalibHelper.h:533
edm::FileInPath
Definition: FileInPath.h:64
gainCalibHelper::TypeName
constexpr char const * TypeName[2]
Definition: SiPixelGainCalibHelper.h:286
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:863
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:128
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
gainCalibHelper::SiPixelGainCalibrationValuesPerRegion::SiPixelGainCalibrationValuesPerRegion
SiPixelGainCalibrationValuesPerRegion()
Definition: SiPixelGainCalibHelper.h:401
Exception
Definition: hltDiff.cc:246
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
cond::payloadInspector::PlotBase::addInputParam
void addInputParam(const std::string &paramName)
Definition: PayloadInspector.cc:35
cond::payloadInspector::SINGLE_IOV
Definition: PayloadInspector.h:289
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:505