CbmRoot
Loading...
Searching...
No Matches
CbmStsUnpackMonitor.cxx
Go to the documentation of this file.
1/* Copyright (C) 2021 Goethe-University, Frankfurt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Pierre-Alain Loizeau, Pascal Raisig [committer], Dominik Smith */
4
6
7#include "MicrosliceDescriptor.hpp"
8#include "TCanvas.h"
9
10#include <FairRun.h>
11#include <FairRunOnline.h>
12#include <Logger.h>
13
14#include <RtypesCore.h>
15#include <TFile.h>
16#include <TH1.h>
17#include <TH2.h>
18#include <THttpServer.h>
19#include <TProfile.h>
20#include <TROOT.h>
21
22#include <cmath>
23#include <cstdint>
24#include <iomanip>
25#include <iostream>
26#include <memory>
27#include <string>
28#include <vector>
29
30CbmStsUnpackMonitor::CbmStsUnpackMonitor(/* args */) : vNbMessType(7, 0), fvpAllHistoPointers()
31{
32 // Miscroslice component properties histos
33 for (UInt_t component = 0; component < kiMaxNbFlibLinks; component++) {
34 fvhMsSize[component] = nullptr;
35 fvhMsSizeTime[component] = nullptr;
36 }
37}
38
40{
41 for (auto iter = fvpAllHistoPointers.begin(); iter != fvpAllHistoPointers.end();) {
42 if (iter->first != nullptr) {
43 delete iter->first;
44 }
45 iter = fvpAllHistoPointers.erase(iter);
46 }
47 for (auto iter = fvpAllCanvasPointers.begin(); iter != fvpAllCanvasPointers.end();) {
48 if (iter->first != nullptr) {
49 delete iter->first;
50 }
51 iter = fvpAllCanvasPointers.erase(iter);
52 }
53}
54
56{
57 TString sHistName{""};
58 TString title{""};
59 const UInt_t uNbAsics = pUnpackPar->GetNrOfAsics();
60 const UInt_t uNbFebs = pUnpackPar->GetNrOfFebs();
61 const UInt_t uNbAsicsPerFeb = pUnpackPar->GetNbAsicsPerFeb();
62 const UInt_t uNbChanPerFeb = pUnpackPar->GetNbChanPerFeb();
63
65 fvuNbRawTsFeb.resize(uNbFebs);
66 fvvuNbRawTsChan.resize(uNbFebs);
67 fvuNbDigisTsFeb.resize(uNbFebs);
68 fvvuNbDigisTsChan.resize(uNbFebs);
69 for (uint32_t uFebIdx = 0; uFebIdx < uNbFebs; ++uFebIdx) {
70 fvvuNbRawTsChan[uFebIdx].resize(uNbChanPerFeb, 0);
71 fvvuNbDigisTsChan[uFebIdx].resize(uNbChanPerFeb, 0);
72 }
73
75 fhDigisTimeInRun = new TH1I("hStsDigisTimeInRun", "Digis Nb vs Time in Run; Time in run [s]; Digis Nb []", 10, 0, 1);
76 fhDigisTimeInRun->SetCanExtend(TH1::kAllAxes);
78
79 fhVectorSize = new TH1I("fhStsVectorSize", "Size of the vector VS TS index; TS index; Size [bytes]", 10, 0, 10);
80 fhVectorSize->SetCanExtend(TH1::kAllAxes);
82
84 new TH1I("fhStsVectorCapacity", "Size of the vector VS TS index; TS index; Size [bytes]", 10000, 0., 10000.);
86
87 fhMsCntEvo = new TH1I("fhStsMsCntEvo", "; MS index [s]; Counts []", 600, 0.0, 600.0);
89
91 new TH2I("fhStsMsErrorsEvo", "; MS index [s]; Error type []; Counts []", 600, 0.0, 600.0, 4, -0.5, 3.5);
93
95 sHistName = "hStsAllFebsHitRateEvo";
96 title = "Hits per second & FEB; Time [s]; FEB []; Hits []";
97 fhStsAllFebsHitRateEvo = new TH2I(sHistName, title, 600, 0, 600, uNbFebs, -0.5, uNbFebs - 0.5);
98 // fhStsAllFebsHitRateEvo->SetCanExtend(TH1::kAllAxes);
100
102 sHistName = "hStsAllAsicsHitRateEvo";
103 title = "Hits per second & ASIC; Time [s]; ASIC []; Hits []";
104 fhStsAllAsicsHitRateEvo = new TH2I(sHistName, title, 600, 0, 600, uNbAsics, -0.5, uNbAsics - 0.5);
105 // fhStsAllAsicsHitRateEvo->SetCanExtend(TH1::kAllAxes);
107
109 sHistName = "hStsFebAsicHitCounts";
110 title = "Hits per FEB & ASIC; FEB []; ASIC in FEB[]; Hits []";
112 new TH2I(sHistName, title, uNbFebs, -0.5, uNbFebs - 0.5, uNbAsicsPerFeb, -0.5, uNbAsicsPerFeb - 0.5);
114
115 sHistName = "hStsStatusMessType";
116 title = "Nb of status message of each type for each DPB; ASIC; Status Type";
117 fhStsStatusMessType = new TH2I(sHistName, title, uNbAsics, 0, uNbAsics, 16, 0., 16.);
119
121 sHistName = "hStsRawHitRatioPerFeb";
122 title = "Proportion of digis over raw hits in each FEB; FEB []; digis/raw [Prct]";
123 fhRawHitRatioPerFeb = new TProfile(sHistName, title, uNbFebs, -0.5, uNbFebs - 0.5);
125
128 fuLongHistoBinNb = uAlignedLimit / fuLongHistoBinSizeSec;
129
133 for (UInt_t uFebIdx = 0; uFebIdx < uNbFebs; ++uFebIdx) {
135 sHistName = Form("hStsRawChRatio_%03d", uFebIdx);
136 title = Form("Proportion of raw hits in each channel of FEB %2d; Channel []; Share of FEB raw msg [Prct]", uFebIdx);
137 fvhRawChRatio.push_back(new TProfile(sHistName, title, uNbChanPerFeb, -0.5, uNbChanPerFeb - 0.5));
138 sHistName = Form("hStsHitChRatio_%03d", uFebIdx);
139 title = Form("Proportion of digis in each channel of FEB %2d; Channel []; Share of FEB digis [Prct]", uFebIdx);
140 fvhHitChRatio.push_back(new TProfile(sHistName, title, uNbChanPerFeb, -0.5, uNbChanPerFeb - 0.5));
141 sHistName = Form("hStsDupliChRatio_%03d", uFebIdx);
142 title =
143 Form("Proportion of duplicates in each channel of FEB %2d; Channel []; Share of FEB duplicates [Prct]", uFebIdx);
144 fvhDupliChRatio.push_back(new TProfile(sHistName, title, uNbChanPerFeb, -0.5, uNbChanPerFeb - 0.5));
145 sHistName = Form("hStsRawHitRatioPerCh_%03d", uFebIdx);
146 title = Form("Proportion of digis over raw hits in each channel of FEB %2d; Channel []; digis/raw [Prct]", uFebIdx);
147 fvhRawHitRatioPerCh.push_back(new TProfile(sHistName, title, uNbChanPerFeb, -0.5, uNbChanPerFeb - 0.5));
148 sHistName = Form("hStsRawDupliRatioPerCh_%03d", uFebIdx);
149 title =
150 Form("Proportion of duplicates over raw hits in each channel of FEB %2d; Channel []; dupli/raw [Prct]", uFebIdx);
151 fvhRawDupliRatioPerCh.push_back(new TProfile(sHistName, title, uNbChanPerFeb, -0.5, uNbChanPerFeb - 0.5));
152
154 sHistName = Form("hStsFebChanCntRaw_%03u", uFebIdx);
155 title = Form("Hits Count per channel, FEB #%03u; Channel; Hits []", uFebIdx);
156 fvhStsFebChanCntRaw.push_back(new TH1I(sHistName, title, uNbChanPerFeb, -0.5, uNbChanPerFeb - 0.5));
157
159 sHistName = Form("hStsFebChanAdcRaw_%03u", uFebIdx);
160 title = Form("Raw Adc distribution per channel, FEB #%03u; Channel []; Adc "
161 "[]; Hits []",
162 uFebIdx);
163 fvhStsFebChanAdcRaw.push_back(new TH2I(sHistName, title, uNbChanPerFeb, -0.5, uNbChanPerFeb - 0.5,
165
167 sHistName = Form("hStsFebChanAdcRawProfc_%03u", uFebIdx);
168 title = Form("Raw Adc prodile per channel, FEB #%03u; Channel []; Adc []", uFebIdx);
169 fvhStsFebChanAdcRawProf.push_back(new TProfile(sHistName, title, uNbChanPerFeb, -0.5, uNbChanPerFeb - 0.5));
170
172 sHistName = Form("hStsFebChanAdcCal_%03u", uFebIdx);
173 title = Form("Cal. Adc distribution per channel, FEB #%03u; Channel []; Adc [e-]; Hits []", uFebIdx);
174 fvhStsFebChanAdcCal.push_back(
175 new TH2I(sHistName, title, uNbChanPerFeb, -0.5, uNbChanPerFeb - 0.5, 50, 0., 100000.));
176
178 sHistName = Form("hStsFebChanAdcCalProfc_%03u", uFebIdx);
179 title = Form("Cal. Adc prodile per channel, FEB #%03u; Channel []; Adc [e-]", uFebIdx);
180 fvhStsFebChanAdcCalProf.push_back(new TProfile(sHistName, title, uNbChanPerFeb, -0.5, uNbChanPerFeb - 0.5));
181
183 sHistName = Form("hStsFebChanRawTs_%03u", uFebIdx);
184 title = Form("Raw Timestamp distribution per channel, FEB #%03u; Channel "
185 "[]; Ts []; Hits []",
186 uFebIdx);
187 fvhStsFebChanRawTs.push_back(new TH2I(sHistName, title, uNbChanPerFeb, -0.5, uNbChanPerFeb - 0.5,
189
191 sHistName = Form("hStsFebChanMissEvt_%03u", uFebIdx);
192 title = Form("Missed Event flags per channel, FEB #%03u; Channel []; Miss "
193 "Evt []; Hits []",
194 uFebIdx);
195 fvhStsFebChanMissEvt.push_back(new TH2I(sHistName, title, uNbChanPerFeb, -0.5, uNbChanPerFeb - 0.5, 2, -0.5, 1.5));
196
198 sHistName = Form("hStsFebChanMissEvtEvo_%03u", uFebIdx);
199 title = Form("Missed Evt flags per second & channel in FEB #%03u; Time "
200 "[s]; Channel []; Missed Evt flags []",
201 uFebIdx);
202 fvhStsFebChanMissEvtEvo.push_back(
203 new TH2I(sHistName, title, 600, 0, 600, uNbChanPerFeb, -0.5, uNbChanPerFeb - 0.5));
204 // fvhStsFebChanMissEvtEvo.back()->SetCanExtend(TH1::kAllAxes);
205
207 sHistName = Form("hStsFebAsicMissEvtEvo_%03u", uFebIdx);
208 title = Form("Missed Evt flags per second & StsXyter in FEB #%03u; Time "
209 "[s]; Asic []; Missed Evt flags []",
210 uFebIdx);
211 fvhStsFebAsicMissEvtEvo.push_back(
212 new TH2I(sHistName, title, 600, 0, 600, uNbAsicsPerFeb, -0.5, uNbAsicsPerFeb - 0.5));
213 // fvhStsFebAsicMissEvtEvo.back()->SetCanExtend(TH1::kAllAxes);
214
216 sHistName = Form("hStsFebMissEvtEvo_%03u", uFebIdx);
217 title = Form("Missed Evt flags per second & channel in FEB #%03u; Time "
218 "[s]; Missed Evt flags []",
219 uFebIdx);
220 fvhStsFebMissEvtEvo.push_back(new TH1I(sHistName, title, 600, 0, 600));
221 // fvhStsFebMissEvtEvo.back()->SetCanExtend(TH1::kAllAxes);
222
224 sHistName = Form("hStsFebChanRateEvo_%03u", uFebIdx);
225 title = Form("Hits per second & channel in FEB #%03u; Time [s]; Channel []; Hits []", uFebIdx);
226 fvhStsFebChanHitRateEvo.push_back(
227 new TH2I(sHistName, title, 600, 0, 600, uNbChanPerFeb, -0.5, uNbChanPerFeb - 0.5));
228 // fvhStsFebChanHitRateEvo.back()->SetCanExtend(TH1::kAllAxes);
229
231 sHistName = Form("hStsFebAsicRateEvo_%03u", uFebIdx);
232 title = Form("Hits per second & StsXyter in FEB #%03u; Time [s]; Asic []; Hits []", uFebIdx);
233 fvhStsFebAsicHitRateEvo.push_back(
234 new TH2I(sHistName, title, 600, 0, 600, uNbAsicsPerFeb, -0.5, uNbAsicsPerFeb - 0.5));
235 // fvhStsFebAsicHitRateEvo.back()->SetCanExtend(TH1::kAllAxes);
236
238 sHistName = Form("hStsFebRateEvo_%03u", uFebIdx);
239 title = Form("Hits per second in FEB #%03u; Time [s]; Hits []", uFebIdx);
240 fvhStsFebHitRateEvo.push_back(new TH1I(sHistName, title, 600, 0, 600));
241 // fvhStsFebHitRateEvo.back()->SetCanExtend(TH1::kAllAxes);
242
244 sHistName = Form("hStsFebChanRateEvoLong_%03u", uFebIdx);
245 title = Form("Hits per second & channel in FEB #%03u; Time [min]; Channel []; Hits []", uFebIdx);
246 fvhStsFebChanHitRateEvoLong.push_back(new TH2D(sHistName, title, fuLongHistoBinNb, -0.5, uAlignedLimit - 0.5,
247 uNbChanPerFeb, -0.5, uNbChanPerFeb - 0.5));
248
250 sHistName = Form("hStsFebAsicRateEvoLong_%03u", uFebIdx);
251 title = Form("Hits per second & StsXyter in FEB #%03u; Time [min]; Asic []; Hits []", uFebIdx);
252 fvhStsFebAsicHitRateEvoLong.push_back(new TH2D(sHistName, title, fuLongHistoBinNb, -0.5, uAlignedLimit - 0.5,
253 uNbAsicsPerFeb, -0.5, uNbAsicsPerFeb - 0.5));
254
256 sHistName = Form("hStsFebRateEvoLong_%03u", uFebIdx);
257 title = Form("Hits per second in FEB #%03u; Time [min]; Hits []", uFebIdx);
258 fvhStsFebHitRateEvoLong.push_back(new TH1D(sHistName, title, fuLongHistoBinNb, -0.5, uAlignedLimit - 0.5));
259
260 AddHistoToVector(fvhRawChRatio[uFebIdx], "perFeb");
261 AddHistoToVector(fvhHitChRatio[uFebIdx], "perFeb");
262 AddHistoToVector(fvhDupliChRatio[uFebIdx], "perFeb");
263 AddHistoToVector(fvhRawHitRatioPerCh[uFebIdx], "perFeb");
264 AddHistoToVector(fvhRawDupliRatioPerCh[uFebIdx], "perFeb");
265 AddHistoToVector(fvhStsFebChanCntRaw[uFebIdx], "perFeb");
266 AddHistoToVector(fvhStsFebChanAdcRaw[uFebIdx], "perFeb");
267 AddHistoToVector(fvhStsFebChanAdcRawProf[uFebIdx], "perFeb");
268 AddHistoToVector(fvhStsFebChanAdcCal[uFebIdx], "perFeb");
269 AddHistoToVector(fvhStsFebChanAdcCalProf[uFebIdx], "perFeb");
270 AddHistoToVector(fvhStsFebChanRawTs[uFebIdx], "perFeb");
271 AddHistoToVector(fvhStsFebChanMissEvt[uFebIdx], "perFeb");
272 AddHistoToVector(fvhStsFebChanMissEvtEvo[uFebIdx], "perFeb");
273 AddHistoToVector(fvhStsFebAsicMissEvtEvo[uFebIdx], "perFeb");
274 AddHistoToVector(fvhStsFebMissEvtEvo[uFebIdx], "perFeb");
275 AddHistoToVector(fvhStsFebChanHitRateEvo[uFebIdx], "perFeb");
276 AddHistoToVector(fvhStsFebAsicHitRateEvo[uFebIdx], "perFeb");
277 AddHistoToVector(fvhStsFebHitRateEvo[uFebIdx], "perFeb");
280 AddHistoToVector(fvhStsFebHitRateEvoLong[uFebIdx], "perFeb");
281 }
282
284 const Double_t w = 2 * 400;
285 const Double_t h = 3 * 200;
286
287 // Create summary canvases per FEB
288 fvcStsSumm.resize(uNbFebs);
289 fvcStsSmxErr.resize(uNbFebs);
290 for (UInt_t uFebIdx = 0; uFebIdx < uNbFebs; ++uFebIdx) {
291 // if (kTRUE == fUnpackParSts->IsFebActive(uFebIdx)) {
292 fvcStsSumm[uFebIdx] = new TCanvas(Form("cStsSum_%03u", uFebIdx), Form("Summary plots for FEB %03u", uFebIdx), w, h);
293 AddCanvasToVector(fvcStsSumm[uFebIdx], "perFebCanvases");
294
295 fvcStsSumm[uFebIdx]->Divide(2, 3);
296 }
297 return kTRUE;
298}
299
301{
302 for (UInt_t uFebIdx = 0; uFebIdx < fvcStsSumm.size(); ++uFebIdx) {
303 // if (kTRUE == fUnpackParSts->IsFebActive(uFebIdx)) {
304 fvcStsSumm[uFebIdx]->cd(1);
305 gPad->SetGridx();
306 gPad->SetGridy();
307 gPad->SetLogy();
308 fvhStsFebChanCntRaw[uFebIdx]->Draw();
309
310 //fvcStsSumm[uFebIdx]->cd(2);
311 //gPad->SetGridx();
312 //gPad->SetGridy();
313 //gPad->SetLogy();
314 //fvhStsFebChanHitRateProf[uFebIdx]->Draw("e0");
315
316 fvcStsSumm[uFebIdx]->cd(3);
317 gPad->SetGridx();
318 gPad->SetGridy();
319 gPad->SetLogz();
320 fvhStsFebChanAdcRaw[uFebIdx]->Draw("colz");
321
322 fvcStsSumm[uFebIdx]->cd(4);
323 gPad->SetGridx();
324 gPad->SetGridy();
325 //gPad->SetLogy();
326 fvhStsFebChanAdcRawProf[uFebIdx]->Draw();
327
328 fvcStsSumm[uFebIdx]->cd(5);
329 gPad->SetGridx();
330 gPad->SetGridy();
331 gPad->SetLogz();
332 fvhStsFebChanHitRateEvo[uFebIdx]->Draw("colz");
333
334 fvcStsSumm[uFebIdx]->cd(6);
335 gPad->SetGridx();
336 gPad->SetGridy();
337 //gPad->SetLogy();
338 fvhStsFebChanMissEvt[uFebIdx]->Draw("colz");
339
340 // two following two are inactive as currently adc raw and cal are the same
341
342 //fvcStsSumm[ uFebIdx ]->cd(5);
343 //gPad->SetGridx();
344 //gPad->SetGridy();
345 //gPad->SetLogz();
346 //fvhStsFebChanAdcCal[ uFebIdx ]->Draw( "colz" );
347
348 //fvcStsSumm[ uFebIdx ]->cd(6);
349 //gPad->SetGridx();
350 //gPad->SetGridy();
351 //gPad->SetLogy();
352 //fvhStsFebChanAdcCalProf[ uFebIdx ]->Draw();
353 }
354}
355
357{
358 if (nullptr == fvhMsSize[component]) {
359 TString sMsSizeName = Form("StsMsSize_link_%02u", component);
360 TString sMsSizeTitle = Form("Size of MS for nDPB of link %02u; Ms Size [bytes]", component);
361 fvhMsSize[component] = new TH1F(sMsSizeName.Data(), sMsSizeTitle.Data(), 30000, 0., 30000.);
362 fvhMsSize[component]->SetCanExtend(TH2::kAllAxes);
363 AddHistoToVector(fvhMsSize[component], "perComponent");
364 }
365 if (nullptr == fvhMsSizeTime[component]) {
366 TString sMsSizeName = Form("StsMsSizeTime_link_%02u", component);
367 TString sMsSizeTitle = Form("Size of MS vs time for gDPB of link %02u; Time[s] ; Ms Size [bytes]", component);
368 fvhMsSizeTime[component] = new TProfile(sMsSizeName.Data(), sMsSizeTitle.Data(), 15000, 0., 300.);
369 fvhMsSizeTime[component]->SetCanExtend(TH2::kAllAxes);
370 AddHistoToVector(fvhMsSizeTime[component], "perComponent");
371 }
372 return kTRUE;
373}
374
376{
377 if (nullptr != fvhMsSize[component]) {
378 fvhMsSize[component]->Reset();
379 }
380 if (nullptr != fvhMsSizeTime[component]) {
381 fvhMsSizeTime[component]->Reset();
382 }
383 return kTRUE;
384}
385
387{
388 fhDigisTimeInRun->Reset();
389 fhVectorSize->Reset();
390 fhVectorCapacity->Reset();
391 fhMsCntEvo->Reset();
392 fhMsErrorsEvo->Reset();
393 fhStsAllFebsHitRateEvo->Reset();
395 fhStsFebAsicHitCounts->Reset();
396 fhStsStatusMessType->Reset();
397 fhRawHitRatioPerFeb->Reset();
398
399 for (UInt_t uFebIdx = 0; uFebIdx < fvhRawChRatio.size(); ++uFebIdx) {
400 fvhRawChRatio[uFebIdx]->Reset();
401 fvhHitChRatio[uFebIdx]->Reset();
402 fvhDupliChRatio[uFebIdx]->Reset();
403 fvhRawHitRatioPerCh[uFebIdx]->Reset();
404 fvhRawDupliRatioPerCh[uFebIdx]->Reset();
405 }
406 for (UInt_t uFebIdx = 0; uFebIdx < fvhStsFebChanCntRaw.size(); ++uFebIdx) {
407 fvhStsFebChanCntRaw[uFebIdx]->Reset();
408 }
409 for (UInt_t uFebIdx = 0; uFebIdx < fvhStsFebChanAdcRaw.size(); ++uFebIdx) {
410 fvhStsFebChanAdcRaw[uFebIdx]->Reset();
411 }
412 for (UInt_t uFebIdx = 0; uFebIdx < fvhStsFebChanAdcRawProf.size(); ++uFebIdx) {
413 fvhStsFebChanAdcRawProf[uFebIdx]->Reset();
414 }
415 for (UInt_t uFebIdx = 0; uFebIdx < fvhStsFebChanAdcCal.size(); ++uFebIdx) {
416 fvhStsFebChanAdcCal[uFebIdx]->Reset();
417 }
418 for (UInt_t uFebIdx = 0; uFebIdx < fvhStsFebChanAdcCalProf.size(); ++uFebIdx) {
419 fvhStsFebChanAdcCalProf[uFebIdx]->Reset();
420 }
421 for (UInt_t uFebIdx = 0; uFebIdx < fvhStsFebChanRawTs.size(); ++uFebIdx) {
422 fvhStsFebChanRawTs[uFebIdx]->Reset();
423 }
424 for (UInt_t uFebIdx = 0; uFebIdx < fvhStsFebChanMissEvt.size(); ++uFebIdx) {
425 fvhStsFebChanMissEvt[uFebIdx]->Reset();
426 }
427 for (UInt_t uFebIdx = 0; uFebIdx < fvhStsFebChanMissEvtEvo.size(); ++uFebIdx) {
428 fvhStsFebChanMissEvtEvo[uFebIdx]->Reset();
429 }
430 for (UInt_t uFebIdx = 0; uFebIdx < fvhStsFebAsicMissEvtEvo.size(); ++uFebIdx) {
431 fvhStsFebAsicMissEvtEvo[uFebIdx]->Reset();
432 }
433 for (UInt_t uFebIdx = 0; uFebIdx < fvhStsFebMissEvtEvo.size(); ++uFebIdx) {
434 fvhStsFebMissEvtEvo[uFebIdx]->Reset();
435 }
436 for (UInt_t uFebIdx = 0; uFebIdx < fvhStsFebChanHitRateEvo.size(); ++uFebIdx) {
437 fvhStsFebChanHitRateEvo[uFebIdx]->Reset();
438 }
439 for (UInt_t uFebIdx = 0; uFebIdx < fvhStsFebAsicHitRateEvo.size(); ++uFebIdx) {
440 fvhStsFebAsicHitRateEvo[uFebIdx]->Reset();
441 }
442 for (UInt_t uFebIdx = 0; uFebIdx < fvhStsFebHitRateEvo.size(); ++uFebIdx) {
443 fvhStsFebHitRateEvo[uFebIdx]->Reset();
444 }
445 for (UInt_t uFebIdx = 0; uFebIdx < fvhStsFebChanHitRateEvoLong.size(); ++uFebIdx) {
446 fvhStsFebChanHitRateEvoLong[uFebIdx]->Reset();
447 }
448 for (UInt_t uFebIdx = 0; uFebIdx < fvhStsFebAsicHitRateEvoLong.size(); ++uFebIdx) {
449 fvhStsFebAsicHitRateEvoLong[uFebIdx]->Reset();
450 }
451 for (UInt_t uFebIdx = 0; uFebIdx < fvhStsFebHitRateEvoLong.size(); ++uFebIdx) {
452 fvhStsFebHitRateEvoLong[uFebIdx]->Reset();
453 }
454 return kTRUE;
455}
456
458{
459 const UInt_t uNbAsics = pUnpackPar->GetNrOfAsics();
460 const UInt_t uNrOfDpbs = pUnpackPar->GetNrOfDpbs();
461 const UInt_t uNbChanPerAsic = pUnpackPar->GetNbChanPerAsic();
462 const UInt_t uNbFebs = pUnpackPar->GetNrOfFebs();
463 const UInt_t uNbChanPerFeb = pUnpackPar->GetNbChanPerFeb();
464 TString sHistName{""};
465 TString title{""};
466
467 sHistName = "hStsPulserMessageType";
468 title = "Nb of message for each type; Type";
469 fhStsMessType = new TH1I(sHistName, title, 6, 0., 6.);
470 fhStsMessType->GetXaxis()->SetBinLabel(1, "Dummy");
471 fhStsMessType->GetXaxis()->SetBinLabel(2, "Hit");
472 fhStsMessType->GetXaxis()->SetBinLabel(3, "TsMsb");
473 fhStsMessType->GetXaxis()->SetBinLabel(4, "Epoch");
474 fhStsMessType->GetXaxis()->SetBinLabel(5, "Status");
475 fhStsMessType->GetXaxis()->SetBinLabel(6, "Empty");
477
478 sHistName = "hStsPulserMessageTypePerDpb";
479 title = "Nb of message of each type for each DPB; DPB; Type";
480 fhStsMessTypePerDpb = new TH2I(sHistName, title, uNrOfDpbs, 0, uNrOfDpbs, 6, 0., 6.);
481 fhStsMessTypePerDpb->GetYaxis()->SetBinLabel(1, "Dummy");
482 fhStsMessTypePerDpb->GetYaxis()->SetBinLabel(2, "Hit");
483 fhStsMessTypePerDpb->GetYaxis()->SetBinLabel(3, "TsMsb");
484 fhStsMessTypePerDpb->GetYaxis()->SetBinLabel(4, "Epoch");
485 fhStsMessTypePerDpb->GetYaxis()->SetBinLabel(5, "Status");
486 fhStsMessTypePerDpb->GetYaxis()->SetBinLabel(6, "Empty");
488
489 sHistName = "hStsMessTypePerElink";
490 title = "Nb of message of each type for each DPB; DPB; Type";
492 new TH2I(sHistName, title, uNrOfDpbs * fNrElinksPerDpb, 0, uNrOfDpbs * fNrElinksPerDpb, 6, 0., 6.);
493 fhStsMessTypePerElink->GetYaxis()->SetBinLabel(1, "Dummy");
494 fhStsMessTypePerElink->GetYaxis()->SetBinLabel(2, "Hit");
495 fhStsMessTypePerElink->GetYaxis()->SetBinLabel(3, "TsMsb");
496 fhStsMessTypePerElink->GetYaxis()->SetBinLabel(4, "Epoch");
497 fhStsMessTypePerElink->GetYaxis()->SetBinLabel(5, "Status");
498 fhStsMessTypePerElink->GetYaxis()->SetBinLabel(6, "Empty");
500
501 sHistName = "hStsHitsElinkPerDpb";
502 title = "Nb of hit messages per eLink for each DPB; DPB; eLink; Hits nb []";
503 fhStsHitsElinkPerDpb = new TH2I(sHistName, title, uNrOfDpbs, 0, uNrOfDpbs, 42, 0., 42.);
505
506 sHistName = "hStsDpbRawTsMsb";
507 title = "MSB messages for each DPB; DPB; TsMsb; Count []";
508 fhStsDpbRawTsMsb = new TH2I(sHistName, title, uNrOfDpbs, 0, uNrOfDpbs, 10, 0, 10);
509 fhStsDpbRawTsMsb->SetCanExtend(TH2::kAllAxes);
511
512 sHistName = "hStsDpbRawTsMsbSx";
513 title = "MSB SX messages for each DPB; DPB; TsMsb & 0x1F; Count []";
514 fhStsDpbRawTsMsbSx = new TH2I(sHistName, title, uNrOfDpbs, 0, uNrOfDpbs, 10, 0, 10);
515 fhStsDpbRawTsMsbSx->SetCanExtend(TH2::kAllAxes);
517
518 sHistName = "hStsDpbRawTsMsbDpb";
519 title = "MSB DPB messages for each DPB; DPB; TsMsb >> 5; Count []";
520 fhStsDpbRawTsMsbDpb = new TH2I(sHistName, title, uNrOfDpbs, 0, uNrOfDpbs, 10, 0, 10);
521 fhStsDpbRawTsMsbDpb->SetCanExtend(TH2::kAllAxes);
523
525 sHistName = "hStsRawHitRatioEvoPerFeb";
526 title = "Proportion of digis over raw hits in each FEB; Time [s]; FEB []; digis/raw [Prct]";
527 fhRawHitRatioEvoPerFeb = new TProfile2D(sHistName, title, 600, -0.5, 599.5, uNbFebs, -0.5, uNbFebs - 0.5);
529 for (uint32_t uFebIdx = 0; uFebIdx < uNbFebs; ++uFebIdx) {
530 sHistName = Form("hStsChDupliAdc_%03d", uFebIdx);
531 title = Form("ADC in duplicate raw in each channel of FEB %2d; Channel []; ADC []", uFebIdx);
532 fvhChDupliAdc.push_back(new TH2I(sHistName, title, uNbChanPerFeb, -0.5, uNbChanPerFeb - 0.5, 32, -0.5, 31.5));
533
534 sHistName = Form("hStsRawChRatioEvo_%03d", uFebIdx);
535 title = Form("Proportion of raw hits in each channel of FEB %2d; Time [s]; Channel []; Share of FEB raw msg [Prct]",
536 uFebIdx);
537 fvhRawChRatioEvo.push_back(
538 new TProfile2D(sHistName, title, 600, -0.5, 599.5, uNbChanPerFeb, -0.5, uNbChanPerFeb - 0.5));
539 sHistName = Form("hStsHitChRatioEvo_%03d", uFebIdx);
540 title =
541 Form("Proportion of digis in each channel of FEB %2d; Time [s]; Channel []; Share of FEB digis [Prct]", uFebIdx);
542 fvhHitChRatioEvo.push_back(
543 new TProfile2D(sHistName, title, 600, -0.5, 599.5, uNbChanPerFeb, -0.5, uNbChanPerFeb - 0.5));
544 sHistName = Form("hStsDupliChRatioEvo_%03d", uFebIdx);
545 title =
546 Form("Proportion of duplicates in each channel of FEB %2d; Time [s]; Channel []; Share of FEB duplicates [Prct]",
547 uFebIdx);
548 fvhDupliChRatioEvo.push_back(
549 new TProfile2D(sHistName, title, 600, -0.5, 599.5, uNbChanPerFeb, -0.5, uNbChanPerFeb - 0.5));
550 sHistName = Form("hStsRawHitRatioEvoPerCh_%03d", uFebIdx);
551 title = Form("Proportion of digis over raw hits in each channel of FEB %2d; Time [s]; Channel []; digis/raw [Prct]",
552 uFebIdx);
553 fvhRawHitRatioEvoPerCh.push_back(
554 new TProfile2D(sHistName, title, 600, -0.5, 599.5, uNbChanPerFeb, -0.5, uNbChanPerFeb - 0.5));
555 sHistName = Form("hStsRawDupliRatioEvoPerCh_%03d", uFebIdx);
556 title =
557 Form("Proportion of duplicates over raw hits in each channel of FEB %2d; Time [s]; Channel []; dupli/raw [Prct]",
558 uFebIdx);
559 fvhRawDupliRatioEvoPerCh.push_back(
560 new TProfile2D(sHistName, title, 600, -0.5, 599.5, uNbChanPerFeb, -0.5, uNbChanPerFeb - 0.5));
561
562 AddHistoToVector(fvhChDupliAdc[uFebIdx], "perFeb");
563 AddHistoToVector(fvhRawChRatioEvo[uFebIdx], "perFeb");
564 AddHistoToVector(fvhHitChRatioEvo[uFebIdx], "perFeb");
565 AddHistoToVector(fvhDupliChRatioEvo[uFebIdx], "perFeb");
566 AddHistoToVector(fvhRawHitRatioEvoPerCh[uFebIdx], "perFeb");
567 AddHistoToVector(fvhRawDupliRatioEvoPerCh[uFebIdx], "perFeb");
568 }
569
572 for (UInt_t uAsicIdx = 0; uAsicIdx < uNbAsics; ++uAsicIdx) {
573
575 sHistName = Form("hStsChanCntRaw_%03u", uAsicIdx);
576 title = Form("Hits Count per channel, Asic #%03u; Channel; Hits []", uAsicIdx);
577 fvhStsChanCntRaw.push_back(new TH1I(sHistName, title, uNbChanPerAsic, -0.5, uNbChanPerAsic - 0.5));
578
580 sHistName = Form("hStsChanAdcRaw_%03u", uAsicIdx);
581 title = Form("Raw Adc distribution per channel, Asic #%03u; Channel []; Adc "
582 "[]; Hits []",
583 uAsicIdx);
584 fvhStsChanAdcRaw.push_back(new TH2I(sHistName, title, uNbChanPerAsic, -0.5, uNbChanPerAsic - 0.5,
586
588 sHistName = Form("hStsChanAdcRawProfc_%03u", uAsicIdx);
589 title = Form("Raw Adc prodile per channel, Asic #%03u; Channel []; Adc []", uAsicIdx);
590 fvhStsChanAdcRawProf.push_back(new TProfile(sHistName, title, uNbChanPerAsic, -0.5, uNbChanPerAsic - 0.5));
591
593 sHistName = Form("hStsChanRawTs_%03u", uAsicIdx);
594 title = Form("Raw Timestamp distribution per channel, Asic #%03u; Channel "
595 "[]; Ts []; Hits []",
596 uAsicIdx);
597 fvhStsChanRawTs.push_back(new TH2I(sHistName, title, uNbChanPerAsic, -0.5, uNbChanPerAsic - 0.5,
599
601 sHistName = Form("hStsChanMissEvt_%03u", uAsicIdx);
602 title = Form("Missed Event flags per channel, Asic #%03u; Channel []; Miss "
603 "Evt []; Hits []",
604 uAsicIdx);
605 fvhStsChanMissEvt.push_back(new TH2I(sHistName, title, uNbChanPerAsic, -0.5, uNbChanPerAsic - 0.5, 2, -0.5, 1.5));
606
607 AddHistoToVector(fvhStsChanCntRaw[uAsicIdx], "perAsic");
608 AddHistoToVector(fvhStsChanAdcRaw[uAsicIdx], "perAsic");
609 AddHistoToVector(fvhStsChanAdcRawProf[uAsicIdx], "perAsic");
610 AddHistoToVector(fvhStsChanRawTs[uAsicIdx], "perAsic");
611 AddHistoToVector(fvhStsChanMissEvt[uAsicIdx], "perAsic");
612 }
613 return kTRUE;
614}
615
617{
618 fhStsMessType->Reset();
619 fhStsMessTypePerDpb->Reset();
620 fhStsMessTypePerElink->Reset();
621 fhStsHitsElinkPerDpb->Reset();
622 fhStsDpbRawTsMsb->Reset();
623 fhStsDpbRawTsMsbSx->Reset();
624 fhStsDpbRawTsMsbDpb->Reset();
625 fhRawHitRatioEvoPerFeb->Reset();
626
627 for (UInt_t uFebIdx = 0; uFebIdx < fvhRawChRatioEvo.size(); ++uFebIdx) {
628 fvhChDupliAdc[uFebIdx]->Reset();
629 fvhRawChRatioEvo[uFebIdx]->Reset();
630 fvhHitChRatioEvo[uFebIdx]->Reset();
631 fvhDupliChRatioEvo[uFebIdx]->Reset();
632 fvhRawHitRatioEvoPerCh[uFebIdx]->Reset();
633 fvhRawDupliRatioEvoPerCh[uFebIdx]->Reset();
634 }
635
636 for (UInt_t uAsicIdx = 0; uAsicIdx < fvhStsChanCntRaw.size(); ++uAsicIdx) {
637 fvhStsChanCntRaw[uAsicIdx]->Reset();
638 }
639 for (UInt_t uAsicIdx = 0; uAsicIdx < fvhStsChanAdcRaw.size(); ++uAsicIdx) {
640 fvhStsChanAdcRaw[uAsicIdx]->Reset();
641 }
642 for (UInt_t uAsicIdx = 0; uAsicIdx < fvhStsChanAdcRawProf.size(); ++uAsicIdx) {
643 fvhStsChanAdcRawProf[uAsicIdx]->Reset();
644 }
645 for (UInt_t uAsicIdx = 0; uAsicIdx < fvhStsChanRawTs.size(); ++uAsicIdx) {
646 fvhStsChanRawTs[uAsicIdx]->Reset();
647 }
648 for (UInt_t uAsicIdx = 0; uAsicIdx < fvhStsChanMissEvt.size(); ++uAsicIdx) {
649 fvhStsChanMissEvt[uAsicIdx]->Reset();
650 }
651 return kTRUE;
652}
653// -------------------------------------------------------------------------
654
655
656// -------------------------------------------------------------------------
657void CbmStsUnpackMonitor::FillHitMonitoringHistos(const UInt_t& uFebIdx, const UShort_t& /*usChan*/,
658 const UInt_t& uChanInFeb, const UShort_t& usRawAdc,
659 const Double_t& dCalAdc, const UShort_t& usRawTs,
660 const bool& isHitMissedEvts)
661{
662 FillStsFebChanAdcCal(uFebIdx, uChanInFeb, dCalAdc);
663 FillStsFebChanAdcCalProf(uFebIdx, uChanInFeb, dCalAdc);
664 FillStsFebChanCntRaw(uFebIdx, uChanInFeb);
665 FillStsFebChanAdcRaw(uFebIdx, uChanInFeb, usRawAdc);
666 FillStsFebChanRawTs(uFebIdx, uChanInFeb, usRawTs);
667 FillStsFebChanMissEvt(uFebIdx, uChanInFeb, isHitMissedEvts);
668 FillStsFebChanAdcRawProf(uFebIdx, uChanInFeb, usRawAdc);
669}
670
671
672// -------------------------------------------------------------------------
673void CbmStsUnpackMonitor::FillHitDebugMonitoringHistos(const UInt_t& uAsicIdx, const UShort_t& usChan,
674 const UShort_t& usRawAdc, const UShort_t& usRawTs,
675 const bool& isHitMissedEvts)
676{
677 FillStsChanCntRaw(uAsicIdx, usChan);
678 FillStsChanAdcRaw(uAsicIdx, usChan, usRawAdc);
679 FillStsChanAdcRawProf(uAsicIdx, usChan, usRawAdc);
680 FillStsChanRawTs(uAsicIdx, usChan, usRawTs);
681 FillStsChanMissEvt(uAsicIdx, usChan, isHitMissedEvts);
682}
683
684
685// -------------------------------------------------------------------------
686void CbmStsUnpackMonitor::FillHitEvoMonitoringHistos(const UInt_t& uFebIdx, const UInt_t& uAsicIdx,
687 const UInt_t& uAsicInFeb, const UInt_t& uChanInFeb,
688 const Double_t& dAbsTimeSec, const bool& isHitMissedEvts)
689{
690 // Check Starting point of histos with time as X axis
691 if (-1 == fdStartTime) {
692 fdStartTime = dAbsTimeSec;
693 }
694
695 Double_t dTimeSinceStartSec = dAbsTimeSec - fdStartTime;
696
697 // Fill histos with time as X axis
698 FillStsFebAsicHitCounts(uFebIdx, uAsicInFeb);
699 FillStsFebChanHitRateEvo(uFebIdx, dTimeSinceStartSec, uChanInFeb);
700 FillStsFebAsicHitRateEvo(uFebIdx, dTimeSinceStartSec, uAsicInFeb);
701 FillStsFebHitRateEvo(uFebIdx, dTimeSinceStartSec);
702 FillStsAllFebsHitRateEvo(dTimeSinceStartSec, uFebIdx);
703 FillStsAllAsicsHitRateEvo(dTimeSinceStartSec, uAsicIdx);
704 if (isHitMissedEvts) {
705 FillStsFebChanMissEvtEvo(uFebIdx, dTimeSinceStartSec, uChanInFeb);
706 FillStsFebAsicMissEvtEvo(uFebIdx, dTimeSinceStartSec, uAsicInFeb);
707 FillStsFebMissEvtEvo(uFebIdx, dTimeSinceStartSec);
708 }
709 const Double_t dTimeSinceStartMin = dTimeSinceStartSec / 60.0;
710 FillStsFebHitRateEvoLong(uFebIdx, dTimeSinceStartMin);
711 FillStsFebChanHitRateEvoLong(uFebIdx, dTimeSinceStartMin, uChanInFeb);
712 FillStsFebAsicHitRateEvoLong(uFebIdx, dTimeSinceStartMin, uAsicInFeb);
713
714 // fviFebCountsSinceLastRateUpdate[uFebIdx]++;
715 // fvdFebChanCountsSinceLastRateUpdate[uFebIdx][uChanInFeb] += 1;
716 /*
717 if( kTRUE == fbLongHistoEnable )
718 {
719 std::chrono::steady_clock::time_point tNow = std::chrono::steady_clock::now();
720 Double_t dUnixTimeInRun = std::chrono::duration_cast< std::chrono::seconds >(tNow - ftStartTimeUnix).count();
721 fhFebRateEvoLong[ uAsicIdx ]->Fill( dUnixTimeInRun , 1.0 / fuLongHistoBinSizeSec );
722 fhFebChRateEvoLong[ uAsicIdx ]->Fill( dUnixTimeInRun , usChan, 1.0 / fuLongHistoBinSizeSec );
723 }
724*/
725}
726
727// -------------------------------------------------------------------------
729{
730 if (0 == dFirstTsStartTime) dFirstTsStartTime = dTsStartTimeS;
731 double_t dTimeInRun = dTsStartTimeS - dFirstTsStartTime;
732 double_t dRatio = 0;
733 uint32_t uNbFebs = fvuNbRawTsFeb.size();
734 uint32_t uNbChansPerFeb = (uNbFebs ? fvvuNbRawTsChan[0].size() : 0);
735 for (uint32_t uFebIdx = 0; uFebIdx < uNbFebs; ++uFebIdx) {
736 uint32_t uNbDupliFeb = fvuNbRawTsFeb[uFebIdx] - fvuNbDigisTsFeb[uFebIdx];
737 if (fvuNbRawTsFeb[uFebIdx]) {
738 dRatio = fvuNbDigisTsFeb[uFebIdx] * 100.0 / fvuNbRawTsFeb[uFebIdx];
739 fhRawHitRatioPerFeb->Fill(uFebIdx, dRatio);
740 if (fDebugMode) { //
741 fhRawHitRatioEvoPerFeb->Fill(dTimeInRun, uFebIdx, dRatio);
742 }
743 }
744
745 for (uint32_t uChan = 0; uChan < uNbChansPerFeb; ++uChan) {
746 uint32_t uNbDupliChan = fvvuNbRawTsChan[uFebIdx][uChan] - fvvuNbDigisTsChan[uFebIdx][uChan];
747 if (fvuNbRawTsFeb[uFebIdx]) {
748 dRatio = fvvuNbRawTsChan[uFebIdx][uChan] * 100.0 / fvuNbRawTsFeb[uFebIdx];
749 fvhRawChRatio[uFebIdx]->Fill(uChan, dRatio);
750 if (fDebugMode) { //
751 fvhRawChRatioEvo[uFebIdx]->Fill(dTimeInRun, uChan, dRatio);
752 }
753 }
754
755 if (fvuNbDigisTsFeb[uFebIdx]) {
756 dRatio = fvvuNbDigisTsChan[uFebIdx][uChan] * 100.0 / fvuNbDigisTsFeb[uFebIdx];
757 fvhHitChRatio[uFebIdx]->Fill(uChan, dRatio);
758 if (fDebugMode) { //
759 fvhHitChRatioEvo[uFebIdx]->Fill(dTimeInRun, uChan, dRatio);
760 }
761 }
762
763 if (uNbDupliFeb) {
764 dRatio = uNbDupliChan * 100.0 / uNbDupliFeb;
765 fvhDupliChRatio[uFebIdx]->Fill(uChan, dRatio);
766 if (fDebugMode) { //
767 fvhDupliChRatioEvo[uFebIdx]->Fill(dTimeInRun, uChan, dRatio);
768 }
769 }
770
771 if (fvvuNbRawTsChan[uFebIdx][uChan]) {
772 dRatio = fvvuNbDigisTsChan[uFebIdx][uChan] * 100.0 / fvvuNbRawTsChan[uFebIdx][uChan];
773 fvhRawHitRatioPerCh[uFebIdx]->Fill(uChan, dRatio);
774 if (fDebugMode) { //
775 fvhRawHitRatioEvoPerCh[uFebIdx]->Fill(dTimeInRun, uChan, dRatio);
776 }
777
778 dRatio = uNbDupliChan * 100.0 / fvvuNbRawTsChan[uFebIdx][uChan];
779 fvhRawDupliRatioPerCh[uFebIdx]->Fill(uChan, dRatio);
780 if (fDebugMode) { //
781 fvhRawDupliRatioEvoPerCh[uFebIdx]->Fill(dTimeInRun, uChan, dRatio);
782 }
783 }
784
785 fvvuNbRawTsChan[uFebIdx][uChan] = 0;
786 fvvuNbDigisTsChan[uFebIdx][uChan] = 0;
787 }
788 fvuNbRawTsFeb[uFebIdx] = 0;
789 fvuNbDigisTsFeb[uFebIdx] = 0;
790 }
791}
792
793// -------------------------------------------------------------------------
794void CbmStsUnpackMonitor::FillDuplicateHitsAdc(const uint32_t& uFebIdx, const uint32_t& uChanInFeb,
795 const uint16_t& usAdc)
796{
797 if (fDebugMode) { //
798 fvhChDupliAdc[uFebIdx]->Fill(uChanInFeb, usAdc);
799 }
800}
801// -------------------------------------------------------------------------
803{
804 std::fill(vNbMessType.begin(), vNbMessType.end(), 0);
805 sMessPatt = "";
806 bError = false;
807}
808
809// -------------------------------------------------------------------------
810void CbmStsUnpackMonitor::ProcessDebugInfo(const stsxyter::Message& Mess, const UInt_t& uCurrDpbIdx)
811{
812 const stsxyter::MessType typeMess = Mess.GetMessType();
813
814 FillStsMessType(static_cast<uint16_t>(typeMess));
815 FillStsMessTypePerDpb(uCurrDpbIdx, static_cast<uint16_t>(typeMess));
816 switch (typeMess) {
818 ++vNbMessType[0];
819 sMessPatt += " H ";
820 sMessPatt += ".";
821
822 const UShort_t usElinkIdx = Mess.GetLinkIndexHitBinning();
823 FillStsMessTypePerElink(usElinkIdx, static_cast<uint16_t>(typeMess));
824 FillStsHitsElinkPerDpb(uCurrDpbIdx, usElinkIdx);
825 break;
826 }
828 ++vNbMessType[1];
829 sMessPatt += " T ";
830 FillStsMessTypePerElink(uCurrDpbIdx * fNrElinksPerDpb, static_cast<uint16_t>(typeMess));
831 break;
832 }
834 ++vNbMessType[2];
835 sMessPatt += " E ";
836 FillStsMessTypePerElink(uCurrDpbIdx * fNrElinksPerDpb, static_cast<uint16_t>(typeMess));
837 break;
838 }
840 ++vNbMessType[3];
841 sMessPatt += " S ";
842 FillStsMessTypePerElink(Mess.GetLinkIndex(), static_cast<uint16_t>(typeMess));
843 break;
844 }
846 ++vNbMessType[4];
847 sMessPatt += " Em";
848 FillStsMessTypePerElink(uCurrDpbIdx * fNrElinksPerDpb, static_cast<uint16_t>(typeMess));
849 break;
850 }
852 ++vNbMessType[5];
853 sMessPatt += " En";
854 bError = Mess.IsMsErrorFlagOn();
855 FillStsMessTypePerElink(uCurrDpbIdx * fNrElinksPerDpb, static_cast<uint16_t>(typeMess));
856 break;
857 }
859 ++vNbMessType[6];
860 sMessPatt += " D ";
861 FillStsMessTypePerElink(uCurrDpbIdx * fNrElinksPerDpb, static_cast<uint16_t>(typeMess));
862 break;
863 }
864 default: {
865 }
866 }
867}
868
869// -------------------------------------------------------------------------
870void CbmStsUnpackMonitor::PrintDebugInfo(const uint64_t MsStartTime, const size_t NrProcessedTs,
871 const uint16_t msDescriptorFlags, const uint32_t uSize)
872{
873 if (18967040000 == MsStartTime || 18968320000 == MsStartTime) {
874 LOG(debug) << sMessPatt;
875 }
876 if (static_cast<uint16_t>(fles::MicrosliceFlags::CrcValid) != msDescriptorFlags) {
877 LOG(debug) << "STS unp "
878 << " TS " << std::setw(12) << NrProcessedTs << " MS " << std::setw(12) << MsStartTime << " MS flags 0x"
879 << std::setw(4) << std::hex << msDescriptorFlags << std::dec << " Size " << std::setw(8) << uSize
880 << " bytes "
881 << " H " << std::setw(5) << vNbMessType[0] << " T " << std::setw(5) << vNbMessType[1] << " E "
882 << std::setw(5) << vNbMessType[2] << " S " << std::setw(5) << vNbMessType[3] << " Em " << std::setw(5)
883 << vNbMessType[4] << " En " << std::setw(5) << vNbMessType[5] << " D " << std::setw(5) << vNbMessType[6]
884 << " Err " << bError << " Undet. bad " << (!bError && 400 != vNbMessType[1]);
885 }
886}
887
888// ---- Init ----
890{
891 // Get Infos from the parset
893
895 TFile* oldFile = gFile;
896 TDirectory* oldDir = gDirectory;
897 gROOT->cd();
898
900 CreateHistograms(parset);
902
904 DrawCanvases();
905
907 gFile = oldFile;
908 gDirectory = oldDir;
909
911 std::vector<std::pair<TNamed*, std::string>> vHistos = GetHistoVector();
912
914 std::vector<std::pair<TCanvas*, std::string>> vCanvases = GetCanvasVector();
915
917 THttpServer* server = FairRunOnline::Instance()->GetHttpServer();
918 if (nullptr != server) {
919 for (UInt_t uCanvas = 0; uCanvas < vCanvases.size(); ++uCanvas) {
920 server->Register(Form("/sts/%s", vCanvases[uCanvas].second.data()), vCanvases[uCanvas].first);
921 }
922 for (UInt_t uHisto = 0; uHisto < vHistos.size(); ++uHisto) {
923 server->Register(Form("/sts/%s", vHistos[uHisto].second.data()), vHistos[uHisto].first);
924 }
925 /*
926 server->RegisterCommand("/Reset_UnpSts_Hist", "bMcbm2018UnpackerTaskStsResetHistos=kTRUE");
927 server->Restrict("/Reset_UnpSts_Hist", "allow=admin");
928*/
929 }
930
931 return kTRUE;
932}
933
934// ---- Finish ----
936{
938 std::vector<std::pair<TNamed*, std::string>> vHistos = GetHistoVector();
939
941 std::vector<std::pair<TCanvas*, std::string>> vCanvases = GetCanvasVector();
942
944 TFile* oldFile = gFile;
945 TDirectory* oldDir = gDirectory;
946 TFile* histoFile = nullptr;
947
948 // open separate histo file in recreate mode
949 histoFile = new TFile(fHistoFileName, "RECREATE");
950 histoFile->cd();
951
953 for (UInt_t uHisto = 0; uHisto < vHistos.size(); ++uHisto) {
955 TString sFolder = vHistos[uHisto].second.data();
956 if (nullptr == gDirectory->Get(sFolder)) gDirectory->mkdir(sFolder);
957 gDirectory->cd(sFolder);
958
960 vHistos[uHisto].first->Write();
961
962 histoFile->cd();
963 }
964
966 for (UInt_t uCanvas = 0; uCanvas < vCanvases.size(); ++uCanvas) {
968 TString sFolder = vCanvases[uCanvas].second.data();
969 if (nullptr == gDirectory->Get(sFolder)) gDirectory->mkdir(sFolder);
970 gDirectory->cd(sFolder);
971
973 vCanvases[uCanvas].first->Write();
974
975 histoFile->cd();
976 }
977
979 gFile = oldFile;
980 gDirectory = oldDir;
981
982 histoFile->Close();
983 delete histoFile;
984}
985
986
ClassImp(CbmConverterManager)
static constexpr UInt_t GetNbAsicsPerFeb()
static constexpr UInt_t GetNbElinkPerDpb()
static constexpr UInt_t GetNbChanPerAsic()
static constexpr UInt_t GetNbChanPerFeb()
Data class with information on a STS local track.
void FillStsMessTypePerDpb(UInt_t DpbIdx, uint16_t typeMess)
void FillStsChanAdcRaw(UInt_t uAsicIdx, UShort_t usChan, UShort_t usRawAdc)
void PrintDebugInfo(const uint64_t MsStartTime, const size_t NrProcessedTs, const uint16_t msDescriptorFlags, const uint32_t uSize)
void FillHitEvoMonitoringHistos(const UInt_t &uFebIdx, const UInt_t &uAsicIdx, const UInt_t &uAsicInFeb, const UInt_t &uChanInFeb, const Double_t &dAbsTimeSec, const bool &isHitMissedEvts)
Bool_t CreateMsComponentSizeHistos(UInt_t component)
std::vector< TProfile2D * > fvhDupliChRatioEvo
void FillStsFebChanHitRateEvoLong(UInt_t uFebIdx, Double_t dTimeSinceStartMin, UInt_t uChanInFeb)
void FillStsAllAsicsHitRateEvo(Double_t dTimeSinceStartSec, UInt_t uAsicIdx)
std::vector< uint32_t > fvuNbRawTsFeb
Per timeslice counters to evaluate the eventual raw messages rejection per FEB.
std::vector< TH1 * > fvhStsFebHitRateEvoLong
std::vector< TProfile2D * > fvhRawChRatioEvo
TProfile2D * fhRawHitRatioEvoPerFeb
Bool_t CreateDebugHistograms(CbmMcbm2018StsPar *pUnpackPar)
void FillStsAllFebsHitRateEvo(Double_t dTimeSinceStartSec, UInt_t uFebIdx)
void FillStsHitsElinkPerDpb(UInt_t DpbIdx, UInt_t ElinkIdx)
void FillStsFebChanAdcRawProf(UInt_t uFebIdx, UInt_t uChanInFeb, UShort_t usRawAdc)
std::vector< TH1 * > fvhStsFebMissEvtEvo
std::vector< TProfile * > fvhRawDupliRatioPerCh
std::vector< TH2 * > fvhStsFebChanHitRateEvoLong
void FillStsFebChanCntRaw(UInt_t uFebIdx, UInt_t uChanInFeb)
Fill general "per Feb" histogram vectors.
void FillStsFebChanAdcCal(UInt_t uFebIdx, UInt_t uChanInFeb, Double_t dCalAdc)
TH1 * fhDigisTimeInRun
General histograms.
uint32_t fNrElinksPerDpb
Number of elinks per dpb, extracted from the parset.
std::vector< TProfile2D * > fvhRawHitRatioEvoPerCh
void AddHistoToVector(TNamed *pointer, std::string sFolder="")
void AddCanvasToVector(TCanvas *pointer, std::string sFolder="")
std::vector< TProfile * > fvhHitChRatio
void FillStsFebChanMissEvt(UInt_t uFebIdx, UInt_t uChan, bool missEvtFlag)
std::vector< uint32_t > fvuNbDigisTsFeb
void FillStsMessType(uint16_t typeMess)
Fill debugging histograms.
void FillStsFebAsicHitCounts(UInt_t uFebIdx, UInt_t uAsicInFeb)
std::vector< TH2 * > fvhStsChanAdcRaw
Bool_t ResetMsComponentSizeHistos(UInt_t component)
void FillStsFebAsicHitRateEvoLong(UInt_t uFebIdx, Double_t dTimeSinceStartMin, UInt_t uAsicInFeb)
static const UInt_t kiMaxNbFlibLinks
std::vector< TCanvas * > fvcStsSumm
Canvases.
std::vector< TProfile * > fvhStsFebChanAdcRawProf
std::vector< std::pair< TNamed *, std::string > > fvpAllHistoPointers
std::vector< TH2 * > fvhStsFebChanRawTs
std::vector< TProfile * > fvhDupliChRatio
std::vector< uint32_t > vNbMessType
void FillStsFebMissEvtEvo(UInt_t uFebIdx, Double_t dTimeSinceStartSec)
std::vector< TH2 * > fvhStsFebChanMissEvtEvo
std::vector< TH1 * > fvhStsFebChanCntRaw
void FillStsChanMissEvt(UInt_t uAsicIdx, UShort_t usChan, bool missedEvtFlag)
std::vector< TH2 * > fvhStsFebChanMissEvt
std::vector< std::pair< TCanvas *, std::string > > GetCanvasVector()
void ProcessDebugInfo(const stsxyter::Message &Mess, const UInt_t &uCurrDpbIdx)
TProfile * fvhMsSizeTime[kiMaxNbFlibLinks]
std::vector< TProfile * > fvhStsFebChanAdcCalProf
std::vector< TProfile * > fvhStsChanAdcRawProf
std::vector< TH2 * > fvhStsFebChanHitRateEvo
void FillPerTimesliceCountersHistos(double_t dTsStartTime)
void FillStsFebChanRawTs(UInt_t uFebIdx, UInt_t uChan, UShort_t usRawTs)
void FillStsFebHitRateEvoLong(UInt_t uFebIdx, Double_t dTimeSinceStartMin)
std::vector< TH2 * > fvhStsFebAsicHitRateEvoLong
void FillStsChanCntRaw(UInt_t uAsicIdx, UShort_t usChan)
Fill debugging "per Asic" histogram vectors.
std::vector< TH2 * > fvhChDupliAdc
std::vector< TH2 * > fvhStsChanMissEvt
void FillStsFebAsicMissEvtEvo(UInt_t uFebIdx, Double_t dTimeSinceStartSec, UInt_t uAsicInFeb)
void Finish()
Write all histograms and canvases to file.
void FillStsFebHitRateEvo(UInt_t uFebIdx, Double_t dTimeSinceStartSec)
void FillStsFebChanAdcCalProf(UInt_t uFebIdx, UInt_t uChanInFeb, Double_t dCalAdc)
void FillStsMessTypePerElink(UInt_t ElinkIdx, uint16_t typeMess)
double_t dFirstTsStartTime
Rate evolution histos.
std::vector< std::pair< TCanvas *, std::string > > fvpAllCanvasPointers
Vector of pointers to histograms + optional folder name.
void FillStsFebChanMissEvtEvo(UInt_t uFebIdx, Double_t dTimeSinceStartSec, UInt_t uChanInFeb)
std::vector< TProfile * > fvhRawChRatio
General "per Feb" histogram vectors.
std::vector< TH2 * > fvhStsFebAsicHitRateEvo
std::vector< TH2 * > fvhStsFebChanAdcRaw
void FillStsChanRawTs(UInt_t uAsicIdx, UShort_t usChan, UShort_t usRawTs)
std::vector< TProfile2D * > fvhRawDupliRatioEvoPerCh
void FillDuplicateHitsAdc(const uint32_t &uFebIdx, const uint32_t &uChanInFeb, const uint16_t &usAdc)
void FillStsChanAdcRawProf(UInt_t uAsicIdx, UShort_t usChan, UShort_t usRawAdc)
std::vector< std::vector< uint32_t > > fvvuNbDigisTsChan
Bool_t Init(CbmMcbm2018StsPar *digiParSet)
Init all required parameter informations and histograms.
Bool_t CreateHistograms(CbmMcbm2018StsPar *pUnpackPar)
std::vector< std::vector< uint32_t > > fvvuNbRawTsChan
Per timeslice counters to evaluate the eventual raw messages rejection per [FEB, chan] pairs.
std::vector< TH2 * > fvhStsFebChanAdcCal
std::vector< std::pair< TNamed *, std::string > > GetHistoVector()
void FillStsFebChanHitRateEvo(UInt_t uFebIdx, Double_t dTimeSinceStartSec, UInt_t uChanInFeb)
void FillHitMonitoringHistos(const UInt_t &uFebIdx, const UShort_t &usChan, const UInt_t &uChanInFeb, const UShort_t &usRawAdc, const Double_t &dCalAdc, const UShort_t &usRawTs, const bool &isHitMissedEvts)
void FillStsFebAsicHitRateEvo(UInt_t uFebIdx, Double_t dTimeSinceStartSec, UInt_t uAsicInFeb)
void FillHitDebugMonitoringHistos(const UInt_t &uAsicIdx, const UShort_t &usChan, const UShort_t &usRawAdc, const UShort_t &usRawTs, const bool &isHitMissedEvts)
std::vector< TH2 * > fvhStsFebAsicMissEvtEvo
TH1 * fvhMsSize[kiMaxNbFlibLinks]
bool fDebugMode
Flag if debug mode is active or not.
TH1 * fhStsMessType
Debugging histograms.
std::vector< TH1 * > fvhStsChanCntRaw
Debugging "per Asic" histogram vectors.
std::vector< TH1 * > fvhStsFebHitRateEvo
std::vector< TProfile * > fvhRawHitRatioPerCh
std::vector< TCanvas * > fvcStsSmxErr
void FillStsFebChanAdcRaw(UInt_t uFebIdx, UInt_t uChanInFeb, UShort_t usRawAdc)
std::vector< TProfile2D * > fvhHitChRatioEvo
std::vector< TH2 * > fvhStsChanRawTs
XPU_D uint16_t GetLinkIndex() const
For all data: Returns the (global) index of the eLink on which the message was received (n bit field)
XPU_D MessType GetMessType() const
Returns the message type, see enum MessType.
XPU_D uint16_t GetLinkIndexHitBinning() const
XPU_D bool IsMsErrorFlagOn() const
For End of MS data: Returns the MS error flag (1 bit field)
static constexpr uint32_t kuHitNbTsBins
static constexpr uint32_t kuHitNbAdcBins
Status/properties constants.
MessType
Message types.