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/LHCInfoPerLS.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 LHCInfoPerLS_Display : public cond::payloadInspector::PlotImage<LHCInfoPerLS> {
0014 public:
0015 LHCInfoPerLS_Display() : cond::payloadInspector::PlotImage<LHCInfoPerLS>("LHCInfoPerLS Inspector - Display") {}
0016
0017 bool fill() override {
0018 auto tag = PlotBase::getTag<0>();
0019 auto iov = tag.iovs.front();
0020 std::shared_ptr<LHCInfoPerLS> payload = fetchPayload(std::get<1>(iov));
0021 if (!payload) {
0022 return false;
0023 }
0024
0025
0026 std::vector<std::pair<std::string, std::string>> items;
0027 items.push_back({"LS: ", std::to_string(payload->lumiSection())});
0028 items.push_back({"crossingAngleX: ", std::to_string(payload->crossingAngleX())});
0029 items.push_back({"crossingAngleY: ", std::to_string(payload->crossingAngleY())});
0030 items.push_back({"betaStarX: ", std::to_string(payload->betaStarX())});
0031 items.push_back({"betaStarY: ", std::to_string(payload->betaStarY())});
0032 items.push_back({"runNumber: ", std::to_string(payload->runNumber())});
0033
0034
0035 TCanvas canvas("c", "c", 800, 600);
0036 canvas.cd();
0037 TLatex latex;
0038 latex.SetTextSize(0.03);
0039
0040 float startY = 0.95;
0041 float stepY = 0.06;
0042
0043
0044 latex.SetTextColor(kBlack);
0045 latex.DrawLatexNDC(0.05, startY, "LHCInfoPerLS Inspector");
0046
0047
0048 std::size_t offset = 2;
0049
0050
0051 for (std::size_t i = 0; i < items.size(); ++i) {
0052 float y = startY - (i + offset) * stepY;
0053 latex.SetTextColor(kBlack);
0054 latex.DrawLatexNDC(0.05, y, items[i].first.c_str());
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(LHCInfoPerLS) { PAYLOAD_INSPECTOR_CLASS(LHCInfoPerLS_Display); }