257 LOG(info) <<
"create Histos for " <<
fuNrOfGdpbs <<
" gDPBs ";
259 THttpServer* server = FairRunOnline::Instance()->GetHttpServer();
263 UInt_t uHistoryHistoSize = 1800;
266 name =
"hMessageType";
267 title =
"Nb of message for each type; Type";
280 name =
"hSysMessType";
281 title =
"Nb of system message for each type; System Type";
289 name =
"hGet4MessType";
290 title =
"Nb of message for each type per GET4; GET4 chip # ; Type";
298 name =
"hGet4ChanScm";
299 title =
"SC messages per GET4 channel; GET4 channel # ; SC type";
309 name =
"hGet4ChanErrors";
310 title =
"Error messages per GET4 channel; GET4 channel # ; Error";
336 name =
"hGet4EpochFlags";
337 title =
"Epoch flags per GET4; GET4 chip # ; Type";
345 name =
"hGdpbMessageType";
346 title =
"Nb of message for each type per Gdpb; Type; Gdpb Idx []";
360 name =
"hGdpbSysMessType";
361 title =
"Nb of system message for each type per Gdpb; System Type; Gdpb Idx []";
370 name =
"hGdpbSysMessPattType";
371 title =
"Nb of pattern message for each type per Gdpb; Pattern Type; Gdpb Idx []";
379 name =
"hGdpbEpochFlags";
380 title =
"Epoch flags per gDPB; gDPB # ; Type";
388 name = Form(
"hGdpbEpochSyncEvo");
389 title = Form(
"Epoch SYNC per second and gDPB; Time[s]; gDPB #; SYNC Nb");
391 new TH2D(name.Data(), title.Data(), uHistoryHistoSize, 0, uHistoryHistoSize,
fuNrOfGdpbs, 0.,
fuNrOfGdpbs);
394 name = Form(
"hGdpbEpochMissEvo");
395 title = Form(
"Epoch Missmatch per second and gDPB; Time[s]; gDPB #; Missmatch Nb");
397 new TH2D(name.Data(), title.Data(), uHistoryHistoSize, 0, uHistoryHistoSize,
fuNrOfGdpbs, 0.,
fuNrOfGdpbs);
401 name =
"hPatternMissmatch";
402 title =
"Missmatch pattern integral per Gdpb; ASIC Pattern []; Gdpb Idx []";
405 name =
"hPatternEnable";
406 title =
"Enable pattern integral per Gdpb; ASIC Pattern []; Gdpb Idx []";
409 name =
"hPatternResync";
410 title =
"Resync pattern integral per Gdpb; ASIC Pattern []; Gdpb Idx []";
418 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
420 name = Form(
"hGdpbGet4MessType_%02u", uGdpb);
421 title = Form(
"Nb of message for each type per GET4 in gDPB %02u; GET4 chip # ; Type", uGdpb);
429 name = Form(
"hGdpbGet4ChanErrors_%02u", uGdpb);
430 title = Form(
"Error messages per GET4 channel in gDPB %02u; GET4 channel # ; Error", uGdpb);
459 Form(
"Epoch Counts per MS in gDPB %02u; Epochs/MS []; MS nb[]", uGdpb), 1000,
462 Form(
"hEpochsPerMsPerTs_gDPB%02u", uGdpb),
463 Form(
"Epoch Counts per MS in gDPB %02u; TS []; Epochs/MS []; MS nb[]", uGdpb), 10000, 0, 10000, 100, -0.5, 99.5));
465 Form(
"Epoch index difference per MS in gDPB %02u; Ep(N) - Ep(N "
468 1001, -500.5, 500.5));
470 Form(
"Epoch index difference per MS in gDPB %02u; TS []; Ep(N) "
471 "- Ep(N - 1) []; MS nb[]",
473 10000, 0, 10000, 101, -50.5, 50.5));
475 Form(
"Bits value in previous epoch when diff not 1 in gDPB "
476 "%02u; TS []; Bit []; Value[]",
478 32, -0.5, 31.5, 2, -0.5, 1.5));
480 Form(
"Bits value in new epoch when diff not 1 in gDPB %02u; TS "
481 "[]; Bit []; Value[]",
483 32, -0.5, 31.5, 2, -0.5, 1.5));
485 Form(
"Digits value in previous epoch when diff not 1 in gDPB "
486 "%02u; TS []; Digit []; Value[]",
488 10, -0.5, 9.5, 10, -0.5, 9.5));
490 Form(
"Digits value in new epoch when diff not 1 in gDPB %02u; "
491 "TS []; Digit []; Value[]",
493 10, -0.5, 9.5, 10, -0.5, 9.5));
495 Form(
"MS start with Epoch in gDPB %02u?; TS []; 1st Msg is "
496 "Epoch? []; MS nb[]",
498 10000, 0, 10000, 2, -0.5, 1.5));
500 Form(
"MS close with Epoch in gDPB %02u?; TS []; Last Msg is "
501 "Epoch? []; MS nb[]",
503 10000, 0, 10000, 2, -0.5, 1.5));
505 Form(
"Hit Counts per MS in first channel in gDPB %02u; TS []; "
506 "Hits/MS []; MS nb[]",
508 10000, 0, 10000, 150, -0.5, 149.5));
510 Form(
"Mean Hit count per MS and channel vs Time in gDPB "
511 "%02u; TS []; Channel []; <Hits/Ms> []",
536 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
555 server->RegisterCommand(
"/Reset_All_eTOF",
"bCheckFormatGdpbResetHistos=kTRUE");
556 server->RegisterCommand(
"/Save_All_eTof",
"bCheckFormatGdpbSaveHistos=kTRUE");
558 server->Restrict(
"/Reset_All_eTof",
"allow=admin");
559 server->Restrict(
"/Save_All_eTof",
"allow=admin");
565 fcSummary =
new TCanvas(
"cSummary",
"gDPB Monitoring Summary");
593 server->Register(
"/canvases",
fcSummary);
596 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
597 fcFormatGdpb.push_back(
new TCanvas(Form(
"cFormatGdpb%02u", uGdpb), Form(
"gDPB %02u Data Format Check", uGdpb)));
650 fcMsSizeAll =
dynamic_cast<TCanvas*
>(gROOT->FindObject(
"cMsSizeAll"));
652 fcMsSizeAll =
new TCanvas(
"cMsSizeAll",
"Evolution of MS size in last 300 s", w,
h);
654 LOG(info) <<
"Created MS size canvas in TOF monitor";
657 LOG(info) <<
"Recovered MS size canvas in TOF monitor";
661 LOG(info) <<
"Leaving CreateHistograms";
667 LOG(info) <<
"Reset eTOF STAR histos ";
672 LOG(info) <<
"Start saving eTOF STAR histos ";
678 std::chrono::time_point<std::chrono::system_clock> timeCurrent = std::chrono::system_clock::now();
683 else if (300 < elapsed_seconds.count()) {
684 std::time_t cTimeCurrent = std::chrono::system_clock::to_time_t(timeCurrent);
686 std::strftime(tempBuff, 80,
"%F %T", localtime(&cTimeCurrent));
691 LOG(debug1) <<
"Timeslice contains " << ts.num_microslices(component) <<
"microslices.";
694 if (0 == ts.index())
return kTRUE;
704 Int_t messageType = -111;
708 for (UInt_t uMsIdx = 0; uMsIdx < uNbMsLoop; uMsIdx++) {
716 auto msDescriptor = ts.descriptor(uMsComp, uMsIdx);
732 constexpr uint32_t kuBytesPerMessage = 8;
735 auto msDescriptor = ts.descriptor(uMsComp, uMsIdx);
737 fdMsIndex =
static_cast<double>(msDescriptor.idx);
739 const uint8_t* msContent =
reinterpret_cast<const uint8_t*
>(ts.content(uMsComp, uMsIdx));
741 uint32_t
size = msDescriptor.size;
743 if (
size > 0) LOG(debug) <<
"Microslice: " << msDescriptor.idx <<
" has size: " <<
size;
753 if (0 != (
size % kuBytesPerMessage))
754 LOG(error) <<
"The input microslice buffer does NOT "
755 <<
"contain only complete nDPB messages!";
758 uint32_t uNbMessages = (
size - (
size % kuBytesPerMessage)) / kuBytesPerMessage;
766 LOG(info) <<
"---------------------------------------------------------------";
777 LOG(error) <<
"Could not find the gDPB index for AFCK id 0x" << std::hex <<
fuGdpbId << std::dec
779 << uMsCompIdx <<
"\n"
780 <<
"If valid this index has to be added in the TOF "
781 "parameter file in the RocIdArray field";
788 const uint64_t* pInBuff =
reinterpret_cast<const uint64_t*
>(msContent);
789 for (uint32_t uIdx = 0; uIdx < uNbMessages; uIdx++) {
791 uint64_t ulData =
static_cast<uint64_t
>(pInBuff[uIdx]);
794 if (0 == uIdx) {
continue; }
811 <<
" set in parameters.";
814 if (uNbMessages - 1 == uIdx)
817 switch (messageType) {
865 Long64_t iEpDiff = ulEpochNr;
871 for (UInt_t uBit = 0; uBit < 32; ++uBit) {
877 for (UInt_t uDigit = 0; uDigit < 10; ++uDigit) {
881 TMath::Floor((ulEpochNr % (10 * uPower)) / uPower));
1020 LOG(error) <<
"Message type " << std::hex << std::setw(2) << static_cast<uint16_t>(messageType)
1021 <<
" not included in Get4 unpacker.";
1026 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {