1 #ifndef CONDCORE_BEAMSPOTPLUGINS_BEAMSPOTPAYLOADINSPECTORHELPER_H 2 #define CONDCORE_BEAMSPOTPLUGINS_BEAMSPOTPAYLOADINSPECTORHELPER_H 13 #include <fmt/printf.h> 32 return std::make_pair(
run,
lumi);
68 std::time_t unixTime =
static_cast<std::time_t
>(hasMicros ? timeValue / 1000000 : timeValue);
71 std::tm* timeInfo = toUTC ? std::gmtime(&unixTime) : std::localtime(&unixTime);
75 std::strftime(
buffer,
sizeof(
buffer),
"%Y-%m-%d %H:%M:%S", timeInfo);
86 const bool addUnits =
false ) {
89 return (addUnits ?
"X [cm]" :
"X");
91 return (addUnits ?
"Y [cm]" :
"Y");
93 return (addUnits ?
"Z [cm]" :
"Z");
95 return (addUnits ?
"#sigma_{X} [cm]" :
"sigmaX");
97 return (addUnits ?
"#sigma_{Y} [cm]" :
"sigmaY");
99 return (addUnits ?
"#sigma_{Z} [cm]" :
"sigmaZ");
101 return (addUnits ?
"#frac{dX}{dZ} [rad]" :
"dx/dz");
103 return (addUnits ?
"#frac{dY}{dZ} [rad]" :
"dy/dz");
105 return "should never be here";
114 template <
class PayloadType>
135 ss <<
"Dumping BeamSpot parameters Data:" << std::endl;
178 template <parameters my_param,
class PayloadType>
186 auto ret = std::make_pair<double, double>(-9999., -9999.);
190 return std::make_pair<double, double>(
payload.x(),
payload.xError());
192 return std::make_pair<double, double>(
payload.y(),
payload.yError());
194 return std::make_pair<double, double>(
payload.z(),
payload.zError());
196 return std::make_pair<double, double>(
payload.beamWidthX(),
payload.beamWidthXError());
198 return std::make_pair<double, double>(
payload.beamWidthY(),
payload.beamWidthYError());
200 return std::make_pair<double, double>(
payload.sigmaZ(),
payload.sigmaZError());
202 return std::make_pair<double, double>(
payload.dxdz(),
payload.dxdzError());
204 return std::make_pair<double, double>(
payload.dydz(),
payload.dydzError());
217 template <parameters my_param,
class PayloadType>
225 auto ret = std::make_pair<double, double>(-9999., -9999.);
229 return std::make_pair<double, double>(
payload.x(),
payload.xError());
231 return std::make_pair<double, double>(
payload.y(),
payload.yError());
233 return std::make_pair<double, double>(
payload.z(),
payload.zError());
235 return std::make_pair<double, double>(
payload.beamWidthX(),
payload.beamWidthXError());
237 return std::make_pair<double, double>(
payload.beamWidthY(),
payload.beamWidthYError());
239 return std::make_pair<double, double>(
payload.sigmaZ(),
payload.sigmaZError());
241 return std::make_pair<double, double>(
payload.dxdz(),
payload.dxdzError());
243 return std::make_pair<double, double>(
payload.dydz(),
payload.dydzError());
256 template <parameters my_param,
class PayloadType>
264 auto ret = std::make_pair<double, double>(-9999., -9999.);
268 return std::make_pair<double, double>(
payload.x(),
payload.xError());
270 return std::make_pair<double, double>(
payload.y(),
payload.yError());
272 return std::make_pair<double, double>(
payload.z(),
payload.zError());
274 return std::make_pair<double, double>(
payload.beamWidthX(),
payload.beamWidthXError());
276 return std::make_pair<double, double>(
payload.beamWidthY(),
payload.beamWidthYError());
278 return std::make_pair<double, double>(
payload.sigmaZ(),
payload.sigmaZError());
280 return std::make_pair<double, double>(
payload.dxdz(),
payload.dxdzError());
282 return std::make_pair<double, double>(
payload.dydz(),
payload.dydzError());
294 template <
class PayloadType>
307 template <
class PayloadType>
312 "Display of BeamSpot parameters") {
313 if constexpr (std::is_same_v<PayloadType, BeamSpotOnlineObjects>) {
321 auto tag = cond::payloadInspector::PlotBase::getTag<0>();
323 auto iov =
tag.iovs.front();
325 gStyle->SetHistMinimumZero(kTRUE);
329 TCanvas
canvas(
"Beam Spot Parameters Summary",
"BeamSpot Parameters summary",
isOnline_ ? 1500 : 1000, 1000);
335 canvas.cd(1)->SetTopMargin(0.05);
336 canvas.cd(1)->SetBottomMargin(0.06);
337 canvas.cd(1)->SetLeftMargin(0.15);
338 canvas.cd(1)->SetRightMargin(0.01);
342 auto h2_BSParameters = std::make_unique<TH2F>(
"Parameters",
"", 2, 0.0, 2.0, 8, 0, 8.);
343 h2_BSParameters->SetStats(
false);
345 std::function<double(parameters, bool)> cutFunctor = [
this](
parameters my_param,
bool isError) {
396 h2_BSParameters->GetXaxis()->SetBinLabel(1,
"Value");
397 h2_BSParameters->GetXaxis()->SetBinLabel(2,
"Error");
399 unsigned int yBin = 8;
403 h2_BSParameters->GetYaxis()->SetBinLabel(
yBin, theLabel.c_str());
404 h2_BSParameters->SetBinContent(1,
yBin, cutFunctor(param,
false));
405 h2_BSParameters->SetBinContent(2,
yBin, cutFunctor(param,
true));
409 h2_BSParameters->GetXaxis()->LabelsOption(
"h");
410 h2_BSParameters->GetYaxis()->SetLabelSize(0.05);
411 h2_BSParameters->GetXaxis()->SetLabelSize(0.05);
412 h2_BSParameters->SetMarkerSize(1.5);
413 h2_BSParameters->Draw(
"TEXT");
418 ltx.SetTextSize(0.030);
420 ltx.SetTextSize(0.025);
422 ltx.SetTextAlign(11);
427 gPad->GetLeftMargin(),
428 1 - gPad->GetTopMargin() + 0.01,
434 canvas.cd(2)->SetTopMargin(0.05);
435 canvas.cd(2)->SetBottomMargin(0.06);
436 canvas.cd(2)->SetLeftMargin(0.25);
437 canvas.cd(2)->SetRightMargin(0.01);
443 for (
int bin = 1;
bin <= extras->GetNbinsY();
bin++) {
445 << extras->GetYaxis()->GetBinLabel(
bin) <<
": " << extras->GetBinContent(1,
bin) <<
"\n";
448 extras->Draw(
"TEXT");
451 gPad->GetLeftMargin(),
452 1 - gPad->GetTopMargin() + 0.01,
456 if constexpr (std::is_same_v<PayloadType, BeamSpotOnlineObjects>) {
458 const auto&
creationTime = test_<cond::Time_t, std::out_of_range>(
464 const auto&
startTime = test_<cond::Time_t, std::out_of_range>(
470 const auto&
endTime = test_<cond::Time_t, std::out_of_range>(
476 ltx.SetTextSize(0.025);
478 gPad->GetLeftMargin() + 0.01,
479 gPad->GetBottomMargin() + 0.15,
482 ltx.DrawLatexNDC(gPad->GetLeftMargin() + 0.01,
483 gPad->GetBottomMargin() + 0.085,
486 ltx.DrawLatexNDC(gPad->GetLeftMargin() + 0.01,
487 gPad->GetBottomMargin() + 0.025,
491 gPad->GetLeftMargin(), gPad->GetBottomMargin() - 0.05,
"#color[4]{N.B.} TimeStamps are in UTC");
526 return "#sigma_{X} [cm]";
528 return "#sigma_{Y} [cm]";
530 return "#sigma_{Z} [cm]";
532 return "#frac{dX}{dZ} [rad]";
534 return "#frac{dY}{dZ} [rad]";
536 return "should never be here";
544 template <
typename T,
class Except,
class Func,
class Response>
547 LogDebug(
"DisplayParameters") <<
"I have tried" << std::endl;
549 }
catch (
const Except&
e) {
550 LogDebug(
"DisplayParameters") <<
"I have caught!" << std::endl;
552 return static_cast<T>(1);
560 template <
class PayloadType, cond::payloadInspector::IOVMultiplicity nIOVs,
int ntags>
564 :
cond::payloadInspector::
PlotImage<PayloadType, nIOVs,
ntags>(
"Display of BeamSpot parameters differences") {
565 if constexpr (std::is_same_v<PayloadType, BeamSpotOnlineObjects>) {
574 auto theIOVs = cond::payloadInspector::PlotBase::getTag<0>().
iovs;
575 auto f_tagname = cond::payloadInspector::PlotBase::getTag<0>().
name;
577 auto firstiov = theIOVs.front();
578 std::tuple<cond::Time_t, cond::Hash> lastiov;
584 auto tag2iovs = cond::payloadInspector::PlotBase::getTag<1>().
iovs;
585 l_tagname = cond::payloadInspector::PlotBase::getTag<1>().
name;
586 lastiov = tag2iovs.front();
588 lastiov = theIOVs.back();
597 TCanvas
canvas(
"Beam Spot Parameters Difference Summary",
"Beam Spot Parameters Difference summary", 1000, 1000);
600 canvas.cd(1)->SetTopMargin(0.08);
601 canvas.cd(1)->SetBottomMargin(0.06);
602 canvas.cd(1)->SetLeftMargin(0.14);
603 canvas.cd(1)->SetRightMargin(0.16);
608 auto h2_BSParameters = std::make_unique<TH2F>(
"Parameters",
"", 2, 0.0, 2.0, 8, 0, 8.);
609 h2_BSParameters->SetStats(
false);
610 h2_BSParameters->GetXaxis()->SetBinLabel(1,
"Value");
611 h2_BSParameters->GetXaxis()->SetBinLabel(2,
"Error");
612 h2_BSParameters->GetXaxis()->LabelsOption(
"h");
613 h2_BSParameters->GetYaxis()->SetLabelSize(0.05);
614 h2_BSParameters->GetXaxis()->SetLabelSize(0.05);
615 h2_BSParameters->SetMarkerSize(1.5);
622 std::stringstream ss1, ss2;
636 unsigned int yBin = 8;
640 h2_BSParameters->GetYaxis()->SetBinLabel(
yBin, theLabel.c_str());
641 h2_BSParameters->SetBinContent(1,
yBin, diffPars[
foo]);
642 h2_BSParameters->SetBinContent(2,
yBin, diffErrors[
foo]);
647 auto h2_BSShadow = (TH2F*)(h2_BSParameters->Clone(
"shadow"));
648 h2_BSShadow->GetZaxis()->SetTitle(
"#Delta Parameter(payload A - payload B)");
649 h2_BSShadow->GetZaxis()->CenterTitle();
650 h2_BSShadow->GetZaxis()->SetTitleOffset(1.5);
653 double max = h2_BSShadow->GetMaximum();
654 double min = h2_BSShadow->GetMinimum();
655 double val_white = 0.;
656 double per_white = (
max !=
min) ? ((val_white -
min) / (
max -
min)) : 0.5;
659 double Red[
number] = {0., 1., 1.};
660 double Green[
number] = {0., 1., 0.};
661 double Blue[
number] = {1., 1., 0.};
662 double Stops[
number] = {0., per_white, 1.};
664 h2_BSShadow->SetContour(nb);
665 TColor::CreateGradientColorTable(
number, Stops, Red, Green, Blue, nb);
667 h2_BSShadow->Draw(
"colz");
668 h2_BSParameters->Draw(
"TEXTsame");
672 ltx.SetTextSize(0.025);
673 ltx.SetTextAlign(11);
683 gPad->GetLeftMargin() - 0.1,
684 1 - gPad->GetTopMargin() + 0.015,
686 "#splitline{A = #color[4]{%s}: %s}{B = #color[4]{%s}: %s}", f_tagname, f_runLSs, l_tagname, l_runLSs))
690 gPad->GetLeftMargin() - 0.1,
691 1 - gPad->GetTopMargin() + 0.015,
692 (fmt::sprintf(
"#splitline{#color[4]{%s}}{A = %s | B = %s}", f_tagname, l_runLSs, f_runLSs)).c_str());
739 return (addUnits ?
"X [cm]" :
"X");
741 return (addUnits ?
"Y [cm]" :
"Y");
743 return (addUnits ?
"Z [cm]" :
"Z");
745 return (addUnits ?
"MeanX [cm]" :
"meanX");
747 return (addUnits ?
"MeanY [cm]" :
"meanY");
749 return (addUnits ?
"MeanZ [cm]" :
"meanZ");
751 return (addUnits ?
"#sigma_{X} [#mum]" :
"sigmaX");
753 return (addUnits ?
"#sigma_{Y} [#mum]" :
"sigmaY");
755 return (addUnits ?
"#sigma_{Z} [cm]" :
"sigmaZ");
757 return (addUnits ?
"#beta* [cm]" :
"BetaStar");
759 return (addUnits ?
"Emittance [cm]" :
"Emittance");
761 return (addUnits ?
"Phi [rad]" :
"Phi");
763 return (addUnits ?
"Alpha [rad]" :
"Alpha");
765 return (addUnits ?
"TimeOffset [ns]" :
"TimeOffset");
767 return "should never be here";
776 template <
class PayloadType>
778 typedef std::array<double, parameters::END_OF_TYPES>
bshelpdata;
795 ss <<
"Dumping SimBeamSpot parameters Data:" << std::endl;
823 template <
class PayloadType>
828 "Display of SimBeamSpot parameters") {}
831 auto tag = cond::payloadInspector::PlotBase::getTag<0>();
833 auto iov =
tag.iovs.front();
835 gStyle->SetHistMinimumZero(kTRUE);
839 TCanvas
canvas(
"Sim Beam Spot Parameters Summary",
"Sim BeamSpot Parameters summary", 1000, 1000);
841 canvas.cd(1)->SetTopMargin(0.05);
842 canvas.cd(1)->SetBottomMargin(0.06);
843 canvas.cd(1)->SetLeftMargin(0.25);
844 canvas.cd(1)->SetRightMargin(0.01);
849 h2_SimBSParameters->SetStats(
false);
851 std::function<double(parameters)> cutFunctor = [
this](
parameters my_param) {
889 h2_SimBSParameters->GetXaxis()->SetBinLabel(1,
"Value");
895 h2_SimBSParameters->GetYaxis()->SetBinLabel(
yBin, theLabel.c_str());
896 h2_SimBSParameters->SetBinContent(1,
yBin, cutFunctor(param));
900 h2_SimBSParameters->GetXaxis()->LabelsOption(
"h");
901 h2_SimBSParameters->GetYaxis()->SetLabelSize(0.05);
902 h2_SimBSParameters->GetXaxis()->SetLabelSize(0.05);
903 h2_SimBSParameters->SetMarkerSize(1.5);
904 h2_SimBSParameters->Draw(
"TEXT");
908 ltx.SetTextSize(0.025);
913 ltx.SetTextAlign(32);
914 ltx.DrawLatexNDC(1 - gPad->GetRightMargin(),
915 1 - gPad->GetTopMargin() + 0.01,
936 template <
class PayloadType, cond::payloadInspector::IOVMultiplicity nIOVs,
int ntags>
941 "Display of SimBeamSpot parameters differences") {}
945 auto theIOVs = cond::payloadInspector::PlotBase::getTag<0>().
iovs;
946 auto f_tagname = cond::payloadInspector::PlotBase::getTag<0>().
name;
948 auto firstiov = theIOVs.front();
949 std::tuple<cond::Time_t, cond::Hash> lastiov;
955 auto tag2iovs = cond::payloadInspector::PlotBase::getTag<1>().
iovs;
956 l_tagname = cond::payloadInspector::PlotBase::getTag<1>().
name;
957 lastiov = tag2iovs.front();
959 lastiov = theIOVs.back();
969 "Sim Beam Spot Parameters Difference Summary",
"Sim Beam Spot Parameters Difference summary", 1000, 1000);
971 canvas.cd(1)->SetTopMargin(0.10);
972 canvas.cd(1)->SetBottomMargin(0.06);
973 canvas.cd(1)->SetLeftMargin(0.23);
974 canvas.cd(1)->SetRightMargin(0.16);
980 h2_SimBSParameters->SetStats(
false);
981 h2_SimBSParameters->GetXaxis()->SetBinLabel(1,
"Value");
982 h2_SimBSParameters->GetXaxis()->LabelsOption(
"h");
983 h2_SimBSParameters->GetYaxis()->SetLabelSize(0.05);
984 h2_SimBSParameters->GetXaxis()->SetLabelSize(0.05);
985 h2_SimBSParameters->SetMarkerSize(1.5);
992 std::stringstream ss1, ss2;
1008 h2_SimBSParameters->GetYaxis()->SetBinLabel(
yBin, theLabel.c_str());
1009 h2_SimBSParameters->SetBinContent(1,
yBin, diffPars[
foo]);
1014 auto h2_SimBSShadow = (TH2F*)(h2_SimBSParameters->Clone(
"shadow"));
1015 h2_SimBSShadow->GetZaxis()->SetTitle(
"#Delta Parameter(payload A - payload B)");
1016 h2_SimBSShadow->GetZaxis()->CenterTitle();
1017 h2_SimBSShadow->GetZaxis()->SetTitleOffset(1.5);
1020 double max = h2_SimBSShadow->GetMaximum();
1021 double min = h2_SimBSShadow->GetMinimum();
1022 double val_white = 0.;
1023 double per_white = (
max !=
min) ? ((val_white -
min) / (
max -
min)) : 0.5;
1026 double Red[
number] = {0., 1., 1.};
1027 double Green[
number] = {0., 1., 0.};
1028 double Blue[
number] = {1., 1., 0.};
1029 double Stops[
number] = {0., per_white, 1.};
1031 h2_SimBSShadow->SetContour(nb);
1032 TColor::CreateGradientColorTable(
number, Stops, Red, Green, Blue, nb);
1034 h2_SimBSShadow->Draw(
"colz");
1035 h2_SimBSParameters->Draw(
"TEXTsame");
1037 auto ltx = TLatex();
1038 ltx.SetTextFont(62);
1039 ltx.SetTextSize(0.025);
1040 ltx.SetTextAlign(11);
1050 gPad->GetLeftMargin(),
1051 1 - gPad->GetTopMargin() + 0.025,
1053 "#splitline{A = #color[4]{%s}: %s}{B = #color[4]{%s}: %s}", f_tagname, f_runLSs, l_tagname, l_runLSs))
1057 gPad->GetLeftMargin(),
1058 1 - gPad->GetTopMargin() + 0.025,
1059 (fmt::sprintf(
"#splitline{#color[4]{%s}}{A = %s | B = %s}", f_tagname, l_runLSs, f_runLSs)).c_str());
1101 return (addUnits ?
"MeanX [cm]" :
"meanX");
1103 return (addUnits ?
"MeanY [cm]" :
"meanY");
1105 return (addUnits ?
"MeanZ [cm]" :
"meanZ");
1107 return (addUnits ?
"E_{proton} [GeV]" :
"eProton");
1109 return (addUnits ?
"Crab freq. [MHz]" :
"crabFrequency");
1111 return (addUnits ?
"RF800" :
"rf800");
1113 return (addUnits ?
"x-ing angle [#murad]" :
"crossingAngle");
1115 return (addUnits ?
"Crab x-ing angle [#murad]" :
"crabbingAngleCrossing");
1117 return (addUnits ?
"Crab sep. angle [#murad]" :
"crabbingAngleSeparation");
1119 return (addUnits ?
"#beta x-ing plane [m]" :
"betaCrossingPlane");
1121 return (addUnits ?
"#beta sep. plane [m]" :
"betaSeparationPlane");
1123 return (addUnits ?
"#epsilon_{horizontal} [mm]" :
"horizontalEmittance");
1125 return (addUnits ?
"#epsilon_{vertical} [mm]" :
"verticalEmittance");
1127 return (addUnits ?
"Bunch lenght [m]" :
"bunchLenght");
1129 return (addUnits ?
"TimeOffset [ns]" :
"TimeOffset");
1131 return "should never be here";
1140 template <
class PayloadType>
1165 ss <<
"Dumping SimBeamSpotHLLHC parameters Data:" << std::endl;
1193 template <
class PayloadType>
1198 "Display of SimBeamSpotHLLHC parameters") {}
1201 auto tag = cond::payloadInspector::PlotBase::getTag<0>();
1203 auto iov =
tag.iovs.front();
1205 gStyle->SetHistMinimumZero(kTRUE);
1209 std::function<double(parameters)> cutFunctor = [
this](
parameters my_param) {
1227 return m_payload->crabbingAngleCrossing();
1229 return m_payload->crabbingAngleSeparation();
1233 return m_payload->betaSeparationPlane();
1235 return m_payload->horizontalEmittance();
1249 TCanvas
canvas(
"Sim Beam Spot HL-LHC Parameters Summary",
"Sim BeamSpot HL-LHC Parameters summary", 1500, 1000);
1254 canvas.cd(1)->SetTopMargin(0.05);
1255 canvas.cd(1)->SetBottomMargin(0.06);
1256 canvas.cd(1)->SetLeftMargin(0.35);
1257 canvas.cd(1)->SetRightMargin(0.01);
1258 canvas.cd(1)->Modified();
1261 auto h2_SimBSHLLHCParameters = std::make_unique<TH2F>(
1263 h2_SimBSHLLHCParameters->SetStats(
false);
1264 h2_SimBSHLLHCParameters->GetXaxis()->SetBinLabel(1,
"Value");
1266 unsigned int yBin = 8;
1270 h2_SimBSHLLHCParameters->GetYaxis()->SetBinLabel(
yBin, theLabel.c_str());
1271 h2_SimBSHLLHCParameters->SetBinContent(1,
yBin, cutFunctor(param));
1275 h2_SimBSHLLHCParameters->GetXaxis()->LabelsOption(
"h");
1276 h2_SimBSHLLHCParameters->GetYaxis()->SetLabelSize(0.05);
1277 h2_SimBSHLLHCParameters->GetXaxis()->SetLabelSize(0.05);
1278 h2_SimBSHLLHCParameters->SetMarkerSize(1.5);
1279 h2_SimBSHLLHCParameters->Draw(
"TEXT");
1281 auto ltx = TLatex();
1282 ltx.SetTextFont(62);
1283 ltx.SetTextSize(0.030);
1284 ltx.SetTextAlign(11);
1289 gPad->GetLeftMargin(),
1290 1 - gPad->GetTopMargin() + 0.01,
1296 canvas.cd(2)->SetTopMargin(0.05);
1297 canvas.cd(2)->SetBottomMargin(0.06);
1298 canvas.cd(2)->SetLeftMargin(0.35);
1299 canvas.cd(2)->SetRightMargin(0.01);
1300 canvas.cd(2)->Modified();
1304 auto h2_SimBSHLLHCParameters_Extras =
1305 std::make_unique<TH2F>(
"Parameters Extras",
"", 1, 0.0, 1.0, span, 0,
static_cast<float>(span));
1306 h2_SimBSHLLHCParameters_Extras->SetStats(
false);
1307 h2_SimBSHLLHCParameters_Extras->GetXaxis()->SetBinLabel(1,
"Value");
1309 unsigned int yBin_Extras = span;
1313 h2_SimBSHLLHCParameters_Extras->GetYaxis()->SetBinLabel(yBin_Extras, theLabel.c_str());
1314 h2_SimBSHLLHCParameters_Extras->SetBinContent(1, yBin_Extras, cutFunctor(param));
1318 h2_SimBSHLLHCParameters_Extras->GetXaxis()->LabelsOption(
"h");
1319 h2_SimBSHLLHCParameters_Extras->GetYaxis()->SetLabelSize(0.05);
1320 h2_SimBSHLLHCParameters_Extras->GetXaxis()->SetLabelSize(0.05);
1321 h2_SimBSHLLHCParameters_Extras->SetMarkerSize(1.5);
1322 h2_SimBSHLLHCParameters_Extras->Draw(
"TEXT");
1325 gPad->GetLeftMargin(),
1326 1 - gPad->GetTopMargin() + 0.01,
1346 template <
class PayloadType, cond::payloadInspector::IOVMultiplicity nIOVs,
int ntags>
1351 "Display of SimBeamSpotHLLHC parameters differences") {}
1355 auto theIOVs = cond::payloadInspector::PlotBase::getTag<0>().
iovs;
1356 auto f_tagname = cond::payloadInspector::PlotBase::getTag<0>().
name;
1358 auto firstiov = theIOVs.front();
1359 std::tuple<cond::Time_t, cond::Hash> lastiov;
1365 auto tag2iovs = cond::payloadInspector::PlotBase::getTag<1>().
iovs;
1366 l_tagname = cond::payloadInspector::PlotBase::getTag<1>().
name;
1367 lastiov = tag2iovs.front();
1369 lastiov = theIOVs.back();
1378 TCanvas
canvas(
"Sim Beam Spot HL-LHC Parameters Difference Summary",
1379 "Sim Beam Spot HL-LHC Parameters Difference summary",
1386 auto h2_SimBSHLLHCParameters = std::make_unique<TH2F>(
1388 h2_SimBSHLLHCParameters->SetStats(
false);
1389 h2_SimBSHLLHCParameters->GetXaxis()->SetBinLabel(1,
"Value");
1390 h2_SimBSHLLHCParameters->GetXaxis()->LabelsOption(
"h");
1391 h2_SimBSHLLHCParameters->GetYaxis()->SetLabelSize(0.05);
1392 h2_SimBSHLLHCParameters->GetXaxis()->SetLabelSize(0.05);
1393 h2_SimBSHLLHCParameters->SetMarkerSize(1.5);
1396 auto h2_SimBSHLLHCParameters_Extras =
1397 std::make_unique<TH2F>(
"Parameters Extras",
"", 1, 0.0, 1.0, span, 0,
static_cast<float>(span));
1398 h2_SimBSHLLHCParameters_Extras->SetStats(
false);
1399 h2_SimBSHLLHCParameters_Extras->GetXaxis()->SetBinLabel(1,
"Value");
1400 h2_SimBSHLLHCParameters_Extras->GetXaxis()->LabelsOption(
"h");
1401 h2_SimBSHLLHCParameters_Extras->GetYaxis()->SetLabelSize(0.05);
1402 h2_SimBSHLLHCParameters_Extras->GetXaxis()->SetLabelSize(0.05);
1403 h2_SimBSHLLHCParameters_Extras->SetMarkerSize(1.5);
1410 std::stringstream ss1, ss2;
1422 unsigned int yBin = 8;
1426 h2_SimBSHLLHCParameters->GetYaxis()->SetBinLabel(
yBin, theLabel.c_str());
1427 h2_SimBSHLLHCParameters->SetBinContent(1,
yBin, diffPars[
foo]);
1431 unsigned int yBin_Extras = span;
1435 h2_SimBSHLLHCParameters_Extras->GetYaxis()->SetBinLabel(yBin_Extras, theLabel.c_str());
1436 h2_SimBSHLLHCParameters_Extras->SetBinContent(
1437 1, yBin_Extras, diffPars[
foo]);
1442 auto h2_SimBSHLLHCShadow = (TH2F*)(h2_SimBSHLLHCParameters->Clone(
"shadow"));
1443 h2_SimBSHLLHCShadow->GetZaxis()->SetTitle(
"#Delta Parameter(payload A - payload B)");
1444 h2_SimBSHLLHCShadow->GetZaxis()->CenterTitle();
1445 h2_SimBSHLLHCShadow->GetZaxis()->SetTitleOffset(1.5);
1447 auto h2_SimBSHLLHCShadow_Extras = (TH2F*)(h2_SimBSHLLHCParameters_Extras->Clone(
"shadow"));
1448 h2_SimBSHLLHCShadow_Extras->GetZaxis()->SetTitle(
"#Delta Parameter(payload A - payload B)");
1449 h2_SimBSHLLHCShadow_Extras->GetZaxis()->CenterTitle();
1450 h2_SimBSHLLHCShadow_Extras->GetZaxis()->SetTitleOffset(1.5);
1453 double max =
std::max(h2_SimBSHLLHCShadow->GetMaximum(), h2_SimBSHLLHCShadow_Extras->GetMaximum());
1454 double min =
std::min(h2_SimBSHLLHCShadow->GetMinimum(), h2_SimBSHLLHCShadow_Extras->GetMinimum());
1455 double val_white = 0.;
1456 double per_white = (
max !=
min) ? ((val_white -
min) / (
max -
min)) : 0.5;
1459 double Red[
number] = {0., 1., 1.};
1460 double Green[
number] = {0., 1., 0.};
1461 double Blue[
number] = {1., 1., 0.};
1462 double Stops[
number] = {0., per_white, 1.};
1464 h2_SimBSHLLHCShadow->SetContour(nb);
1465 h2_SimBSHLLHCShadow_Extras->SetContour(nb);
1466 TColor::CreateGradientColorTable(
number, Stops, Red, Green, Blue, nb);
1470 canvas.cd(1)->SetTopMargin(0.10);
1471 canvas.cd(1)->SetBottomMargin(0.06);
1472 canvas.cd(1)->SetLeftMargin(0.35);
1473 canvas.cd(1)->SetRightMargin(0.25);
1474 canvas.cd(1)->Modified();
1476 h2_SimBSHLLHCShadow->Draw(
"colz");
1477 h2_SimBSHLLHCParameters->Draw(
"TEXTsame");
1479 auto ltx = TLatex();
1480 ltx.SetTextFont(62);
1481 ltx.SetTextSize(0.025);
1482 ltx.SetTextAlign(11);
1492 gPad->GetLeftMargin(),
1493 1 - gPad->GetTopMargin() + 0.025,
1495 "#splitline{A = #color[4]{%s}: %s}{B = #color[4]{%s}: %s}", f_tagname, f_runLSs, l_tagname, l_runLSs))
1499 gPad->GetLeftMargin(),
1500 1 - gPad->GetTopMargin() + 0.025,
1501 (fmt::sprintf(
"#splitline{#color[4]{%s}}{A = %s | B = %s}", f_tagname, l_runLSs, f_runLSs)).c_str());
1506 canvas.cd(2)->SetTopMargin(0.10);
1507 canvas.cd(2)->SetBottomMargin(0.06);
1508 canvas.cd(2)->SetLeftMargin(0.35);
1509 canvas.cd(2)->SetRightMargin(0.20);
1510 canvas.cd(2)->Modified();
1512 h2_SimBSHLLHCShadow_Extras->Draw(
"colz");
1513 h2_SimBSHLLHCParameters_Extras->Draw(
"TEXTsame");
1517 gPad->GetLeftMargin(),
1518 1 - gPad->GetTopMargin() + 0.025,
1520 "#splitline{A = #color[4]{%s}: %s}{B = #color[4]{%s}: %s}", f_tagname, f_runLSs, l_tagname, l_runLSs))
1524 gPad->GetLeftMargin(),
1525 1 - gPad->GetTopMargin() + 0.025,
1526 (fmt::sprintf(
"#splitline{#color[4]{%s}}{A = %s | B = %s}", f_tagname, l_runLSs, f_runLSs)).c_str());
const bshelpdata centralValues() const
std::string m_imageFileName
Log< level::Info, true > LogVerbatim
const bshelpdata diffErrors(const BSParamsHelper &bs2, const bool isPull=false) const
const bshelpdata centralValues() const
const bshelpdata diffCentralValues(const SimBSHLLHCParamsHelper &bs2, const bool isPull=false) const
PlotImage(const std::string &title)
std::shared_ptr< PayloadType > l_payload
std::pair< double, double > getFromPayload(PayloadType &payload) override
virtual std::shared_ptr< TH2F > fillTheExtraHistogram() const
static constexpr double cmToUm
ret
prodAgent to be discontinued
const Time_t kLowMask(0xFFFFFFFF)
std::shared_ptr< PayloadType > m_payload
std::array< double, parameters::END_OF_TYPES > bshelpdata
std::string getStringFromParamEnum(const parameters ¶meter, const bool addUnits=false)
Log< level::Error, false > LogError
std::pair< double, double > getFromPayload(PayloadType &payload) override
static constexpr double cmToUm
std::array< double, parameters::lastLumi > bshelpdata
const bshelpdata diffCentralValues(const BSParamsHelper &bs2, const bool isPull=false) const
static std::string to_string(const XMLCh *ch)
ScatterPlot(const std::string &title, const std::string &xLabel, const std::string &yLabel)
void printDebug(std::stringstream &ss)
unsigned long long Time_t
std::string convertTimeToDateString(cond::Time_t timeValue, bool hasMicros=false, bool toUTC=true)
std::shared_ptr< PayloadType > l_payload
std::pair< unsigned int, unsigned int > unpack(cond::Time_t since)
std::shared_ptr< PayloadType > m_payload
const bshelpdata errors() const
PlotAnnotations m_plotAnnotations
std::shared_ptr< PayloadType > f_payload
RunHistoryPlot(const std::string &title, const std::string &yLabel)
SimBSHLLHCParamsHelper(const std::shared_ptr< PayloadType > &bs)
std::pair< double, double > getFromPayload(PayloadType &payload) override
T test_(Func f, Response r) const
std::string getStringFromParamEnum(const parameters ¶meter, const bool addUnits=false)
Log< level::Warning, true > LogPrint
std::shared_ptr< PayloadType > f_payload
std::array< double, parameters::END_OF_TYPES > bshelpdata
void printDebug(std::stringstream &ss)
virtual std::string getStringFromTypeEnum(const parameters ¶meter) const
const bshelpdata diffCentralValues(const SimBSParamsHelper &bs2, const bool isPull=false) const
static void better_error(const std::exception &e)
SimBSParamsHelper(const std::shared_ptr< PayloadType > &bs)
TimeHistoryPlot(const std::string &title, const std::string &yLabel)
std::shared_ptr< PayloadType > f_payload
HistoryPlot(const std::string &title, const std::string &yLabel)
const bshelpdata centralValues() const
void printDebug(std::stringstream &ss)
std::tuple< double, double > getFromPayload(PayloadType &payload) override
std::shared_ptr< PayloadType > m_payload
std::shared_ptr< PayloadType > l_payload
BSParamsHelper(const std::shared_ptr< PayloadType > &bs)
std::string getStringFromParamEnum(const parameters ¶meter, const bool addUnits=false)
unsigned int ntags() const
virtual std::shared_ptr< TH2F > fillTheExtraHistogram() const
std::shared_ptr< PayloadType > fetchPayload(const cond::Hash &payloadHash)