34 #include "TPaveStats.h" 35 #include "TPaletteAxis.h" 44 class RunInfoTest :
public Histogram1D<RunInfo, SINGLE_IOV> {
48 bool fill()
override {
49 auto tag = PlotBase::getTag<0>();
50 for (
auto const& iov :
tag.iovs) {
51 std::shared_ptr<RunInfo>
payload = Base::fetchPayload(std::get<1>(iov));
63 class RunInfoParameters :
public PlotImage<RunInfo, SINGLE_IOV> {
67 bool fill()
override {
68 gStyle->SetPaintTextFormat(
"g");
69 auto tag = PlotBase::getTag<0>();
71 auto iov = iovs.front();
72 std::shared_ptr<RunInfo>
payload = fetchPayload(std::get<1>(iov));
74 TCanvas
canvas(
"RunInfo Parameters Summary",
"RunInfo Parameters summary", 1000, 1000);
77 gStyle->SetHistMinimumZero();
80 canvas.SetBottomMargin(0.06);
82 canvas.SetRightMargin(0.02);
86 auto h2_RunInfoParameters = std::make_unique<TH2F>(
"Parameters",
"", 1, 0.0, 1.0, 11, 0, 11.);
87 auto h2_RunInfoState = std::make_unique<TH2F>(
"State",
"", 1, 0.0, 1.0, 11, 0, 11.);
88 h2_RunInfoParameters->SetStats(
false);
89 h2_RunInfoState->SetStats(
false);
101 return payload->m_start_current;
103 return payload->m_stop_current;
123 h2_RunInfoParameters->GetXaxis()->SetBinLabel(1,
"Value");
124 h2_RunInfoState->GetXaxis()->SetBinLabel(1,
"Value");
128 unsigned int yBin = 11;
132 h2_RunInfoState->GetYaxis()->SetBinLabel(
yBin, theLabel.c_str());
133 h2_RunInfoParameters->GetYaxis()->SetBinLabel(
yBin, theLabel.c_str());
134 h2_RunInfoParameters->SetBinContent(1,
yBin, cutFunctor(param));
137 if ((
payload->m_avg_current) <= -1) {
139 h2_RunInfoState->SetBinContent(1,
yBin, 0.);
143 h2_RunInfoState->SetBinContent(1,
yBin, 1.);
148 h2_RunInfoState->SetBinContent(1,
yBin, 0.9);
154 h2_RunInfoParameters->GetXaxis()->LabelsOption(
"h");
155 h2_RunInfoParameters->GetYaxis()->SetLabelSize(0.05);
156 h2_RunInfoParameters->GetXaxis()->SetLabelSize(0.05);
157 h2_RunInfoParameters->SetMarkerSize(1.5);
159 h2_RunInfoState->GetXaxis()->LabelsOption(
"h");
160 h2_RunInfoState->GetYaxis()->SetLabelSize(0.05);
161 h2_RunInfoState->GetXaxis()->SetLabelSize(0.05);
162 h2_RunInfoState->SetMarkerSize(1.5);
165 h2_RunInfoState->Draw(
"col");
167 h2_RunInfoParameters->Draw(
"TEXTsame");
172 t1.SetTextSize(0.03);
173 t1.DrawLatex(0.1, 0.98,
"RunInfo parameters:");
174 t1.DrawLatex(0.1, 0.95,
"payload:");
175 t1.DrawLatex(0.1, 0.92,
"start time:");
176 t1.DrawLatex(0.1, 0.89,
"end time:");
180 t1.DrawLatex(0.37, 0.982, Form(
"IOV %s",
std::to_string(+std::get<0>(iov)).c_str()));
181 t1.DrawLatex(0.21, 0.952, Form(
" %s", (std::get<1>(iov)).c_str()));
185 TPaveText ksPt(0, 0, 0.35, 0.04,
"NDC");
186 ksPt.SetBorderSize(0);
187 ksPt.SetFillColor(0);
188 const char* textToAdd;
191 textToAdd =
"This is a fake RunInfoPayload";
194 textToAdd =
"This is a valid RunInfoPayload";
197 textToAdd =
"This is an invalid RunInfoPayload";
200 throw cms::Exception(
"PayloadInspector") <<
"an invalid state has been found";
203 ksPt.AddText(textToAdd);
216 template <RunInfoPI::parameters param>
217 class RunInfoCurrentHistory :
public HistoryPlot<RunInfo, std::pair<bool, float> > {
219 RunInfoCurrentHistory()
222 ~RunInfoCurrentHistory()
override =
default;
224 std::pair<bool, float> getFromPayload(
RunInfo&
payload)
override {
225 bool isRealRun = ((
payload.m_run) != -1);
229 return std::make_pair(isRealRun,
payload.m_start_current);
231 return std::make_pair(isRealRun,
payload.m_stop_current);
233 return std::make_pair(isRealRun,
payload.m_avg_current);
235 return std::make_pair(isRealRun,
payload.m_max_current);
237 return std::make_pair(isRealRun,
payload.m_min_current);
244 return std::make_pair(isRealRun, -1.0);
251 return "Magent start current [A]";
253 return "Magnet stop current [A]";
255 return "Magnet average current [A]";
257 return "Magnet max current [A]";
259 return "Magnet min current [A]";
261 return "B-field intensity [T]";
263 return "should never be here";
268 typedef RunInfoCurrentHistory<RunInfoPI::m_start_current> RunInfoStartCurrentHistory;
269 typedef RunInfoCurrentHistory<RunInfoPI::m_stop_current> RunInfoStopCurrentHistory;
270 typedef RunInfoCurrentHistory<RunInfoPI::m_avg_current> RunInfoAverageCurrentHistory;
271 typedef RunInfoCurrentHistory<RunInfoPI::m_max_current> RunInfoMaxCurrentHistory;
272 typedef RunInfoCurrentHistory<RunInfoPI::m_min_current> RunInfoMinCurrentHistory;
273 typedef RunInfoCurrentHistory<RunInfoPI::m_BField> RunInfoBFieldHistory;
278 template <RunInfoPI::DET theDet>
279 class RunInfoDetHistory :
public HistoryPlot<RunInfo, std::pair<bool, float> > {
282 ~RunInfoDetHistory()
override =
default;
284 std::pair<bool, float> getFromPayload(
RunInfo&
payload)
override {
285 bool isRealRun = ((
payload.m_run) != -1);
286 float returnValue = 0.;
289 return std::make_pair(isRealRun, returnValue);
293 const auto limits = fedBounds.at(theDet);
294 const auto& FEDsIn =
payload.m_fed_in;
295 for (
const auto& FED : FEDsIn) {
301 return std::make_pair(isRealRun, returnValue);
305 using RunInfoTrackerHistory = RunInfoDetHistory<RunInfoPI::SISTRIP>;
306 using RunInfoSiPixelHistory = RunInfoDetHistory<RunInfoPI::SIPIXEL>;
307 using RunInfoSiPixelPhase1History = RunInfoDetHistory<RunInfoPI::SIPIXELPHASE1>;
FEDMAP_T buildFEDBounds()
ret
prodAgent to be discontinued
void reportSummaryMapPalette(TH2 *obj)
const std::string getStringFromTypeEnum(const types &type)
float runDuration(const std::shared_ptr< RunInfo > &payload)
std::string runEndTime(const std::shared_ptr< RunInfo > &payload)
static std::string to_string(const XMLCh *ch)
#define PAYLOAD_INSPECTOR_CLASS(CLASS_NAME)
std::string getStringFromTypeEnum(const parameters ¶meter)
#define PAYLOAD_INSPECTOR_MODULE(PAYLOAD_TYPENAME)
float theBField(const float current)
Log< level::Warning, false > LogWarning
std::string runStartTime(const std::shared_ptr< RunInfo > &payload)