CbmRoot
Loading...
Searching...
No Matches
CbmMuchUnpackMonitor.cxx
Go to the documentation of this file.
1/* Copyright (C) 2022 Fair GmbH, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Pierre-Alain Loizeau [committer] */
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
30CbmMuchUnpackMonitor::CbmMuchUnpackMonitor(/* 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("hMuchDigisTimeInRun", "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("fhMuchVectorSize", "Size of the vector VS TS index; TS index; Size [bytes]", 10, 0, 10);
80 fhVectorSize->SetCanExtend(TH1::kAllAxes);
82
84 new TH1I("fhMuchVectorCapacity", "Size of the vector VS TS index; TS index; Size [bytes]", 10000, 0., 10000.);
86
87 fhMsCntEvo = new TH1I("fhMuchMsCntEvo", "; MS index [s]; Counts []", 600, 0.0, 600.0);
89
91 new TH2I("fhMuchMsErrorsEvo", "; MS index [s]; Error type []; Counts []", 600, 0.0, 600.0, 4, -0.5, 3.5);
93
95 sHistName = "hMuchAllFebsHitRateEvo";
96 title = "Hits per second & FEB; Time [s]; FEB []; Hits []";
97 fhMuchAllFebsHitRateEvo = new TH2I(sHistName, title, 600, 0, 600, uNbFebs, -0.5, uNbFebs - 0.5);
98 // fhMuchAllFebsHitRateEvo->SetCanExtend(TH1::kAllAxes);
100
102 sHistName = "hMuchAllAsicsHitRateEvo";
103 title = "Hits per second & ASIC; Time [s]; ASIC []; Hits []";
104 fhMuchAllAsicsHitRateEvo = new TH2I(sHistName, title, 600, 0, 600, uNbAsics, -0.5, uNbAsics - 0.5);
105 // fhMuchAllAsicsHitRateEvo->SetCanExtend(TH1::kAllAxes);
107
109 sHistName = "hMuchFebAsicHitCounts";
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 = "hMuchStatusMessType";
116 title = "Nb of status message of each type for each DPB; ASIC; Status Type";
117 fhMuchStatusMessType = new TH2I(sHistName, title, uNbAsics, 0, uNbAsics, 16, 0., 16.);
119
121 sHistName = "hMuchRawHitRatioPerFeb";
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("hMuchRawChRatio_%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("hMuchHitChRatio_%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("hMuchDupliChRatio_%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("hMuchRawHitRatioPerCh_%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("hMuchRawDupliRatioPerCh_%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("hMuchFebChanCntRaw_%03u", uFebIdx);
155 title = Form("Hits Count per channel, FEB #%03u; Channel; Hits []", uFebIdx);
156 fvhMuchFebChanCntRaw.push_back(new TH1I(sHistName, title, uNbChanPerFeb, -0.5, uNbChanPerFeb - 0.5));
157
159 sHistName = Form("hMuchFebChanAdcRaw_%03u", uFebIdx);
160 title = Form("Raw Adc distribution per channel, FEB #%03u; Channel []; Adc "
161 "[]; Hits []",
162 uFebIdx);
163 fvhMuchFebChanAdcRaw.push_back(new TH2I(sHistName, title, uNbChanPerFeb, -0.5, uNbChanPerFeb - 0.5,
165
167 sHistName = Form("hMuchFebChanAdcRawProfc_%03u", uFebIdx);
168 title = Form("Raw Adc prodile per channel, FEB #%03u; Channel []; Adc []", uFebIdx);
169 fvhMuchFebChanAdcRawProf.push_back(new TProfile(sHistName, title, uNbChanPerFeb, -0.5, uNbChanPerFeb - 0.5));
170
172 sHistName = Form("hMuchFebChanAdcCal_%03u", uFebIdx);
173 title = Form("Cal. Adc distribution per channel, FEB #%03u; Channel []; Adc [e-]; Hits []", uFebIdx);
174 fvhMuchFebChanAdcCal.push_back(
175 new TH2I(sHistName, title, uNbChanPerFeb, -0.5, uNbChanPerFeb - 0.5, 50, 0., 100000.));
176
178 sHistName = Form("hMuchFebChanAdcCalProfc_%03u", uFebIdx);
179 title = Form("Cal. Adc prodile per channel, FEB #%03u; Channel []; Adc [e-]", uFebIdx);
180 fvhMuchFebChanAdcCalProf.push_back(new TProfile(sHistName, title, uNbChanPerFeb, -0.5, uNbChanPerFeb - 0.5));
181
183 sHistName = Form("hMuchFebChanRawTs_%03u", uFebIdx);
184 title = Form("Raw Timestamp distribution per channel, FEB #%03u; Channel "
185 "[]; Ts []; Hits []",
186 uFebIdx);
187 fvhMuchFebChanRawTs.push_back(new TH2I(sHistName, title, uNbChanPerFeb, -0.5, uNbChanPerFeb - 0.5,
189
191 sHistName = Form("hMuchFebChanMissEvt_%03u", uFebIdx);
192 title = Form("Missed Event flags per channel, FEB #%03u; Channel []; Miss "
193 "Evt []; Hits []",
194 uFebIdx);
195 fvhMuchFebChanMissEvt.push_back(new TH2I(sHistName, title, uNbChanPerFeb, -0.5, uNbChanPerFeb - 0.5, 2, -0.5, 1.5));
196
198 sHistName = Form("hMuchFebChanMissEvtEvo_%03u", uFebIdx);
199 title = Form("Missed Evt flags per second & channel in FEB #%03u; Time "
200 "[s]; Channel []; Missed Evt flags []",
201 uFebIdx);
202 fvhMuchFebChanMissEvtEvo.push_back(
203 new TH2I(sHistName, title, 600, 0, 600, uNbChanPerFeb, -0.5, uNbChanPerFeb - 0.5));
204 // fvhMuchFebChanMissEvtEvo.back()->SetCanExtend(TH1::kAllAxes);
205
207 sHistName = Form("hMuchFebAsicMissEvtEvo_%03u", uFebIdx);
208 title = Form("Missed Evt flags per second & StsXyter in FEB #%03u; Time "
209 "[s]; Asic []; Missed Evt flags []",
210 uFebIdx);
211 fvhMuchFebAsicMissEvtEvo.push_back(
212 new TH2I(sHistName, title, 600, 0, 600, uNbAsicsPerFeb, -0.5, uNbAsicsPerFeb - 0.5));
213 // fvhMuchFebAsicMissEvtEvo.back()->SetCanExtend(TH1::kAllAxes);
214
216 sHistName = Form("hMuchFebMissEvtEvo_%03u", uFebIdx);
217 title = Form("Missed Evt flags per second & channel in FEB #%03u; Time "
218 "[s]; Missed Evt flags []",
219 uFebIdx);
220 fvhMuchFebMissEvtEvo.push_back(new TH1I(sHistName, title, 600, 0, 600));
221 // fvhMuchFebMissEvtEvo.back()->SetCanExtend(TH1::kAllAxes);
222
224 sHistName = Form("hMuchFebChanRateEvo_%03u", uFebIdx);
225 title = Form("Hits per second & channel in FEB #%03u; Time [s]; Channel []; Hits []", uFebIdx);
226 fvhMuchFebChanHitRateEvo.push_back(
227 new TH2I(sHistName, title, 600, 0, 600, uNbChanPerFeb, -0.5, uNbChanPerFeb - 0.5));
228 // fvhMuchFebChanHitRateEvo.back()->SetCanExtend(TH1::kAllAxes);
229
231 sHistName = Form("hMuchFebAsicRateEvo_%03u", uFebIdx);
232 title = Form("Hits per second & StsXyter in FEB #%03u; Time [s]; Asic []; Hits []", uFebIdx);
233 fvhMuchFebAsicHitRateEvo.push_back(
234 new TH2I(sHistName, title, 600, 0, 600, uNbAsicsPerFeb, -0.5, uNbAsicsPerFeb - 0.5));
235 // fvhMuchFebAsicHitRateEvo.back()->SetCanExtend(TH1::kAllAxes);
236
238 sHistName = Form("hMuchFebRateEvo_%03u", uFebIdx);
239 title = Form("Hits per second in FEB #%03u; Time [s]; Hits []", uFebIdx);
240 fvhMuchFebHitRateEvo.push_back(new TH1I(sHistName, title, 600, 0, 600));
241 // fvhMuchFebHitRateEvo.back()->SetCanExtend(TH1::kAllAxes);
242
244 sHistName = Form("hMuchFebChanRateEvoLong_%03u", uFebIdx);
245 title = Form("Hits per second & channel in FEB #%03u; Time [min]; Channel []; Hits []", uFebIdx);
246 fvhMuchFebChanHitRateEvoLong.push_back(new TH2D(sHistName, title, fuLongHistoBinNb, -0.5, uAlignedLimit - 0.5,
247 uNbChanPerFeb, -0.5, uNbChanPerFeb - 0.5));
248
250 sHistName = Form("hMuchFebAsicRateEvoLong_%03u", uFebIdx);
251 title = Form("Hits per second & StsXyter in FEB #%03u; Time [min]; Asic []; Hits []", uFebIdx);
252 fvhMuchFebAsicHitRateEvoLong.push_back(new TH2D(sHistName, title, fuLongHistoBinNb, -0.5, uAlignedLimit - 0.5,
253 uNbAsicsPerFeb, -0.5, uNbAsicsPerFeb - 0.5));
254
256 sHistName = Form("hMuchFebRateEvoLong_%03u", uFebIdx);
257 title = Form("Hits per second in FEB #%03u; Time [min]; Hits []", uFebIdx);
258 fvhMuchFebHitRateEvoLong.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(fvhMuchFebChanCntRaw[uFebIdx], "perFeb");
266 AddHistoToVector(fvhMuchFebChanAdcRaw[uFebIdx], "perFeb");
267 AddHistoToVector(fvhMuchFebChanAdcRawProf[uFebIdx], "perFeb");
268 AddHistoToVector(fvhMuchFebChanAdcCal[uFebIdx], "perFeb");
269 AddHistoToVector(fvhMuchFebChanAdcCalProf[uFebIdx], "perFeb");
270 AddHistoToVector(fvhMuchFebChanRawTs[uFebIdx], "perFeb");
271 AddHistoToVector(fvhMuchFebChanMissEvt[uFebIdx], "perFeb");
272 AddHistoToVector(fvhMuchFebChanMissEvtEvo[uFebIdx], "perFeb");
273 AddHistoToVector(fvhMuchFebAsicMissEvtEvo[uFebIdx], "perFeb");
274 AddHistoToVector(fvhMuchFebMissEvtEvo[uFebIdx], "perFeb");
275 AddHistoToVector(fvhMuchFebChanHitRateEvo[uFebIdx], "perFeb");
276 AddHistoToVector(fvhMuchFebAsicHitRateEvo[uFebIdx], "perFeb");
277 AddHistoToVector(fvhMuchFebHitRateEvo[uFebIdx], "perFeb");
280 AddHistoToVector(fvhMuchFebHitRateEvoLong[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 fvcMuchSumm.resize(uNbFebs);
289 fvcMuchSmxErr.resize(uNbFebs);
290 for (UInt_t uFebIdx = 0; uFebIdx < uNbFebs; ++uFebIdx) {
291 // if (kTRUE == fUnpackParMuch->IsFebActive(uFebIdx)) {
292 fvcMuchSumm[uFebIdx] =
293 new TCanvas(Form("cMuchSum_%03u", uFebIdx), Form("Summary plots for FEB %03u", uFebIdx), w, h);
294 AddCanvasToVector(fvcMuchSumm[uFebIdx], "perFebCanvases");
295
296 fvcMuchSumm[uFebIdx]->Divide(2, 3);
297 }
298 return kTRUE;
299}
300
302{
303 for (UInt_t uFebIdx = 0; uFebIdx < fvcMuchSumm.size(); ++uFebIdx) {
304 // if (kTRUE == fUnpackParMuch->IsFebActive(uFebIdx)) {
305 fvcMuchSumm[uFebIdx]->cd(1);
306 gPad->SetGridx();
307 gPad->SetGridy();
308 gPad->SetLogy();
309 fvhMuchFebChanCntRaw[uFebIdx]->Draw();
310
311 //fvcMuchSumm[uFebIdx]->cd(2);
312 //gPad->SetGridx();
313 //gPad->SetGridy();
314 //gPad->SetLogy();
315 //fvhMuchFebChanHitRateProf[uFebIdx]->Draw("e0");
316
317 fvcMuchSumm[uFebIdx]->cd(3);
318 gPad->SetGridx();
319 gPad->SetGridy();
320 gPad->SetLogz();
321 fvhMuchFebChanAdcRaw[uFebIdx]->Draw("colz");
322
323 fvcMuchSumm[uFebIdx]->cd(4);
324 gPad->SetGridx();
325 gPad->SetGridy();
326 //gPad->SetLogy();
327 fvhMuchFebChanAdcRawProf[uFebIdx]->Draw();
328
329 fvcMuchSumm[uFebIdx]->cd(5);
330 gPad->SetGridx();
331 gPad->SetGridy();
332 gPad->SetLogz();
333 fvhMuchFebChanHitRateEvo[uFebIdx]->Draw("colz");
334
335 fvcMuchSumm[uFebIdx]->cd(6);
336 gPad->SetGridx();
337 gPad->SetGridy();
338 //gPad->SetLogy();
339 fvhMuchFebChanMissEvt[uFebIdx]->Draw("colz");
340
341 // two following two are inactive as currently adc raw and cal are the same
342
343 //fvcMuchSumm[ uFebIdx ]->cd(5);
344 //gPad->SetGridx();
345 //gPad->SetGridy();
346 //gPad->SetLogz();
347 //fvhMuchFebChanAdcCal[ uFebIdx ]->Draw( "colz" );
348
349 //fvcMuchSumm[ uFebIdx ]->cd(6);
350 //gPad->SetGridx();
351 //gPad->SetGridy();
352 //gPad->SetLogy();
353 //fvhMuchFebChanAdcCalProf[ uFebIdx ]->Draw();
354 }
355}
356
358{
359 if (nullptr == fvhMsSize[component]) {
360 TString sMsSizeName = Form("MuchMsSize_link_%02u", component);
361 TString sMsSizeTitle = Form("Size of MS for nDPB of link %02u; Ms Size [bytes]", component);
362 fvhMsSize[component] = new TH1F(sMsSizeName.Data(), sMsSizeTitle.Data(), 30000, 0., 30000.);
363 fvhMsSize[component]->SetCanExtend(TH2::kAllAxes);
364 AddHistoToVector(fvhMsSize[component], "perComponent");
365 }
366 if (nullptr == fvhMsSizeTime[component]) {
367 TString sMsSizeName = Form("MuchMsSizeTime_link_%02u", component);
368 TString sMsSizeTitle = Form("Size of MS vs time for gDPB of link %02u; Time[s] ; Ms Size [bytes]", component);
369 fvhMsSizeTime[component] = new TProfile(sMsSizeName.Data(), sMsSizeTitle.Data(), 15000, 0., 300.);
370 fvhMsSizeTime[component]->SetCanExtend(TH2::kAllAxes);
371 AddHistoToVector(fvhMsSizeTime[component], "perComponent");
372 }
373 return kTRUE;
374}
375
377{
378 if (nullptr != fvhMsSize[component]) {
379 fvhMsSize[component]->Reset();
380 }
381 if (nullptr != fvhMsSizeTime[component]) {
382 fvhMsSizeTime[component]->Reset();
383 }
384 return kTRUE;
385}
386
388{
389 fhDigisTimeInRun->Reset();
390 fhVectorSize->Reset();
391 fhVectorCapacity->Reset();
392 fhMsCntEvo->Reset();
393 fhMsErrorsEvo->Reset();
396 fhMuchFebAsicHitCounts->Reset();
397 fhMuchStatusMessType->Reset();
398 fhRawHitRatioPerFeb->Reset();
399
400 for (UInt_t uFebIdx = 0; uFebIdx < fvhRawChRatio.size(); ++uFebIdx) {
401 fvhRawChRatio[uFebIdx]->Reset();
402 fvhHitChRatio[uFebIdx]->Reset();
403 fvhDupliChRatio[uFebIdx]->Reset();
404 fvhRawHitRatioPerCh[uFebIdx]->Reset();
405 fvhRawDupliRatioPerCh[uFebIdx]->Reset();
406 }
407 for (UInt_t uFebIdx = 0; uFebIdx < fvhMuchFebChanCntRaw.size(); ++uFebIdx) {
408 fvhMuchFebChanCntRaw[uFebIdx]->Reset();
409 }
410 for (UInt_t uFebIdx = 0; uFebIdx < fvhMuchFebChanAdcRaw.size(); ++uFebIdx) {
411 fvhMuchFebChanAdcRaw[uFebIdx]->Reset();
412 }
413 for (UInt_t uFebIdx = 0; uFebIdx < fvhMuchFebChanAdcRawProf.size(); ++uFebIdx) {
414 fvhMuchFebChanAdcRawProf[uFebIdx]->Reset();
415 }
416 for (UInt_t uFebIdx = 0; uFebIdx < fvhMuchFebChanAdcCal.size(); ++uFebIdx) {
417 fvhMuchFebChanAdcCal[uFebIdx]->Reset();
418 }
419 for (UInt_t uFebIdx = 0; uFebIdx < fvhMuchFebChanAdcCalProf.size(); ++uFebIdx) {
420 fvhMuchFebChanAdcCalProf[uFebIdx]->Reset();
421 }
422 for (UInt_t uFebIdx = 0; uFebIdx < fvhMuchFebChanRawTs.size(); ++uFebIdx) {
423 fvhMuchFebChanRawTs[uFebIdx]->Reset();
424 }
425 for (UInt_t uFebIdx = 0; uFebIdx < fvhMuchFebChanMissEvt.size(); ++uFebIdx) {
426 fvhMuchFebChanMissEvt[uFebIdx]->Reset();
427 }
428 for (UInt_t uFebIdx = 0; uFebIdx < fvhMuchFebChanMissEvtEvo.size(); ++uFebIdx) {
429 fvhMuchFebChanMissEvtEvo[uFebIdx]->Reset();
430 }
431 for (UInt_t uFebIdx = 0; uFebIdx < fvhMuchFebAsicMissEvtEvo.size(); ++uFebIdx) {
432 fvhMuchFebAsicMissEvtEvo[uFebIdx]->Reset();
433 }
434 for (UInt_t uFebIdx = 0; uFebIdx < fvhMuchFebMissEvtEvo.size(); ++uFebIdx) {
435 fvhMuchFebMissEvtEvo[uFebIdx]->Reset();
436 }
437 for (UInt_t uFebIdx = 0; uFebIdx < fvhMuchFebChanHitRateEvo.size(); ++uFebIdx) {
438 fvhMuchFebChanHitRateEvo[uFebIdx]->Reset();
439 }
440 for (UInt_t uFebIdx = 0; uFebIdx < fvhMuchFebAsicHitRateEvo.size(); ++uFebIdx) {
441 fvhMuchFebAsicHitRateEvo[uFebIdx]->Reset();
442 }
443 for (UInt_t uFebIdx = 0; uFebIdx < fvhMuchFebHitRateEvo.size(); ++uFebIdx) {
444 fvhMuchFebHitRateEvo[uFebIdx]->Reset();
445 }
446 for (UInt_t uFebIdx = 0; uFebIdx < fvhMuchFebChanHitRateEvoLong.size(); ++uFebIdx) {
447 fvhMuchFebChanHitRateEvoLong[uFebIdx]->Reset();
448 }
449 for (UInt_t uFebIdx = 0; uFebIdx < fvhMuchFebAsicHitRateEvoLong.size(); ++uFebIdx) {
450 fvhMuchFebAsicHitRateEvoLong[uFebIdx]->Reset();
451 }
452 for (UInt_t uFebIdx = 0; uFebIdx < fvhMuchFebHitRateEvoLong.size(); ++uFebIdx) {
453 fvhMuchFebHitRateEvoLong[uFebIdx]->Reset();
454 }
455 return kTRUE;
456}
457
459{
460 const UInt_t uNbAsics = pUnpackPar->GetNrOfAsics();
461 const UInt_t uNrOfDpbs = pUnpackPar->GetNrOfDpbs();
462 const UInt_t uNbChanPerAsic = pUnpackPar->GetNbChanPerAsic();
463 const UInt_t uNbFebs = pUnpackPar->GetNrOfFebs();
464 const UInt_t uNbChanPerFeb = pUnpackPar->GetNbChanPerFeb();
465 TString sHistName{""};
466 TString title{""};
467
468 sHistName = "hMuchPulserMessageType";
469 title = "Nb of message for each type; Type";
470 fhMuchMessType = new TH1I(sHistName, title, 6, 0., 6.);
471 fhMuchMessType->GetXaxis()->SetBinLabel(1, "Dummy");
472 fhMuchMessType->GetXaxis()->SetBinLabel(2, "Hit");
473 fhMuchMessType->GetXaxis()->SetBinLabel(3, "TsMsb");
474 fhMuchMessType->GetXaxis()->SetBinLabel(4, "Epoch");
475 fhMuchMessType->GetXaxis()->SetBinLabel(5, "Status");
476 fhMuchMessType->GetXaxis()->SetBinLabel(6, "Empty");
478
479 sHistName = "hMuchPulserMessageTypePerDpb";
480 title = "Nb of message of each type for each DPB; DPB; Type";
481 fhMuchMessTypePerDpb = new TH2I(sHistName, title, uNrOfDpbs, 0, uNrOfDpbs, 6, 0., 6.);
482 fhMuchMessTypePerDpb->GetYaxis()->SetBinLabel(1, "Dummy");
483 fhMuchMessTypePerDpb->GetYaxis()->SetBinLabel(2, "Hit");
484 fhMuchMessTypePerDpb->GetYaxis()->SetBinLabel(3, "TsMsb");
485 fhMuchMessTypePerDpb->GetYaxis()->SetBinLabel(4, "Epoch");
486 fhMuchMessTypePerDpb->GetYaxis()->SetBinLabel(5, "Status");
487 fhMuchMessTypePerDpb->GetYaxis()->SetBinLabel(6, "Empty");
489
490 sHistName = "hMuchMessTypePerElink";
491 title = "Nb of message of each type for each eLink; eLink; Type";
493 new TH2I(sHistName, title, uNrOfDpbs * fNrElinksPerDpb, 0, uNrOfDpbs * fNrElinksPerDpb, 6, 0., 6.);
494 fhMuchMessTypePerElink->GetYaxis()->SetBinLabel(1, "Dummy");
495 fhMuchMessTypePerElink->GetYaxis()->SetBinLabel(2, "Hit");
496 fhMuchMessTypePerElink->GetYaxis()->SetBinLabel(3, "TsMsb");
497 fhMuchMessTypePerElink->GetYaxis()->SetBinLabel(4, "Epoch");
498 fhMuchMessTypePerElink->GetYaxis()->SetBinLabel(5, "Status");
499 fhMuchMessTypePerElink->GetYaxis()->SetBinLabel(6, "Empty");
501
502 sHistName = "hMuchHitsElinkPerDpb";
503 title = "Nb of hit messages per eLink for each DPB; DPB; eLink; Hits nb []";
504 fhMuchHitsElinkPerDpb = new TH2I(sHistName, title, uNrOfDpbs, 0, uNrOfDpbs, 42, 0., 42.);
506
507 sHistName = "hMuchDpbRawTsMsb";
508 title = "MSB messages for each DPB; DPB; TsMsb; Count []";
509 fhMuchDpbRawTsMsb = new TH2I(sHistName, title, uNrOfDpbs, 0, uNrOfDpbs, 10, 0, 10);
510 fhMuchDpbRawTsMsb->SetCanExtend(TH2::kAllAxes);
512
513 sHistName = "hMuchDpbRawTsMsbSx";
514 title = "MSB SX messages for each DPB; DPB; TsMsb & 0x1F; Count []";
515 fhMuchDpbRawTsMsbSx = new TH2I(sHistName, title, uNrOfDpbs, 0, uNrOfDpbs, 10, 0, 10);
516 fhMuchDpbRawTsMsbSx->SetCanExtend(TH2::kAllAxes);
518
519 sHistName = "hMuchDpbRawTsMsbDpb";
520 title = "MSB DPB messages for each DPB; DPB; TsMsb >> 5; Count []";
521 fhMuchDpbRawTsMsbDpb = new TH2I(sHistName, title, uNrOfDpbs, 0, uNrOfDpbs, 10, 0, 10);
522 fhMuchDpbRawTsMsbDpb->SetCanExtend(TH2::kAllAxes);
524
526 sHistName = "hMuchRawHitRatioEvoPerFeb";
527 title = "Proportion of digis over raw hits in each FEB; Time [s]; FEB []; digis/raw [Prct]";
528 fhRawHitRatioEvoPerFeb = new TProfile2D(sHistName, title, 600, -0.5, 599.5, uNbFebs, -0.5, uNbFebs - 0.5);
530 for (uint32_t uFebIdx = 0; uFebIdx < uNbFebs; ++uFebIdx) {
531 sHistName = Form("hMuchChDupliAdc_%03d", uFebIdx);
532 title = Form("ADC in duplicate raw in each channel of FEB %2d; Channel []; ADC []", uFebIdx);
533 fvhChDupliAdc.push_back(new TH2I(sHistName, title, uNbChanPerFeb, -0.5, uNbChanPerFeb - 0.5, 32, -0.5, 31.5));
534
535 sHistName = Form("hMuchRawChRatioEvo_%03d", uFebIdx);
536 title = Form("Proportion of raw hits in each channel of FEB %2d; Time [s]; Channel []; Share of FEB raw msg [Prct]",
537 uFebIdx);
538 fvhRawChRatioEvo.push_back(
539 new TProfile2D(sHistName, title, 600, -0.5, 599.5, uNbChanPerFeb, -0.5, uNbChanPerFeb - 0.5));
540 sHistName = Form("hMuchHitChRatioEvo_%03d", uFebIdx);
541 title =
542 Form("Proportion of digis in each channel of FEB %2d; Time [s]; Channel []; Share of FEB digis [Prct]", uFebIdx);
543 fvhHitChRatioEvo.push_back(
544 new TProfile2D(sHistName, title, 600, -0.5, 599.5, uNbChanPerFeb, -0.5, uNbChanPerFeb - 0.5));
545 sHistName = Form("hMuchDupliChRatioEvo_%03d", uFebIdx);
546 title =
547 Form("Proportion of duplicates in each channel of FEB %2d; Time [s]; Channel []; Share of FEB duplicates [Prct]",
548 uFebIdx);
549 fvhDupliChRatioEvo.push_back(
550 new TProfile2D(sHistName, title, 600, -0.5, 599.5, uNbChanPerFeb, -0.5, uNbChanPerFeb - 0.5));
551 sHistName = Form("hMuchRawHitRatioEvoPerCh_%03d", uFebIdx);
552 title = Form("Proportion of digis over raw hits in each channel of FEB %2d; Time [s]; Channel []; digis/raw [Prct]",
553 uFebIdx);
554 fvhRawHitRatioEvoPerCh.push_back(
555 new TProfile2D(sHistName, title, 600, -0.5, 599.5, uNbChanPerFeb, -0.5, uNbChanPerFeb - 0.5));
556 sHistName = Form("hMuchRawDupliRatioEvoPerCh_%03d", uFebIdx);
557 title =
558 Form("Proportion of duplicates over raw hits in each channel of FEB %2d; Time [s]; Channel []; dupli/raw [Prct]",
559 uFebIdx);
560 fvhRawDupliRatioEvoPerCh.push_back(
561 new TProfile2D(sHistName, title, 600, -0.5, 599.5, uNbChanPerFeb, -0.5, uNbChanPerFeb - 0.5));
562
563 AddHistoToVector(fvhChDupliAdc[uFebIdx], "perFeb");
564 AddHistoToVector(fvhRawChRatioEvo[uFebIdx], "perFeb");
565 AddHistoToVector(fvhHitChRatioEvo[uFebIdx], "perFeb");
566 AddHistoToVector(fvhDupliChRatioEvo[uFebIdx], "perFeb");
567 AddHistoToVector(fvhRawHitRatioEvoPerCh[uFebIdx], "perFeb");
568 AddHistoToVector(fvhRawDupliRatioEvoPerCh[uFebIdx], "perFeb");
569 }
570
573 for (UInt_t uAsicIdx = 0; uAsicIdx < uNbAsics; ++uAsicIdx) {
574
576 sHistName = Form("hMuchChanCntRaw_%03u", uAsicIdx);
577 title = Form("Hits Count per channel, Asic #%03u; Channel; Hits []", uAsicIdx);
578 fvhMuchChanCntRaw.push_back(new TH1I(sHistName, title, uNbChanPerAsic, -0.5, uNbChanPerAsic - 0.5));
579
581 sHistName = Form("hMuchChanAdcRaw_%03u", uAsicIdx);
582 title = Form("Raw Adc distribution per channel, Asic #%03u; Channel []; Adc "
583 "[]; Hits []",
584 uAsicIdx);
585 fvhMuchChanAdcRaw.push_back(new TH2I(sHistName, title, uNbChanPerAsic, -0.5, uNbChanPerAsic - 0.5,
587
589 sHistName = Form("hMuchChanAdcRawProfc_%03u", uAsicIdx);
590 title = Form("Raw Adc prodile per channel, Asic #%03u; Channel []; Adc []", uAsicIdx);
591 fvhMuchChanAdcRawProf.push_back(new TProfile(sHistName, title, uNbChanPerAsic, -0.5, uNbChanPerAsic - 0.5));
592
594 sHistName = Form("hMuchChanRawTs_%03u", uAsicIdx);
595 title = Form("Raw Timestamp distribution per channel, Asic #%03u; Channel "
596 "[]; Ts []; Hits []",
597 uAsicIdx);
598 fvhMuchChanRawTs.push_back(new TH2I(sHistName, title, uNbChanPerAsic, -0.5, uNbChanPerAsic - 0.5,
600
602 sHistName = Form("hMuchChanMissEvt_%03u", uAsicIdx);
603 title = Form("Missed Event flags per channel, Asic #%03u; Channel []; Miss "
604 "Evt []; Hits []",
605 uAsicIdx);
606 fvhMuchChanMissEvt.push_back(new TH2I(sHistName, title, uNbChanPerAsic, -0.5, uNbChanPerAsic - 0.5, 2, -0.5, 1.5));
607
608 AddHistoToVector(fvhMuchChanCntRaw[uAsicIdx], "perAsic");
609 AddHistoToVector(fvhMuchChanAdcRaw[uAsicIdx], "perAsic");
610 AddHistoToVector(fvhMuchChanAdcRawProf[uAsicIdx], "perAsic");
611 AddHistoToVector(fvhMuchChanRawTs[uAsicIdx], "perAsic");
612 AddHistoToVector(fvhMuchChanMissEvt[uAsicIdx], "perAsic");
613 }
614 return kTRUE;
615}
616
618{
619 fhMuchMessType->Reset();
620 fhMuchMessTypePerDpb->Reset();
621 fhMuchMessTypePerElink->Reset();
622 fhMuchHitsElinkPerDpb->Reset();
623 fhMuchDpbRawTsMsb->Reset();
624 fhMuchDpbRawTsMsbSx->Reset();
625 fhMuchDpbRawTsMsbDpb->Reset();
626 fhRawHitRatioEvoPerFeb->Reset();
627
628 for (UInt_t uFebIdx = 0; uFebIdx < fvhRawChRatioEvo.size(); ++uFebIdx) {
629 fvhChDupliAdc[uFebIdx]->Reset();
630 fvhRawChRatioEvo[uFebIdx]->Reset();
631 fvhHitChRatioEvo[uFebIdx]->Reset();
632 fvhDupliChRatioEvo[uFebIdx]->Reset();
633 fvhRawHitRatioEvoPerCh[uFebIdx]->Reset();
634 fvhRawDupliRatioEvoPerCh[uFebIdx]->Reset();
635 }
636
637 for (UInt_t uAsicIdx = 0; uAsicIdx < fvhMuchChanCntRaw.size(); ++uAsicIdx) {
638 fvhMuchChanCntRaw[uAsicIdx]->Reset();
639 }
640 for (UInt_t uAsicIdx = 0; uAsicIdx < fvhMuchChanAdcRaw.size(); ++uAsicIdx) {
641 fvhMuchChanAdcRaw[uAsicIdx]->Reset();
642 }
643 for (UInt_t uAsicIdx = 0; uAsicIdx < fvhMuchChanAdcRawProf.size(); ++uAsicIdx) {
644 fvhMuchChanAdcRawProf[uAsicIdx]->Reset();
645 }
646 for (UInt_t uAsicIdx = 0; uAsicIdx < fvhMuchChanRawTs.size(); ++uAsicIdx) {
647 fvhMuchChanRawTs[uAsicIdx]->Reset();
648 }
649 for (UInt_t uAsicIdx = 0; uAsicIdx < fvhMuchChanMissEvt.size(); ++uAsicIdx) {
650 fvhMuchChanMissEvt[uAsicIdx]->Reset();
651 }
652 return kTRUE;
653}
654// -------------------------------------------------------------------------
655
656
657// -------------------------------------------------------------------------
658void CbmMuchUnpackMonitor::FillHitMonitoringHistos(const UInt_t& uFebIdx, const UShort_t& usChan,
659 const UInt_t& uChanInFeb, const UShort_t& usRawAdc,
660 const Double_t& dCalAdc, const UShort_t& usRawTs,
661 const bool& isHitMissedEvts)
662{
663 FillMuchFebChanAdcCal(uFebIdx, uChanInFeb, dCalAdc);
664 FillMuchFebChanAdcCalProf(uFebIdx, uChanInFeb, dCalAdc);
665 FillMuchFebChanCntRaw(uFebIdx, uChanInFeb);
666 FillMuchFebChanAdcRaw(uFebIdx, uChanInFeb, usRawAdc);
667 FillMuchFebChanRawTs(uFebIdx, usChan, usRawTs);
668 FillMuchFebChanMissEvt(uFebIdx, usChan, isHitMissedEvts);
669 FillMuchFebChanAdcRawProf(uFebIdx, uChanInFeb, usRawAdc);
670}
671
672
673// -------------------------------------------------------------------------
674void CbmMuchUnpackMonitor::FillHitDebugMonitoringHistos(const UInt_t& uAsicIdx, const UShort_t& usChan,
675 const UShort_t& usRawAdc, const UShort_t& usRawTs,
676 const bool& isHitMissedEvts)
677{
678 FillMuchChanCntRaw(uAsicIdx, usChan);
679 FillMuchChanAdcRaw(uAsicIdx, usChan, usRawAdc);
680 FillMuchChanAdcRawProf(uAsicIdx, usChan, usRawAdc);
681 FillMuchChanRawTs(uAsicIdx, usChan, usRawTs);
682 FillMuchChanMissEvt(uAsicIdx, usChan, isHitMissedEvts);
683}
684
685
686// -------------------------------------------------------------------------
687void CbmMuchUnpackMonitor::FillHitEvoMonitoringHistos(const UInt_t& uFebIdx, const UInt_t& uAsicIdx,
688 const UInt_t& uAsicInFeb, const UInt_t& uChanInFeb,
689 const Double_t& dAbsTimeSec, const bool& isHitMissedEvts)
690{
691 // Check Starting point of histos with time as X axis
692 if (-1 == fdStartTime) {
693 fdStartTime = dAbsTimeSec;
694 }
695
696 Double_t dTimeSinceStartSec = dAbsTimeSec - fdStartTime;
697
698 // Fill histos with time as X axis
699 FillMuchFebAsicHitCounts(uFebIdx, uAsicInFeb);
700 FillMuchFebChanHitRateEvo(uFebIdx, dTimeSinceStartSec, uChanInFeb);
701 FillMuchFebAsicHitRateEvo(uFebIdx, dTimeSinceStartSec, uAsicInFeb);
702 FillMuchFebHitRateEvo(uFebIdx, dTimeSinceStartSec);
703 FillMuchAllFebsHitRateEvo(dTimeSinceStartSec, uFebIdx);
704 FillMuchAllAsicsHitRateEvo(dTimeSinceStartSec, uAsicIdx);
705 if (isHitMissedEvts) {
706 FillMuchFebChanMissEvtEvo(uFebIdx, dTimeSinceStartSec, uChanInFeb);
707 FillMuchFebAsicMissEvtEvo(uFebIdx, dTimeSinceStartSec, uAsicInFeb);
708 FillMuchFebMissEvtEvo(uFebIdx, dTimeSinceStartSec);
709 }
710 const Double_t dTimeSinceStartMin = dTimeSinceStartSec / 60.0;
711 FillMuchFebHitRateEvoLong(uFebIdx, dTimeSinceStartMin);
712 FillMuchFebChanHitRateEvoLong(uFebIdx, dTimeSinceStartMin, uChanInFeb);
713 FillMuchFebAsicHitRateEvoLong(uFebIdx, dTimeSinceStartMin, uAsicInFeb);
714
715 // fviFebCountsSinceLastRateUpdate[uFebIdx]++;
716 // fvdFebChanCountsSinceLastRateUpdate[uFebIdx][uChanInFeb] += 1;
717 /*
718 if( kTRUE == fbLongHistoEnable )
719 {
720 std::chrono::steady_clock::time_point tNow = std::chrono::steady_clock::now();
721 Double_t dUnixTimeInRun = std::chrono::duration_cast< std::chrono::seconds >(tNow - ftStartTimeUnix).count();
722 fhFebRateEvoLong[ uAsicIdx ]->Fill( dUnixTimeInRun , 1.0 / fuLongHistoBinSizeSec );
723 fhFebChRateEvoLong[ uAsicIdx ]->Fill( dUnixTimeInRun , usChan, 1.0 / fuLongHistoBinSizeSec );
724 }
725*/
726}
727
728// -------------------------------------------------------------------------
730{
731 if (0 == dFirstTsStartTime) dFirstTsStartTime = dTsStartTimeS;
732 double_t dTimeInRun = dTsStartTimeS - dFirstTsStartTime;
733 double_t dRatio = 0;
734 uint32_t uNbFebs = fvuNbRawTsFeb.size();
735 uint32_t uNbChansPerFeb = (uNbFebs ? fvvuNbRawTsChan[0].size() : 0);
736 for (uint32_t uFebIdx = 0; uFebIdx < uNbFebs; ++uFebIdx) {
737 uint32_t uNbDupliFeb = fvuNbRawTsFeb[uFebIdx] - fvuNbDigisTsFeb[uFebIdx];
738 if (fvuNbRawTsFeb[uFebIdx]) {
739 dRatio = fvuNbDigisTsFeb[uFebIdx] * 100.0 / fvuNbRawTsFeb[uFebIdx];
740 fhRawHitRatioPerFeb->Fill(uFebIdx, dRatio);
741 if (fDebugMode) { //
742 fhRawHitRatioEvoPerFeb->Fill(dTimeInRun, uFebIdx, dRatio);
743 }
744 }
745
746 for (uint32_t uChan = 0; uChan < uNbChansPerFeb; ++uChan) {
747 uint32_t uNbDupliChan = fvvuNbRawTsChan[uFebIdx][uChan] - fvvuNbDigisTsChan[uFebIdx][uChan];
748 if (fvuNbRawTsFeb[uFebIdx]) {
749 dRatio = fvvuNbRawTsChan[uFebIdx][uChan] * 100.0 / fvuNbRawTsFeb[uFebIdx];
750 fvhRawChRatio[uFebIdx]->Fill(uChan, dRatio);
751 if (fDebugMode) { //
752 fvhRawChRatioEvo[uFebIdx]->Fill(dTimeInRun, uChan, dRatio);
753 }
754 }
755
756 if (fvuNbDigisTsFeb[uFebIdx]) {
757 dRatio = fvvuNbDigisTsChan[uFebIdx][uChan] * 100.0 / fvuNbDigisTsFeb[uFebIdx];
758 fvhHitChRatio[uFebIdx]->Fill(uChan, dRatio);
759 if (fDebugMode) { //
760 fvhHitChRatioEvo[uFebIdx]->Fill(dTimeInRun, uChan, dRatio);
761 }
762 }
763
764 if (uNbDupliFeb) {
765 dRatio = uNbDupliChan * 100.0 / uNbDupliFeb;
766 fvhDupliChRatio[uFebIdx]->Fill(uChan, dRatio);
767 if (fDebugMode) { //
768 fvhDupliChRatioEvo[uFebIdx]->Fill(dTimeInRun, uChan, dRatio);
769 }
770 }
771
772 if (fvvuNbRawTsChan[uFebIdx][uChan]) {
773 dRatio = fvvuNbDigisTsChan[uFebIdx][uChan] * 100.0 / fvvuNbRawTsChan[uFebIdx][uChan];
774 fvhRawHitRatioPerCh[uFebIdx]->Fill(uChan, dRatio);
775 if (fDebugMode) { //
776 fvhRawHitRatioEvoPerCh[uFebIdx]->Fill(dTimeInRun, uChan, dRatio);
777 }
778
779 dRatio = uNbDupliChan * 100.0 / fvvuNbRawTsChan[uFebIdx][uChan];
780 fvhRawDupliRatioPerCh[uFebIdx]->Fill(uChan, dRatio);
781 if (fDebugMode) { //
782 fvhRawDupliRatioEvoPerCh[uFebIdx]->Fill(dTimeInRun, uChan, dRatio);
783 }
784 }
785
786 fvvuNbRawTsChan[uFebIdx][uChan] = 0;
787 fvvuNbDigisTsChan[uFebIdx][uChan] = 0;
788 }
789 fvuNbRawTsFeb[uFebIdx] = 0;
790 fvuNbDigisTsFeb[uFebIdx] = 0;
791 }
792}
793
794// -------------------------------------------------------------------------
795void CbmMuchUnpackMonitor::FillDuplicateHitsAdc(const uint32_t& uFebIdx, const uint32_t& uChanInFeb,
796 const uint16_t& usAdc)
797{
798 if (fDebugMode) { //
799 fvhChDupliAdc[uFebIdx]->Fill(uChanInFeb, usAdc);
800 }
801}
802// -------------------------------------------------------------------------
804{
805 std::fill(vNbMessType.begin(), vNbMessType.end(), 0);
806 sMessPatt = "";
807 bError = false;
808}
809
810// -------------------------------------------------------------------------
811void CbmMuchUnpackMonitor::ProcessDebugInfo(const stsxyter::Message& Mess, const UInt_t& uCurrDpbIdx)
812{
813 const stsxyter::MessType typeMess = Mess.GetMessType();
814
815 FillMuchMessType(static_cast<uint16_t>(typeMess));
816 FillMuchMessTypePerDpb(uCurrDpbIdx, static_cast<uint16_t>(typeMess));
817 switch (typeMess) {
819 ++vNbMessType[0];
820 sMessPatt += " H ";
821 sMessPatt += ".";
822
823 const UShort_t usElinkIdx = Mess.GetLinkIndexHitBinning();
824 FillMuchMessTypePerElink(usElinkIdx, static_cast<uint16_t>(typeMess));
825 FillMuchHitsElinkPerDpb(uCurrDpbIdx, usElinkIdx);
826 break;
827 }
829 ++vNbMessType[1];
830 sMessPatt += " T ";
831 FillMuchMessTypePerElink(uCurrDpbIdx * fNrElinksPerDpb, static_cast<uint16_t>(typeMess));
832 break;
833 }
835 ++vNbMessType[2];
836 sMessPatt += " E ";
837 FillMuchMessTypePerElink(uCurrDpbIdx * fNrElinksPerDpb, static_cast<uint16_t>(typeMess));
838 break;
839 }
841 ++vNbMessType[3];
842 sMessPatt += " S ";
843 FillMuchMessTypePerElink(Mess.GetLinkIndex(), static_cast<uint16_t>(typeMess));
844 break;
845 }
847 ++vNbMessType[4];
848 sMessPatt += " Em";
849 FillMuchMessTypePerElink(uCurrDpbIdx * fNrElinksPerDpb, static_cast<uint16_t>(typeMess));
850 break;
851 }
853 ++vNbMessType[5];
854 sMessPatt += " En";
855 bError = Mess.IsMsErrorFlagOn();
856 FillMuchMessTypePerElink(uCurrDpbIdx * fNrElinksPerDpb, static_cast<uint16_t>(typeMess));
857 break;
858 }
860 ++vNbMessType[6];
861 sMessPatt += " D ";
862 FillMuchMessTypePerElink(uCurrDpbIdx * fNrElinksPerDpb, static_cast<uint16_t>(typeMess));
863 break;
864 }
865 default: {
866 }
867 }
868}
869
870// -------------------------------------------------------------------------
871void CbmMuchUnpackMonitor::PrintDebugInfo(const uint64_t MsStartTime, const size_t NrProcessedTs,
872 const uint16_t msDescriptorFlags, const uint32_t uSize)
873{
874 if (18967040000 == MsStartTime || 18968320000 == MsStartTime) {
875 LOG(debug) << sMessPatt;
876 }
877 if (static_cast<uint16_t>(fles::MicrosliceFlags::CrcValid) != msDescriptorFlags) {
878 LOG(debug) << "STS unp "
879 << " TS " << std::setw(12) << NrProcessedTs << " MS " << std::setw(12) << MsStartTime << " MS flags 0x"
880 << std::setw(4) << std::hex << msDescriptorFlags << std::dec << " Size " << std::setw(8) << uSize
881 << " bytes "
882 << " H " << std::setw(5) << vNbMessType[0] << " T " << std::setw(5) << vNbMessType[1] << " E "
883 << std::setw(5) << vNbMessType[2] << " S " << std::setw(5) << vNbMessType[3] << " Em " << std::setw(5)
884 << vNbMessType[4] << " En " << std::setw(5) << vNbMessType[5] << " D " << std::setw(5) << vNbMessType[6]
885 << " Err " << bError << " Undet. bad " << (!bError && 400 != vNbMessType[1]);
886 }
887}
888
889// ---- Init ----
891{
892 // Get Infos from the parset
894
896 TFile* oldFile = gFile;
897 TDirectory* oldDir = gDirectory;
898 gROOT->cd();
899
901 CreateHistograms(parset);
903
905 DrawCanvases();
906
908 gFile = oldFile;
909 gDirectory = oldDir;
910
912 std::vector<std::pair<TNamed*, std::string>> vHistos = GetHistoVector();
913
915 std::vector<std::pair<TCanvas*, std::string>> vCanvases = GetCanvasVector();
916
918 THttpServer* server = FairRunOnline::Instance()->GetHttpServer();
919 if (nullptr != server) {
920 for (UInt_t uCanvas = 0; uCanvas < vCanvases.size(); ++uCanvas) {
921 server->Register(Form("/much/%s", vCanvases[uCanvas].second.data()), vCanvases[uCanvas].first);
922 }
923 for (UInt_t uHisto = 0; uHisto < vHistos.size(); ++uHisto) {
924 server->Register(Form("/much/%s", vHistos[uHisto].second.data()), vHistos[uHisto].first);
925 }
926 /*
927 server->RegisterCommand("/Reset_UnpMuch_Hist", "bMcbm2018UnpackerTaskMuchResetHistos=kTRUE");
928 server->Restrict("/Reset_UnpMuch_Hist", "allow=admin");
929*/
930 }
931
932 return kTRUE;
933}
934
935// ---- Finish ----
937{
939 std::vector<std::pair<TNamed*, std::string>> vHistos = GetHistoVector();
940
942 std::vector<std::pair<TCanvas*, std::string>> vCanvases = GetCanvasVector();
943
945 TFile* oldFile = gFile;
946 TDirectory* oldDir = gDirectory;
947 TFile* histoFile = nullptr;
948
949 // open separate histo file in recreate mode
950 histoFile = new TFile(fHistoFileName, "RECREATE");
951 histoFile->cd();
952
954 for (UInt_t uHisto = 0; uHisto < vHistos.size(); ++uHisto) {
956 TString sFolder = vHistos[uHisto].second.data();
957 if (nullptr == gDirectory->Get(sFolder)) gDirectory->mkdir(sFolder);
958 gDirectory->cd(sFolder);
959
961 vHistos[uHisto].first->Write();
962
963 histoFile->cd();
964 }
965
967 for (UInt_t uCanvas = 0; uCanvas < vCanvases.size(); ++uCanvas) {
969 TString sFolder = vCanvases[uCanvas].second.data();
970 if (nullptr == gDirectory->Get(sFolder)) gDirectory->mkdir(sFolder);
971 gDirectory->cd(sFolder);
972
974 vCanvases[uCanvas].first->Write();
975
976 histoFile->cd();
977 }
978
980 gFile = oldFile;
981 gDirectory = oldDir;
982
983 histoFile->Close();
984 delete histoFile;
985}
986
987
ClassImp(CbmConverterManager)
std::vector< std::vector< uint32_t > > fvvuNbDigisTsChan
Bool_t CreateMsComponentSizeHistos(UInt_t component)
void FillMuchChanMissEvt(UInt_t uAsicIdx, UShort_t usChan, bool missedEvtFlag)
void FillMuchMessTypePerDpb(UInt_t DpbIdx, uint16_t typeMess)
void FillMuchAllFebsHitRateEvo(Double_t dTimeSinceStartSec, UInt_t uFebIdx)
void PrintDebugInfo(const uint64_t MsStartTime, const size_t NrProcessedTs, const uint16_t msDescriptorFlags, const uint32_t uSize)
std::vector< TProfile * > fvhHitChRatio
void FillPerTimesliceCountersHistos(double_t dTsStartTime)
void FillMuchFebMissEvtEvo(UInt_t uFebIdx, Double_t dTimeSinceStartSec)
void ProcessDebugInfo(const stsxyter::Message &Mess, const UInt_t &uCurrDpbIdx)
void FillMuchFebChanHitRateEvoLong(UInt_t uFebIdx, Double_t dTimeSinceStartMin, UInt_t uChanInFeb)
Bool_t CreateDebugHistograms(CbmMuchUnpackPar *pUnpackPar)
std::vector< std::pair< TNamed *, std::string > > GetHistoVector()
double_t dFirstTsStartTime
Rate evolution histos.
void FillMuchFebChanRawTs(UInt_t uFebIdx, UInt_t uChan, UShort_t usRawTs)
std::vector< std::pair< TCanvas *, std::string > > fvpAllCanvasPointers
Vector of pointers to histograms + optional folder name.
std::vector< uint32_t > vNbMessType
std::vector< TProfile * > fvhRawChRatio
General "per Feb" histogram vectors.
TH1 * fhDigisTimeInRun
General histograms.
std::vector< std::pair< TNamed *, std::string > > fvpAllHistoPointers
static const UInt_t kiMaxNbFlibLinks
std::vector< TH2 * > fvhMuchChanRawTs
void FillMuchChanRawTs(UInt_t uAsicIdx, UShort_t usChan, UShort_t usRawTs)
void FillMuchAllAsicsHitRateEvo(Double_t dTimeSinceStartSec, UInt_t uAsicIdx)
Bool_t Init(CbmMuchUnpackPar *digiParSet)
Init all required parameter informations and histograms.
std::vector< TH1 * > fvhMuchFebChanCntRaw
std::vector< TH1 * > fvhMuchFebHitRateEvoLong
void FillMuchFebChanMissEvt(UInt_t uFebIdx, UInt_t uChan, bool missEvtFlag)
std::vector< TProfile2D * > fvhHitChRatioEvo
void FillMuchFebChanAdcRaw(UInt_t uFebIdx, UInt_t uChanInFeb, UShort_t usRawAdc)
std::vector< TH1 * > fvhMuchFebMissEvtEvo
std::vector< TH2 * > fvhMuchFebAsicHitRateEvo
std::vector< TProfile * > fvhRawDupliRatioPerCh
void FillDuplicateHitsAdc(const uint32_t &uFebIdx, const uint32_t &uChanInFeb, const uint16_t &usAdc)
TH1 * fvhMsSize[kiMaxNbFlibLinks]
std::vector< TH2 * > fvhMuchFebChanHitRateEvoLong
void FillMuchFebHitRateEvoLong(UInt_t uFebIdx, Double_t dTimeSinceStartMin)
void FillMuchFebAsicHitCounts(UInt_t uFebIdx, UInt_t uAsicInFeb)
std::vector< TH2 * > fvhMuchChanMissEvt
std::vector< TH1 * > fvhMuchFebHitRateEvo
std::vector< TProfile2D * > fvhRawDupliRatioEvoPerCh
std::vector< TProfile2D * > fvhRawChRatioEvo
void FillMuchMessTypePerElink(UInt_t ElinkIdx, uint16_t typeMess)
std::vector< TH2 * > fvhMuchFebChanHitRateEvo
std::vector< std::pair< TCanvas *, std::string > > GetCanvasVector()
void FillHitDebugMonitoringHistos(const UInt_t &uAsicIdx, const UShort_t &usChan, const UShort_t &usRawAdc, const UShort_t &usRawTs, const bool &isHitMissedEvts)
std::vector< TH2 * > fvhMuchFebAsicHitRateEvoLong
void AddCanvasToVector(TCanvas *pointer, std::string sFolder="")
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)
std::vector< TCanvas * > fvcMuchSumm
Canvases.
void FillMuchFebChanAdcCalProf(UInt_t uFebIdx, UInt_t uChanInFeb, Double_t dCalAdc)
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)
void FillMuchFebAsicMissEvtEvo(UInt_t uFebIdx, Double_t dTimeSinceStartSec, UInt_t uAsicInFeb)
std::vector< TH2 * > fvhChDupliAdc
std::vector< TProfile2D * > fvhRawHitRatioEvoPerCh
void FillMuchFebAsicHitRateEvoLong(UInt_t uFebIdx, Double_t dTimeSinceStartMin, UInt_t uAsicInFeb)
void FillMuchFebChanCntRaw(UInt_t uFebIdx, UInt_t uChanInFeb)
Fill general "per Feb" histogram vectors.
std::vector< TH2 * > fvhMuchChanAdcRaw
std::vector< TH1 * > fvhMuchChanCntRaw
Debugging "per Asic" histogram vectors.
std::vector< TProfile2D * > fvhDupliChRatioEvo
std::vector< uint32_t > fvuNbRawTsFeb
Per timeslice counters to evaluate the eventual raw messages rejection per FEB.
void FillMuchFebChanAdcRawProf(UInt_t uFebIdx, UInt_t uChanInFeb, UShort_t usRawAdc)
TProfile * fvhMsSizeTime[kiMaxNbFlibLinks]
TH1 * fhMuchMessType
Debugging histograms.
Bool_t ResetMsComponentSizeHistos(UInt_t component)
void FillMuchFebHitRateEvo(UInt_t uFebIdx, Double_t dTimeSinceStartSec)
void FillMuchChanAdcRawProf(UInt_t uAsicIdx, UShort_t usChan, UShort_t usRawAdc)
void FillMuchFebChanHitRateEvo(UInt_t uFebIdx, Double_t dTimeSinceStartSec, UInt_t uChanInFeb)
std::vector< TProfile * > fvhRawHitRatioPerCh
bool fDebugMode
Flag if debug mode is active or not.
std::vector< TProfile * > fvhMuchChanAdcRawProf
std::vector< std::vector< uint32_t > > fvvuNbRawTsChan
Per timeslice counters to evaluate the eventual raw messages rejection per [FEB, chan] pairs.
std::vector< TProfile * > fvhMuchFebChanAdcCalProf
void FillMuchFebAsicHitRateEvo(UInt_t uFebIdx, Double_t dTimeSinceStartSec, UInt_t uAsicInFeb)
std::vector< TH2 * > fvhMuchFebAsicMissEvtEvo
void FillMuchChanCntRaw(UInt_t uAsicIdx, UShort_t usChan)
Fill debugging "per Asic" histogram vectors.
void Finish()
Write all histograms and canvases to file.
std::vector< TH2 * > fvhMuchFebChanRawTs
Bool_t CreateHistograms(CbmMuchUnpackPar *pUnpackPar)
std::vector< TH2 * > fvhMuchFebChanMissEvtEvo
void FillMuchFebChanMissEvtEvo(UInt_t uFebIdx, Double_t dTimeSinceStartSec, UInt_t uChanInFeb)
void FillMuchChanAdcRaw(UInt_t uAsicIdx, UShort_t usChan, UShort_t usRawAdc)
std::vector< uint32_t > fvuNbDigisTsFeb
void FillMuchFebChanAdcCal(UInt_t uFebIdx, UInt_t uChanInFeb, Double_t dCalAdc)
std::vector< TProfile * > fvhMuchFebChanAdcRawProf
std::vector< TCanvas * > fvcMuchSmxErr
std::vector< TH2 * > fvhMuchFebChanMissEvt
std::vector< TH2 * > fvhMuchFebChanAdcRaw
uint32_t fNrElinksPerDpb
Number of elinks per dpb, extracted from the parset.
void AddHistoToVector(TNamed *pointer, std::string sFolder="")
std::vector< TH2 * > fvhMuchFebChanAdcCal
void FillMuchMessType(uint16_t typeMess)
Fill debugging histograms.
void FillMuchHitsElinkPerDpb(UInt_t DpbIdx, UInt_t ElinkIdx)
std::vector< TProfile * > fvhDupliChRatio
static constexpr UInt_t GetNbChanPerFeb()
static constexpr UInt_t GetNbAsicsPerFeb()
static constexpr UInt_t GetNbElinkPerDpb()
static constexpr UInt_t GetNbChanPerAsic()
Data class with information on a STS local track.
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.