1 #ifndef CONDCORE_BEAMSPOTPLUGINS_BEAMSPOTPAYLOADINSPECTORHELPER_H
2 #define CONDCORE_BEAMSPOTPLUGINS_BEAMSPOTPAYLOADINSPECTORHELPER_H
21 namespace BeamSpotPI {
25 auto run = (since >> 32);
27 return std::make_pair(
run,
lumi);
79 return "should never be here";
87 template <parameters my_param,
class PayloadType>
91 : cond::payloadInspector::
HistoryPlot<PayloadType, std::pair<double, double> >(
95 auto ret = std::make_pair<double, double>(-9999., -9999.);
99 return std::make_pair<double, double>(payload.GetX(), payload.GetXError());
101 return std::make_pair<double, double>(payload.GetY(), payload.GetYError());
103 return std::make_pair<double, double>(payload.GetZ(), payload.GetZError());
105 return std::make_pair<double, double>(payload.GetBeamWidthX(), payload.GetBeamWidthXError());
107 return std::make_pair<double, double>(payload.GetBeamWidthY(), payload.GetBeamWidthYError());
109 return std::make_pair<double, double>(payload.GetSigmaZ(), payload.GetSigmaZError());
111 return std::make_pair<double, double>(payload.Getdxdz(), payload.GetdxdzError());
113 return std::make_pair<double, double>(payload.Getdydz(), payload.GetdydzError());
126 template <parameters my_param,
class PayloadType>
130 : cond::payloadInspector::
RunHistoryPlot<PayloadType, std::pair<double, double> >(
134 auto ret = std::make_pair<double, double>(-9999., -9999.);
138 return std::make_pair<double, double>(payload.GetX(), payload.GetXError());
140 return std::make_pair<double, double>(payload.GetY(), payload.GetYError());
142 return std::make_pair<double, double>(payload.GetZ(), payload.GetZError());
144 return std::make_pair<double, double>(payload.GetBeamWidthX(), payload.GetBeamWidthXError());
146 return std::make_pair<double, double>(payload.GetBeamWidthY(), payload.GetBeamWidthYError());
148 return std::make_pair<double, double>(payload.GetSigmaZ(), payload.GetSigmaZError());
150 return std::make_pair<double, double>(payload.Getdxdz(), payload.GetdxdzError());
152 return std::make_pair<double, double>(payload.Getdydz(), payload.GetdydzError());
165 template <parameters my_param,
class PayloadType>
169 : cond::payloadInspector::
TimeHistoryPlot<PayloadType, std::pair<double, double> >(
173 auto ret = std::make_pair<double, double>(-9999., -9999.);
177 return std::make_pair<double, double>(payload.GetX(), payload.GetXError());
179 return std::make_pair<double, double>(payload.GetY(), payload.GetYError());
181 return std::make_pair<double, double>(payload.GetZ(), payload.GetZError());
183 return std::make_pair<double, double>(payload.GetBeamWidthX(), payload.GetBeamWidthXError());
185 return std::make_pair<double, double>(payload.GetBeamWidthY(), payload.GetBeamWidthYError());
187 return std::make_pair<double, double>(payload.GetSigmaZ(), payload.GetSigmaZError());
189 return std::make_pair<double, double>(payload.Getdxdz(), payload.GetdxdzError());
191 return std::make_pair<double, double>(payload.Getdydz(), payload.GetdydzError());
203 template <
class PayloadType>
209 return std::make_tuple(payload.GetX(), payload.GetY());
216 template <
class PayloadType>
221 "Display of BeamSpot parameters") {
222 if constexpr (std::is_same_v<PayloadType, BeamSpotOnlineObjects>) {
230 auto tag = cond::payloadInspector::PlotBase::getTag<0>();
232 auto iov =
tag.iovs.front();
234 gStyle->SetHistMinimumZero(kTRUE);
238 TCanvas
canvas(
"Beam Spot Parameters Summary",
"BeamSpot Parameters summary",
isOnline_ ? 1500 : 1000, 1000);
244 canvas.cd(1)->SetTopMargin(0.05);
245 canvas.cd(1)->SetBottomMargin(0.06);
246 canvas.cd(1)->SetLeftMargin(0.15);
247 canvas.cd(1)->SetRightMargin(0.01);
248 canvas.cd(1)->Modified();
249 canvas.cd(1)->SetGrid();
251 auto h2_BSParameters = std::make_unique<TH2F>(
"Parameters",
"", 2, 0.0, 2.0, 8, 0, 8.);
252 h2_BSParameters->SetStats(
false);
254 std::function<double(parameters, bool)> cutFunctor = [
this](
parameters my_param,
bool isError) {
305 h2_BSParameters->GetXaxis()->SetBinLabel(1,
"Value");
306 h2_BSParameters->GetXaxis()->SetBinLabel(2,
"Error");
308 unsigned int yBin = 8;
312 h2_BSParameters->GetYaxis()->SetBinLabel(yBin, theLabel.c_str());
313 h2_BSParameters->SetBinContent(1, yBin, cutFunctor(param,
false));
314 h2_BSParameters->SetBinContent(2, yBin, cutFunctor(param,
true));
318 h2_BSParameters->GetXaxis()->LabelsOption(
"h");
319 h2_BSParameters->GetYaxis()->SetLabelSize(0.05);
320 h2_BSParameters->GetXaxis()->SetLabelSize(0.05);
321 h2_BSParameters->SetMarkerSize(1.5);
322 h2_BSParameters->Draw(
"TEXT");
327 ltx.SetTextSize(0.030);
329 ltx.SetTextSize(0.025);
331 ltx.SetTextAlign(11);
336 gPad->GetLeftMargin(),
337 1 - gPad->GetTopMargin() + 0.01,
338 (tagname +
" IOV: #color[4]{" + std::to_string(runLS.first) +
"," + std::to_string(runLS.second) +
"}")
343 canvas.cd(2)->SetTopMargin(0.05);
344 canvas.cd(2)->SetBottomMargin(0.06);
345 canvas.cd(2)->SetLeftMargin(0.25);
346 canvas.cd(2)->SetRightMargin(0.01);
347 canvas.cd(2)->Modified();
348 canvas.cd(2)->SetGrid();
352 for (
int bin = 1;
bin <= extras->GetNbinsY();
bin++) {
354 << extras->GetYaxis()->GetBinLabel(
bin) <<
": " << extras->GetBinContent(1,
bin) <<
"\n";
357 extras->Draw(
"TEXT");
360 gPad->GetLeftMargin(),
361 1 - gPad->GetTopMargin() + 0.01,
362 (tagname +
" IOV: #color[4]{" + std::to_string(runLS.first) +
"," + std::to_string(runLS.second) +
"}")
366 canvas.SaveAs(fileName.c_str());
371 canvas.SaveAs(fileName.c_str());
394 return "#sigma_{X} [cm]";
396 return "#sigma_{Y} [cm]";
398 return "#sigma_{Z} [cm]";
400 return "#frac{dX}{dZ} [rad]";
402 return "#frac{dY}{dZ} [rad]";
404 return "should never be here";
std::string m_imageFileName
Log< level::Info, true > LogVerbatim
virtual std::string getStringFromTypeEnum(const parameters ¶meter) const
PlotImage(const std::string &title)
tuple ret
prodAgent to be discontinued
std::pair< unsigned int, unsigned int > unpack(cond::Time_t since)
virtual std::shared_ptr< TH2F > fillTheExtraHistogram() const
const Time_t kLowMask(0xFFFFFFFF)
std::tuple< double, double > getFromPayload(PayloadType &payload) override
ScatterPlot(const std::string &title, const std::string &xLabel, const std::string &yLabel)
unsigned long long Time_t
std::pair< double, double > getFromPayload(PayloadType &payload) override
RunHistoryPlot(const std::string &title, const std::string &yLabel)
TimeHistoryPlot(const std::string &title, const std::string &yLabel)
HistoryPlot(const std::string &title, const std::string &yLabel)
std::pair< double, double > getFromPayload(PayloadType &payload) override
std::pair< double, double > getFromPayload(PayloadType &payload) override
std::shared_ptr< PayloadType > m_payload
std::string getStringFromParamEnum(const parameters ¶meter)
std::shared_ptr< PayloadType > fetchPayload(const cond::Hash &payloadHash)