Skip to content

Commit bf5a1ba

Browse files
committed
Add stub of LHCInfoPer* payload inspector
1 parent 0a96de9 commit bf5a1ba

File tree

3 files changed

+110
-0
lines changed

3 files changed

+110
-0
lines changed

CondCore/RunInfoPlugins/plugins/BuildFile.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,14 @@
33
<use name="CondCore/Utilities"/>
44
<use name="CondCore/CondDB"/>
55
</library>
6+
7+
<library file="LHCInfoPerFill_PayloadInspector.cc" name="LHCInfoPerFill_PayloadInspector">
8+
<use name="CondCore/Utilities"/>
9+
<use name="CondCore/CondDB"/>
10+
</library>
11+
12+
<library file="LHCInfoPerLS_PayloadInspector.cc" name="LHCInfoPerLS_PayloadInspector">
13+
<use name="CondCore/Utilities"/>
14+
<use name="CondCore/CondDB"/>
15+
</library>
16+
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#include "CondCore/Utilities/interface/PayloadInspectorModule.h"
2+
#include "CondCore/Utilities/interface/PayloadInspector.h"
3+
#include "CondFormats/RunInfo/interface/LHCInfoPerFill.h"
4+
#include "FWCore/MessageLogger/interface/MessageLogger.h"
5+
6+
#include <sstream>
7+
#include <memory>
8+
#include "TLatex.h"
9+
#include "TCanvas.h"
10+
11+
namespace {
12+
13+
class LHCInfoPerFill_Display : public cond::payloadInspector::PlotImage<LHCInfoPerFill> {
14+
public:
15+
LHCInfoPerFill_Display()
16+
: cond::payloadInspector::PlotImage<LHCInfoPerFill>("LHCInfoPerFill Inspector - Display") {}
17+
18+
bool fill() override {
19+
auto tag = PlotBase::getTag<0>();
20+
auto iov = tag.iovs.front();
21+
std::shared_ptr<LHCInfoPerFill> payload = fetchPayload(std::get<1>(iov));
22+
if (!payload) {
23+
return false;
24+
}
25+
std::ostringstream ss;
26+
ss << "LHCInfoPerFill Inspector\n\n";
27+
ss << "Fill Number: " << payload->fillNumber() << "\n";
28+
ss << "Beam Energy: " << payload->energy() << "\n";
29+
ss << "Deliv Lumi: " << payload->delivLumi() << "\n";
30+
ss << "Rec Lumi: " << payload->recLumi() << "\n";
31+
ss << "Inst Lumi: " << payload->instLumi() << "\n";
32+
ss << "Injection Scheme: " << payload->injectionScheme() << "\n";
33+
ss << "Colliding Bunches: " << payload->collidingBunches() << "\n";
34+
ss << "Target Bunches: " << payload->targetBunches() << "\n";
35+
// Add more fields as needed
36+
37+
std::string outText = ss.str();
38+
// Save as a simple image (text on white bg)
39+
TCanvas canvas("c", "c", 800, 600);
40+
TLatex latex;
41+
latex.SetTextSize(0.03);
42+
latex.DrawLatexNDC(0.05, 0.95, outText.c_str());
43+
std::string fileName = "LHCInfoPerFill.png";
44+
canvas.SaveAs(fileName.c_str());
45+
return true;
46+
}
47+
};
48+
49+
} // namespace
50+
51+
PAYLOAD_INSPECTOR_MODULE(LHCInfoPerFill) { PAYLOAD_INSPECTOR_CLASS(LHCInfoPerFill_Display); }
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#include "CondCore/Utilities/interface/PayloadInspectorModule.h"
2+
#include "CondCore/Utilities/interface/PayloadInspector.h"
3+
#include "CondFormats/RunInfo/interface/LHCInfoPerLS.h"
4+
#include "FWCore/MessageLogger/interface/MessageLogger.h"
5+
6+
#include <sstream>
7+
#include <memory>
8+
#include "TLatex.h"
9+
#include "TCanvas.h"
10+
11+
namespace {
12+
13+
class LHCInfoPerLS_Display : public cond::payloadInspector::PlotImage<LHCInfoPerLS> {
14+
public:
15+
LHCInfoPerLS_Display() : cond::payloadInspector::PlotImage<LHCInfoPerLS>("LHCInfoPerLS Inspector - Display") {}
16+
17+
bool fill() override {
18+
auto tag = PlotBase::getTag<0>();
19+
auto iov = tag.iovs.front();
20+
std::shared_ptr<LHCInfoPerLS> payload = fetchPayload(std::get<1>(iov));
21+
if (!payload) {
22+
return false;
23+
}
24+
std::ostringstream ss;
25+
ss << "LHCInfoPerLS Inspector\n\n";
26+
ss << "LS: " << payload->lumiSection() << "\n";
27+
ss << "crossingAngleX: " << payload->crossingAngleX() << "\n";
28+
ss << "crossingAngleY: " << payload->crossingAngleY() << "\n";
29+
ss << "betaStarX: " << payload->betaStarX() << "\n";
30+
ss << "betaStarY: " << payload->betaStarY() << "\n";
31+
ss << "runNumber: " << payload->runNumber() << "\n";
32+
// Add more fields as needed
33+
34+
std::string outText = ss.str();
35+
// Save as a simple image (text on white bg)
36+
TCanvas canvas("c", "c", 800, 600);
37+
TLatex latex;
38+
latex.SetTextSize(0.03);
39+
latex.DrawLatexNDC(0.05, 0.95, outText.c_str());
40+
std::string fileName = "LHCInfoPerLS.png";
41+
canvas.SaveAs(fileName.c_str());
42+
return true;
43+
}
44+
};
45+
46+
} // namespace
47+
48+
PAYLOAD_INSPECTOR_MODULE(LHCInfoPerLS) { PAYLOAD_INSPECTOR_CLASS(LHCInfoPerLS_Display); }

0 commit comments

Comments
 (0)