Skip to content

Commit 9e21d74

Browse files
authored
Merge pull request #45438 from yuanchao/from-CMSSW_14_1_0_pre3
Payload Inspector for L1TMuonGlobalParam on InputBits
2 parents c93f251 + 410c1af commit 9e21d74

File tree

1 file changed

+115
-0
lines changed

1 file changed

+115
-0
lines changed
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
/*!
2+
\file L1TMuonGlobalParams_PayloadInspector
3+
\Payload Inspector Plugin for L1TMuonGlobalParams payloads
4+
\author Y. Chao
5+
\version $Revision: 1.0 $
6+
\date $Date: 2024/05/15 12:00:00 $
7+
*/
8+
9+
#include "FWCore/MessageLogger/interface/MessageLogger.h"
10+
11+
#include "CondCore/Utilities/interface/PayloadInspectorModule.h"
12+
#include "CondCore/Utilities/interface/PayloadInspector.h"
13+
#include "CondCore/CondDB/interface/Time.h"
14+
15+
// the data format of the condition to be inspected
16+
#include "CondFormats/L1TObjects/interface/L1TMuonGlobalParams.h"
17+
18+
#include "L1Trigger/L1TMuon/interface/L1TMuonGlobalParamsHelper.h"
19+
#include "L1Trigger/L1TMuon/interface/L1TMuonGlobalParams_PUBLIC.h"
20+
21+
#include <bitset>
22+
23+
// include ROOT
24+
#include "TH1F.h"
25+
#include "TLine.h"
26+
#include "TLegend.h"
27+
#include "TCanvas.h"
28+
#include "TLatex.h"
29+
30+
namespace {
31+
32+
using namespace cond::payloadInspector;
33+
34+
class L1TMuonGlobalParamsInputBits : public PlotImage<L1TMuonGlobalParams, SINGLE_IOV> {
35+
public:
36+
L1TMuonGlobalParamsInputBits() : PlotImage<L1TMuonGlobalParams, SINGLE_IOV>("L1TMuonGlobalParams plot") {}
37+
38+
bool fill() override {
39+
auto tag = PlotBase::getTag<0>();
40+
auto iov = tag.iovs.front();
41+
42+
std::string IOVsince = std::to_string(std::get<0>(iov));
43+
std::shared_ptr<L1TMuonGlobalParams> payload = fetchPayload(std::get<1>(iov));
44+
if (payload.get()) {
45+
/// Create a canvas
46+
edm::LogInfo("L1TMG") << "absIsoCheckMemLUTPath: " << payload->absIsoCheckMemLUTPath();
47+
TCanvas canvas("L1TMuonGlobal", "L1TMuonGlobal", 800, 600);
48+
49+
L1TMuonGlobalParams l1tmg = (L1TMuonGlobalParams)*payload;
50+
L1TMuonGlobalParamsHelper l1tmgph(l1tmg);
51+
52+
canvas.cd();
53+
canvas.Update();
54+
55+
TLatex tl;
56+
// Draw the columns titles
57+
tl.SetTextAlign(12);
58+
tl.SetTextSize(0.03);
59+
60+
TH1F input1("InputsToDisable", "", 72, 0, 72);
61+
TH1F input2("MaskedInputs", "", 72, 0, 72);
62+
63+
TLegend leg(0.60, 0.65, 0.85, 0.85);
64+
65+
TLine lzero(0.0, 2.0, 72., 2.0);
66+
lzero.SetLineWidth(1);
67+
lzero.SetLineColor(1);
68+
lzero.SetLineStyle(2);
69+
70+
leg.AddEntry(&input2, "MaskedInputs", "l");
71+
leg.AddEntry(&input1, "InputsToDisable", "l");
72+
leg.SetLineColor(0);
73+
leg.SetFillColor(0);
74+
75+
input1.SetStats(0);
76+
input1.SetMaximum(5);
77+
input1.SetXTitle("InputBits");
78+
input1.SetYTitle("Bit value");
79+
input1.SetLabelOffset(0.9, "Y");
80+
input1.SetLineWidth(3);
81+
input1.SetLineColor(9);
82+
input2.SetLineWidth(3);
83+
input1.SetLineColor(8);
84+
85+
for (size_t idx = 1; idx <= 72; idx++) {
86+
input1.SetBinContent(idx, l1tmgph.inputsToDisable()[idx] + 0.01);
87+
input2.SetBinContent(idx, l1tmgph.maskedInputs()[idx] + 2.01);
88+
}
89+
90+
canvas.cd();
91+
input1.Draw("");
92+
input2.Draw("same");
93+
leg.Draw();
94+
lzero.Draw();
95+
96+
tl.DrawLatexNDC(
97+
0.12,
98+
0.85,
99+
(fmt::v8::format(
100+
"fwVersion: {}, bx Min, Max: {}, {}", l1tmgph.fwVersion(), payload->bxMin(), payload->bxMax()))
101+
.c_str());
102+
tl.DrawLatexNDC(0.1, 0.92, (fmt::v8::format("{}, iov: {}", tag.name, IOVsince)).c_str());
103+
tl.DrawLatexNDC(0.07, 0.59, "1");
104+
tl.DrawLatexNDC(0.07, 0.27, "1");
105+
106+
std::string fileName(m_imageFileName);
107+
canvas.SaveAs(fileName.c_str());
108+
} // payload
109+
return true;
110+
} // fill
111+
};
112+
113+
} // namespace
114+
115+
PAYLOAD_INSPECTOR_MODULE(L1TMuonGlobalParams) { PAYLOAD_INSPECTOR_CLASS(L1TMuonGlobalParamsInputBits); }

0 commit comments

Comments
 (0)