270 TString sHistName {
""};
273 sHistName =
"hPulserMessageType";
274 title =
"Nb of message for each type; Type";
289 sHistName =
"hPulserSysMessType";
290 title =
"Nb of system message for each type; System Type";
298 sHistName =
"hPulserMessageTypePerDpb";
299 title =
"Nb of message of each type for each DPB; DPB; Type";
314 sHistName =
"hPulserSysMessTypePerDpb";
315 title =
"Nb of system message of each type for each DPB; DPB; System Type";
323 sHistName =
"hPulserMessageTypePerElink";
324 title =
"Nb of message of each type for each eLink; eLink; Type";
340 sHistName =
"hPulserSysMessTypePerElink";
341 title =
"Nb of system message of each type for each eLink; eLink; System Type";
354 const Int_t iNbDecadesRate = 9;
355 const Int_t iNbStepsDecade = 9;
356 const Int_t iNbSubStepsInStep = 10;
357 const Int_t iNbBinsRate = iNbStepsDecade + iNbStepsDecade * iNbSubStepsInStep * iNbDecadesRate + 1;
358 Double_t dBinsRate[iNbBinsRate];
360 for (
Int_t iSubU = 0; iSubU < iNbStepsDecade; iSubU++)
361 dBinsRate[iSubU] = 0.1 * (1 + iSubU);
362 std::cout << std::endl;
364 Double_t dSubstepSize = 1.0 / iNbSubStepsInStep;
365 for (
Int_t iDecade = 0; iDecade < iNbDecadesRate; iDecade++) {
366 Double_t dBase = std::pow(10, iDecade);
367 Int_t iDecadeIdx = iNbStepsDecade + iDecade * iNbStepsDecade * iNbSubStepsInStep;
368 for (
Int_t iStep = 0; iStep < iNbStepsDecade; iStep++) {
369 Int_t iStepIdx = iDecadeIdx + iStep * iNbSubStepsInStep;
370 for (
Int_t iSubStep = 0; iSubStep < iNbSubStepsInStep; iSubStep++) {
371 dBinsRate[iStepIdx + iSubStep] = dBase * (1 + iStep) + dBase * dSubstepSize * iSubStep;
375 dBinsRate[iNbBinsRate - 1] = std::pow(10, iNbDecadesRate);
381 UInt_t uNbBinEvo = (32768 + 1) * 2;
383 Double_t dMinEdgeEvo = dMaxEdgeEvo * -1.0;
387 for (UInt_t uXyterIdx = 0; uXyterIdx <
fuNbStsXyters; ++uXyterIdx) {
389 sHistName = Form(
"hPulserChanCntRaw_%03u", uXyterIdx);
390 title = Form(
"Hits Count per channel, StsXyter #%03u; Channel; Hits []", uXyterIdx);
393 sHistName = Form(
"hPulserChanCntRawGood_%03u", uXyterIdx);
394 title = Form(
"Hits Count per channel in good MS, StsXyter #%03u; Channel; Hits []", uXyterIdx);
398 sHistName = Form(
"hPulserChanAdcRaw_%03u", uXyterIdx);
399 title = Form(
"Raw Adc distribution per channel, StsXyter #%03u; Channel "
400 "[]; Adc []; Hits []",
406 sHistName = Form(
"hPulserChanAdcRawProfc_%03u", uXyterIdx);
407 title = Form(
"Raw Adc prodile per channel, StsXyter #%03u; Channel []; Adc []", uXyterIdx);
411 sHistName = Form(
"hPulserChanRawTs_%03u", uXyterIdx);
412 title = Form(
"Raw Timestamp distribution per channel, StsXyter #%03u; "
413 "Channel []; Ts []; Hits []",
419 sHistName = Form(
"hPulserChanMissEvt_%03u", uXyterIdx);
420 title = Form(
"Missed Event flags per channel, StsXyter #%03u; Channel []; "
421 "Miss Evt []; Hits []",
428 sHistName = Form(
"hPulserChanMissEvtEvo_%03u", uXyterIdx);
429 title = Form(
"Missed Evt flags per second & channel in StsXyter #%03u; "
430 "Time [s]; Channel []; Missed Evt flags []",
437 sHistName = Form(
"hPulserFebMissEvtEvo%03u", uXyterIdx);
438 title = Form(
"Missed Evt flags per second in StsXyter #%03u; Time [s]; "
439 "Missed Evt flags []",
444 sHistName = Form(
"hPulserChanRateEvo_%03u", uXyterIdx);
445 title = Form(
"Hits per second & channel in StsXyter #%03u; Time [s]; "
446 "Channel []; Hits []",
452 sHistName = Form(
"hPulserFebRateEvo_%03u", uXyterIdx);
453 title = Form(
"Hits per second in StsXyter #%03u; Time [s]; Hits []", uXyterIdx);
457 sHistName = Form(
"hPulserChanRateEvoLong_%03u", uXyterIdx);
458 title = Form(
"Hits per second & channel in StsXyter #%03u; Time [min]; "
459 "Channel []; Hits []",
465 sHistName = Form(
"hPulserFebRateEvoLong_%03u", uXyterIdx);
466 title = Form(
"Hits per second in StsXyter #%03u; Time [min]; Hits []", uXyterIdx);
470 sHistName = Form(
"fhPulserTimeDiffPerAsic_%03u", uXyterIdx);
471 title = Form(
"Time diff for pulser hits between ASIC %03u and other ASICs; "
472 "tn - t%03u [ns]; ASIC n; Counts",
473 uXyterIdx, uXyterIdx);
477 for (UInt_t uXyterIdxB = 0; uXyterIdxB <
fuNbStsXyters; ++uXyterIdxB) {
478 if (uXyterIdxB == uXyterIdx) {
479 sHistName = Form(
"fhPulserTimeDiffSameAsic_%03u", uXyterIdx);
480 title = Form(
"Time diff for consecutive hits in ASIC %03u; tn - t [ns]; Counts", uXyterIdx);
483 sHistName = Form(
"fhPulserTimeDiffPerAsicPair_%03u_%03u", uXyterIdx, uXyterIdxB);
484 title = Form(
"Time diff for pulser hits in ASIC %03u and %03u; tn - t "
486 uXyterIdx, uXyterIdxB);
490 if (uXyterIdxB == uXyterIdx) {
491 sHistName = Form(
"fhPulserTimeDiffEvoSameAsic_%03u", uXyterIdx);
492 title = Form(
"Time diff for consecutive hits in ASIC %03u; Time in run "
493 "[s]; tn - t [ns]; Counts",
497 sHistName = Form(
"fhPulserTimeDiffEvoPerAsicPair_%03u_%03u", uXyterIdx, uXyterIdxB);
498 title = Form(
"Time diff for pulser hits in ASIC %03u and %03u; Time in "
499 "run [s]; tn - t [ns]; Counts",
500 uXyterIdx, uXyterIdxB);
505 sHistName = Form(
"fhPulserTsLsbMatchPerAsicPair_%03u_%03u", uXyterIdx, uXyterIdxB);
506 title = Form(
"TS LSB for pulser hits in ASIC %03u and %03u; TS LSB %03u "
507 "[bin]; TS LSB %03u [bin]",
508 uXyterIdx, uXyterIdxB, uXyterIdx, uXyterIdxB);
510 new TH2I(sHistName, title, 256, -0.5, 255.5, 256, -0.5, 255.5));
512 sHistName = Form(
"fhPulserTsMsbMatchPerAsicPair_%03u_%03u", uXyterIdx, uXyterIdxB);
513 title = Form(
"TS MSB for pulser hits in ASIC %03u and %03u; TS MSB %03u "
514 "[bin]; TS MSB %03u [bin]",
515 uXyterIdx, uXyterIdxB, uXyterIdx, uXyterIdxB);
519 sHistName = Form(
"fhPulserIntervalAsic_%03u", uXyterIdx);
520 title = Form(
"Time diff between consecutive hits in ASIC %03us; dt [ns]; Counts", uXyterIdx, uXyterIdx);
523 sHistName = Form(
"fhPulserIntervalLongAsic_%03u", uXyterIdx);
524 title = Form(
"Time diff between consecutive hits in ASIC %03us; dt [ns]; Counts", uXyterIdx, uXyterIdx);
548 THttpServer* server = FairRunOnline::Instance()->GetHttpServer();
556 for (UInt_t uXyterIdx = 0; uXyterIdx <
fuNbStsXyters; ++uXyterIdx) {
571 for (UInt_t uXyterIdxB = 0; uXyterIdxB <
fuNbStsXyters; ++uXyterIdxB) {
572 if (uXyterIdxB == uXyterIdx) {
588 server->RegisterCommand(
"/Reset_All_Pulser",
"bCosy2018ResetPulser=kTRUE");
589 server->RegisterCommand(
"/Write_All_Pulser",
"bCosy2018WritePulser=kTRUE");
591 server->Restrict(
"/Reset_All_Pulser",
"allow=admin");
592 server->Restrict(
"/Write_All_Pulser",
"allow=admin");
600 for (UInt_t uXyterIdx = 0; uXyterIdx <
fuNbStsXyters; ++uXyterIdx) {
602 new TCanvas(Form(
"cStsSum_%03u", uXyterIdx), Form(
"Summary plots for StsXyter %03u", uXyterIdx), w,
h);
603 cStsSumm->Divide(2, 2);
625 TCanvas* cDtPerAsic =
new TCanvas(
"cDtPerAsic",
"Time Differences per ASIC", w,
h);
628 for (UInt_t uXyterIdx = 0; uXyterIdx <
fuNbStsXyters; ++uXyterIdx) {
629 cDtPerAsic->cd(1 + uXyterIdx);
638 TCanvas* cDtInAsic =
new TCanvas(
"cDtInAsic",
"Time Differences in ASIC", w,
h);
641 for (UInt_t uXyterIdx = 0; uXyterIdx <
fuNbStsXyters; ++uXyterIdx) {
642 cDtInAsic->cd(1 + uXyterIdx);
650 TCanvas* cDtAsicPairs =
new TCanvas(
"cDtAsicPairs",
"Time Differences in ASIC", w,
h);
652 cDtAsicPairs->Divide(3);
654 for (UInt_t uXyterIdx = 0; uXyterIdx <
fuNbStsXyters && uXyterIdx < 3; ++uXyterIdx) {
655 for (UInt_t uXyterIdxB = uXyterIdx + 1; uXyterIdxB <
fuNbStsXyters; ++uXyterIdxB) {
656 cDtAsicPairs->cd(uXyterIdx + uXyterIdxB);
665 TCanvas* cTsLsbAsicPairs =
new TCanvas(
"cTsLsbAsicPairs",
"Time Differences in ASIC", w,
h);
667 cTsLsbAsicPairs->Divide(3);
669 for (UInt_t uXyterIdx = 0; uXyterIdx <
fuNbStsXyters && uXyterIdx < 3; ++uXyterIdx) {
670 for (UInt_t uXyterIdxB = uXyterIdx + 1; uXyterIdxB <
fuNbStsXyters; ++uXyterIdxB) {
671 cTsLsbAsicPairs->cd(uXyterIdx + uXyterIdxB);
681 TCanvas* cTsMsbAsicPairs =
new TCanvas(
"cTsMsbAsicPairs",
"Time Differences in ASIC", w,
h);
683 cTsMsbAsicPairs->Divide(3);
685 for (UInt_t uXyterIdx = 0; uXyterIdx <
fuNbStsXyters && uXyterIdx < 3; ++uXyterIdx) {
686 for (UInt_t uXyterIdxB = uXyterIdx + 1; uXyterIdxB <
fuNbStsXyters; ++uXyterIdxB) {
687 cTsMsbAsicPairs->cd(uXyterIdx + uXyterIdxB);
700 fcMsSizeAll =
dynamic_cast<TCanvas*
>(gROOT->FindObject(
"cMsSizeAll"));
702 fcMsSizeAll =
new TCanvas(
"cMsSizeAll",
"Evolution of MS size in last 300 s", w,
h);
704 LOG(info) <<
"Created MS size canvas in STS monitor";
707 LOG(info) <<
"Recovered MS size canvas in STS monitor";
715 THttpServer* server = FairRunOnline::Instance()->GetHttpServer();
726 LOG(debug) <<
"Timeslice contains " << ts.num_microslices(component) <<
"microslices.";
729 if (NULL ==
fhMsSz[component]) {
730 TString sMsSzName = Form(
"MsSz_link_%02lu", component);
731 TString sMsSzTitle = Form(
"Size of MS for nDPB of link %02lu; Ms Size [bytes]", component);
732 fhMsSz[component] =
new TH1F(sMsSzName.Data(), sMsSzTitle.Data(), 160000, 0., 20000.);
733 fHM->Add(sMsSzName.Data(),
fhMsSz[component]);
734 if (server) server->Register(
"/FlibRaw",
fhMsSz[component]);
735 sMsSzName = Form(
"MsSzTime_link_%02lu", component);
736 sMsSzTitle = Form(
"Size of MS vs time for gDPB of link %02lu; Time[s] ; Ms Size [bytes]", component);
737 fhMsSzTime[component] =
new TProfile(sMsSzName.Data(), sMsSzTitle.Data(), 15000, 0., 300.);
739 if (server) server->Register(
"/FlibRaw",
fhMsSzTime[component]);
745 LOG(info) <<
"Added MS size histo for component: " << component <<
" (DPB)";
750 size_t numCompMsInTs = ts.num_microslices(component);
765 for (UInt_t uXyterIdx = 0; uXyterIdx <
fuNbStsXyters; ++uXyterIdx) {
780 LOG(info) <<
"CbmCosy2018MonitorPulser::DoUnpack => Changed fvuChanNbHitsInMs size " <<
fvuChanNbHitsInMs.size()
782 LOG(info) <<
"CbmCosy2018MonitorPulser::DoUnpack => Changed "
783 "fvuChanNbHitsInMs size "
785 LOG(info) <<
"CbmCosy2018MonitorPulser::DoUnpack => Changed "
786 "fvuChanNbHitsInMs size "
790 for (
size_t m = 0; m < numCompMsInTs; ++m) {
794 auto msDescriptor = ts.descriptor(component, m);
796 const uint8_t* msContent =
reinterpret_cast<const uint8_t*
>(ts.content(component, m));
798 uint32_t
size = msDescriptor.size;
802 <<
" has size: " <<
size;
818 LOG(error) <<
"The input microslice buffer does NOT "
819 <<
"contain only complete nDPB messages!";
825 const uint32_t* pInBuff =
reinterpret_cast<const uint32_t*
>(msContent);
827 for (uint32_t uIdx = 0; uIdx < uNbMessages; ++uIdx) {
829 uint32_t ulData =
static_cast<uint32_t
>(pInBuff[uIdx]);
846 LOG(fatal) <<
"CbmCosy2018MonitorPulser::DoUnpack => "
847 <<
"eLink index out of bounds!" << usElinkIdx <<
" VS " <<
fuNbElinksPerDpb;
865 LOG(info) <<
"CbmCosy2018MonitorPulser::DoUnpack => "
866 <<
"EPOCH message at unexpected position in MS: message " << uIdx <<
" VS message 0 expected!";
877 LOG(fatal) <<
"CbmCosy2018MonitorPulser::DoUnpack => "
878 <<
"Unknown message type, should never happen, stopping here!";
894 ULong64_t ulLastHitTime = (*(
fvmHitsInTs.rbegin())).GetTs();
895 std::vector<stsxyter::FinalHit>::iterator it;
896 std::vector<stsxyter::FinalHit>::iterator itB;
898 std::chrono::steady_clock::time_point tNow = std::chrono::steady_clock::now();
899 Double_t dUnixTimeInRun = std::chrono::duration_cast<std::chrono::seconds>(tNow -
ftStartTimeUnix).count();
904 UShort_t usAsicIdx = (*it).GetAsic();
905 UShort_t usChanIdx = (*it).GetChan();
906 ULong64_t ulHitTs = (*it).GetTs();
907 UShort_t usHitAdc = (*it).GetAdc();
919 UShort_t usChanIdx = (*it).GetChan();
923 for (UInt_t uAsicB = uAsic; uAsicB <
fuNbStsXyters; uAsicB++) {
925 UShort_t usChanIdxB = (*itB).GetChan();
926 Double_t dDt = (
static_cast<Double_t
>((*itB).GetTs()) -
static_cast<Double_t
>((*it).GetTs()))
935 ((*itB).GetTs() & 0x03F00) >> 8);
940 (
static_cast<Double_t
>((*it).GetTs()) -
static_cast<Double_t
>(
fvmLastHitAsic[uAsic].GetTs()))
958 for (UInt_t uDpb = 0; uDpb <
fuNrOfDpbs; ++uDpb) {
959 Double_t dTsMsbTime =
965 LOG(info) <<
"End of TS " << std::setw(7) << ts.index() <<
" eDPB " << std::setw(2) << uDpb
968 <<
" current TS MSB time is " << std::setw(12) << dTsMsbTime <<
" s";