File indexing completed on 2025-07-03 00:42:03
0001 #include "CondCore/Utilities/interface/PayloadInspectorModule.h"
0002 #include "CondCore/Utilities/interface/PayloadInspector.h"
0003 #include "CondFormats/RunInfo/interface/LHCInfoPerFill.h"
0004 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0005
0006 #include <sstream>
0007 #include <memory>
0008 #include "TLatex.h"
0009 #include "TCanvas.h"
0010
0011 namespace {
0012
0013 class LHCInfoPerFill_Display : public cond::payloadInspector::PlotImage<LHCInfoPerFill> {
0014 public:
0015 LHCInfoPerFill_Display()
0016 : cond::payloadInspector::PlotImage<LHCInfoPerFill>("LHCInfoPerFill Inspector - Display") {}
0017
0018 bool fill() override {
0019 auto tag = PlotBase::getTag<0>();
0020 auto iov = tag.iovs.front();
0021 std::shared_ptr<LHCInfoPerFill> payload = fetchPayload(std::get<1>(iov));
0022 if (!payload) {
0023 return false;
0024 }
0025
0026 std::vector<std::pair<std::string, std::string>> items;
0027 items.push_back({"Fill Number: ", std::to_string(payload->fillNumber())});
0028 items.push_back({"Beam Energy: ", std::to_string(payload->energy())});
0029 items.push_back({"Deliv Lumi: ", std::to_string(payload->delivLumi())});
0030 items.push_back({"Rec Lumi: ", std::to_string(payload->recLumi())});
0031 items.push_back({"Inst Lumi: ", std::to_string(payload->instLumi())});
0032 items.push_back({"Injection Scheme: ", payload->injectionScheme()});
0033 items.push_back({"Colliding Bunches: ", std::to_string(payload->collidingBunches())});
0034 items.push_back({"Target Bunches: ", std::to_string(payload->targetBunches())});
0035
0036 TCanvas canvas("c", "c", 800, 600);
0037 canvas.cd();
0038 TLatex latex;
0039 latex.SetTextSize(0.03);
0040
0041 float startY = 0.95;
0042 float stepY = 0.06;
0043
0044
0045 latex.SetTextColor(kBlack);
0046 latex.DrawLatexNDC(0.05, startY, "LHCInfoPerFill Inspector");
0047
0048
0049 for (std::size_t i = 0; i < items.size(); ++i) {
0050 float y = startY - (i + 2) * stepY;
0051
0052 latex.SetTextColor(kBlack);
0053 latex.DrawLatexNDC(0.05, y, items[i].first.c_str());
0054
0055 latex.SetTextColor(kRed);
0056 latex.DrawLatexNDC(0.30, y, items[i].second.c_str());
0057 }
0058
0059
0060 TLatex t1;
0061 t1.SetNDC();
0062 t1.SetTextAlign(12);
0063 t1.SetTextSize(0.04);
0064 t1.DrawLatex(0.1, 0.18, "LHCInfo parameters:");
0065 t1.DrawLatex(0.1, 0.15, "payload:");
0066
0067 t1.SetTextFont(42);
0068 t1.SetTextColor(4);
0069 t1.DrawLatex(0.37, 0.182, Form("IOV %s", std::to_string(+std::get<0>(iov)).c_str()));
0070 t1.DrawLatex(0.21, 0.152, Form(" %s", (std::get<1>(iov)).c_str()));
0071
0072 std::string fileName(m_imageFileName);
0073 canvas.SaveAs(fileName.c_str());
0074
0075 return true;
0076 }
0077 };
0078
0079 }
0080
0081 PAYLOAD_INSPECTOR_MODULE(LHCInfoPerFill) { PAYLOAD_INSPECTOR_CLASS(LHCInfoPerFill_Display); }