CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Protected Attributes
gainCalibHelper::SiPixelGainCalibrationValuesByPart< myType, PayloadType > Class Template Reference

#include <SiPixelGainCalibHelper.h>

Inheritance diagram for gainCalibHelper::SiPixelGainCalibrationValuesByPart< 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
 
 SiPixelGainCalibrationValuesByPart ()
 
- 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)
 
cond::persistency::Session dbSession ()
 
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 ()
 
const std::map< std::string,
std::string > & 
inputParamValues () const
 
bool isSingleIov () const
 
bool isTwoTags () const
 
unsigned int ntags () const
 
std::string payloadType () const
 
 PlotBase ()
 
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::SiPixelGainCalibrationValuesByPart< myType, PayloadType >

Definition at line 870 of file SiPixelGainCalibHelper.h.

Constructor & Destructor Documentation

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

Definition at line 873 of file SiPixelGainCalibHelper.h.

References gainCalibHelper::SiPixelGainCalibrationValuesByPart< myType, PayloadType >::isForHLT_, and gainCalibHelper::SiPixelGainCalibrationValuesByPart< myType, PayloadType >::label_.

875  Form("SiPixelGainCalibrationOffline %s Values By Partition", TypeName[myType])) {
876  if constexpr (std::is_same_v<PayloadType, SiPixelGainCalibrationOffline>) {
877  isForHLT_ = false;
878  label_ = "SiPixelGainCalibrationOffline_PayloadInspector";
879  } else {
880  isForHLT_ = true;
881  label_ = "SiPixelGainCalibrationForHLT_PayloadInspector";
882  }
883  }
constexpr char const * TypeName[2]

Member Function Documentation

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

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

Definition at line 885 of file SiPixelGainCalibHelper.h.

References SiPixelPI::adjustCanvasMargins(), SiPixelPI::adjustStats(), svgfig::canvas(), cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >::fetchPayload(), MillePedeFileConverter_cfg::fileName, gainCalibHelper::gainCalibPI::fillTheHistos(), mps_fire::i, gainCalibHelper::SiPixelGainCalibrationValuesByPart< myType, PayloadType >::isForHLT_, gainCalibHelper::SiPixelGainCalibrationValuesByPart< myType, PayloadType >::label_, compareTotals::legend, cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >::m_imageFileName, SiPixelPI::makeNicePlotStyle(), AlCaHLTBitMon_QueryRunRegistry::string, gainCalibHelper::gainCalibPI::t_gain, gainCalibHelper::gainCalibPI::t_pedestal, GlobalPosition_Frontier_DevDB_cff::tag, cond::impl::to_string(), and gainCalibHelper::TypeName.

885  {
886  auto tag = cond::payloadInspector::PlotBase::getTag<0>();
887  auto iov = tag.iovs.front();
888 
889  gStyle->SetOptStat("emr");
890 
891  std::shared_ptr<PayloadType> payload = this->fetchPayload(std::get<1>(iov));
892 
893  TCanvas canvas("Canv", "Canv", 1400, 800);
894  canvas.Divide(2, 1);
895  canvas.cd();
896 
897  float minimum(9999.);
898  float maximum(-9999.);
899 
900  switch (myType) {
901  case gainCalibPI::t_gain:
902  maximum = payload->getGainHigh();
903  minimum = payload->getGainLow();
904  break;
906  maximum = payload->getPedHigh();
907  minimum = payload->getPedLow();
908  break;
909  default:
910  edm::LogError(label_) << "Unrecognized type " << myType << std::endl;
911  break;
912  }
913 
914  auto hBPix = std::make_shared<TH1F>(Form("%s BPIX", TypeName[myType]),
915  Form("SiPixel Gain Calibration %s BPIx -%s;per %s %s (BPix);# %ss",
916  (isForHLT_ ? "ForHLT" : "Offline"),
917  TypeName[myType],
918  (isForHLT_ ? "Column" : "Pixel"),
919  TypeName[myType],
920  (isForHLT_ ? "column" : "pixel")),
921  200,
922  minimum,
923  maximum);
924 
925  auto hFPix = std::make_shared<TH1F>(Form("%s FPIX", TypeName[myType]),
926  Form("SiPixel Gain Calibration %s FPix -%s;per %s %s (FPix);# %ss",
927  (isForHLT_ ? "ForHLT" : "Offline"),
928  TypeName[myType],
929  (isForHLT_ ? "Column" : "Pixel"),
930  TypeName[myType],
931  (isForHLT_ ? "column" : "pixel")),
932  200,
933  minimum,
934  maximum);
935 
936  for (unsigned int i : {1, 2}) {
937  SiPixelPI::adjustCanvasMargins(canvas.cd(i), 0.04, 0.12, 0.12, 0.02);
938  canvas.cd(i)->Modified();
939  }
940 
941  // actually fill the histograms
942  fillTheHistos(payload, hBPix, hFPix, myType);
943 
944  canvas.cd(1)->SetLogy();
945  hBPix->SetTitle("");
946  hBPix->GetYaxis()->SetRangeUser(0.1, hBPix->GetMaximum() * 10);
947  hBPix->SetFillColor(kBlue);
948  hBPix->SetMarkerStyle(20);
949  hBPix->SetMarkerSize(1);
950  hBPix->Draw("hist");
951 
952  SiPixelPI::makeNicePlotStyle(hBPix.get());
953  hBPix->SetStats(true);
954 
955  canvas.cd(2)->SetLogy();
956  hFPix->SetTitle("");
957  hFPix->GetYaxis()->SetRangeUser(0.1, hFPix->GetMaximum() * 10);
958  hFPix->SetFillColor(kBlue);
959  hFPix->SetMarkerStyle(20);
960  hFPix->SetMarkerSize(1);
961  hFPix->Draw("hist");
962 
963  SiPixelPI::makeNicePlotStyle(hFPix.get());
964  hFPix->SetStats(true);
965 
966  canvas.Update();
967 
968  TLegend legend = TLegend(0.32, 0.92, 0.97, 0.95);
969  legend.SetHeader(("Payload hash: #bf{" + (std::get<1>(iov)) + "}").c_str(),
970  "C"); // option "C" allows to center the header
971  //legend.AddEntry(h1.get(), ("IOV: " + std::to_string(std::get<0>(iov))).c_str(), "PL");
972  legend.SetLineColor(10);
973  legend.SetTextSize(0.025);
974  canvas.cd(1);
975  legend.Draw("same");
976  canvas.cd(2);
977  legend.Draw("same");
978 
979  canvas.cd(1);
980  TPaveStats* st1 = (TPaveStats*)hBPix->FindObject("stats");
981  st1->SetTextSize(0.03);
982  SiPixelPI::adjustStats(st1, 0.13, 0.815, 0.44, 0.915);
983 
984  canvas.cd(2);
985  TPaveStats* st2 = (TPaveStats*)hFPix->FindObject("stats");
986  st2->SetTextSize(0.03);
987  SiPixelPI::adjustStats(st2, 0.14, 0.815, 0.44, 0.915);
988 
989  auto ltx = TLatex();
990  ltx.SetTextFont(62);
991  //ltx.SetTextColor(kBlue);
992  ltx.SetTextSize(0.045);
993  ltx.SetTextAlign(11);
994  canvas.cd(1);
995  ltx.DrawLatexNDC(gPad->GetLeftMargin() + 0.01,
996  1 - gPad->GetTopMargin() + 0.01,
997  ("SiPixel Gain Calibration IOV:" + std::to_string(std::get<0>(iov))).c_str());
998 
999  canvas.cd(2);
1000  ltx.DrawLatexNDC(gPad->GetLeftMargin() + 0.01,
1001  1 - gPad->GetTopMargin() + 0.01,
1002  ("SiPixel Gain Calibration IOV:" + std::to_string(std::get<0>(iov))).c_str());
1003 
1005  canvas.SaveAs(fileName.c_str());
1006 
1007  return true;
1008  }
std::string to_string(const V &value)
Definition: OMSAccess.h:71
Log< level::Error, false > LogError
def canvas
Definition: svgfig.py:482
constexpr char const * TypeName[2]
void adjustCanvasMargins(TVirtualPad *pad, float top, float bottom, float left, float right)
void adjustStats(TPaveStats *stats, float X1, float Y1, float X2, float Y2)
void makeNicePlotStyle(TH1 *hist)
static void fillTheHistos(const std::shared_ptr< PayloadType > &payload, std::shared_ptr< TH1 > hBPix, std::shared_ptr< TH1 > hFPix, gainCalibPI::type theType)
std::shared_ptr< PayloadType > fetchPayload(const cond::Hash &payloadHash)

Member Data Documentation

template<gainCalibPI::type myType, class PayloadType >
bool gainCalibHelper::SiPixelGainCalibrationValuesByPart< myType, PayloadType >::isForHLT_
protected
template<gainCalibPI::type myType, class PayloadType >
std::string gainCalibHelper::SiPixelGainCalibrationValuesByPart< myType, PayloadType >::label_
protected