CMS 3D CMS Logo

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)
 
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<gainCalibPI::type myType, class PayloadType>
class gainCalibHelper::SiPixelGainCalibrationValuesByPart< myType, PayloadType >

Definition at line 863 of file SiPixelGainCalibHelper.h.

Constructor & Destructor Documentation

◆ SiPixelGainCalibrationValuesByPart()

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

Definition at line 867 of file SiPixelGainCalibHelper.h.

870  public:
872  : cond::payloadInspector::PlotImage<PayloadType, cond::payloadInspector::SINGLE_IOV>(
873  Form("SiPixelGainCalibrationOffline %s Values By Partition", TypeName[myType])) {
874  if constexpr (std::is_same_v<PayloadType, SiPixelGainCalibrationOffline>) {
875  isForHLT_ = false;
876  label_ = "SiPixelGainCalibrationOffline_PayloadInspector";
877  } else {

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

Member Function Documentation

◆ fill()

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

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

Definition at line 879 of file SiPixelGainCalibHelper.h.

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

Member Data Documentation

◆ isForHLT_

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

◆ label_

template<gainCalibPI::type myType, class PayloadType >
std::string gainCalibHelper::SiPixelGainCalibrationValuesByPart< myType, PayloadType >::label_
protected
gainCalibHelper::gainCalibPI::t_pedestal
Definition: SiPixelGainCalibHelper.h:39
svgfig.canvas
def canvas(*sub, **attr)
Definition: svgfig.py:482
gainCalibHelper::SiPixelGainCalibrationValuesByPart::label_
std::string label_
Definition: SiPixelGainCalibHelper.h:1006
cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >::m_imageFileName
std::string m_imageFileName
Definition: PayloadInspector.h:868
mps_fire.i
i
Definition: mps_fire.py:428
gainCalibHelper::gainCalibPI::t_gain
Definition: SiPixelGainCalibHelper.h:39
gainCalibHelper::SiPixelGainCalibrationValuesByPart::SiPixelGainCalibrationValuesByPart
SiPixelGainCalibrationValuesByPart()
Definition: SiPixelGainCalibHelper.h:867
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
gainCalibHelper::TypeName
constexpr char const * TypeName[2]
Definition: SiPixelGainCalibHelper.h:286
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition: GlobalPosition_Frontier_DevDB_cff.py:11
jets_cff.payload
payload
Definition: jets_cff.py:32
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cond
Definition: plugin.cc:23
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
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
SiPixelPI::adjustStats
void adjustStats(TPaveStats *stats, float X1, float Y1, float X2, float Y2)
Definition: SiPixelPayloadInspectorHelper.h:519
cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >
SiPixelPI::makeNicePlotStyle
void makeNicePlotStyle(TH1 *hist)
Definition: SiPixelPayloadInspectorHelper.h:545
gainCalibHelper::SiPixelGainCalibrationValuesByPart::isForHLT_
bool isForHLT_
Definition: SiPixelGainCalibHelper.h:1005
gainCalibHelper::gainCalibPI::fillTheHistos
static void fillTheHistos(const std::shared_ptr< PayloadType > &payload, std::shared_ptr< TH1 > hBPix, std::shared_ptr< TH1 > hFPix, gainCalibPI::type theType)
Definition: SiPixelGainCalibHelper.h:231
cond::payloadInspector::SINGLE_IOV
Definition: PayloadInspector.h:289
SiPixelPI::adjustCanvasMargins
void adjustCanvasMargins(TVirtualPad *pad, float top, float bottom, float left, float right)
Definition: SiPixelPayloadInspectorHelper.h:505