47 , fbDebugMonitorMode(kFALSE)
48 , fvbMaskedComponents()
54 , fuNrOfChannelsPerGet4(0)
55 , fuNrOfChannelsPerFee(0)
57 , fuNrOfGet4PerGdpb(0)
58 , fuNrOfChannelsPerGdpb(0)
72 , fdTsStopTimeCore(-1.0)
75 , fuCurrentEquipmentId(0)
81 , fvulCurrentEpochCycle()
82 , fvulCurrentEpochFull()
84 , fdStartTimeMsSz(0.0)
85 , ftStartTimeUnix(std::chrono::steady_clock::now())
91 , fvulGdpbTsFullLast()
92 , fvulStarTsFullLast()
95 , fvuStarTrigCmdLast()
98 , fdFirstDigiTimeDif(0.)
100 , fhRawTDigEvT0(nullptr)
101 , fhRawTDigRef0(nullptr)
102 , fhRawTDigRef(nullptr)
103 , fhRawTRefDig0(nullptr)
104 , fhRawTRefDig1(nullptr)
105 , fhRawDigiLastDigi(nullptr)
111 , fhDetChanCoinc(nullptr) {}
114 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
123 LOG(info) <<
"Initializing mCBM TOF 2019 unpacker algo";
138 LOG(info) <<
"Init parameter containers for CbmMcbm2018UnpackerAlgoTof";
145 LOG(info) <<
"**********************************************";
146 LOG(info) <<
"ReInit parameter containers for CbmMcbm2018UnpackerAlgoTof";
150 LOG(ERROR) <<
" CbmMcbm2018TofPar not found ";
165 LOG(INFO) <<
"InitParameters from " <<
fUnpackPar;
195 LOG(info) <<
"GDPB Id of TOF " <<
i <<
" : " << std::hex
206 for (UInt_t uGbtx = 0; uGbtx <
fuNrOfGbtx; ++uGbtx) {
214 LOG(info) <<
"Nr. of possible Tof channels: " << uNrOfChannels;
219 for (UInt_t iGbtx = 0; iGbtx <
fuNrOfGbtx; ++iGbtx) {
224 const Int_t RpcMap[5] = {4, 2, 0, 3, 1};
225 for (Int_t iRpc = 0; iRpc <
fviNrOfRpc[iGbtx]; iRpc++) {
229 for (Int_t iStr = 0; iStr < iStrMax; iStr++) {
230 Int_t iStrMap = iStr;
231 Int_t iRpcMap = RpcMap[iRpc];
233 if (
fviRpcSide[iGbtx] == 0) iStrMap = 31 - iStr;
252 const Int_t RpcMap[3] = {0, 1, 2};
253 for (Int_t iRpc = 0; iRpc <
fviNrOfRpc[iGbtx]; iRpc++) {
257 for (Int_t iStr = 0; iStr < iStrMax; iStr++) {
258 Int_t iStrMap = iStr;
259 Int_t iRpcMap = RpcMap[iRpc];
261 if (
fviRpcSide[iGbtx] == 0) iStrMap = 31 - iStr;
281 LOG(info) <<
" Map diamond at GBTX - iCh = " << iCh;
306 UInt_t uChannelT0 = uCh / 8 + 4 *
fviRpcSide[iGbtx];
309 LOG(info) << Form(
"T0 channel: %u from GBTx %2u Fee %2u "
310 "Channel %2u, indx %d address %08x",
333 LOG(info) <<
" Map CERN 20 gap at GBTX - iCh = " << iCh;
334 const Int_t StrMap[32] = {0, 1, 2, 3, 4, 31, 5, 6, 7, 30, 8,
335 9, 10, 29, 11, 12, 13, 14, 28, 15, 16, 17,
336 18, 27, 26, 25, 24, 23, 22, 21, 20, 19};
338 Int_t iModuleType = 7;
340 for (Int_t iFeet = 0; iFeet < 2; iFeet++) {
341 for (Int_t iStr = 0; iStr < 32; iStr++) {
342 Int_t iStrMap = 31 - 12 - StrMap[iStr];
343 Int_t iSideMap = iFeet;
346 iModuleId, iRpcMap, iStrMap, iSideMap, iModuleType);
353 LOG(info) <<
" Map end CERN 20 gap at GBTX - iCh = " << iCh;
359 Int_t iModuleType = 8;
360 for (Int_t iRpc = 0; iRpc < 8; iRpc++) {
362 iModuleId, 7 - iRpc, 0, 0, iModuleType);
365 iCh += (24 + 2 * 32);
368 LOG(info) <<
" Map end ceramics box at GBTX - iCh = " << iCh;
373 LOG(info) <<
" Map Star2 box at GBTX - iCh = " << iCh;
374 const Int_t iRpc[5] = {1, -1, 1, 0, 0};
375 const Int_t iSide[5] = {1, -1, 0, 1, 0};
376 for (Int_t iFeet = 0; iFeet < 5; iFeet++) {
377 for (Int_t iStr = 0; iStr < 32; iStr++) {
378 Int_t iStrMap = iStr;
379 Int_t iRpcMap = iRpc[iFeet];
380 Int_t iSideMap = iSide[iFeet];
381 if (iSideMap == 0) iStrMap = 31 - iStr;
398 LOG(info) <<
" Map Buc box at GBTX - iCh = " << iCh;
399 const Int_t iRpc[5] = {0, -1, 0, 1, 1};
400 const Int_t iSide[5] = {1, -1, 0, 1, 0};
401 for (Int_t iFeet = 0; iFeet < 5; iFeet++) {
402 for (Int_t iStr = 0; iStr < 32; iStr++) {
403 Int_t iStrMap = iStr;
404 Int_t iRpcMap = iRpc[iFeet];
405 Int_t iSideMap = iSide[iFeet];
410 iRpcMap = 1 - iRpcMap;
414 iSideMap = 1 - iSideMap;
418 iRpcMap = 1 - iRpcMap;
419 iSideMap = 1 - iSideMap;
422 iRpcMap = 1 - iRpcMap;
445 LOG(info) <<
" Found unused GBTX link at iCh = " << iCh;
449 default: LOG(error) <<
"Invalid Tof Type specifier ";
452 TString sPrintout =
"";
453 for (UInt_t uCh = 0; uCh < uNrOfChannels; ++uCh) {
454 if (0 == uCh % 8) sPrintout +=
"\n";
459 LOG(info) << sPrintout;
501 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
521 UShort_t usDetectorId) {
529 LOG(info) <<
"CbmMcbm2018UnpackerAlgoTof::AddMsComponentToList => Component "
530 << component <<
" with detector ID 0x" << std::hex << usDetectorId
531 << std::dec <<
" added to list";
537 fdTsStartTime =
static_cast<Double_t
>(ts.descriptor(0, 0).idx);
557 LOG(info) <<
"In each TS " <<
fuNbMsLoop <<
" MS will be looped over";
573 <<
fuMsIndex <<
" for component " << uMsComp;
609 return a.GetTime() < b.GetTime();
618 auto msDescriptor = ts.descriptor(uMsCompIdx, uMsIdx);
620 const uint8_t* msContent =
621 reinterpret_cast<const uint8_t*
>(ts.content(uMsCompIdx, uMsIdx));
623 uint32_t uSize = msDescriptor.size;
626 LOG(debug) <<
"Microslice: " <<
fulCurrentMsIdx <<
" from EqId " << std::hex
640 <<
"---------------------------------------------------------------";
642 LOG(warning) <<
"Could not find the gDPB index for AFCK id 0x" << std::hex
645 <<
" component " << uMsCompIdx <<
"\n"
646 <<
"If valid this index has to be added in the TOF "
647 "parameter file in the DbpIdArray field";
665 LOG(error) <<
"The input microslice buffer does NOT "
666 <<
"contain only complete gDPB messages!";
669 uint32_t uNbMessages =
673 Int_t messageType = -111;
674 const uint64_t* pInBuff =
675 reinterpret_cast<const uint64_t*
>(msContent);
678 for (uint32_t uIdx = 0; uIdx < uNbMessages; uIdx++) {
695 LOG(warning) <<
"Message with Get4 ID too high: " <<
fuGet4Id <<
" VS "
718 LOG(debug) <<
" CbmMcbm2018UnpackerAlgoTof ==> In timeslice "
720 <<
" component " << uMsCompIdx
721 <<
" first message is not an epoch: type " << messageType
722 <<
" -> It will be ignored! ";
726 switch (messageType) {
728 if (pMess[uIdx].getGdpbHitIs24b()) {
729 LOG(error) <<
"This event builder does not support 24b hit message!!!"
730 <<
" Message " << uIdx <<
"/" << uNbMessages <<
" 0x"
745 LOG(debug2) <<
"This event builder does not support unmerged epoch "
775 LOG(error) <<
"Message type " << std::hex << std::setw(2)
776 <<
static_cast<uint16_t
>(messageType)
777 <<
" not included in Get4 unpacker.";
793 const uint64_t& ulCycleData) {
799 LOG(warning) <<
"CbmMcbm2018UnpackerAlgoTof::ProcessEpochCycle => "
800 <<
" Missmatch in epoch cycles detected for Gdpb "
802 <<
", probably fake cycles due to epoch index corruption! "
803 << Form(
" Current cycle 0x%09llX New cycle 0x%09llX",
808 LOG(info) <<
"CbmMcbm2018UnpackerAlgoTof::ProcessEpochCycle => "
810 << Form(
": Current cycle 0x%09llX New cycle 0x%09llX",
875 ULong64_t ulEpochNr =
880 LOG(info) <<
"CbmMcbm2018UnpackerAlgoTof::ProcessEndOfMsEpoch => "
882 << Form(
": Current cycle 0x%09llX New cycle 0x%09llX",
885 << Form(
"(old Ep %08llx new Ep %08llx)",
913 ULong64_t ulNewGdpbTsFull =
930 LOG(warning) <<
"Possible error: identical STAR tokens found twice in "
931 "a row => ignore 2nd! "
935 << Form(
"gDPB ts = %12llu ",
937 << Form(
"STAR ts = %12llu ",
941 << Form(
"TRG Wrd = %5x ", uTrigWord);
947 LOG(debug) <<
"Probable reset of the GDPB TS: old = "
949 <<
" new = " << Form(
"%16llu", ulNewGdpbTsFull)
957 LOG(debug) <<
"Probable reset of the STAR TS: old = "
959 <<
" new = " << Form(
"%16llu", ulNewStarTsFull)
995 default: LOG(error) <<
"Unknown Star Trigger messageindex: " << iMsgIndex;
1002 if (0 == iBufferSize)
return;
1004 LOG(debug) <<
"Now processing stored messages for for gDPB " <<
fuCurrDpbIdx
1015 if (0 == ulCurEpochGdpbGet4)
return;
1018 ulCurEpochGdpbGet4--;
1020 Int_t messageType = -111;
1021 for (Int_t iMsgIdx = 0; iMsgIdx < iBufferSize; iMsgIdx++) {
1032 ulCurEpochGdpbGet4);
1035 switch (messageType) {
1056 LOG(error) <<
"Message type " << std::hex << std::setw(2)
1057 <<
static_cast<uint16_t
>(messageType)
1058 <<
" not included in Get4 unpacker.";
1075 UInt_t uChannelNrInFee =
1086 UInt_t uRemappedChannelNrInSys =
1091 uRemappedChannelNr = uChannelNr;
1092 uRemappedChannelNrInSys =
1098 Double_t dHitTot = uTot;
1118 if (
fviRpcChUId.size() < uRemappedChannelNrInSys) {
1119 LOG(fatal) <<
"Invalid mapping index " << uRemappedChannelNrInSys <<
" VS "
1121 <<
", Get4 " <<
fuGet4Id <<
", Ch " << uChannel <<
", ChNr "
1122 << uChannelNr <<
", ChNrIF " << uChannelNrInFee <<
", FiS "
1127 UInt_t uChanUId =
fviRpcChUId[uRemappedChannelNrInSys];
1158 << Form(
"Insert 0x%08x digi with time ", uChanUId) << dHitTime
1159 << Form(
", Tot %4.0f", dHitTot)
1167 fDigiVect.emplace_back(uChanUId, dHitTime, dHitTot);
1181 LOG(debug) <<
"Unknown GET4 message, data: " << std::hex << std::setw(8)
1183 <<
" Full message: " << std::hex << std::setw(16)
1184 << mess.
getData() << std::dec;
1189 LOG(info) << Form(
"GET4 Resynchronization: Get4:0x%04x ",
1193 LOG(info) <<
"GET4 synchronization pulse missing in gDPB "
1211 switch (uErrorType) {
1258 "Missmatch pattern message => Type %u, Index %2d, Pattern 0x%08X",
1277 LOG(debug2) << Form(
1278 "Enable pattern message => Type %d, Index %2d, Pattern 0x%08X",
1295 "RESYNC pattern message => Type %d, Index %2d, Pattern 0x%08X",
1303 LOG(debug) <<
"Crazy pattern message, subtype " << usType;
1320 std::string sFolder =
"Tof_Raw_gDPB";
1322 LOG(info) <<
"create Histos for " <<
fuNrOfGdpbs <<
" gDPBs ";
1325 new TH1F(Form(
"Raw_TDig-EvT0"),
1326 Form(
"Raw digi time difference to 1st digi ; time [ns]; cts"),
1332 new TH1F(Form(
"Raw_TDig-Ref0"),
1333 Form(
"Raw digi time difference to Ref ; time [ns]; cts"),
1339 new TH1F(Form(
"Raw_TDig-Ref"),
1340 Form(
"Raw digi time difference to Ref ; time [ns]; cts"),
1346 new TH1F(Form(
"Raw_TRef-Dig0"),
1347 Form(
"Raw Ref time difference to last digi ; time [ns]; cts"),
1353 new TH1F(Form(
"Raw_TRef-Dig1"),
1354 Form(
"Raw Ref time difference to last digi ; time [ns]; cts"),
1360 new TH1F(Form(
"Raw_Digi-LastDigi"),
1361 Form(
"Raw Digi time difference to last digi ; time [ns]; cts"),
1378 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; uGdpb++) {
1380 new TH2F(Form(
"Raw_Tot_gDPB_%02u", uGdpb),
1381 Form(
"Raw TOT gDPB %02u; channel; TOT [bin]", uGdpb),
1390 new TH1I(Form(
"ChCount_gDPB_%02u", uGdpb),
1391 Form(
"Channel counts gDPB %02u; channel; Hits", uGdpb),
1397 Form(
"ChCountRemap_gDPB_%02u", uGdpb),
1398 Form(
"Remapped channel counts gDPB %02u; Remapped channel; Hits", uGdpb),
1404 new TH2F(Form(
"fhChanCoinc_%02u", uGdpb),
1405 Form(
"Channels Coincidence %02u; Left; Right", uGdpb),
1421 new TH1I(
"fhVectorSize",
1422 "Size of the vector VS TS index; TS index; Size [bytes]",
1427 new TH1I(
"fhVectorCapacity",
1428 "Size of the vector VS TS index; TS index; Size [bytes]",