13 #include "FairLogger.h"
14 #include "FairRootManager.h"
16 #include "FairRunOnline.h"
17 #include "FairRuntimeDb.h"
21 #include "TClonesArray.h"
26 #include "THttpServer.h"
28 #include "TPaveStats.h"
30 #include "TProfile2D.h"
47 , fvMsComponentsList()
50 , fbIgnoreOverlapMs(kFALSE)
51 , fuMsAcceptsPercent(100)
56 , fdTsCoreSizeInNs(0.0)
57 , fsHistoFilename(
"data/HistosMonitorDataRate.root")
59 , fulCurrentTsIndex(0)
64 , fdStartTimeMsSz(-1.)
65 , fuHistoryHistoSize(1800)
66 , fvuTsSzLink(fuNbFlimLinks, 0)
67 , fcMsSizeAll(nullptr)
68 , fhDataRateTimeAllLinks(nullptr)
69 , fvhDataRateTimePerLink(fuNbFlimLinks, nullptr)
70 , fvhTsSzPerLink(fuNbFlimLinks, nullptr)
71 , fvhTsSzTimePerLink(fuNbFlimLinks, nullptr)
72 , fvhMsSzPerLink(fuNbFlimLinks, nullptr)
73 , fvhMsSzTimePerLink(fuNbFlimLinks, nullptr)
74 , fvhMsMessPerLink(fuNbFlimLinks, nullptr)
75 , fvhMsMessTimePerLink(fuNbFlimLinks, nullptr)
76 , fvhMsMeanChDataPerLink(fuNbFlimLinks, nullptr)
77 , fvhMsMeanChDataTimePerLink(fuNbFlimLinks, nullptr) {}
82 LOG(info) <<
"Initializing Get4 monitor";
84 FairRootManager* ioman = FairRootManager::Instance();
86 LOG(fatal) <<
"No FairRootManager instance";
93 LOG(info) <<
"Setting parameter containers for " << GetName();
97 LOG(info) <<
"Init parameter containers for " << GetName();
106 LOG(info) <<
"ReInit parameter containers for " << GetName();
121 UInt_t uComp = component;
135 uint32_t iNbBinsLog = 0;
137 std::vector<double> dBinsLogVector =
139 double* dBinsLog = dBinsLogVector.data();
144 Form(
"DataRateTime_link_%02u", uComp),
146 "Data Rate vs time for DPB of link %02u; Time[s] ; DataRate [bytes/s]",
154 new TH1F(Form(
"TsSz_link_%02u", uComp),
155 Form(
"Size of TS from link %02u; Ts Size [bytes]", uComp),
160 Form(
"TsSzTime_link_%02u", uComp),
161 Form(
"Size of TS vs time for DPB of link %02u; Time[s] ; Ts Size [bytes]",
167 TString sMsSzName = Form(
"MsSz_link_%02u", uComp);
169 Form(
"Size of MS from link %02u; Ms Size [bytes]", uComp);
171 new TH1F(sMsSzName.Data(), sMsSzTitle.Data(), 160000, 0., 20000.);
173 sMsSzName = Form(
"MsSzTime_link_%02u", uComp);
175 Form(
"Size of MS vs time for DPB of link %02u; Time[s] ; Ms Size [bytes]",
183 sMsSzName = Form(
"MsMess_link_%02u", uComp);
185 Form(
"Messages Number of MS from link %02u; Mess Nb []", uComp);
187 new TH1F(sMsSzName.Data(), sMsSzTitle.Data(), 5000, 0., 5000.);
189 sMsSzName = Form(
"MsMessTime_link_%02u", uComp);
190 sMsSzTitle = Form(
"Messages Number of MS vs time for DPB of link %02u; "
191 "Time[s] ; Mess Nb []",
199 sMsSzName = Form(
"MsMeanChData_link_%02u", uComp);
201 "Mean data size per channels of MS from link %02u; Mean Ch Data [bytes]",
204 new TH1F(sMsSzName.Data(), sMsSzTitle.Data(), 5000, 0., 5000.);
206 sMsSzName = Form(
"MsMeanChDataTime_link_%02u", uComp);
207 sMsSzTitle = Form(
"Mean data size per channel of MS vs time for DPB of "
208 "link %02u; Time[s] ; Mean Ch Data[bytes]",
221 LOG(info) <<
"Added MS size histo for component (link): " << component;
224 size_t uOverlapMsNb) {
232 LOG(info) <<
"create Histos ";
234 THttpServer* server = FairRunOnline::Instance()->GetHttpServer();
237 uint32_t iNbBinsLog = 0;
239 std::vector<double> dBinsLogVector =
241 double* dBinsLog = dBinsLogVector.data();
245 new TH1D(
"DataRateTime_all",
246 "Data Rate vs time for all DPBs; Time[s] ; DataRate [MB/s]",
254 Form(
"DataRateTime_link_%02u", uComp),
255 Form(
"Data Rate vs time for DPB of link %02u; Time[s] ; DataRate [MB/s]",
263 new TH1F(Form(
"TsSz_link_%02u", uComp),
264 Form(
"Size of TS from link %02u; Ts Size [bytes]", uComp),
269 Form(
"TsSzTime_link_%02u", uComp),
270 Form(
"Size of TS vs time for DPB of link %02u; Time[s] ; Ts Size [bytes]",
277 TString sMsSzName = Form(
"MsSz_link_%02u", uComp);
279 Form(
"Size of MS from link %02u; Ms Size [bytes]", uComp);
281 new TH1F(sMsSzName.Data(), sMsSzTitle.Data(), iNbBinsLog, dBinsLog);
283 sMsSzName = Form(
"MsSzTime_link_%02u", uComp);
285 Form(
"Size of MS vs time for DPB of link %02u; Time[s] ; Ms Size [bytes]",
293 sMsSzName = Form(
"MsMess_link_%02u", uComp);
295 Form(
"Messages Number of MS from link %02u; Mess Nb []", uComp);
297 new TH1F(sMsSzName.Data(), sMsSzTitle.Data(), 5000, 0., 5000.);
299 sMsSzName = Form(
"MsMessTime_link_%02u", uComp);
300 sMsSzTitle = Form(
"Messages Number of MS vs time for DPB of link %02u; "
301 "Time[s] ; Mess Nb []",
309 sMsSzName = Form(
"MsMeanChData_link_%02u", uComp);
311 "Mean data size per channels of MS from link %02u; Mean Ch Data [bytes]",
314 new TH1F(sMsSzName.Data(), sMsSzTitle.Data(), 5000, 0., 5000.);
316 sMsSzName = Form(
"MsMeanChDataTime_link_%02u", uComp);
317 sMsSzTitle = Form(
"Mean data size per channel of MS vs time for DPB of "
318 "link %02u; Time[s] ; Mean Ch Data[bytes]",
335 new TCanvas(
"cDataRateTimeAll",
"Data Rate per link", w,
h);
338 fcTsSizeAll =
new TCanvas(
"cTsSizeAll",
"TS size per link", w,
h);
341 new TCanvas(
"cTsSizeTimeAll",
"Evolution of TS size per link", w,
h);
344 fcMsSizeAll =
new TCanvas(
"cMsSizeAll",
"MS size per link", w,
h);
347 new TCanvas(
"cMsSizeTimeAll",
"Evolution of MS size per link", w,
h);
350 fcMsMessAll =
new TCanvas(
"cMsMessAll",
"MS message number per link", w,
h);
353 "cMsMessTimeAll",
"Evolution of MS message number per link", w,
h);
357 "fcMsDataChAll",
"Mean data per channel in each MS, per link", w,
h);
360 "fcMsDataChTimeAll",
"Evolution of Mean data per channel per link", w,
h);
420 LOG(info) <<
"Created MS size canvas";
446 server->RegisterCommand(
"/Reset_All_Hist",
447 "bMcbmMoniDataRateResetHistos=kTRUE");
448 server->RegisterCommand(
"/Save_All_Hist",
449 "bMcbmMoniDataRateSaveHistos=kTRUE");
451 server->Restrict(
"/Reset_All_Hist",
"allow=admin");
452 server->Restrict(
"/Save_All_Hist",
"allow=admin");
455 LOG(info) <<
"Leaving CreateHistograms";
461 LOG(info) <<
"Reset eTOF STAR histos ";
466 LOG(info) <<
"Start saving Data Rates Moni histos ";
472 if (0 == ts.index())
return kTRUE;
486 for (UInt_t uMsIdx = 0; uMsIdx < uNbMsLoop; uMsIdx++) {
495 auto msDescriptor = ts.descriptor(uMsComp, uMsIdx);
515 auto msDescriptor = ts.descriptor(uMsComp, uMsIdx);
516 UInt_t uSysId = msDescriptor.sys_id;
518 fdMsIndex =
static_cast<double>(msDescriptor.idx) * (1e-9);
522 uint32_t size = msDescriptor.size;
523 Double_t dSizeMb = size;
524 dSizeMb = dSizeMb / 1024 / 1024;
545 uint32_t uNbMessages = 0;
567 default: uNbMessages = (size - (size % 4)) / 4;
575 Double_t dMeanDataPerChan = size;
603 TDirectory* oldDir = NULL;
604 TFile* histoFile = NULL;
605 if (
"" != sFileName) {
609 histoFile =
new TFile(sFileName,
"RECREATE");
613 gDirectory->mkdir(
"Flib_Raw");
614 gDirectory->cd(
"Flib_Raw");
635 TH1* pMissedTsH1 =
dynamic_cast<TH1*
>(gROOT->FindObjectAny(
"Missed_TS"));
636 if (NULL != pMissedTsH1) pMissedTsH1->Write();
638 TProfile* pMissedTsEvoP =
639 dynamic_cast<TProfile*
>(gROOT->FindObjectAny(
"Missed_TS_Evo"));
640 if (NULL != pMissedTsEvoP) pMissedTsEvoP->Write();
642 gDirectory->cd(
"..");
645 if (
"" != sFileName) {
653 LOG(info) <<
"Reseting all histograms.";