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

Constructor & Destructor Documentation

◆ SiPixelGainCalibrationValuesByPart()

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

Definition at line 868 of file SiPixelGainCalibHelper.h.

871  public:
873  : cond::payloadInspector::PlotImage<PayloadType, cond::payloadInspector::SINGLE_IOV>(
874  Form("SiPixelGainCalibrationOffline %s Values By Partition", TypeName[myType])) {
875  if constexpr (std::is_same_v<PayloadType, SiPixelGainCalibrationOffline>) {
876  isForHLT_ = false;
877  label_ = "SiPixelGainCalibrationOffline_PayloadInspector";
878  } 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 880 of file SiPixelGainCalibHelper.h.

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

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:40
svgfig.canvas
def canvas(*sub, **attr)
Definition: svgfig.py:482
gainCalibHelper::SiPixelGainCalibrationValuesByPart::label_
std::string label_
Definition: SiPixelGainCalibHelper.h:1007
cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >::m_imageFileName
std::string m_imageFileName
Definition: PayloadInspector.h:910
mps_fire.i
i
Definition: mps_fire.py:428
gainCalibHelper::gainCalibPI::t_gain
Definition: SiPixelGainCalibHelper.h:40
gainCalibHelper::SiPixelGainCalibrationValuesByPart::SiPixelGainCalibrationValuesByPart
SiPixelGainCalibrationValuesByPart()
Definition: SiPixelGainCalibHelper.h:868
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
gainCalibHelper::TypeName
constexpr char const * TypeName[2]
Definition: SiPixelGainCalibHelper.h:287
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:905
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:522
cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >
SiPixelPI::makeNicePlotStyle
void makeNicePlotStyle(TH1 *hist)
Definition: SiPixelPayloadInspectorHelper.h:548
gainCalibHelper::SiPixelGainCalibrationValuesByPart::isForHLT_
bool isForHLT_
Definition: SiPixelGainCalibHelper.h:1006
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:232
cond::payloadInspector::SINGLE_IOV
Definition: PayloadInspector.h:295
SiPixelPI::adjustCanvasMargins
void adjustCanvasMargins(TVirtualPad *pad, float top, float bottom, float left, float right)
Definition: SiPixelPayloadInspectorHelper.h:508