16#include "FairRootManager.h"
18#include "FairRunOnline.h"
19#include "FairRuntimeDb.h"
22#include "TClonesArray.h"
27#include "THttpServer.h"
29#include "TPaveStats.h"
31#include "TProfile2D.h"
89 LOG(info) <<
"Initializing Get4 monitor";
91 FairRootManager* ioman = FairRootManager::Instance();
92 if (ioman == NULL) { LOG(fatal) <<
"No FairRootManager instance"; }
101 LOG(info) <<
"Init parameter containers for " << GetName();
111 LOG(info) <<
"ReInit parameter containers for " << GetName();
125 UInt_t uComp = component;
139 uint32_t iNbBinsLog = 0;
142 double* dBinsLog = dBinsLogVector.data();
147 new TH1D(Form(
"DataRateTime_link_%02u", uComp),
148 Form(
"Data Rate vs time for DPB of link %02u; Time[s] ; DataRate [bytes/s]", uComp),
fuHistoryHistoSize,
153 Form(
"Size of TS from link %02u; Ts Size [bytes]", uComp), iNbBinsLog, dBinsLog);
156 new TProfile(Form(
"TsSzTime_link_%02u", uComp),
157 Form(
"Size of TS vs time for DPB of link %02u; Time[s] ; Ts Size [bytes]", uComp),
160 TString sMsSzName = Form(
"MsSz_link_%02u", uComp);
161 TString sMsSzTitle = Form(
"Size of MS from link %02u; Ms Size [bytes]", uComp);
162 fvhMsSzPerLink[uComp] =
new TH1F(sMsSzName.Data(), sMsSzTitle.Data(), 160000, 0., 20000.);
164 sMsSzName = Form(
"MsSzTime_link_%02u", uComp);
165 sMsSzTitle = Form(
"Size of MS vs time for DPB of link %02u; Time[s] ; Ms Size [bytes]", uComp);
169 sMsSzName = Form(
"MsMess_link_%02u", uComp);
170 sMsSzTitle = Form(
"Messages Number of MS from link %02u; Mess Nb []", uComp);
171 fvhMsMessPerLink[uComp] =
new TH1F(sMsSzName.Data(), sMsSzTitle.Data(), 5000, 0., 5000.);
173 sMsSzName = Form(
"MsMessTime_link_%02u", uComp);
174 sMsSzTitle = Form(
"Messages Number of MS vs time for DPB of link %02u; "
175 "Time[s] ; Mess Nb []",
180 sMsSzName = Form(
"MsMeanChData_link_%02u", uComp);
181 sMsSzTitle = Form(
"Mean data size per channels of MS from link %02u; Mean Ch Data [bytes]", uComp);
184 sMsSzName = Form(
"MsMeanChDataTime_link_%02u", uComp);
185 sMsSzTitle = Form(
"Mean data size per channel of MS vs time for DPB of "
186 "link %02u; Time[s] ; Mean Ch Data[bytes]",
196 LOG(info) <<
"Added MS size histo for component (link): " << component;
208 LOG(info) <<
"create Histos ";
210 THttpServer* server = FairRunOnline::Instance()->GetHttpServer();
213 uint32_t iNbBinsLog = 0;
216 double* dBinsLog = dBinsLogVector.data();
219 fhDataRateTimeAllLinks =
new TH1D(
"DataRateTime_all",
"Data Rate vs time for all DPBs; Time[s] ; DataRate [MB/s]",
225 new TH1D(Form(
"DataRateTime_link_%02u", uComp),
226 Form(
"Data Rate vs time for DPB of link %02u; Time[s] ; DataRate [MB/s]", uComp),
fuHistoryHistoSize, 0.,
231 Form(
"Size of TS from link %02u; Ts Size [bytes]", uComp), iNbBinsLog, dBinsLog);
234 new TProfile(Form(
"TsSzTime_link_%02u", uComp),
235 Form(
"Size of TS vs time for DPB of link %02u; Time[s] ; Ts Size [bytes]", uComp),
239 TString sMsSzName = Form(
"MsSz_link_%02u", uComp);
240 TString sMsSzTitle = Form(
"Size of MS from link %02u; Ms Size [bytes]", uComp);
241 fvhMsSzPerLink[uComp] =
new TH1F(sMsSzName.Data(), sMsSzTitle.Data(), iNbBinsLog, dBinsLog);
243 sMsSzName = Form(
"MsSzTime_link_%02u", uComp);
244 sMsSzTitle = Form(
"Size of MS vs time for DPB of link %02u; Time[s] ; Ms Size [bytes]", uComp);
248 sMsSzName = Form(
"MsMess_link_%02u", uComp);
249 sMsSzTitle = Form(
"Messages Number of MS from link %02u; Mess Nb []", uComp);
250 fvhMsMessPerLink[uComp] =
new TH1F(sMsSzName.Data(), sMsSzTitle.Data(), 5000, 0., 5000.);
252 sMsSzName = Form(
"MsMessTime_link_%02u", uComp);
253 sMsSzTitle = Form(
"Messages Number of MS vs time for DPB of link %02u; "
254 "Time[s] ; Mess Nb []",
259 sMsSzName = Form(
"MsMeanChData_link_%02u", uComp);
260 sMsSzTitle = Form(
"Mean data size per channels of MS from link %02u; Mean Ch Data [bytes]", uComp);
263 sMsSzName = Form(
"MsMeanChDataTime_link_%02u", uComp);
264 sMsSzTitle = Form(
"Mean data size per channel of MS vs time for DPB of "
265 "link %02u; Time[s] ; Mean Ch Data[bytes]",
281 fcTsSizeAll =
new TCanvas(
"cTsSizeAll",
"TS size per link", w,
h);
283 fcTsSizeTimeAll =
new TCanvas(
"cTsSizeTimeAll",
"Evolution of TS size per link", w,
h);
286 fcMsSizeAll =
new TCanvas(
"cMsSizeAll",
"MS size per link", w,
h);
288 fcMsSizeTimeAll =
new TCanvas(
"cMsSizeTimeAll",
"Evolution of MS size per link", w,
h);
291 fcMsMessAll =
new TCanvas(
"cMsMessAll",
"MS message number per link", w,
h);
293 fcMsMessTimeAll =
new TCanvas(
"cMsMessTimeAll",
"Evolution of MS message number per link", w,
h);
296 fcMsDataChAll =
new TCanvas(
"fcMsDataChAll",
"Mean data per channel in each MS, per link", w,
h);
298 fcMsDataChTimeAll =
new TCanvas(
"fcMsDataChTimeAll",
"Evolution of Mean data per channel per link", w,
h);
358 LOG(info) <<
"Created MS size canvas";
384 server->RegisterCommand(
"/Reset_All_Hist",
"bMcbmMoniDataRateResetHistos=kTRUE");
385 server->RegisterCommand(
"/Save_All_Hist",
"bMcbmMoniDataRateSaveHistos=kTRUE");
387 server->Restrict(
"/Reset_All_Hist",
"allow=admin");
388 server->Restrict(
"/Save_All_Hist",
"allow=admin");
391 LOG(info) <<
"Leaving CreateHistograms";
397 LOG(info) <<
"Reset eTOF STAR histos ";
402 LOG(info) <<
"Start saving Data Rates Moni histos ";
408 if (0 == ts.index())
return kTRUE;
422 for (UInt_t uMsIdx = 0; uMsIdx < uNbMsLoop; uMsIdx++) {
430 auto msDescriptor = ts.descriptor(uMsComp, uMsIdx);
449 auto msDescriptor = ts.descriptor(uMsComp, uMsIdx);
450 UInt_t uSysId = msDescriptor.sys_id;
452 fdMsIndex =
static_cast<double>(msDescriptor.idx) * (1e-9);
456 uint32_t
size = msDescriptor.size;
457 Double_t dSizeMb =
size;
458 dSizeMb = dSizeMb / 1024 / 1024;
478 uint32_t uNbMessages = 0;
485 default: uNbMessages = (
size - (
size % 4)) / 4;
492 Double_t dMeanDataPerChan =
size;
519 TFile* oldFile = gFile;
520 TDirectory* oldDir = gDirectory;
522 TFile* histoFile = NULL;
523 if (
"" != sFileName) {
525 histoFile =
new TFile(sFileName,
"RECREATE");
529 gDirectory->mkdir(
"Flib_Raw");
530 gDirectory->cd(
"Flib_Raw");
551 TH1* pMissedTsH1 =
dynamic_cast<TH1*
>(gROOT->FindObjectAny(
"Missed_TS"));
552 if (NULL != pMissedTsH1) pMissedTsH1->Write();
554 TProfile* pMissedTsEvoP =
dynamic_cast<TProfile*
>(gROOT->FindObjectAny(
"Missed_TS_Evo"));
555 if (NULL != pMissedTsEvoP) pMissedTsEvoP->Write();
557 gDirectory->cd(
"..");
560 if (
"" != sFileName) {
572 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 **/
Double_t fdTsCoreSizeInNs
Data class with information on a STS local track.