CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Attributes
gainCalibHelper::SiPixelGainCalibrationValueComparisonBase< myType, PayloadType > Class Template Reference

#include <SiPixelGainCalibHelper.h>

Inheritance diagram for gainCalibHelper::SiPixelGainCalibrationValueComparisonBase< myType, PayloadType >:
cond::payloadInspector::PlotImage< PayloadType > cond::payloadInspector::PlotImpl< UNSPECIFIED_IOV, 0 > cond::payloadInspector::PlotBase gainCalibHelper::SiPixelGainCalibrationValueComparisonSingleTag< myType, PayloadType > gainCalibHelper::SiPixelGainCalibrationValueComparisonTwoTags< myType, PayloadType >

Public Member Functions

bool fill (const std::vector< std::tuple< cond::Time_t, cond::Hash >> &iovs) override
 
 SiPixelGainCalibrationValueComparisonBase ()
 
- Public Member Functions inherited from cond::payloadInspector::PlotImage< PayloadType >
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< UNSPECIFIED_IOV, 0 >
virtual bool fill ()
 
virtual bool fill (const std::vector< std::tuple< cond::Time_t, cond::Hash >> &iovs)
 
 PlotImpl (const std::string &type, const std::string &title)
 
std::string processData () override
 
void setSingleIov (bool flag)
 
void setTwoTags (bool flag)
 
 ~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 >
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 >
typedef PlotImpl< UNSPECIFIED_IOV, 0 > Base
 
- Public Attributes inherited from cond::payloadInspector::PlotImpl< UNSPECIFIED_IOV, 0 >
bool m_singleIovSet = false
 

Detailed Description

template<gainCalibPI::type myType, class PayloadType>
class gainCalibHelper::SiPixelGainCalibrationValueComparisonBase< myType, PayloadType >

Definition at line 1011 of file SiPixelGainCalibHelper.h.

Constructor & Destructor Documentation

◆ SiPixelGainCalibrationValueComparisonBase()

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

Definition at line 1014 of file SiPixelGainCalibHelper.h.

1018  public:
1020  : cond::payloadInspector::PlotImage<PayloadType>(
1021  Form("SiPixelGainCalibration %s Values Comparison", TypeName[myType])) {
1022  if constexpr (std::is_same_v<PayloadType, SiPixelGainCalibrationOffline>) {

References gainCalibHelper::TypeName.

Member Function Documentation

◆ fill()

template<gainCalibPI::type myType, class PayloadType >
bool gainCalibHelper::SiPixelGainCalibrationValueComparisonBase< myType, PayloadType >::fill ( const std::vector< std::tuple< cond::Time_t, cond::Hash >> &  iovs)
inlineoverride

Definition at line 1023 of file SiPixelGainCalibHelper.h.

1024  {
1025  isForHLT_ = true;
1026  }
1027  }
1028  bool fill(const std::vector<std::tuple<cond::Time_t, cond::Hash>>& iovs) override {
1029  gStyle->SetOptStat("emr");
1030  TGaxis::SetExponentOffset(-0.1, 0.01, "y"); // Y offset
1031  TH1F::SetDefaultSumw2(true);
1032 
1033  std::vector<std::tuple<cond::Time_t, cond::Hash>> sorted_iovs = iovs;
1034  // make absolute sure the IOVs are sortd by since
1035  std::sort(begin(sorted_iovs), end(sorted_iovs), [](auto const& t1, auto const& t2) {
1036  return std::get<0>(t1) < std::get<0>(t2);
1037  });
1038  auto firstiov = sorted_iovs.front();
1039  auto lastiov = sorted_iovs.back();
1040 
1041  std::shared_ptr<PayloadType> last_payload = this->fetchPayload(std::get<1>(lastiov));
1042  std::shared_ptr<PayloadType> first_payload = this->fetchPayload(std::get<1>(firstiov));
1043 
1044  std::string lastIOVsince = std::to_string(std::get<0>(lastiov));
1045  std::string firstIOVsince = std::to_string(std::get<0>(firstiov));
1046 
1047  float minimum(9999.);
1048  float maximum(-9999.);
1049 
1050  switch (myType) {
1051  case gainCalibPI::t_gain:
1052  maximum = std::max(last_payload->getGainHigh(), first_payload->getGainHigh());
1053  minimum = std::min(last_payload->getGainLow(), first_payload->getGainLow());
1054  break;
1056  maximum = std::max(last_payload->getPedHigh(), first_payload->getPedHigh());
1057  minimum = std::min(last_payload->getPedLow(), first_payload->getPedLow());
1058  break;
1059  default:
1060  edm::LogError(label_) << "Unrecognized type " << myType << std::endl;
1061  break;
1062  }
1063 
1064  TCanvas canvas("Canv", "Canv", 1200, 1000);
1065  canvas.cd();
1066  auto hfirst = std::make_shared<TH1F>(Form("First, IOV %s", firstIOVsince.c_str()),
1067  Form("SiPixel Gain Calibration %s - %s;per %s %s;# %ss",
1068  (isForHLT_ ? "ForHLT" : "Offline"),
1069  TypeName[myType],
1070  (isForHLT_ ? "Column" : "Pixel"),
1071  TypeName[myType],
1072  (isForHLT_ ? "column" : "pixel")),
1073  200,
1074  minimum,
1075  maximum);
1076 
1077  auto hlast = std::make_shared<TH1F>(Form("Last, IOV %s", lastIOVsince.c_str()),
1078  Form("SiPixel Gain Calibration %s - %s;per %s %s;# %ss",
1079  (isForHLT_ ? "ForHLT" : "Offline"),
1080  TypeName[myType],
1081  (isForHLT_ ? "Column" : "Pixel"),
1082  TypeName[myType],
1083  (isForHLT_ ? "column" : "pixel")),
1084  200,
1085  minimum,
1086  maximum);
1087 
1088  SiPixelPI::adjustCanvasMargins(canvas.cd(), 0.05, 0.12, 0.12, 0.03);
1089  canvas.Modified();
1090 
1091  gainCalibPI::fillTheHisto(first_payload, hfirst, myType);
1092  gainCalibPI::fillTheHisto(last_payload, hlast, myType);
1093 
1094  canvas.cd()->SetLogy();
1095  auto extrema = SiPixelPI::getExtrema(hfirst.get(), hlast.get());
1096  //hfirst->GetYaxis()->SetRangeUser(extrema.first, extrema.second * 1.10);
1097  hfirst->GetYaxis()->SetRangeUser(1., extrema.second * 10);
1098 
1099  hfirst->SetTitle("");
1100  hfirst->SetLineColor(kRed);
1101  hfirst->SetBarWidth(0.95);
1102  hfirst->Draw("hist");
1103 
1104  hlast->SetTitle("");
1105  hlast->SetFillColorAlpha(kBlue, 0.20);
1106  hlast->SetBarWidth(0.95);
1107  hlast->Draw("histsames");
1108 
1109  SiPixelPI::makeNicePlotStyle(hfirst.get());
1110  hfirst->SetStats(true);
1111  SiPixelPI::makeNicePlotStyle(hlast.get());
1112  hlast->SetStats(true);
1113 
1114  canvas.Update();
1115 
1116  TLegend legend = TLegend(0.45, 0.86, 0.74, 0.94);
1117  //legend.SetHeader("#font[22]{SiPixel Offline Gain Calibration Comparison}", "C"); // option "C" allows to center the header
1118  //legend.AddEntry(hfirst.get(), ("IOV: " + std::to_string(std::get<0>(firstiov))).c_str(), "FL");
1119  //legend.AddEntry(hlast.get(), ("IOV: " + std::to_string(std::get<0>(lastiov))).c_str(), "FL");
1120  legend.AddEntry(hfirst.get(), ("payload: #color[2]{" + std::get<1>(firstiov) + "}").c_str(), "F");
1121  legend.AddEntry(hlast.get(), ("payload: #color[4]{" + std::get<1>(lastiov) + "}").c_str(), "F");
1122  legend.SetTextSize(0.022);
1123  legend.SetLineColor(10);
1124  legend.Draw("same");
1125 
1126  TPaveStats* st1 = (TPaveStats*)hfirst->FindObject("stats");
1127  st1->SetTextSize(0.021);
1128  st1->SetLineColor(kRed);
1129  st1->SetTextColor(kRed);
1130  SiPixelPI::adjustStats(st1, 0.13, 0.86, 0.31, 0.94);
1131 
1132  TPaveStats* st2 = (TPaveStats*)hlast->FindObject("stats");
1133  st2->SetTextSize(0.021);
1134  st2->SetLineColor(kBlue);
1135  st2->SetTextColor(kBlue);
1136  SiPixelPI::adjustStats(st2, 0.13, 0.77, 0.31, 0.85);
1137 
1138  auto ltx = TLatex();
1139  ltx.SetTextFont(62);
1140  //ltx.SetTextColor(kBlue);
1141  ltx.SetTextSize(0.047);
1142  ltx.SetTextAlign(11);
1143  ltx.DrawLatexNDC(gPad->GetLeftMargin(),
1144  1 - gPad->GetTopMargin() + 0.01,
1145  ("SiPixel Gain Calibration IOV:#color[2]{" + std::to_string(std::get<0>(firstiov)) +
1146  "} vs IOV:#color[4]{" + std::to_string(std::get<0>(lastiov)) + "}")
1147  .c_str());
1148 
1150  canvas.SaveAs(fileName.c_str());
1151 #ifdef MMDEBUG

Member Data Documentation

◆ isForHLT_

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

Definition at line 1154 of file SiPixelGainCalibHelper.h.

◆ label_

template<gainCalibPI::type myType, class PayloadType >
std::string gainCalibHelper::SiPixelGainCalibrationValueComparisonBase< myType, PayloadType >::label_
protected
gainCalibHelper::gainCalibPI::t_pedestal
Definition: SiPixelGainCalibHelper.h:39
svgfig.canvas
def canvas(*sub, **attr)
Definition: svgfig.py:482
RandomServiceHelper.t2
t2
Definition: RandomServiceHelper.py:257
cond::payloadInspector::PlotImage< PayloadType >::m_imageFileName
std::string m_imageFileName
Definition: PayloadInspector.h:868
gainCalibHelper::gainCalibPI::t_gain
Definition: SiPixelGainCalibHelper.h:39
min
T min(T a, T b)
Definition: MathUtil.h:58
gainCalibHelper::SiPixelGainCalibrationValueComparisonBase::SiPixelGainCalibrationValueComparisonBase
SiPixelGainCalibrationValueComparisonBase()
Definition: SiPixelGainCalibHelper.h:1014
cond::payloadInspector::PlotImage< PayloadType >::PlotImage
PlotImage(const std::string &title)
Definition: PayloadInspector.h:855
MillePedeFileConverter_cfg.fileName
fileName
Definition: MillePedeFileConverter_cfg.py:32
RandomServiceHelper.t1
t1
Definition: RandomServiceHelper.py:256
gainCalibHelper::TypeName
constexpr char const * TypeName[2]
Definition: SiPixelGainCalibHelper.h:286
mps_fire.end
end
Definition: mps_fire.py:242
cond::payloadInspector::PlotImpl< UNSPECIFIED_IOV, 0 >::fill
virtual bool fill()
Definition: PayloadInspector.h:403
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cond
Definition: plugin.cc:23
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
cond::payloadInspector::PlotImage< PayloadType >::fetchPayload
std::shared_ptr< PayloadType > fetchPayload(const cond::Hash &payloadHash)
Definition: PayloadInspector.h:863
listHistos.legend
legend
Definition: listHistos.py:41
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
gainCalibHelper::SiPixelGainCalibrationValueComparisonBase::isForHLT_
bool isForHLT_
Definition: SiPixelGainCalibHelper.h:1154
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
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
gainCalibHelper::SiPixelGainCalibrationValueComparisonBase::label_
std::string label_
Definition: SiPixelGainCalibHelper.h:1155
cond::payloadInspector::PlotImage< PayloadType >
SiPixelPI::makeNicePlotStyle
void makeNicePlotStyle(TH1 *hist)
Definition: SiPixelPayloadInspectorHelper.h:545
SiPixelPI::getExtrema
std::pair< float, float > getExtrema(TH1 *h1, TH1 *h2)
Definition: SiPixelPayloadInspectorHelper.h:529
SiPixelPI::adjustCanvasMargins
void adjustCanvasMargins(TVirtualPad *pad, float top, float bottom, float left, float right)
Definition: SiPixelPayloadInspectorHelper.h:505