CbmRoot
Loading...
Searching...
No Matches
CbmMcbm2018MonitorDataRates.cxx
Go to the documentation of this file.
1/* Copyright (C) 2019-2021 Facility for Antiproton and Ion Research in Europe, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Pierre-Alain Loizeau [committer] */
4
5// -----------------------------------------------------------------------------
6// ----- -----
7// ----- CbmMcbm2018MonitorDataRates -----
8// ----- Created 26.03.2019 by P.-A. Loizeau -----
9// ----- -----
10// -----------------------------------------------------------------------------
11
13
14#include "CbmFlesHistosTools.h"
16
17#include "FairRootManager.h"
18#include "FairRun.h"
19#include "FairRunOnline.h"
20#include "FairRuntimeDb.h"
21#include <Logger.h>
22
23#include "Rtypes.h"
24#include "TCanvas.h"
25#include "TClonesArray.h"
26#include "TF1.h"
27#include "TH1.h"
28#include "TH2.h"
29#include "THStack.h"
30#include "THttpServer.h"
31#include "TMath.h"
32#include "TPaveStats.h"
33#include "TProfile.h"
34#include "TProfile2D.h"
35#include "TROOT.h"
36#include "TString.h"
37#include "TStyle.h"
38#include <TFile.h>
39
40#include <algorithm>
41#include <ctime>
42#include <iomanip>
43#include <iostream>
44
45#include <stdint.h>
46
49
52 , fvMsComponentsList()
53 , fuNbCoreMsPerTs(0)
54 , fuNbOverMsPerTs(0)
55 , fbIgnoreOverlapMs(kFALSE)
56 , fuMsAcceptsPercent(100)
57 , fuTotalMsNb(0)
58 , fuOverlapMsNb(0)
59 , fuCoreMs(0)
60 , fdMsSizeInNs(0.0)
61 , fdTsCoreSizeInNs(0.0)
62 , fsHistoFilename("data/HistosMonitorDataRate.root")
63 , fuNbFlimLinks(16)
64 , fulCurrentTsIndex(0)
65 , fuCurrentMs(0)
66 , fuCurrentMsSysId(0)
67 , fdMsIndex(0)
68 , fiEquipmentId(0)
69 , fdStartTimeMsSz(-1.)
70 , fuHistoryHistoSize(1800)
71 , fvuTsSzLink(fuNbFlimLinks, 0)
72 , fcMsSizeAll(nullptr)
73 , fhDataRateTimeAllLinks(nullptr)
74 , fvhDataRateTimePerLink(fuNbFlimLinks, nullptr)
75 , fvhTsSzPerLink(fuNbFlimLinks, nullptr)
76 , fvhTsSzTimePerLink(fuNbFlimLinks, nullptr)
77 , fvhMsSzPerLink(fuNbFlimLinks, nullptr)
78 , fvhMsSzTimePerLink(fuNbFlimLinks, nullptr)
79 , fvhMsMessPerLink(fuNbFlimLinks, nullptr)
80 , fvhMsMessTimePerLink(fuNbFlimLinks, nullptr)
81 , fvhMsMeanChDataPerLink(fuNbFlimLinks, nullptr)
82 , fvhMsMeanChDataTimePerLink(fuNbFlimLinks, nullptr)
83{
84}
85
87
89{
90 LOG(info) << "Initializing Get4 monitor";
91
92 FairRootManager* ioman = FairRootManager::Instance();
93 if (ioman == NULL) { LOG(fatal) << "No FairRootManager instance"; } // if( ioman == NULL )
94
95 return kTRUE;
96}
97
98void CbmMcbm2018MonitorDataRates::SetParContainers() { LOG(info) << "Setting parameter containers for " << GetName(); }
99
101{
102 LOG(info) << "Init parameter containers for " << GetName();
103 Bool_t initOK = ReInitContainers();
104
106
107 return initOK;
108}
109
111{
112 LOG(info) << "ReInit parameter containers for " << GetName();
113 return kTRUE;
114}
115
116
117void CbmMcbm2018MonitorDataRates::AddMsComponentToList(size_t component, UShort_t /*usDetectorId*/)
118{
120 for (UInt_t uCompIdx = 0; uCompIdx < fvMsComponentsList.size(); ++uCompIdx)
121 if (component == fvMsComponentsList[uCompIdx]) return;
122
124 fvMsComponentsList.push_back(component);
125
126 UInt_t uComp = component;
127 if (fuNbFlimLinks <= uComp) {
128 fuNbFlimLinks = uComp + 1;
129 fvhDataRateTimePerLink.resize(fuNbFlimLinks, nullptr);
130 fvhTsSzPerLink.resize(fuNbFlimLinks, nullptr);
131 fvhTsSzTimePerLink.resize(fuNbFlimLinks, nullptr);
132 fvhMsSzPerLink.resize(fuNbFlimLinks, nullptr);
133 fvhMsSzTimePerLink.resize(fuNbFlimLinks, nullptr);
134 fvhMsMessPerLink.resize(fuNbFlimLinks, nullptr);
135 fvhMsMessTimePerLink.resize(fuNbFlimLinks, nullptr);
136 fvhMsMeanChDataPerLink.resize(fuNbFlimLinks, nullptr);
138
140 uint32_t iNbBinsLog = 0;
142 std::vector<double> dBinsLogVector = GenerateLogBinArray(9, 9, 10, iNbBinsLog);
143 double* dBinsLog = dBinsLogVector.data();
144 // double * dBinsLog = GenerateLogBinArray( 9, 9, 10, iNbBinsLog );
145
148 new TH1D(Form("DataRateTime_link_%02u", uComp),
149 Form("Data Rate vs time for DPB of link %02u; Time[s] ; DataRate [bytes/s]", uComp), fuHistoryHistoSize,
151
153 fvhTsSzPerLink[uComp] = new TH1F(Form("TsSz_link_%02u", uComp),
154 Form("Size of TS from link %02u; Ts Size [bytes]", uComp), iNbBinsLog, dBinsLog);
155
156 fvhTsSzTimePerLink[uComp] =
157 new TProfile(Form("TsSzTime_link_%02u", uComp),
158 Form("Size of TS vs time for DPB of link %02u; Time[s] ; Ts Size [bytes]", uComp),
160
161 TString sMsSzName = Form("MsSz_link_%02u", uComp);
162 TString sMsSzTitle = Form("Size of MS from link %02u; Ms Size [bytes]", uComp);
163 fvhMsSzPerLink[uComp] = new TH1F(sMsSzName.Data(), sMsSzTitle.Data(), 160000, 0., 20000.);
164
165 sMsSzName = Form("MsSzTime_link_%02u", uComp);
166 sMsSzTitle = Form("Size of MS vs time for DPB of link %02u; Time[s] ; Ms Size [bytes]", uComp);
167 fvhMsSzTimePerLink[uComp] =
168 new TProfile(sMsSzName.Data(), sMsSzTitle.Data(), 100 * fuHistoryHistoSize, 0., fuHistoryHistoSize);
169
170 sMsSzName = Form("MsMess_link_%02u", uComp);
171 sMsSzTitle = Form("Messages Number of MS from link %02u; Mess Nb []", uComp);
172 fvhMsMessPerLink[uComp] = new TH1F(sMsSzName.Data(), sMsSzTitle.Data(), 5000, 0., 5000.);
173
174 sMsSzName = Form("MsMessTime_link_%02u", uComp);
175 sMsSzTitle = Form("Messages Number of MS vs time for DPB of link %02u; "
176 "Time[s] ; Mess Nb []",
177 uComp);
178 fvhMsMessTimePerLink[uComp] =
179 new TProfile(sMsSzName.Data(), sMsSzTitle.Data(), 100 * fuHistoryHistoSize, 0., fuHistoryHistoSize);
180
181 sMsSzName = Form("MsMeanChData_link_%02u", uComp);
182 sMsSzTitle = Form("Mean data size per channels of MS from link %02u; Mean Ch Data [bytes]", uComp);
183 fvhMsMeanChDataPerLink[uComp] = new TH1F(sMsSzName.Data(), sMsSzTitle.Data(), 5000, 0., 5000.);
184
185 sMsSzName = Form("MsMeanChDataTime_link_%02u", uComp);
186 sMsSzTitle = Form("Mean data size per channel of MS vs time for DPB of "
187 "link %02u; Time[s] ; Mean Ch Data[bytes]",
188 uComp);
190 new TH1D(sMsSzName.Data(), sMsSzTitle.Data(), fuHistoryHistoSize, 0., fuHistoryHistoSize);
191
193 // delete dBinsLog;
194
195 } // if( fuNbFlimLinks <= uComp )
196
197 LOG(info) << "Added MS size histo for component (link): " << component;
198}
199void CbmMcbm2018MonitorDataRates::SetNbMsInTs(size_t uCoreMsNb, size_t uOverlapMsNb)
200{
201 fuNbCoreMsPerTs = uCoreMsNb;
202 fuNbOverMsPerTs = uOverlapMsNb;
203
204 // UInt_t uNbMsTotal = fuNbCoreMsPerTs + fuNbOverMsPerTs;
205}
206
208{
209 LOG(info) << "create Histos ";
210
211 THttpServer* server = FairRunOnline::Instance()->GetHttpServer();
212
214 uint32_t iNbBinsLog = 0;
216 std::vector<double> dBinsLogVector = GenerateLogBinArray(9, 9, 10, iNbBinsLog);
217 double* dBinsLog = dBinsLogVector.data();
218 // double * dBinsLog = GenerateLogBinArray( 9, 9, 10, iNbBinsLog );
219
220 fhDataRateTimeAllLinks = new TH1D("DataRateTime_all", "Data Rate vs time for all DPBs; Time[s] ; DataRate [MB/s]",
222
223 for (UInt_t uComp = 0; uComp < fuNbFlimLinks; ++uComp) {
226 new TH1D(Form("DataRateTime_link_%02u", uComp),
227 Form("Data Rate vs time for DPB of link %02u; Time[s] ; DataRate [MB/s]", uComp), fuHistoryHistoSize, 0.,
229
231 fvhTsSzPerLink[uComp] = new TH1F(Form("TsSz_link_%02u", uComp),
232 Form("Size of TS from link %02u; Ts Size [bytes]", uComp), iNbBinsLog, dBinsLog);
233
234 fvhTsSzTimePerLink[uComp] =
235 new TProfile(Form("TsSzTime_link_%02u", uComp),
236 Form("Size of TS vs time for DPB of link %02u; Time[s] ; Ts Size [bytes]", uComp),
238
240 TString sMsSzName = Form("MsSz_link_%02u", uComp);
241 TString sMsSzTitle = Form("Size of MS from link %02u; Ms Size [bytes]", uComp);
242 fvhMsSzPerLink[uComp] = new TH1F(sMsSzName.Data(), sMsSzTitle.Data(), iNbBinsLog, dBinsLog);
243
244 sMsSzName = Form("MsSzTime_link_%02u", uComp);
245 sMsSzTitle = Form("Size of MS vs time for DPB of link %02u; Time[s] ; Ms Size [bytes]", uComp);
246 fvhMsSzTimePerLink[uComp] =
247 new TProfile(sMsSzName.Data(), sMsSzTitle.Data(), 100 * fuHistoryHistoSize, 0., fuHistoryHistoSize);
248
249 sMsSzName = Form("MsMess_link_%02u", uComp);
250 sMsSzTitle = Form("Messages Number of MS from link %02u; Mess Nb []", uComp);
251 fvhMsMessPerLink[uComp] = new TH1F(sMsSzName.Data(), sMsSzTitle.Data(), 5000, 0., 5000.);
252
253 sMsSzName = Form("MsMessTime_link_%02u", uComp);
254 sMsSzTitle = Form("Messages Number of MS vs time for DPB of link %02u; "
255 "Time[s] ; Mess Nb []",
256 uComp);
257 fvhMsMessTimePerLink[uComp] =
258 new TProfile(sMsSzName.Data(), sMsSzTitle.Data(), 100 * fuHistoryHistoSize, 0., fuHistoryHistoSize);
259
260 sMsSzName = Form("MsMeanChData_link_%02u", uComp);
261 sMsSzTitle = Form("Mean data size per channels of MS from link %02u; Mean Ch Data [bytes]", uComp);
262 fvhMsMeanChDataPerLink[uComp] = new TH1F(sMsSzName.Data(), sMsSzTitle.Data(), 5000, 0., 5000.);
263
264 sMsSzName = Form("MsMeanChDataTime_link_%02u", uComp);
265 sMsSzTitle = Form("Mean data size per channel of MS vs time for DPB of "
266 "link %02u; Time[s] ; Mean Ch Data[bytes]",
267 uComp);
269 new TH1D(sMsSzName.Data(), sMsSzTitle.Data(), fuHistoryHistoSize, 0., fuHistoryHistoSize);
270
272 // delete dBinsLog;
273 } // for( UInt_t uComp = 0; uComp < fuNbFlimLinks; ++uComp )
274
276 Double_t w = 10;
277 Double_t h = 10;
278
279 fcDataRateTimeAll = new TCanvas("cDataRateTimeAll", "Data Rate per link", w, h);
280 fcDataRateTimeAll->Divide(4, 4);
281
282 fcTsSizeAll = new TCanvas("cTsSizeAll", "TS size per link", w, h);
283 fcTsSizeAll->Divide(4, 4);
284 fcTsSizeTimeAll = new TCanvas("cTsSizeTimeAll", "Evolution of TS size per link", w, h);
285 fcTsSizeTimeAll->Divide(4, 4);
286
287 fcMsSizeAll = new TCanvas("cMsSizeAll", "MS size per link", w, h);
288 fcMsSizeAll->Divide(4, 4);
289 fcMsSizeTimeAll = new TCanvas("cMsSizeTimeAll", "Evolution of MS size per link", w, h);
290 fcMsSizeTimeAll->Divide(4, 4);
291
292 fcMsMessAll = new TCanvas("cMsMessAll", "MS message number per link", w, h);
293 fcMsMessAll->Divide(4, 4);
294 fcMsMessTimeAll = new TCanvas("cMsMessTimeAll", "Evolution of MS message number per link", w, h);
295 fcMsMessTimeAll->Divide(4, 4);
296
297 fcMsDataChAll = new TCanvas("fcMsDataChAll", "Mean data per channel in each MS, per link", w, h);
298 fcMsDataChAll->Divide(4, 4);
299 fcMsDataChTimeAll = new TCanvas("fcMsDataChTimeAll", "Evolution of Mean data per channel per link", w, h);
300 fcMsDataChTimeAll->Divide(4, 4);
301
302 for (UInt_t uComp = 0; uComp < fuNbFlimLinks; ++uComp)
303 if (nullptr != fvhMsSzTimePerLink[uComp]) {
304 fcDataRateTimeAll->cd(1 + uComp);
305 gPad->SetGridx();
306 gPad->SetGridy();
307 gPad->SetLogy();
308 fvhDataRateTimePerLink[uComp]->Draw("hist");
309
310 fcTsSizeAll->cd(1 + uComp);
311 gPad->SetGridx();
312 gPad->SetGridy();
313 gPad->SetLogy();
314 fvhTsSzPerLink[uComp]->Draw("hist");
315
316 fcTsSizeTimeAll->cd(1 + uComp);
317 gPad->SetGridx();
318 gPad->SetGridy();
319 gPad->SetLogy();
320 fvhTsSzTimePerLink[uComp]->Draw("hist");
321
322 fcMsSizeAll->cd(1 + uComp);
323 gPad->SetGridx();
324 gPad->SetGridy();
325 gPad->SetLogy();
326 fvhMsSzPerLink[uComp]->Draw("hist");
327
328 fcMsSizeTimeAll->cd(1 + uComp);
329 gPad->SetGridx();
330 gPad->SetGridy();
331 gPad->SetLogy();
332 fvhMsSzTimePerLink[uComp]->Draw("hist");
333
334 fcMsMessAll->cd(1 + uComp);
335 gPad->SetGridx();
336 gPad->SetGridy();
337 gPad->SetLogy();
338 fvhMsMessPerLink[uComp]->Draw("hist");
339
340 fcMsMessTimeAll->cd(1 + uComp);
341 gPad->SetGridx();
342 gPad->SetGridy();
343 gPad->SetLogy();
344 fvhMsMessTimePerLink[uComp]->Draw("hist");
345
346 fcMsDataChAll->cd(1 + uComp);
347 gPad->SetGridx();
348 gPad->SetGridy();
349 gPad->SetLogy();
350 fvhMsMeanChDataPerLink[uComp]->Draw("hist");
351
352 fcMsDataChTimeAll->cd(1 + uComp);
353 gPad->SetGridx();
354 gPad->SetGridy();
355 gPad->SetLogy();
356 fvhMsMeanChDataTimePerLink[uComp]->Draw("hist");
357 } // if( nullptr != fvhMsSzTimePerLink[ uComp ] )
358
359 LOG(info) << "Created MS size canvas";
360
361 if (server) {
362 server->Register("/FlibRaw", fhDataRateTimeAllLinks);
363 for (UInt_t uComp = 0; uComp < fuNbFlimLinks; ++uComp) {
364 server->Register("/FlibRaw", fvhDataRateTimePerLink[uComp]);
365 server->Register("/FlibRaw", fvhTsSzPerLink[uComp]);
366 server->Register("/FlibRaw", fvhTsSzTimePerLink[uComp]);
367 server->Register("/FlibRaw", fvhMsSzPerLink[uComp]);
368 server->Register("/FlibRaw", fvhMsSzTimePerLink[uComp]);
369 server->Register("/FlibRaw", fvhMsMessPerLink[uComp]);
370 server->Register("/FlibRaw", fvhMsMessTimePerLink[uComp]);
371 server->Register("/FlibRaw", fvhMsMeanChDataPerLink[uComp]);
372 server->Register("/FlibRaw", fvhMsMeanChDataTimePerLink[uComp]);
373 } // for( UInt_t uComp = 0; uComp < fuNbFlimLinks; ++uComp )
374
375 server->Register("/canvases", fcDataRateTimeAll);
376 server->Register("/canvases", fcTsSizeAll);
377 server->Register("/canvases", fcTsSizeTimeAll);
378 server->Register("/canvases", fcMsSizeAll);
379 server->Register("/canvases", fcMsSizeTimeAll);
380 server->Register("/canvases", fcMsMessAll);
381 server->Register("/canvases", fcMsMessTimeAll);
382 server->Register("/canvases", fcMsDataChAll);
383 server->Register("/canvases", fcMsDataChTimeAll);
384
385 server->RegisterCommand("/Reset_All_Hist", "bMcbmMoniDataRateResetHistos=kTRUE");
386 server->RegisterCommand("/Save_All_Hist", "bMcbmMoniDataRateSaveHistos=kTRUE");
387
388 server->Restrict("/Reset_All_Hist", "allow=admin");
389 server->Restrict("/Save_All_Hist", "allow=admin");
390 } // if( server )
391
392 LOG(info) << "Leaving CreateHistograms";
393}
394
395Bool_t CbmMcbm2018MonitorDataRates::DoUnpack(const fles::Timeslice& ts, size_t /*component*/)
396{
398 LOG(info) << "Reset eTOF STAR histos ";
401 } // if( bMcbmMoniDataRateResetHistos )
403 LOG(info) << "Start saving Data Rates Moni histos ";
404 SaveAllHistos("data/Histos_Shift_DataRates.root");
406 } // if( bSaveStsHistos )
407
409 if (0 == ts.index()) return kTRUE;
410
412 UInt_t uNbMsLoop = fuNbCoreMsPerTs;
413 if (kFALSE == fbIgnoreOverlapMs) uNbMsLoop += fuNbOverMsPerTs;
414
415 // Int_t messageType = -111;
416 // Double_t dTsStartTime = -1;
417
419 for (UInt_t uComp = 0; uComp < fuNbFlimLinks; ++uComp)
420 fvuTsSzLink[uComp] = 0;
421
423 for (UInt_t uMsIdx = 0; uMsIdx < uNbMsLoop; uMsIdx++) {
424 if (fuMsAcceptsPercent < uMsIdx) continue;
425
426 fuCurrentMs = uMsIdx;
427
428 if (0 == fulCurrentTsIndex && 0 == uMsIdx) {
429 for (UInt_t uMsCompIdx = 0; uMsCompIdx < fvMsComponentsList.size(); ++uMsCompIdx) {
430 UInt_t uMsComp = fvMsComponentsList[uMsCompIdx];
431 auto msDescriptor = ts.descriptor(uMsComp, uMsIdx);
432 /*
433 LOG(info) << "hi hv eqid flag si sv idx/start crc size offset";
434 LOG(info) << Form( "%02x %02x %04x %04x %02x %02x %016llx %08x %08x %016llx",
435 static_cast<unsigned int>(msDescriptor.hdr_id),
436 static_cast<unsigned int>(msDescriptor.hdr_ver), msDescriptor.eq_id, msDescriptor.flags,
437 static_cast<unsigned int>(msDescriptor.sys_id),
438 static_cast<unsigned int>(msDescriptor.sys_ver), msDescriptor.idx, msDescriptor.crc,
439 msDescriptor.size, msDescriptor.offset );
440*/
441 LOG(info) << FormatMsHeaderPrintout(msDescriptor);
442 } // for( UInt_t uMsCompIdx = 0; uMsCompIdx < fvMsComponentsList.size(); ++uMsCompIdx )
443 } // if( 0 == fulCurrentTsIndex && 0 == uMsIdx )
444
446 for (UInt_t uMsCompIdx = 0; uMsCompIdx < fvMsComponentsList.size(); ++uMsCompIdx) {
447 // constexpr uint32_t kuBytesPerMessage = 8;
448
449 UInt_t uMsComp = fvMsComponentsList[uMsCompIdx];
450 auto msDescriptor = ts.descriptor(uMsComp, uMsIdx);
451 UInt_t uSysId = msDescriptor.sys_id;
452 fiEquipmentId = msDescriptor.eq_id;
453 fdMsIndex = static_cast<double>(msDescriptor.idx) * (1e-9);
454 fuCurrentMsSysId = static_cast<unsigned int>(msDescriptor.sys_id);
455 // const uint8_t* msContent = reinterpret_cast<const uint8_t*>( ts.content( uMsComp, uMsIdx ) );
456
457 uint32_t size = msDescriptor.size;
458 Double_t dSizeMb = size;
459 dSizeMb = dSizeMb / 1024 / 1024;
460 fvuTsSzLink[uMsComp] += size;
461
462 // if( 0 == uMsIdx && 0 == uMsCompIdx )
463 // dTsStartTime = fdMsIndex;
464
466 fvhMsSzPerLink[uMsComp]->Fill(size);
468 // Reset the evolution Histogram and the start time when we reach the end of the range
469 fvhMsSzTimePerLink[uMsComp]->Reset();
470 fvhMsMessTimePerLink[uMsComp]->Reset();
471 fvhMsMeanChDataTimePerLink[uMsComp]->Reset();
473 } // if( fuHistoryHistoSize < fdMsIndex - fdStartTimeMsSz )
475 fvhDataRateTimePerLink[uMsComp]->Fill(fdMsIndex - fdStartTimeMsSz, dSizeMb);
477
478 // Compute the number of complete messages in the input microslice buffer, depending on sysid
479 uint32_t uNbMessages = 0;
480 switch (uSysId) {
481 case kuSysIdSts: uNbMessages = (size - (size % kuBytesPerMessageSts)) / kuBytesPerMessageSts; break;
482 case kuSysIdRich: uNbMessages = (size - (size % kuBytesPerMessageRich)) / kuBytesPerMessageRich; break;
483 case kuSysIdMuch: uNbMessages = (size - (size % kuBytesPerMessageMuch)) / kuBytesPerMessageMuch; break;
484 case kuSysIdTof: uNbMessages = (size - (size % kuBytesPerMessageTof)) / kuBytesPerMessageTof; break;
485 case kuSysIdBmon: uNbMessages = (size - (size % kuBytesPerMessageBmon)) / kuBytesPerMessageBmon; break;
486 default: uNbMessages = (size - (size % 4)) / 4;
487 } // switch( uSysId )
488 fvhMsMessPerLink[uMsComp]->Fill(uNbMessages);
489 fvhMsMessTimePerLink[uMsComp]->Fill(fdMsIndex - fdStartTimeMsSz, uNbMessages);
490
493 Double_t dMeanDataPerChan = size;
494 dMeanDataPerChan /= fmChannelsPerEqId[fiEquipmentId];
495 fvhMsMeanChDataPerLink[uMsComp]->Fill(dMeanDataPerChan);
496 fvhMsMeanChDataTimePerLink[uMsComp]->Fill(fdMsIndex - fdStartTimeMsSz, dMeanDataPerChan);
497 } // if( fDpbIdIndexMap.end() != fmChannelsPerEqId.find( fiEquipmentId ) )
498 } // for( UInt_t uMsCompIdx = 0; uMsCompIdx < fvMsComponentsList.size(); ++uMsCompIdx )
499 } // for( UInt_t uMsIdx = 0; uMsIdx < uNbMsLoop; uMsIdx ++ )
500
502 for (UInt_t uMsCompIdx = 0; uMsCompIdx < fvMsComponentsList.size(); ++uMsCompIdx) {
503 UInt_t uMsComp = fvMsComponentsList[uMsCompIdx];
504 fvhTsSzPerLink[uMsComp]->Fill(fvuTsSzLink[uMsComp]);
505 fvhTsSzTimePerLink[uMsComp]->Fill(fdMsIndex - fdStartTimeMsSz, fvuTsSzLink[uMsComp]);
506 } // for( UInt_t uComp = 0; uComp < fuNbFlimLinks; ++uComp )
507
509
510 return kTRUE;
511}
512
514
516
518{
520 TFile* oldFile = gFile;
521 TDirectory* oldDir = gDirectory;
522
523 TFile* histoFile = NULL;
524 if ("" != sFileName) {
525 // open separate histo file in recreate mode
526 histoFile = new TFile(sFileName, "RECREATE");
527 histoFile->cd();
528 } // if( "" != sFileName )
529
530 gDirectory->mkdir("Flib_Raw");
531 gDirectory->cd("Flib_Raw");
532 fhDataRateTimeAllLinks->Write();
533 for (UInt_t uLinks = 0; uLinks < fuNbFlimLinks; uLinks++)
534 if (nullptr != fvhMsSzTimePerLink[uLinks]) {
535 fvhDataRateTimePerLink[uLinks]->Write();
536 fvhTsSzPerLink[uLinks]->Write();
537 fvhTsSzTimePerLink[uLinks]->Write();
538 fvhMsSzPerLink[uLinks]->Write();
539 fvhMsSzTimePerLink[uLinks]->Write();
540 fvhMsMessPerLink[uLinks]->Write();
541 fvhMsMessTimePerLink[uLinks]->Write();
542 fvhMsMeanChDataPerLink[uLinks]->Write();
543 fvhMsMeanChDataTimePerLink[uLinks]->Write();
544 } // if( nullptr != fvhMsSzTimePerLink[ uComp ] )
545 fcMsSizeAll->Write();
546 fcMsSizeTimeAll->Write();
547 fcMsMessAll->Write();
548 fcMsMessTimeAll->Write();
549 fcMsDataChAll->Write();
550 fcMsDataChTimeAll->Write();
551
552 TH1* pMissedTsH1 = dynamic_cast<TH1*>(gROOT->FindObjectAny("Missed_TS"));
553 if (NULL != pMissedTsH1) pMissedTsH1->Write();
554
555 TProfile* pMissedTsEvoP = dynamic_cast<TProfile*>(gROOT->FindObjectAny("Missed_TS_Evo"));
556 if (NULL != pMissedTsEvoP) pMissedTsEvoP->Write();
557
558 gDirectory->cd("..");
559
560
561 if ("" != sFileName) {
562 // Restore original directory position
563 histoFile->Close();
564 } // if( "" != sFileName )
565
567 gFile = oldFile;
568 gDirectory = oldDir;
569}
570
572{
573 LOG(info) << "Reseting all histograms.";
574
575 fhDataRateTimeAllLinks->Reset();
576 for (UInt_t uLinks = 0; uLinks < fuNbFlimLinks; uLinks++)
577 if (nullptr != fvhMsSzTimePerLink[uLinks]) {
578 fvhDataRateTimePerLink[uLinks]->Reset();
579 fvhTsSzPerLink[uLinks]->Reset();
580 fvhTsSzTimePerLink[uLinks]->Reset();
581 fvhMsSzPerLink[uLinks]->Reset();
582 fvhMsSzTimePerLink[uLinks]->Reset();
583 fvhMsMessPerLink[uLinks]->Reset();
584 fvhMsMessTimePerLink[uLinks]->Reset();
585 fvhMsMeanChDataPerLink[uLinks]->Reset();
586 fvhMsMeanChDataTimePerLink[uLinks]->Reset();
587 } // if( nullptr != fvhMsSzTimePerLink[ uComp ] )
588
589 fdStartTimeMsSz = -1;
590}
ClassImp(CbmConverterManager)
std::vector< double > GenerateLogBinArray(uint32_t uNbDecadesLog, uint32_t uNbStepsDecade, uint32_t uNbSubStepsInStep, uint32_t &uNbBinsLog, int32_t iStartExp, bool bAddZeroStart)
std::string FormatMsHeaderPrintout(const fles::MicrosliceDescriptor &msDescriptor)
Bool_t bMcbmMoniDataRateResetHistos
Bool_t bMcbmMoniDataRateSaveHistos
static constexpr size_t size()
Definition KfSimdPseudo.h:2
virtual void SetNbMsInTs(size_t uCoreMsNb, size_t uOverlapMsNb)
std::map< UInt_t, UInt_t > fmChannelsPerEqId
Parameters.
static const UInt_t kuSysIdSts
Constants.
std::vector< TProfile * > fvhTsSzTimePerLink
std::vector< size_t > fvMsComponentsList
FLES containers.
virtual Bool_t DoUnpack(const fles::Timeslice &ts, size_t component)
virtual void AddMsComponentToList(size_t component, UShort_t usDetectorId)
std::vector< TProfile * > fvhMsMessTimePerLink
Double_t fdStartTimeMsSz
Histograms and histogram control variables.
std::vector< TProfile * > fvhMsSzTimePerLink
size_t fuMsAcceptsPercent
/‍** Ignore Overlap Ms: all fuOverlapMsNb MS at the end of timeslice **‍/
Data class with information on a STS local track.