1031 gStyle->SetOptStat(
"emr");
1032 TGaxis::SetExponentOffset(-0.1, 0.01,
"y");
1033 TH1F::SetDefaultSumw2(
true);
1035 std::vector<std::tuple<cond::Time_t, cond::Hash>> sorted_iovs =
iovs;
1038 return std::get<0>(
t1) < std::get<0>(
t2);
1040 auto firstiov = sorted_iovs.front();
1041 auto lastiov = sorted_iovs.back();
1043 std::shared_ptr<PayloadType> last_payload = this->
fetchPayload(std::get<1>(lastiov));
1044 std::shared_ptr<PayloadType> first_payload = this->
fetchPayload(std::get<1>(firstiov));
1049 float minimum(9999.);
1050 float maximum(-9999.);
1054 maximum =
std::max(last_payload->getGainHigh(), first_payload->getGainHigh());
1055 minimum =
std::min(last_payload->getGainLow(), first_payload->getGainLow());
1058 maximum =
std::max(last_payload->getPedHigh(), first_payload->getPedHigh());
1059 minimum =
std::min(last_payload->getPedLow(), first_payload->getPedLow());
1066 TCanvas
canvas(
"Canv",
"Canv", 1200, 1000);
1068 auto hfirst = std::make_shared<TH1F>(Form(
"First, IOV %s", firstIOVsince.c_str()),
1069 Form(
"SiPixel Gain Calibration %s - %s;per %s %s;# %ss",
1079 auto hlast = std::make_shared<TH1F>(Form(
"Last, IOV %s", lastIOVsince.c_str()),
1080 Form(
"SiPixel Gain Calibration %s - %s;per %s %s;# %ss",
1099 hfirst->GetYaxis()->SetRangeUser(1., extrema.second * 10);
1101 hfirst->SetTitle(
"");
1102 hfirst->SetLineColor(kRed);
1103 hfirst->SetBarWidth(0.95);
1104 hfirst->Draw(
"hist");
1106 hlast->SetTitle(
"");
1107 hlast->SetFillColorAlpha(kBlue, 0.20);
1108 hlast->SetBarWidth(0.95);
1109 hlast->Draw(
"histsames");
1112 hfirst->SetStats(
true);
1114 hlast->SetStats(
true);
1118 TLegend
legend = TLegend(0.45, 0.86, 0.74, 0.94);
1122 legend.AddEntry(hfirst.get(), (
"payload: #color[2]{" + std::get<1>(firstiov) +
"}").c_str(),
"F");
1123 legend.AddEntry(hlast.get(), (
"payload: #color[4]{" + std::get<1>(lastiov) +
"}").c_str(),
"F");
1124 legend.SetTextSize(0.022);
1128 TPaveStats* st1 = (TPaveStats*)hfirst->FindObject(
"stats");
1129 st1->SetTextSize(0.021);
1130 st1->SetLineColor(kRed);
1131 st1->SetTextColor(kRed);
1134 TPaveStats* st2 = (TPaveStats*)hlast->FindObject(
"stats");
1135 st2->SetTextSize(0.021);
1136 st2->SetLineColor(kBlue);
1137 st2->SetTextColor(kBlue);
1140 auto ltx = TLatex();
1141 ltx.SetTextFont(62);
1143 ltx.SetTextSize(0.047);
1144 ltx.SetTextAlign(11);
1145 ltx.DrawLatexNDC(gPad->GetLeftMargin(),
1146 1 - gPad->GetTopMargin() + 0.01,
1147 (
"SiPixel Gain Calibration IOV:#color[2]{" +
std::to_string(std::get<0>(firstiov)) +
1148 "} vs IOV:#color[4]{" +
std::to_string(std::get<0>(lastiov)) +
"}")
1154 canvas.SaveAs(
"out.root");
std::string m_imageFileName
Log< level::Error, false > LogError
std::pair< float, float > getExtrema(TH1 *h1, TH1 *h2)
static std::string to_string(const XMLCh *ch)
constexpr char const * TypeName[2]
static void fillTheHisto(const std::shared_ptr< PayloadType > &payload, std::shared_ptr< TH1F > h1, gainCalibPI::type theType, const std::vector< uint32_t > &wantedIds={})
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)
std::shared_ptr< PayloadType > fetchPayload(const cond::Hash &payloadHash)