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

Constructor & Destructor Documentation

◆ SiPixelGainCalibrationValueComparisonBase()

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

Definition at line 1015 of file SiPixelGainCalibHelper.h.

1019  public:
1021  : cond::payloadInspector::PlotImage<PayloadType>(
1022  Form("SiPixelGainCalibration %s Values Comparison", TypeName[myType])) {
1023  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 1024 of file SiPixelGainCalibHelper.h.

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

Member Data Documentation

◆ isForHLT_

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

Definition at line 1155 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:40
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:910
gainCalibHelper::gainCalibPI::t_gain
Definition: SiPixelGainCalibHelper.h:40
min
T min(T a, T b)
Definition: MathUtil.h:58
gainCalibHelper::SiPixelGainCalibrationValueComparisonBase::SiPixelGainCalibrationValueComparisonBase
SiPixelGainCalibrationValueComparisonBase()
Definition: SiPixelGainCalibHelper.h:1015
cond::payloadInspector::PlotImage< PayloadType >::PlotImage
PlotImage(const std::string &title)
Definition: PayloadInspector.h:897
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:287
mps_fire.end
end
Definition: mps_fire.py:242
cond::payloadInspector::PlotImpl< UNSPECIFIED_IOV, 0 >::fill
virtual bool fill()
Definition: PayloadInspector.h:409
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cond
Definition: plugin.cc:23
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
jetUpdater_cfi.sort
sort
Definition: jetUpdater_cfi.py:29
cond::payloadInspector::PlotImage< PayloadType >::fetchPayload
std::shared_ptr< PayloadType > fetchPayload(const cond::Hash &payloadHash)
Definition: PayloadInspector.h:905
listHistos.legend
legend
Definition: listHistos.py:41
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
gainCalibHelper::SiPixelGainCalibrationValueComparisonBase::isForHLT_
bool isForHLT_
Definition: SiPixelGainCalibHelper.h:1155
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:129
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
gainCalibHelper::SiPixelGainCalibrationValueComparisonBase::label_
std::string label_
Definition: SiPixelGainCalibHelper.h:1156
cond::payloadInspector::PlotImage< PayloadType >
SiPixelPI::makeNicePlotStyle
void makeNicePlotStyle(TH1 *hist)
Definition: SiPixelPayloadInspectorHelper.h:548
SiPixelPI::getExtrema
std::pair< float, float > getExtrema(TH1 *h1, TH1 *h2)
Definition: SiPixelPayloadInspectorHelper.h:532
SiPixelPI::adjustCanvasMargins
void adjustCanvasMargins(TVirtualPad *pad, float top, float bottom, float left, float right)
Definition: SiPixelPayloadInspectorHelper.h:508