19#include "FairRootManager.h"
21#include "FairRunOnline.h"
22#include "FairRuntimeDb.h"
27#include "TClonesArray.h"
32#include "THttpServer.h"
34#include "TPaveStats.h"
36#include "TProfile2D.h"
59 , fvMsComponentsList()
62 , fbIgnoreOverlapMs(kFALSE)
63 , fsHistoFileFullname(
"data/TofPulserHistos.root")
64 , fuMsAcceptsPercent(100)
69 , fdTsCoreSizeInNs(0.0)
76 , fuNrOfChannelsPerGet4(0)
77 , fuNrOfChannelsPerFee(0)
79 , fuNrOfGet4PerGdpb(0)
80 , fuNrOfChannelsPerGdpb(0)
81 , fuRawDataPrintMsgNb(100000)
82 , fuRawDataPrintMsgIdx(fuRawDataPrintMsgNb)
83 , fbPrintAllHitsEnable(kFALSE)
84 , fbPrintAllEpochsEnable(kFALSE)
86 , fuDiamondDpbIdx(10000)
97 , fviMsgCounter(11, 0)
103 , fvulGdpbTsFullLast()
104 , fvulStarTsFullLast()
106 , fvuStarDaqCmdLast()
107 , fvuStarTrigCmdLast()
109 , fvbFirstEpochSeen()
110 , fvulCurrentEpochCycle()
111 , fvulCurrentEpochFull()
112 , fulCurrentEpochTime(0)
115 , fvuFeeNbHitsLastMs()
116 , fdTsLastPulserHit()
117 , fvuCoincNbHitsLastMs()
118 , fvdCoincTsLastHit()
119 , dMinDt(-1. * (kuNbBinsDt *
gdpbv100::kdBinSize / 2.) -
gdpbv100::kdBinSize / 2.)
120 , dMaxDt(1. * (kuNbBinsDt *
gdpbv100::kdBinSize / 2.) +
gdpbv100::kdBinSize / 2.)
122 , fuNbFeePlotsPerGdpb(0)
124 , fdStartTimeLong(-1.)
125 , fdStartTimeMsSz(-1.)
126 , fuHistoryHistoSize(1800)
127 , fuHistoryHistoSizeLong(600)
128 , fdLastRmsUpdateTime(0.0)
129 , fdFitZoomWidthPs(0.0)
131 , fvhMsSzPerLink(12, NULL)
132 , fvhMsSzTimePerLink(12, NULL)
133 , fvhTimeDiffPulser()
134 , fhTimeMeanPulser(NULL)
135 , fhTimeRmsPulser(NULL)
136 , fhTimeRmsZoomFitPuls(NULL)
137 , fhTimeResFitPuls(NULL)
138 , fvhPulserCountEvoPerFeeGdpb()
139 , fvhPulserTimeDiffEvoGbtxGbtx()
140 , fvvhPulserTimeDiffEvoGdpbGdpb()
141 , fvvhPulserTimeDiffEvoFeeFee()
146 , fTimeLastHistoSaving()
154 LOG(info) <<
"Initializing Get4 monitor";
156 FairRootManager* ioman = FairRootManager::Instance();
157 if (ioman == NULL) { LOG(fatal) <<
"No FairRootManager instance"; }
164 LOG(info) <<
"Setting parameter containers for " << GetName();
170 LOG(info) <<
"Init parameter containers for " << GetName();
192 LOG(info) <<
"ReInit parameter containers for " << GetName();
222 LOG(info) <<
"GDPB Id of TOF " << i <<
" : " << std::hex <<
fUnpackPar->
GetGdpbId(i) << std::dec;
235 for (UInt_t uGbtx = 0; uGbtx <
fuNrOfGbtx; ++uGbtx) {
242 LOG(info) <<
"Nr. of RPCs per GBTx: ";
243 std::stringstream ss;
244 for (UInt_t uGbtx = 0; uGbtx <
fuNrOfGbtx; ++uGbtx)
246 LOG(info) << ss.str();
248 LOG(info) <<
"RPC type per GBTx: ";
250 for (UInt_t uGbtx = 0; uGbtx <
fuNrOfGbtx; ++uGbtx)
252 LOG(info) << ss.str();
254 LOG(info) <<
"RPC side per GBTx: ";
256 for (UInt_t uGbtx = 0; uGbtx <
fuNrOfGbtx; ++uGbtx)
258 LOG(info) << ss.str();
260 LOG(info) <<
"Module ID per GBTx: ";
262 for (UInt_t uGbtx = 0; uGbtx <
fuNrOfGbtx; ++uGbtx)
264 LOG(info) << ss.str();
284 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
317 UInt_t uGet4topadi[32] = {4, 3, 2, 1,
318 8, 7, 6, 5, 12, 11, 10, 9, 16, 15, 14, 13, 20, 19,
319 18, 17, 24, 23, 22, 21, 28, 27, 26, 25, 32, 31, 30, 29};
321 UInt_t uPaditoget4[32] = {4, 3, 2, 1,
322 12, 11, 10, 9, 20, 19, 18, 17, 28, 27, 26, 25, 32, 31,
323 30, 29, 8, 7, 6, 5, 16, 15, 14, 13, 24, 23, 22, 21};
334 UInt_t kuElinkToGet4[
kuNbGet4PerGbtx] = {27, 2, 7, 3, 31, 26, 30, 1, 33, 37, 32, 13, 9, 14,
335 10, 15, 17, 21, 16, 35, 34, 38, 25, 24, 0, 6, 20, 23,
336 18, 22, 28, 4, 29, 5, 19, 36, 39, 8, 12, 11};
337 UInt_t kuGet4ToElink[
kuNbGet4PerGbtx] = {24, 7, 1, 3, 31, 33, 25, 2, 37, 12, 14, 39, 38, 11,
338 13, 15, 18, 16, 28, 34, 26, 17, 29, 27, 23, 22, 5, 0,
339 30, 32, 6, 4, 10, 8, 20, 19, 35, 9, 21, 36};
361 TString sMsSzName = Form(
"MsSz_link_%02lu", component);
362 TString sMsSzTitle = Form(
"Size of MS from link %02lu; Ms Size [bytes]", component);
363 fvhMsSzPerLink[component] =
new TH1F(sMsSzName.Data(), sMsSzTitle.Data(), 160000, 0., 20000.);
365 sMsSzName = Form(
"MsSzTime_link_%02lu", component);
366 sMsSzTitle = Form(
"Size of MS vs time for gDPB of link %02lu; Time[s] ; Ms Size [bytes]", component);
369 THttpServer* server = FairRunOnline::Instance()->GetHttpServer();
379 LOG(info) <<
"Added MS size histo for component (link): " << component;
392 LOG(info) <<
"create Histos for " <<
fuNrOfGdpbs <<
" gDPBs ";
394 THttpServer* server = FairRunOnline::Instance()->GetHttpServer();
403 Double_t dBinSzG4v2 = (6250. / 112.);
423 new TH1I(Form(
"hTimeDiffPulser_g%02u_f%1u_g%02u_f%1u",
424 uGdpbA, uFeeIdA, uGdpbB, uFeeIdB),
425 Form(
"Time difference for pulser on gDPB %02u FEE %1u and "
426 "gDPB %02u FEE %1u; DeltaT [ps]; Counts",
427 uGdpbA, uFeeIdA, uGdpbB, uFeeIdB),
435 name =
"hTimeMeanPulser";
438 "Time difference Mean for each FEE pairs; FEE A; FEE B ; Mean [ps]",
442 name =
"hTimeRmsPulser";
445 "Time difference RMS for each FEE pairs; FEE A; FEE B ; RMS [ps]",
449 name =
"hTimeRmsZoomFitPuls";
452 "Time difference RMS after zoom for each FEE "
453 "pairs; FEE A; FEE B ; RMS [ps]",
457 name =
"hTimeResFitPuls";
460 "Time difference Res from fit for each FEE pairs; FEE A; FEE B ; Sigma [ps]",
466 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
468 name = Form(
"hPulserCountEvoPerFeeGdpb%02u", uGdpb);
471 Form(
"Pulser count per FEE in gDPB %02u; time in run [s]; dt [ps]",
477 name = Form(
"hPulserTimeDiffEvoGdpb%02uGbtx00Gbtx%02u", uGdpb, uGbtx + 1);
479 new TProfile(name.Data(),
480 Form(
"Time difference of the 1st FEE in the 1st GBTx of "
481 "gDPB %02u vs GBTx %02u; time in run [s]; dt [ps]",
488 for (UInt_t uGdpbB = uGdpb + 1; uGdpbB <
fuNrOfGdpbs; ++uGdpbB) {
489 name = Form(
"hPulserTimeDiffEvoGdpb%02uGdpb%02u", uGdpb, uGdpbB);
491 new TProfile(name.Data(),
492 Form(
"Time difference of the 1st FEE in the 1st GBTx of "
493 "gDPB %02u vs %02u; time in run [s]; dt [ps]",
501 for (UInt_t uFeeRef = 0; uFeeRef <
kuNbRefFeeEvo; ++uFeeRef) {
511 new TProfile(Form(
"hTimeDiffEvoFeeFee_g%02u_f%02u_g%02u_f%02u",
512 uGdpbRef, uFeeIdRef, uGdpb, uFeeId),
513 Form(
"Time difference for pulser on gDPB %02u FEE %1u and "
514 "gDPB %02u FEE %02u; time in run [s]; DeltaT [ps]",
515 uGdpbRef, uFeeIdRef, uGdpb, uFeeId),
528 Form(
"hFeeFtDistribPerCh_g%02u_f%02u", uGdpb, uFeeId ),
529 Form(
"FT distribution per channel for gDPB %02u FEE %02u", uGdpb, uFeeId ),
533 Form(
"hFeeFtNormDnl_g%02u_f%02u", uGdpb, uFeeId ),
534 Form(
"Normalized DNL per channel for gDPB %02u FEE %02u", uGdpb, uFeeId ),
538 Form(
"hFeeFtNormInl_g%02u_f%02u", uGdpb, uFeeId ),
539 Form(
"Normalized INL per channel for gDPB %02u FEE %02u", uGdpb, uFeeId ),
557 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
562 for (UInt_t uGdpbB = uGdpb + 1; uGdpbB <
fuNrOfGdpbs; ++uGdpbB)
573 server->RegisterCommand(
"/Reset_All_eTOF",
"bMcbmMoniTofPulserResetHistos=kTRUE");
574 server->RegisterCommand(
"/Save_All_eTof",
"bMcbmMoniTofPulserSaveHistos=kTRUE");
575 server->RegisterCommand(
"/Update_PulsFit",
"bMcbmMoniTofPulserUpdateZoomedFit=kTRUE");
576 server->RegisterCommand(
"/Print_Raw_Data",
"bMcbmMoniTofPulserRawDataPrint=kTRUE");
577 server->RegisterCommand(
"/Print_AllHits",
"bMcbmMoniTofPulserPrintAllHitsEna=kTRUE");
578 server->RegisterCommand(
"/Print_AllEps",
"bMcbmMoniTofPulserPrintAllEpochsEna=kTRUE");
580 server->Restrict(
"/Reset_All_eTof",
"allow=admin");
581 server->Restrict(
"/Save_All_eTof",
"allow=admin");
582 server->Restrict(
"/Update_PulsFit",
"allow=admin");
583 server->Restrict(
"/Update_DnlInl",
"allow=admin");
584 server->Restrict(
"/Print_Raw_Data",
"allow=admin");
585 server->Restrict(
"/Print_AllHits",
"allow=admin");
586 server->Restrict(
"/Print_AllEps",
"allow=admin");
594 TCanvas* cPulser =
new TCanvas(
"cPulser",
"Time difference RMS for pulser channels when FEE pulser mode is ON", w,
h);
595 cPulser->Divide(2, 2);
619 TCanvas* cPulserEvo =
620 new TCanvas(
"cPulserEvo",
"Time difference evolution between 1st FEE of 1st GBTx of gDPB pairs", w,
h);
622 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs - 1; uGdpb++) {
623 cPulserEvo->cd(1 + uGdpb);
632 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; uGdpb++) {
633 TCanvas* cPulserEvoGbtx =
634 new TCanvas(Form(
"cPulserEvoGbtx%02u", uGdpb),
635 Form(
"Time difference evolution between 1st FEE of GBTx pairs in gDPB %02u", uGdpb), w,
h);
639 cPulserEvoGbtx->cd(1 + uGbtx);
652 fcMsSizeAll =
dynamic_cast<TCanvas*
>(gROOT->FindObject(
"cMsSizeAll"));
654 fcMsSizeAll =
new TCanvas(
"cMsSizeAll",
"Evolution of MS size in last 300 s", w,
h);
656 LOG(info) <<
"Created MS size canvas in TOF monitor";
659 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 ";
698 std::chrono::time_point<std::chrono::system_clock> timeCurrent = std::chrono::system_clock::now();
705 else if (300 < elapsed_seconds.count()) {
706 std::time_t cTimeCurrent = std::chrono::system_clock::to_time_t(timeCurrent);
708 std::strftime(tempBuff, 80,
"%F %T", localtime(&cTimeCurrent));
721 LOG(debug1) <<
"Timeslice contains " << ts.num_microslices(component) <<
"microslices.";
727 Int_t messageType = -111;
731 for (UInt_t uMsIdx = 0; uMsIdx < uNbMsLoop; uMsIdx++) {
739 auto msDescriptor = ts.descriptor(uMsComp, uMsIdx);
755 constexpr uint32_t kuBytesPerMessage = 8;
758 auto msDescriptor = ts.descriptor(uMsComp, uMsIdx);
760 fdMsIndex =
static_cast<double>(msDescriptor.idx);
762 const uint8_t* msContent =
reinterpret_cast<const uint8_t*
>(ts.content(uMsComp, uMsIdx));
764 uint32_t
size = msDescriptor.size;
766 if (
size > 0) LOG(debug) <<
"Microslice: " << msDescriptor.idx <<
" has size: " <<
size;
786 if (0 != (
size % kuBytesPerMessage))
787 LOG(error) <<
"The input microslice buffer does NOT "
788 <<
"contain only complete nDPB messages!";
791 uint32_t uNbMessages = (
size - (
size % kuBytesPerMessage)) / kuBytesPerMessage;
799 LOG(info) <<
"---------------------------------------------------------------";
810 LOG(warning) <<
"Could not find the gDPB index for AFCK id 0x" << std::hex <<
fuGdpbId << std::dec
812 << uMsCompIdx <<
"\n"
813 <<
"If valid this index has to be added in the TOF "
814 "parameter file in the RocIdArray field";
821 const uint64_t* pInBuff =
reinterpret_cast<const uint64_t*
>(msContent);
822 for (uint32_t uIdx = 0; uIdx < uNbMessages; uIdx++) {
824 uint64_t ulData =
static_cast<uint64_t
>(pInBuff[uIdx]);
852 <<
" set in parameters.";
854 switch (messageType) {
874 LOG(info) <<
"Epoch: " << Form(
"0x%08x ",
fuGdpbId) <<
", Merg"
875 <<
", Link " << std::setw(1) << mess.
getGdpbEpLinkId() <<
", epoch " << std::setw(8)
886 LOG(info) <<
"Epoch: " << Form(
"0x%08x ",
fuGdpbId) <<
", " << std::setw(4) <<
fuGet4Nr <<
", Link "
887 << std::setw(1) << mess.
getGdpbEpLinkId() <<
", epoch " << std::setw(8)
944 LOG(error) <<
"Message type " << std::hex << std::setw(2) << static_cast<uint16_t>(messageType)
945 <<
" not included in Get4 unpacker.";
993 if (uGdpbNr == uGdpbNrB) {
1003 if (0 == uGbtxNr && 0 == uGbtxNrB)
1044 LOG(info) <<
"CbmMcbm2018MonitorTofPulser::ProcessEpochCyle => "
1048 <<
" In data 0x" <<
FormatHexPrintout(ulCycleData, 16,
'0',
true) <<
" Cycle 0x"
1077 if (0 < ulCurEpochGdpbGet4) ulCurEpochGdpbGet4--;
1125 if (92 < uTot && uTot < 95) {
1160 LOG(info) <<
"Hit: " << Form(
"0x%08x ",
fuGdpbId) <<
", " << std::setw(2) <<
fuGet4Nr <<
", " << std::setw(3)
1161 << uChannel <<
", " << std::setw(3) << uTot <<
", epoch " << std::setw(3) << ulCurEpochGdpbGet4
1162 <<
", FullTime Clk " << Form(
"%12lu ", ulHitTime) <<
", FullTime s " << Form(
"%12.9f ", dHitTime / 1e9)
1163 <<
", FineTime " << uFts;
1186 if (0 < iBufferSize) {
1187 LOG(debug) <<
"Now processing stored messages for for get4 " <<
fuGet4Nr <<
" with epoch number "
1194 for (Int_t iMsgIdx = 0; iMsgIdx < iBufferSize; iMsgIdx++) {
1225 uint64_t uData = mess.
getData();
1227 LOG(debug) <<
"Get4 MSG type " << mType <<
" from gdpbId " <<
fuGdpbId <<
", getId " <<
fuGet4Id <<
", (hit channel) "
1228 << channel <<
" data " << std::hex << uData;
1236 <<
" for board ID " << std::hex << std::setw(4) <<
fuGdpbId << std::dec;
1244 LOG(debug) <<
" +++++++ > gDPB: " << std::hex << std::setw(4) <<
fuGdpbId << std::dec
1245 <<
", Chip = " << std::setw(2) << mess.
getGdpbGenChipId() <<
", Chan = " << std::setw(1)
1248 << std::setw(2) << uData << std::dec <<
" -- GET4 V1 Error Event";
1250 LOG(debug) <<
" +++++++ >gDPB: " << std::hex << std::setw(4) <<
fuGdpbId << std::dec
1251 <<
", Chip = " << std::setw(2) << mess.
getGdpbGenChipId() <<
", Chan = " << std::setw(1)
1254 << std::setw(2) << uData << std::dec <<
" -- GET4 V1 Error Event ";
1258 LOG(debug) <<
"Unknown GET4 message, data: " << std::hex << std::setw(8) << mess.
getGdpbSysUnkwData() << std::dec
1259 <<
" Full message: " << std::hex << std::setw(16) << mess.
getData() << std::dec;
1264 LOG(info) << Form(
"GET4 Resynchronization: Get4:0x%04x ", mess.
getGdpbGenChipId()) << std::hex << std::setw(4)
1267 LOG(info) <<
"GET4 synchronization pulse missing in gDPB " << std::hex << std::setw(4) <<
fuGdpbId << std::dec;
1271 LOG(debug) <<
"ASIC pattern for missmatch, disable or resync";
1299 if( fuGdpbNr == fuDiamondDpbIdx || 0x90 == fuCurrentMsSysId )
1300 uBadAsic = 32 * usIndex + uBit;
1301 } // if( ( uPattern >> uBit ) & 0x1 )
1304 } // case gdpbv100::PATT_MISSMATCH:
1305 case gdpbv100::PATT_ENABLE:
1307 for( UInt_t uBit = 0; uBit < 32; ++uBit )
1308 if( ( uPattern >> uBit ) & 0x1 )
1310 UInt_t uBadAsic = ConvertElinkToGet4( 32 * usIndex + uBit );
1312 if( fuGdpbNr == fuDiamondDpbIdx || 0x90 == fuCurrentMsSysId )
1313 uBadAsic = 32 * usIndex + uBit;
1314 } // if( ( uPattern >> uBit ) & 0x1 )
1317 } // case gdpbv100::PATT_ENABLE:
1318 case gdpbv100::PATT_RESYNC:
1320 LOG(debug) << Form( "RESYNC pattern message => Type %d, Index %2d, Pattern 0x%08X", usType, usIndex, uPattern );
1322 for( UInt_t uBit = 0; uBit < 32; ++uBit )
1323 if( ( uPattern >> uBit ) & 0x1 )
1325 UInt_t uBadAsic = ConvertElinkToGet4( 32 * usIndex + uBit );
1327 if( fuGdpbNr == fuDiamondDpbIdx || 0x90 == fuCurrentMsSysId )
1328 uBadAsic = 32 * usIndex + uBit;
1329 } // if( ( uPattern >> uBit ) & 0x1 )
1332 } // case gdpbv100::PATT_RESYNC:
1335 LOG(debug) << "Crazy pattern message, subtype " << usType;
1338 } // switch( usType )
1347 switch (iMsgIndex) {
1357 ULong64_t ulNewStarTsFull =
1368 LOG(warning) <<
"Possible error: identical STAR tokens found twice in "
1369 "a row => ignore 2nd! "
1393 <<
" new = " << Form(
"%16llu", ulNewStarTsFull) <<
" Diff = -"
1408 if( fuCurrentMs < fuCoreMs )
1411 if( 0 <= fdStartTime )
1414 if( fuHistoryHistoSize < 1e-9 * (fvulGdpbTsFullLast[fuGdpbNr] * gdpbv100::kdClockCycleSizeNs - fdStartTime) )
1416 ResetEvolutionHistograms();
1417 fdStartTime = fvulGdpbTsFullLast[fuGdpbNr] * gdpbv100::kdClockCycleSizeNs;
1418 } // if( fuHistoryHistoSize < 1e-9 * (fulGdpbTsFullLast * gdpbv100::kdClockCycleSizeNs - fdStartTime) )
1420 fvhTriggerRate[fuGdpbNr]->Fill( 1e-9 * ( fvulGdpbTsFullLast[fuGdpbNr] * gdpbv100::kdClockCycleSizeNs - fdStartTime ) );
1421 fvhStarTokenEvo[fuGdpbNr]->Fill( 1e-9 * ( fvulGdpbTsFullLast[fuGdpbNr] * gdpbv100::kdClockCycleSizeNs - fdStartTime ),
1422 fvuStarTokenLast[fuGdpbNr] );
1423 fvhStarTrigGdpbTsEvo[fuGdpbNr]->Fill( 1e-9 * ( fvulGdpbTsFullLast[fuGdpbNr] * gdpbv100::kdClockCycleSizeNs - fdStartTime ),
1424 fvulGdpbTsFullLast[fuGdpbNr] );
1425 fvhStarTrigStarTsEvo[fuGdpbNr]->Fill( 1e-9 * ( fvulGdpbTsFullLast[fuGdpbNr] * gdpbv100::kdClockCycleSizeNs - fdStartTime ),
1426 fvulStarTsFullLast[fuGdpbNr] );
1427 } // if( 0 < fdStartTime )
1428 else fdStartTime = fvulGdpbTsFullLast[fuGdpbNr] * gdpbv100::kdClockCycleSizeNs;
1429 fvhCmdDaqVsTrig[fuGdpbNr]->Fill( fvuStarDaqCmdLast[fuGdpbNr], fvuStarTrigCmdLast[fuGdpbNr] );
1430 } // if( fuCurrentMs < fuCoreMs )
1434 default: LOG(error) <<
"Unknown Star Trigger messageindex: " << iMsgIndex;
1443 TString message_type;
1446 case 0: message_type =
"NOP";
break;
1447 case 1: message_type =
"HIT";
break;
1448 case 2: message_type =
"EPOCH";
break;
1449 case 3: message_type =
"SYNC";
break;
1450 case 4: message_type =
"AUX";
break;
1451 case 5: message_type =
"EPOCH2";
break;
1452 case 6: message_type =
"GET4";
break;
1453 case 7: message_type =
"SYS";
break;
1454 case 8: message_type =
"GET4_SLC";
break;
1455 case 9: message_type =
"GET4_32B";
break;
1456 case 10: message_type =
"GET4_SYS";
break;
1457 default: message_type =
"UNKNOWN";
break;
1459 LOG(info) << message_type <<
" messages: " <<
fviMsgCounter[i];
1462 LOG(info) <<
"-------------------------------------";
1465 LOG(info) <<
"Last epoch for gDPB: " << std::hex << std::setw(4) << i << std::dec <<
" , GET4 " << std::setw(4)
1469 LOG(info) <<
"-------------------------------------";
1499 TFile* oldFile = gFile;
1500 TDirectory* oldDir = gDirectory;
1502 TFile* histoFile = NULL;
1503 if (
"" != sFileName) {
1505 histoFile =
new TFile(sFileName,
"RECREATE");
1509 gDirectory->mkdir(
"Tof_Raw_gDPB");
1510 gDirectory->cd(
"Tof_Raw_gDPB");
1516 gDirectory->cd(
"..");
1520 gDirectory->mkdir(
"TofDt");
1521 gDirectory->cd(
"TofDt");
1525 gDirectory->cd(
"..");
1528 gDirectory->mkdir(
"TofDtEvo");
1529 gDirectory->cd(
"TofDtEvo");
1530 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
1535 for (UInt_t uGdpbB = uGdpb + 1; uGdpbB <
fuNrOfGdpbs; ++uGdpbB)
1539 for (UInt_t uFeeRef = 0; uFeeRef <
kuNbRefFeeEvo; ++uFeeRef) {
1545 gDirectory->cd(
"..");
1547 gDirectory->mkdir(
"TofDnlInl");
1548 gDirectory->cd(
"TofDnlInl");
1555 gDirectory->cd(
"..");
1557 gDirectory->mkdir(
"Flib_Raw");
1558 gDirectory->cd(
"Flib_Raw");
1559 for (UInt_t uLinks = 0; uLinks <
fvhMsSzPerLink.size(); uLinks++) {
1566 TH1* pMissedTsH1 =
dynamic_cast<TH1*
>(gROOT->FindObjectAny(
"Missed_TS"));
1567 if (NULL != pMissedTsH1) pMissedTsH1->Write();
1569 TProfile* pMissedTsEvoP =
dynamic_cast<TProfile*
>(gROOT->FindObjectAny(
"Missed_TS_Evo"));
1570 if (NULL != pMissedTsEvoP) pMissedTsEvoP->Write();
1572 gDirectory->cd(
"..");
1575 if (
"" != sFileName) {
1582 gDirectory = oldDir;
1587 LOG(info) <<
"Reseting all TOF histograms.";
1600 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
1605 for (UInt_t uGdpbB = uGdpb + 1; uGdpbB <
fuNrOfGdpbs; ++uGdpbB)
1609 for (UInt_t uFeeRef = 0; uFeeRef <
kuNbRefFeeEvo; ++uFeeRef) {
1621 for (UInt_t uLinks = 0; uLinks <
fvhMsSzPerLink.size(); uLinks++) {
1653 LOG(info) <<
"CbmMcbm2018MonitorTofPulser::UpdateZoomedFit => Empty input "
1654 <<
"for FEE pair " << uFeeA <<
" and " << uFeeB <<
" !!! ";
1663 Double_t dPeakPos =
fvhTimeDiffPulser[uFeeA][uFeeB]->GetXaxis()->GetBinCenter(iBinWithMax);
1669 if ((dZoomCounts / dNbCounts) < 0.99) {
1672 LOG(warning) <<
"CbmMcbm2018MonitorTofPulser::UpdateZoomedFit => "
1674 <<
"more than 1% loss for FEE pair " << uFeeA <<
" and " << uFeeB <<
" !!! ";
1684 fitFuncPairs[uFeeA][uFeeB] =
new TF1(Form(
"fPair_%02d_%02d", uFeeA, uFeeB),
"gaus",
1687 fitFuncPairs[uFeeA][uFeeB]->SetParameter(0, dZoomCounts);
1688 fitFuncPairs[uFeeA][uFeeB]->SetParameter(1, dPeakPos);
1689 fitFuncPairs[uFeeA][uFeeB]->SetParameter(2, 200.0);
1691 fvhTimeDiffPulser[uFeeA][uFeeB]->Fit(Form(
"fPair_%02d_%02d", uFeeA, uFeeB),
"QRM0");
1693 dRes = fitFuncPairs[uFeeA][uFeeB]->GetParameter(2);
1695 delete fitFuncPairs[uFeeA][uFeeB];
1700 LOG(info) <<
"CbmMcbm2018MonitorTofPulser::UpdateZoomedFit => "
1701 <<
"For FEE pair " << uFeeA <<
" and " << uFeeB
1702 <<
" we have zoomed RMS = " <<
fvhTimeDiffPulser[uFeeA][uFeeB]->GetRMS() <<
" and a resolution of "
1703 << dRes / TMath::Sqrt2();
1710 LOG(error) <<
"CbmMcbm2018MonitorTofPulser::UpdateZoomedFit => Zoom width "
1712 <<
"please use SetFitZoomWidthPs, e.g. in macro, before trying "
1718 TDirectory* oldDir = gDirectory;
1728 TH1* pFtSelChSlice =
1729 fhFeeFtDistribPerCh[uFeeNrInSys]->ProjectionX(
"temp_pFtSelChSlice", 1 + uChannel, 1 + uChannel);
1730 if (0 < pFtSelChSlice->GetEntries()) {
1732 pFtSelChSlice->Scale(1.0 / dNormFactRise);
1733 pFtSelChSlice->Add(constantVal, -1.);
1737 Double_t dDnl = 0.0;
1738 Double_t dInl = 0.0;
1740 dDnl = pFtSelChSlice->GetBinContent(1 + uFtBin);
1746 delete pFtSelChSlice;
ClassImp(CbmConverterManager)
Bool_t bMcbmMoniTofPulserSaveHistos
Bool_t bMcbmMoniTofPulserPrintAllHitsEna
Bool_t bMcbmMoniTofPulserUpdateZoomedFit
Bool_t bMcbmMoniTofPulserResetHistos
Bool_t bMcbmMoniTofPulserUpdateDnlInl
Bool_t bMcbmMoniTofPulserPrintAllEpochsEna
Bool_t bMcbmMoniTofPulserRawDataPrint
static double dTsStartTime
static constexpr size_t size()
virtual Bool_t DoUnpack(const fles::Timeslice &ts, size_t component)
const UInt_t kuNbGbtxPerGdpb
std::chrono::time_point< std::chrono::system_clock > fTimeLastHistoSaving
CbmMcbm2018TofPar * fUnpackPar
std::vector< Int_t > fviModuleId
std::vector< UInt_t > fvuGet4ToElink
size_t fuMsAcceptsPercent
OLD, to be cleaned out !!!!!
std::vector< ULong64_t > fvulGdpbTsLsb
UInt_t fuHistoryHistoSizeLong
void PrintSysInfo(gdpbv100::Message)
void PrintGenInfo(gdpbv100::Message)
Double_t fdTsCoreSizeInNs
void FillEpochInfo(gdpbv100::Message)
std::vector< UInt_t > fvuPadiToGet4
std::vector< TProfile * > fvhPulserTimeDiffEvoGbtxGbtx
Double_t fdLastRmsUpdateTime
UInt_t fuHistoryHistoSize
std::vector< ULong64_t > fvulGdpbTsMsb
std::vector< UInt_t > fvuStarTrigCmdLast
std::map< UInt_t, UInt_t > fGdpbIdIndexMap
Map of ID to index for the gDPBs.
void FillHitInfo(gdpbv100::Message)
Bool_t fbPrintAllEpochsEnable
std::vector< Int_t > fviRpcSide
std::vector< ULong64_t > fvulCurrentEpochCycle
Int_t GetArrayIndex(Int_t gdpbId, Int_t get4Id)
std::vector< std::vector< TProfile * > > fvvhPulserTimeDiffEvoGdpbGdpb
std::vector< TH2 * > fhFeeFtDistribPerCh
void ResetLongEvolutionHistograms()
std::vector< std::vector< TH1 * > > fvhTimeDiffPulser
Bool_t ReInitContainers()
virtual void SetNbMsInTs(size_t uCoreMsNb, size_t uOverlapMsNb)
void SaveAllHistos(TString sFileName="")
Double_t fdFitZoomWidthPs
std::vector< ULong64_t > fvulGdpbTsFullLast
std::vector< TH2 * > fhFeeFtNormInl
std::vector< TProfile * > fvhMsSzTimePerLink
const UInt_t kuNbBinsDt
[ fuNrOfGdpbs ][ fuNrOfChannelsPerGdpb ]
uint64_t fulCurrentTsIndex
std::vector< UInt_t > fvuGet4ToPadi
TH2 * fhTimeRmsZoomFitPuls
UInt_t fuNrOfChannelsPerGdpb
std::vector< ULong64_t > fvulStarTsMsb
std::vector< ULong64_t > fvulStarTsMid
Bool_t fbPrintAllHitsEnable
std::vector< TH1 * > fvhMsSzPerLink
std::vector< UInt_t > fvuElinkToGet4
5 FEE with 8 GET4 each
UInt_t fuRawDataPrintMsgIdx
UInt_t ConvertElinkToGet4(UInt_t uElinkIdx)
std::vector< TH2 * > fvhPulserCountEvoPerFeeGdpb
CbmMcbm2018MonitorTofPulser()
std::vector< UInt_t > fvuFeeNbHitsLastMs
Buffer for pulser channels.
std::vector< UInt_t > fvuStarDaqCmdLast
void ProcessEpochCycle(uint64_t ulCycleData)
UInt_t fuNrOfChannelsPerGet4
void UpdateNormedDnlInl()
ULong64_t fulCurrentEpochTime
Epoch + Epoch Cycle.
std::vector< std::vector< TProfile * > > fvvhPulserTimeDiffEvoFeeFee
std::vector< ULong64_t > fvulStarTsFullLast
std::vector< ULong64_t > fvulCurrentEpochFull
Epoch cycle from the Ms Start message and Epoch counter flip.
const Double_t kdMaxDtPulserPs
const UInt_t kuRefFeeEvoIdx[kuNbRefFeeEvo]
static const UInt_t kuNbRefFeeEvo
void PrintSlcInfo(gdpbv100::Message)
std::vector< Int_t > fviNrOfRpc
std::vector< int > fviMsgCounter
static const UInt_t kuNbGet4PerGbtx
void ResetEvolutionHistograms()
std::vector< UInt_t > fvuStarTokenLast
void FillStarTrigInfo(gdpbv100::Message)
const UInt_t kuNbFeePerGbtx
virtual void AddMsComponentToList(size_t component, UShort_t usDetectorId)
std::vector< TH2 * > fhFeeFtNormDnl
std::vector< std::vector< gdpbv100::Message > > fvmEpSupprBuffer
Buffer for suppressed epoch processing.
UInt_t fuRawDataPrintMsgNb
std::vector< ULong64_t > fvulCurrentEpoch
std::vector< Bool_t > fvbFirstEpochSeen
void FillPattInfo(gdpbv100::Message)
std::vector< Int_t > fviRpcType
UInt_t fuNrOfChannelsPerFee
TString fsHistoFileFullname
/** Ignore Overlap Ms: all fuOverlapMsNb MS at the end of timeslice **/
std::vector< size_t > fvMsComponentsList
FLES containers.
virtual ~CbmMcbm2018MonitorTofPulser()
UInt_t fuNbFeePlotsPerGdpb
std::vector< Double_t > fdTsLastPulserHit
[ fuFeeNr ]
void FillOutput(CbmDigi *digi)
Int_t GetModuleId(Int_t i)
Int_t GetRpcSide(Int_t i)
Int_t GetNrOfGdpbs()
FIXME: replace with method returning the correspondign constants! see Star2019 parameter.
Int_t GetNrOfRpc(Int_t i)
Int_t GetNrOfGet4PerFee()
Int_t GetNrOfFeesPerGdpb()
Int_t GetRpcType(Int_t i)
Int_t GetNrOfChannelsPerGet4()
Data class with information on a STS local track.
uint16_t getGdpbHitIs24b() const
uint16_t getStarTrigMsgIndex() const
uint32_t getGdpbEpEpochNb() const
uint16_t getGdpbHit32Tot() const
uint64_t getStarTsMidStarC() const
uint16_t getGdpbSysSubType() const
uint64_t getGdpbTsLsbStarB() const
bool getGdpbEpMissmatch() const
double getMsgFullTimeD(uint64_t epoch) const
Returns expanded and adjusted time of message in double (in ns)
void setGdpbGenChipId(uint32_t v)
uint16_t getGdpbHitFineTs() const
void setGdpbEpEpochNb(uint32_t v)
bool getGdpbEpSync() const
uint32_t getGdpbSysFwErrResync() const
uint64_t getStarTsMsbStarB() const
uint32_t getGdpbHitFullTs() const
uint32_t getStarTrigCmdStarD() const
bool isStarTrigger() const
Returns true is message type is MSG_STAR_TRI_A, _B, _C, _D (STAR Trigger message)
bool getGdpbEpEpochLoss() const
uint32_t getStarDaqCmdStarD() const
uint64_t getGdpbTsMsbStarA() const
uint16_t getGdpbGenChipId() const
uint16_t getGdpbSysErrUnused() const
void printDataCout(unsigned kind=msg_print_Prefix|msg_print_Data, uint32_t epoch=0) const
Print message in human readable format to cout.
bool getGdpbEpDataLoss() const
uint32_t getStarTokenStarD() const
bool getGdpbEpLinkId() const
uint64_t getStarTsLsbStarD() const
uint8_t getMessageType() const
Returns the message type. Valid for all message types. 4 bit.
uint32_t getGdpbSysUnkwData() const
uint16_t getGdpbSysErrData() const
bool getGdpbSysErrEdge() const
uint16_t getGdpbSysErrChanId() const
uint64_t getMsgFullTime(uint64_t epoch) const
Returns expanded and adjusted time of message (in ns)
uint16_t getGdpbHitChanId() const
const uint64_t kulEpochCycleBins
@ GET4_V2X_ERR_ADD_RIS_EDG
@ GET4_V2X_ERR_TOT_OVERWRT
@ GET4_V2X_ERR_EVT_DISCARD
@ GET4_V2X_ERR_UNPAIR_FALL
@ GET4_V2X_ERR_SEQUENCE_ER
const uint32_t kuChipIdMergedEpoch
const uint32_t kuFeePulserChannel
const uint32_t kuEpochCounterSz
const uint64_t kulEpochCycleFieldSz