17#include "FairRootManager.h"
19#include "FairRunOnline.h"
20#include "FairRuntimeDb.h"
25#include "TClonesArray.h"
30#include "THttpServer.h"
32#include "TPaveStats.h"
34#include "TProfile2D.h"
52 , fvMsComponentsList()
55 , fbIgnoreOverlapMs(kFALSE)
56 , fuMsAcceptsPercent(100)
61 , fdTsCoreSizeInNs(0.0)
62 , fsHistoFilename(
"data/HistosMonitorDataRate.root")
64 , fulCurrentTsIndex(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)
90 LOG(info) <<
"Initializing Get4 monitor";
92 FairRootManager* ioman = FairRootManager::Instance();
93 if (ioman == NULL) { LOG(fatal) <<
"No FairRootManager instance"; }
102 LOG(info) <<
"Init parameter containers for " << GetName();
112 LOG(info) <<
"ReInit parameter containers for " << GetName();
126 UInt_t uComp = component;
140 uint32_t iNbBinsLog = 0;
143 double* dBinsLog = dBinsLogVector.data();
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,
154 Form(
"Size of TS from link %02u; Ts Size [bytes]", uComp), iNbBinsLog, dBinsLog);
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),
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.);
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);
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.);
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 []",
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);
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]",
197 LOG(info) <<
"Added MS size histo for component (link): " << component;
209 LOG(info) <<
"create Histos ";
211 THttpServer* server = FairRunOnline::Instance()->GetHttpServer();
214 uint32_t iNbBinsLog = 0;
217 double* dBinsLog = dBinsLogVector.data();
220 fhDataRateTimeAllLinks =
new TH1D(
"DataRateTime_all",
"Data Rate vs time for all DPBs; Time[s] ; DataRate [MB/s]",
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.,
232 Form(
"Size of TS from link %02u; Ts Size [bytes]", uComp), iNbBinsLog, dBinsLog);
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),
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);
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);
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.);
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 []",
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);
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]",
282 fcTsSizeAll =
new TCanvas(
"cTsSizeAll",
"TS size per link", w,
h);
284 fcTsSizeTimeAll =
new TCanvas(
"cTsSizeTimeAll",
"Evolution of TS size per link", w,
h);
287 fcMsSizeAll =
new TCanvas(
"cMsSizeAll",
"MS size per link", w,
h);
289 fcMsSizeTimeAll =
new TCanvas(
"cMsSizeTimeAll",
"Evolution of MS size per link", w,
h);
292 fcMsMessAll =
new TCanvas(
"cMsMessAll",
"MS message number per link", w,
h);
294 fcMsMessTimeAll =
new TCanvas(
"cMsMessTimeAll",
"Evolution of MS message number per link", w,
h);
297 fcMsDataChAll =
new TCanvas(
"fcMsDataChAll",
"Mean data per channel in each MS, per link", w,
h);
299 fcMsDataChTimeAll =
new TCanvas(
"fcMsDataChTimeAll",
"Evolution of Mean data per channel per link", w,
h);
359 LOG(info) <<
"Created MS size canvas";
385 server->RegisterCommand(
"/Reset_All_Hist",
"bMcbmMoniDataRateResetHistos=kTRUE");
386 server->RegisterCommand(
"/Save_All_Hist",
"bMcbmMoniDataRateSaveHistos=kTRUE");
388 server->Restrict(
"/Reset_All_Hist",
"allow=admin");
389 server->Restrict(
"/Save_All_Hist",
"allow=admin");
392 LOG(info) <<
"Leaving CreateHistograms";
398 LOG(info) <<
"Reset eTOF STAR histos ";
403 LOG(info) <<
"Start saving Data Rates Moni histos ";
409 if (0 == ts.index())
return kTRUE;
423 for (UInt_t uMsIdx = 0; uMsIdx < uNbMsLoop; uMsIdx++) {
431 auto msDescriptor = ts.descriptor(uMsComp, uMsIdx);
450 auto msDescriptor = ts.descriptor(uMsComp, uMsIdx);
451 UInt_t uSysId = msDescriptor.sys_id;
453 fdMsIndex =
static_cast<double>(msDescriptor.idx) * (1e-9);
457 uint32_t
size = msDescriptor.size;
458 Double_t dSizeMb =
size;
459 dSizeMb = dSizeMb / 1024 / 1024;
479 uint32_t uNbMessages = 0;
486 default: uNbMessages = (
size - (
size % 4)) / 4;
493 Double_t dMeanDataPerChan =
size;
520 TFile* oldFile = gFile;
521 TDirectory* oldDir = gDirectory;
523 TFile* histoFile = NULL;
524 if (
"" != sFileName) {
526 histoFile =
new TFile(sFileName,
"RECREATE");
530 gDirectory->mkdir(
"Flib_Raw");
531 gDirectory->cd(
"Flib_Raw");
552 TH1* pMissedTsH1 =
dynamic_cast<TH1*
>(gROOT->FindObjectAny(
"Missed_TS"));
553 if (NULL != pMissedTsH1) pMissedTsH1->Write();
555 TProfile* pMissedTsEvoP =
dynamic_cast<TProfile*
>(gROOT->FindObjectAny(
"Missed_TS_Evo"));
556 if (NULL != pMissedTsEvoP) pMissedTsEvoP->Write();
558 gDirectory->cd(
"..");
561 if (
"" != sFileName) {
573 LOG(info) <<
"Reseting all histograms.";
ClassImp(CbmConverterManager)
Bool_t bMcbmMoniDataRateResetHistos
Bool_t bMcbmMoniDataRateSaveHistos
static constexpr size_t size()
virtual void SetNbMsInTs(size_t uCoreMsNb, size_t uOverlapMsNb)
static const UInt_t kuBytesPerMessageTof
TCanvas * fcMsSizeTimeAll
void SaveAllHistos(TString sFileName="")
std::map< UInt_t, UInt_t > fmChannelsPerEqId
Parameters.
std::vector< UInt_t > fvuTsSzLink
TCanvas * fcDataRateTimeAll
static const UInt_t kuSysIdBmon
std::vector< TH1 * > fvhMsSzPerLink
std::vector< TH1 * > fvhMsMeanChDataPerLink
TCanvas * fcMsMessTimeAll
std::vector< TH1 * > fvhDataRateTimePerLink
CbmMcbm2018MonitorDataRates()
static const UInt_t kuSysIdSts
Constants.
TH1 * fhDataRateTimeAllLinks
static const UInt_t kuBytesPerMessageSts
Bool_t ReInitContainers()
UInt_t fuHistoryHistoSize
static const UInt_t kuBytesPerMessageBmon
std::vector< TH1 * > fvhMsMessPerLink
static const UInt_t kuSysIdRich
std::vector< TH1 * > fvhTsSzPerLink
static const UInt_t kuBytesPerMessageRich
uint64_t fulCurrentTsIndex
std::vector< TProfile * > fvhTsSzTimePerLink
static const UInt_t kuSysIdMuch
std::vector< size_t > fvMsComponentsList
FLES containers.
TCanvas * fcMsDataChTimeAll
virtual Bool_t DoUnpack(const fles::Timeslice &ts, size_t component)
std::vector< TH1 * > fvhMsMeanChDataTimePerLink
TCanvas * fcTsSizeTimeAll
virtual void AddMsComponentToList(size_t component, UShort_t usDetectorId)
std::vector< TProfile * > fvhMsMessTimePerLink
static const UInt_t kuSysIdTof
Double_t fdStartTimeMsSz
Histograms and histogram control variables.
std::vector< TProfile * > fvhMsSzTimePerLink
static const UInt_t kuBytesPerMessageMuch
virtual ~CbmMcbm2018MonitorDataRates()
size_t fuMsAcceptsPercent
/** Ignore Overlap Ms: all fuOverlapMsNb MS at the end of timeslice **/
Data class with information on a STS local track.