File indexing completed on 2024-04-06 12:01:30
0001
0002
0003
0004
0005
0006
0007 #ifndef CONDCORE_CTPPSPLUGINS_PPSALIGNMENTCONFIGURATIONHELPER_H
0008 #define CONDCORE_CTPPSPLUGINS_PPSALIGNMENTCONFIGURATIONHELPER_H
0009
0010
0011 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0012 #include "CondCore/Utilities/interface/PayloadInspectorModule.h"
0013 #include "CondCore/Utilities/interface/PayloadInspector.h"
0014 #include "CondCore/CondDB/interface/Time.h"
0015 #include "CondFormats/PPSObjects/interface/PPSAlignmentConfiguration.h"
0016
0017
0018 #include <memory>
0019 #include <sstream>
0020 #include <fstream>
0021
0022
0023 #include "TCanvas.h"
0024 #include "TStyle.h"
0025 #include "TH2F.h"
0026 #include "TLatex.h"
0027 #include "TGraph.h"
0028
0029 template <class PayloadType>
0030 class AlignmentPayloadInfo : public cond::payloadInspector::PlotImage<PayloadType, cond::payloadInspector::SINGLE_IOV> {
0031 public:
0032 AlignmentPayloadInfo()
0033 : cond::payloadInspector::PlotImage<PayloadType, cond::payloadInspector::SINGLE_IOV>(
0034 "PPSAlignmentConfiguration payload information") {}
0035
0036 bool fill() override {
0037 auto tag = cond::payloadInspector::PlotBase::getTag<0>();
0038 auto tagname = tag.name;
0039 auto iov = tag.iovs.back();
0040 auto m_payload = this->fetchPayload(std::get<1>(iov));
0041
0042 if (m_payload != nullptr) {
0043 std::string line;
0044 std::vector<std::string> lines;
0045 std::stringstream ss;
0046 ss << *m_payload;
0047 while (getline(ss, line)) {
0048 lines.push_back(line);
0049 }
0050
0051 TCanvas canvas(
0052 "PPSAlignmentConfiguration payload information", "PPSAlignmentConfiguration payload information", 1000, 1400);
0053 canvas.cd(1);
0054 TLatex t;
0055 t.SetTextSize(0.018);
0056
0057 int index = 0;
0058 for (float y = 0.98; index < int(lines.size()); y -= 0.02) {
0059 if (index < int(lines.size() / 2) + 3)
0060 t.DrawLatex(0.02, y, lines[index++].c_str());
0061 else if (index == int(lines.size() / 2) + 3) {
0062 y = 0.98;
0063 t.DrawLatex(0.5, y, lines[index++].c_str());
0064 } else
0065 t.DrawLatex(0.5, y, lines[index++].c_str());
0066 }
0067 t.Draw();
0068
0069 std::string fileName(this->m_imageFileName);
0070 canvas.SaveAs(fileName.c_str());
0071
0072 return true;
0073 } else {
0074 return false;
0075 }
0076 }
0077 };
0078
0079 #endif