20#include "FairRootManager.h"
22#include "FairRunOnline.h"
23#include "FairRuntimeDb.h"
28#include "TClonesArray.h"
33#include "THttpServer.h"
35#include "TPaveStats.h"
37#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)
85 , fulCurrentTsIndex(0)
94 , fviMsgCounter(11, 0)
100 , fvulGdpbTsFullLast()
101 , fvulStarTsFullLast()
103 , fvuStarDaqCmdLast()
104 , fvuStarTrigCmdLast()
106 , fvbFirstEpochSeen()
107 , fvulCurrentEpochCycle()
108 , fvulCurrentEpochFull()
109 , fulCurrentEpochTime(0)
112 , fvuFeeChanNbHitsLastMs()
113 , fvdFeeChanMsLastPulserHit()
114 , dMinDt(-1. * (kuNbBinsDt *
gdpbv100::kdBinSize / 2.) -
gdpbv100::kdBinSize / 2.)
115 , dMaxDt(1. * (kuNbBinsDt *
gdpbv100::kdBinSize / 2.) +
gdpbv100::kdBinSize / 2.)
117 , fuNbFeePlotsPerGdpb(0)
119 , fdStartTimeLong(-1.)
120 , fdStartTimeMsSz(-1.)
121 , fuHistoryHistoSize(1800)
122 , fdLastRmsUpdateTime(0.0)
123 , fdFitZoomWidthPs(0.0)
125 , fvhMsSzPerLink(12, NULL)
126 , fvhMsSzTimePerLink(12, NULL)
135 , fvhTimeDiffPulserFeeA()
136 , fhTimeMeanPulserFeeA(NULL)
137 , fhTimeRmsPulserFeeA(NULL)
138 , fhTimeRmsZoomFitPulsFeeA(NULL)
139 , fhTimeResFitPulsFeeA(NULL)
140 , fvhTimeDiffPulserFeeB()
141 , fhTimeMeanPulserFeeB(NULL)
142 , fhTimeRmsPulserFeeB(NULL)
143 , fhTimeRmsZoomFitPulsFeeB(NULL)
144 , fhTimeResFitPulsFeeB(NULL)
145 , fvhTimeDiffPulserFeeFee()
146 , fhTimeMeanPulserFeeFee(NULL)
147 , fhTimeRmsPulserFeeFee(NULL)
148 , fhTimeRmsZoomFitPulsFeeFee(NULL)
149 , fhTimeResFitPulsFeeFee(NULL)
150 , fhChanTotFeeA(NULL)
151 , fhChanTotFeeB(NULL)
152 , fhChanPulseIntervalFeeA(NULL)
153 , fhChanPulseIntervalFeeB(NULL)
154 , fvhPulserCountEvoPerFeeGdpb()
157 , fcPulserFeeFee(NULL)
163 , fTimeLastHistoSaving()
171 LOG(info) <<
"Initializing Get4 monitor";
173 FairRootManager* ioman = FairRootManager::Instance();
174 if (ioman == NULL) { LOG(fatal) <<
"No FairRootManager instance"; }
181 LOG(info) <<
"Setting parameter containers for " << GetName();
187 LOG(info) <<
"Init parameter containers for " << GetName();
209 LOG(info) <<
"ReInit parameter containers for " << GetName();
239 LOG(info) <<
"GDPB Id of TOF " << i <<
" : " << std::hex <<
fUnpackPar->
GetGdpbId(i) << std::dec;
252 for (UInt_t uGbtx = 0; uGbtx <
fuNrOfGbtx; ++uGbtx) {
259 TString sPrintoutLine =
"Nr. of RPCs per GBTx: ";
260 for (UInt_t uGbtx = 0; uGbtx <
fuNrOfGbtx; ++uGbtx)
261 sPrintoutLine += Form(
" %2d",
fviNrOfRpc[uGbtx]);
262 LOG(info) << sPrintoutLine;
264 sPrintoutLine =
"RPC type per GBTx: ";
265 for (UInt_t uGbtx = 0; uGbtx <
fuNrOfGbtx; ++uGbtx)
266 sPrintoutLine += Form(
" %2d",
fviRpcType[uGbtx]);
267 LOG(info) << sPrintoutLine;
269 sPrintoutLine =
"RPC side per GBTx: ";
270 for (UInt_t uGbtx = 0; uGbtx <
fuNrOfGbtx; ++uGbtx)
271 sPrintoutLine += Form(
" %2d",
fviRpcSide[uGbtx]);
272 LOG(info) << sPrintoutLine;
274 sPrintoutLine =
"Module ID per GBTx: ";
275 for (UInt_t uGbtx = 0; uGbtx <
fuNrOfGbtx; ++uGbtx)
277 LOG(info) << sPrintoutLine;
297 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
337 UInt_t uGet4topadi[32] = {4, 3, 2, 1,
338 8, 7, 6, 5, 12, 11, 10, 9, 16, 15, 14, 13, 20, 19,
339 18, 17, 24, 23, 22, 21, 28, 27, 26, 25, 32, 31, 30, 29};
341 UInt_t uPaditoget4[32] = {4, 3, 2, 1,
342 12, 11, 10, 9, 20, 19, 18, 17, 28, 27, 26, 25, 32, 31,
343 30, 29, 8, 7, 6, 5, 16, 15, 14, 13, 24, 23, 22, 21};
354 UInt_t kuElinkToGet4[
kuNbGet4PerGbtx] = {27, 2, 7, 3, 31, 26, 30, 1, 33, 37, 32, 13, 9, 14,
355 10, 15, 17, 21, 16, 35, 34, 38, 25, 24, 0, 6, 20, 23,
356 18, 22, 28, 4, 29, 5, 19, 36, 39, 8, 12, 11};
357 UInt_t kuGet4ToElink[
kuNbGet4PerGbtx] = {24, 7, 1, 3, 31, 33, 25, 2, 37, 12, 14, 39, 38, 11,
358 13, 15, 18, 16, 28, 34, 26, 17, 29, 27, 23, 22, 5, 0,
359 30, 32, 6, 4, 10, 8, 20, 19, 35, 9, 21, 36};
381 TString sMsSzName = Form(
"MsSz_link_%02lu", component);
382 TString sMsSzTitle = Form(
"Size of MS from link %02lu; Ms Size [bytes]", component);
383 fvhMsSzPerLink[component] =
new TH1F(sMsSzName.Data(), sMsSzTitle.Data(), 160000, 0., 20000.);
385 sMsSzName = Form(
"MsSzTime_link_%02lu", component);
386 sMsSzTitle = Form(
"Size of MS vs time for gDPB of link %02lu; Time[s] ; Ms Size [bytes]", component);
389 THttpServer* server = FairRunOnline::Instance()->GetHttpServer();
399 LOG(info) <<
"Added MS size histo for component (link): " << component;
412 LOG(info) <<
"create Histos for " <<
fuNrOfGdpbs <<
" gDPBs ";
414 THttpServer* server = FairRunOnline::Instance()->GetHttpServer();
423 Double_t dBinSzG4v2 = (6250. / 112.);
438 if (uChanA < uChanB) {
440 new TH1I(Form(
"hTimeDiffPulser_g%02u_gbt%1u_f%1u_ch%02u_ch%02u",
fuGdpbA,
fuGbtxA,
fuFeeA, uChanA, uChanB),
441 Form(
"Time difference for pulser on gDPB %02u GBTx %02u FEE "
442 "%1u channels %02u and %02u; DeltaT [ps]; Counts",
447 new TH1I(Form(
"hTimeDiffPulser_g%02u_gbt%1u_f%1u_ch%02u_ch%02u",
fuGdpbB,
fuGbtxB,
fuFeeB, uChanA, uChanB),
448 Form(
"Time difference for pulser on gDPB %02u GBTx %02u FEE "
449 "%1u channels %02u and %02u; DeltaT [ps]; Counts",
459 new TH1I(Form(
"hTimeDiffPulser_g%02u_gbt%1u_f%1u_ch%02u_g%02u_gbt%1u_f%1u_ch%02u",
fuGdpbA,
fuGbtxA,
fuFeeA,
461 Form(
"Time difference for pulser on gDPB %02u GBTx %02u FEE %1u "
462 "channel %02u and gDPB %02u GBTx %02u FEE %1u channel %02u; "
463 "DeltaT [ps]; Counts",
470 name =
"hTimeMeanPulserFeeA";
472 "Time difference Mean for each channel pairs "
473 "in FEE A; Chan A; Chan B ; Mean [ps]",
477 name =
"hTimeRmsPulserFeeA";
479 "Time difference RMS for each channel pairs "
480 "in FEE A; Chan A; Chan B; RMS [ps]",
484 name =
"hTimeRmsZoomFitPulsFeeA";
486 "Time difference RMS after zoom for each channel pairs in FEE A; "
487 "Chan A; Chan B; RMS [ps]",
491 name =
"hTimeResFitPulsFeeA";
493 "Time difference Res from fit for each channel pairs in FEE A; "
494 "Chan A; Chan B; Sigma [ps]",
499 name =
"hTimeMeanPulserFeeB";
501 "Time difference Mean for each channel pairs "
502 "in FEE B; Chan A; Chan B ; Mean [ps]",
506 name =
"hTimeRmsPulserFeeB";
508 "Time difference RMS for each channel pairs "
509 "in FEE B; Chan A; Chan B; RMS [ps]",
513 name =
"hTimeRmsZoomFitPulsFeeB";
515 "Time difference RMS after zoom for each channel pairs in FEE B; "
516 "Chan A; Chan B; RMS [ps]",
520 name =
"hTimeResFitPulsFeeB";
522 "Time difference Res from fit for each channel pairs in FEE B; "
523 "Chan A; Chan B; Sigma [ps]",
528 name =
"hTimeMeanPulserFeeFee";
530 "Time difference Mean for each channel pairs in FEE A & B; Chan "
531 "FEE A; Chan FEE B ; Mean [ps]",
535 name =
"hTimeRmsPulserFeeFee";
537 "Time difference RMS for each channel pairs in FEE A & B; Chan "
538 "FEE A; Chan FEE B; RMS [ps]",
542 name =
"hTimeRmsZoomFitPulsFeeFee";
544 "Time difference RMS after zoom for each channel pairs in FEE A & "
545 "B; Chan FEE A; Chan FEE B; RMS [ps]",
549 name =
"hTimeResFitPulsFeeFee";
551 "Time difference Res from fit for each channel pairs in FEE A & "
552 "B; Chan FEE A; Chan FEE B; Sigma [ps]",
557 name =
"hChanTotFeeA";
558 fhChanTotFeeA =
new TH2D(name.Data(),
"TOT distribution per channel in FEE A; Chan FEE A; TOT [bin]; Counts []",
561 name =
"hChanTotFeeB";
562 fhChanTotFeeB =
new TH2D(name.Data(),
"TOT distribution per channel in FEE B; Chan FEE B; TOT [bin]; Counts []",
568 uint32_t iNbBinsLog = 0;
571 double* dBinsLog = dBinsLogVector.data();
574 name =
"hChanPulseIntervalFeeA";
576 "Pulses time interval per channel in FEE A; Time interval [ns]; "
577 "Chan FEE A; Counts []",
579 name =
"hChanPulseIntervalFeeB";
581 "Pulses time interval per channel in FEE B; Time interval [ns]; "
582 "Chan FEE B; Counts []",
585 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
586 name = Form(
"hPulserCountEvoPerFeeGdpb%02u", uGdpb);
588 new TH2D(name.Data(), Form(
"Pulser count per FEE in gDPB %02u; time in run [s]; FEE []", uGdpb),
626 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
631 server->RegisterCommand(
"/Reset_All_eTOF",
"bMcbmTofTestFeeResetHistos=kTRUE");
632 server->RegisterCommand(
"/Save_All_eTof",
"bMcbmTofTestFeeSaveHistos=kTRUE");
633 server->RegisterCommand(
"/Update_PulsFit",
"bMcbmTofTestFeeUpdateZoomedFit=kTRUE");
634 server->RegisterCommand(
"/Print_Raw_Data",
"bMcbmTofTestFeeRawDataPrint=kTRUE");
635 server->RegisterCommand(
"/Print_AllHits",
"bMcbmTofTestFeePrintAllHitsEna=kTRUE");
636 server->RegisterCommand(
"/Print_AllEps",
"bMcbmTofTestFeePrintAllEpochsEna=kTRUE");
638 server->Restrict(
"/Reset_All_eTof",
"allow=admin");
639 server->Restrict(
"/Save_All_eTof",
"allow=admin");
640 server->Restrict(
"/Update_PulsFit",
"allow=admin");
641 server->Restrict(
"/Print_Raw_Data",
"allow=admin");
642 server->Restrict(
"/Print_AllHits",
"allow=admin");
643 server->Restrict(
"/Print_AllEps",
"allow=admin");
651 fcPulserFeeA =
new TCanvas(
"cPulserFeeA",
"Time difference RMS for channels on FEE A", w,
h);
678 fcPulserFeeB =
new TCanvas(
"cPulserFeeB",
"Time difference RMS for channels on FEE A", w,
h);
705 fcPulserFeeFee =
new TCanvas(
"cPulserFeeFee",
"Time difference RMS for channels on FEE A VS FEE B", w,
h);
732 fcPulseProp =
new TCanvas(
"cPulseProp",
"Pulse properties for each channel on FEE A and FEE B", w,
h);
767 fcMsSizeAll =
dynamic_cast<TCanvas*
>(gROOT->FindObject(
"cMsSizeAll"));
769 fcMsSizeAll =
new TCanvas(
"cMsSizeAll",
"Evolution of MS size in last 300 s", w,
h);
771 LOG(info) <<
"Created MS size canvas in TOF monitor";
774 LOG(info) <<
"Recovered MS size canvas in TOF monitor";
776 LOG(info) <<
"Leaving CreateHistograms";
782 LOG(info) <<
"Reset eTOF STAR histos ";
787 LOG(info) <<
"Start saving eTOF STAR histos ";
811 std::chrono::time_point<std::chrono::system_clock> timeCurrent = std::chrono::system_clock::now();
818 else if (300 < elapsed_seconds.count()) {
819 std::time_t cTimeCurrent = std::chrono::system_clock::to_time_t(timeCurrent);
821 std::strftime(tempBuff, 80,
"%F %T", localtime(&cTimeCurrent));
834 LOG(debug1) <<
"Timeslice contains " << ts.num_microslices(component) <<
"microslices.";
840 Int_t messageType = -111;
844 for (UInt_t uMsIdx = 0; uMsIdx < uNbMsLoop; uMsIdx++) {
852 auto msDescriptor = ts.descriptor(uMsComp, uMsIdx);
868 constexpr uint32_t kuBytesPerMessage = 8;
871 auto msDescriptor = ts.descriptor(uMsComp, uMsIdx);
873 fdMsIndex =
static_cast<double>(msDescriptor.idx);
875 const uint8_t* msContent =
reinterpret_cast<const uint8_t*
>(ts.content(uMsComp, uMsIdx));
877 uint32_t
size = msDescriptor.size;
879 if (
size > 0) LOG(debug) <<
"Microslice: " << msDescriptor.idx <<
" has size: " <<
size;
899 if (0 != (
size % kuBytesPerMessage))
900 LOG(error) <<
"The input microslice buffer does NOT "
901 <<
"contain only complete nDPB messages!";
904 uint32_t uNbMessages = (
size - (
size % kuBytesPerMessage)) / kuBytesPerMessage;
912 LOG(info) <<
"---------------------------------------------------------------";
923 LOG(warning) <<
"Could not find the gDPB index for AFCK id 0x" << std::hex <<
fuGdpbId << std::dec
925 << uMsCompIdx <<
"\n"
926 <<
"If valid this index has to be added in the TOF "
927 "parameter file in the RocIdArray field";
934 const uint64_t* pInBuff =
reinterpret_cast<const uint64_t*
>(msContent);
935 for (uint32_t uIdx = 0; uIdx < uNbMessages; uIdx++) {
937 uint64_t ulData =
static_cast<uint64_t
>(pInBuff[uIdx]);
965 <<
" set in parameters.";
967 switch (messageType) {
987 LOG(info) <<
"Epoch: " << Form(
"0x%08x ",
fuGdpbId) <<
", Merg"
988 <<
", Link " << std::setw(1) << mess.
getGdpbEpLinkId() <<
", epoch " << std::setw(8)
999 LOG(info) <<
"Epoch: " << Form(
"0x%08x ",
fuGdpbId) <<
", " << std::setw(4) <<
fuGet4Nr <<
", Link "
1000 << std::setw(1) << mess.
getGdpbEpLinkId() <<
", epoch " << std::setw(8)
1002 <<
", Data loss " << std::setw(1) << mess.
getGdpbEpDataLoss() <<
", Epoch loss "
1035 LOG(error) <<
"Message type " << std::hex << std::setw(2) << static_cast<uint16_t>(messageType)
1036 <<
" not included in Get4 unpacker.";
1046 Bool_t bChanOkFeeA = kFALSE;
1047 Bool_t bChanOkFeeB = kFALSE;
1056 Double_t dTimeDiff = 1e3
1064 Double_t dTimeDiff = 1e3
1074 Double_t dTimeDiff = 1e3
1131 LOG(info) <<
"CbmMcbm2018TofTestFee::ProcessEpochCyle => "
1135 <<
" In data 0x" <<
FormatHexPrintout(ulCycleData, 16,
'0',
true) <<
" Cycle 0x"
1164 if (0 < ulCurEpochGdpbGet4) ulCurEpochGdpbGet4--;
1173 UInt_t uRemappedChannelNrInFee =
fvuGet4ToPadi[uChannelNrInFee];
1177 uRemappedChannelNrInFee = uChannelNrInFee;
1208 uRemappedChannelNrInFee);
1213 uRemappedChannelNrInFee);
1221 LOG(info) <<
"Hit: " << Form(
"0x%08x ",
fuGdpbId) <<
", " << std::setw(2) <<
fuGet4Nr <<
", " << std::setw(3)
1222 << uChannel <<
", " << std::setw(3) << uTot <<
", epoch " << std::setw(3) << ulCurEpochGdpbGet4
1223 <<
", FullTime Clk " << Form(
"%12lu ", ulHitTime) <<
", FullTime s " << Form(
"%12.9f ", dHitTime / 1e9)
1224 <<
", FineTime " << uFts;
1247 if (0 < iBufferSize) {
1248 LOG(debug) <<
"Now processing stored messages for for get4 " <<
fuGet4Nr <<
" with epoch number "
1255 for (Int_t iMsgIdx = 0; iMsgIdx < iBufferSize; iMsgIdx++) {
1287 uint64_t uData = mess.
getData();
1289 LOG(debug) <<
"Get4 MSG type " << mType <<
" from gdpbId " <<
fuGdpbId <<
", getId " <<
fuGet4Id <<
", (hit channel) "
1290 << channel <<
" data " << std::hex << uData;
1298 <<
" for board ID " << std::hex << std::setw(4) <<
fuGdpbId << std::dec;
1306 LOG(debug) <<
" +++++++ > gDPB: " << std::hex << std::setw(4) <<
fuGdpbId << std::dec
1307 <<
", Chip = " << std::setw(2) << mess.
getGdpbGenChipId() <<
", Chan = " << std::setw(1)
1310 << std::setw(2) << uData << std::dec <<
" -- GET4 V1 Error Event";
1312 LOG(debug) <<
" +++++++ >gDPB: " << std::hex << std::setw(4) <<
fuGdpbId << std::dec
1313 <<
", Chip = " << std::setw(2) << mess.
getGdpbGenChipId() <<
", Chan = " << std::setw(1)
1316 << std::setw(2) << uData << std::dec <<
" -- GET4 V1 Error Event ";
1320 LOG(debug) <<
"Unknown GET4 message, data: " << std::hex << std::setw(8) << mess.
getGdpbSysUnkwData() << std::dec
1321 <<
" Full message: " << std::hex << std::setw(16) << mess.
getData() << std::dec;
1326 LOG(info) << Form(
"GET4 Resynchronization: Get4:0x%04x ", mess.
getGdpbGenChipId()) << std::hex << std::setw(4)
1329 LOG(info) <<
"GET4 synchronization pulse missing in gDPB " << std::hex << std::setw(4) <<
fuGdpbId << std::dec;
1333 LOG(debug) <<
"ASIC pattern for missmatch, disable or resync";
1361 if( 0x90 == fuCurrentMsSysId )
1362 uBadAsic = 32 * usIndex + uBit;
1363 } // if( ( uPattern >> uBit ) & 0x1 )
1366 } // case gdpbv100::PATT_MISSMATCH:
1367 case gdpbv100::PATT_ENABLE:
1369 for( UInt_t uBit = 0; uBit < 32; ++uBit )
1370 if( ( uPattern >> uBit ) & 0x1 )
1372 UInt_t uBadAsic = ConvertElinkToGet4( 32 * usIndex + uBit );
1374 if( 0x90 == fuCurrentMsSysId )
1375 uBadAsic = 32 * usIndex + uBit;
1376 } // if( ( uPattern >> uBit ) & 0x1 )
1379 } // case gdpbv100::PATT_ENABLE:
1380 case gdpbv100::PATT_RESYNC:
1382 LOG(debug) << Form( "RESYNC pattern message => Type %d, Index %2d, Pattern 0x%08X", usType, usIndex, uPattern );
1384 for( UInt_t uBit = 0; uBit < 32; ++uBit )
1385 if( ( uPattern >> uBit ) & 0x1 )
1387 UInt_t uBadAsic = ConvertElinkToGet4( 32 * usIndex + uBit );
1389 if( 0x90 == fuCurrentMsSysId )
1390 uBadAsic = 32 * usIndex + uBit;
1391 } // if( ( uPattern >> uBit ) & 0x1 )
1394 } // case gdpbv100::PATT_RESYNC:
1397 LOG(debug) << "Crazy pattern message, subtype " << usType;
1400 } // switch( usType )
1409 switch (iMsgIndex) {
1419 ULong64_t ulNewStarTsFull =
1430 LOG(warning) <<
"Possible error: identical STAR tokens found twice in "
1431 "a row => ignore 2nd! "
1455 <<
" new = " << Form(
"%16llu", ulNewStarTsFull) <<
" Diff = -"
1470 if( fuCurrentMs < fuCoreMs )
1473 if( 0 <= fdStartTime )
1476 if( fuHistoryHistoSize < 1e-9 * (fvulGdpbTsFullLast[fuGdpbNr] * gdpbv100::kdClockCycleSizeNs - fdStartTime) )
1478 ResetEvolutionHistograms();
1479 fdStartTime = fvulGdpbTsFullLast[fuGdpbNr] * gdpbv100::kdClockCycleSizeNs;
1480 } // if( fuHistoryHistoSize < 1e-9 * (fulGdpbTsFullLast * gdpbv100::kdClockCycleSizeNs - fdStartTime) )
1482 fvhTriggerRate[fuGdpbNr]->Fill( 1e-9 * ( fvulGdpbTsFullLast[fuGdpbNr] * gdpbv100::kdClockCycleSizeNs - fdStartTime ) );
1483 fvhStarTokenEvo[fuGdpbNr]->Fill( 1e-9 * ( fvulGdpbTsFullLast[fuGdpbNr] * gdpbv100::kdClockCycleSizeNs - fdStartTime ),
1484 fvuStarTokenLast[fuGdpbNr] );
1485 fvhStarTrigGdpbTsEvo[fuGdpbNr]->Fill( 1e-9 * ( fvulGdpbTsFullLast[fuGdpbNr] * gdpbv100::kdClockCycleSizeNs - fdStartTime ),
1486 fvulGdpbTsFullLast[fuGdpbNr] );
1487 fvhStarTrigStarTsEvo[fuGdpbNr]->Fill( 1e-9 * ( fvulGdpbTsFullLast[fuGdpbNr] * gdpbv100::kdClockCycleSizeNs - fdStartTime ),
1488 fvulStarTsFullLast[fuGdpbNr] );
1489 } // if( 0 < fdStartTime )
1490 else fdStartTime = fvulGdpbTsFullLast[fuGdpbNr] * gdpbv100::kdClockCycleSizeNs;
1491 fvhCmdDaqVsTrig[fuGdpbNr]->Fill( fvuStarDaqCmdLast[fuGdpbNr], fvuStarTrigCmdLast[fuGdpbNr] );
1492 } // if( fuCurrentMs < fuCoreMs )
1496 default: LOG(error) <<
"Unknown Star Trigger messageindex: " << iMsgIndex;
1505 TString message_type;
1508 case 0: message_type =
"NOP";
break;
1509 case 1: message_type =
"HIT";
break;
1510 case 2: message_type =
"EPOCH";
break;
1511 case 3: message_type =
"SYNC";
break;
1512 case 4: message_type =
"AUX";
break;
1513 case 5: message_type =
"EPOCH2";
break;
1514 case 6: message_type =
"GET4";
break;
1515 case 7: message_type =
"SYS";
break;
1516 case 8: message_type =
"GET4_SLC";
break;
1517 case 9: message_type =
"GET4_32B";
break;
1518 case 10: message_type =
"GET4_SYS";
break;
1519 default: message_type =
"UNKNOWN";
break;
1521 LOG(info) << message_type <<
" messages: " <<
fviMsgCounter[i];
1579 TFile* oldFile = gFile;
1580 TDirectory* oldDir = gDirectory;
1582 TFile* histoFile = NULL;
1583 if (
"" != sFileName) {
1585 histoFile =
new TFile(sFileName,
"RECREATE");
1589 gDirectory->mkdir(
"TofDt");
1590 gDirectory->cd(
"TofDt");
1606 gDirectory->cd(
"..");
1610 gDirectory->mkdir(
"TofDtFeeA");
1611 gDirectory->cd(
"TofDtFeeA");
1615 gDirectory->cd(
"..");
1617 gDirectory->mkdir(
"TofDtFeeB");
1618 gDirectory->cd(
"TofDtFeeB");
1622 gDirectory->cd(
"..");
1624 gDirectory->mkdir(
"TofDtFeeFee");
1625 gDirectory->cd(
"TofDtFeeFee");
1629 gDirectory->cd(
"..");
1631 gDirectory->mkdir(
"TofPulse");
1632 gDirectory->cd(
"TofPulse");
1637 gDirectory->cd(
"..");
1639 gDirectory->mkdir(
"TofCnt");
1640 gDirectory->cd(
"TofCnt");
1641 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb)
1643 gDirectory->cd(
"..");
1645 gDirectory->mkdir(
"Flib_Raw");
1646 gDirectory->cd(
"Flib_Raw");
1647 for (UInt_t uLinks = 0; uLinks <
fvhMsSzPerLink.size(); uLinks++) {
1654 TH1* pMissedTsH1 =
dynamic_cast<TH1*
>(gROOT->FindObjectAny(
"Missed_TS"));
1655 if (NULL != pMissedTsH1) pMissedTsH1->Write();
1657 TProfile* pMissedTsEvoP =
dynamic_cast<TProfile*
>(gROOT->FindObjectAny(
"Missed_TS_Evo"));
1658 if (NULL != pMissedTsEvoP) pMissedTsEvoP->Write();
1660 gDirectory->cd(
"..");
1668 if (
"" != sFileName) {
1675 gDirectory = oldDir;
1680 LOG(info) <<
"Reseting all TOF histograms.";
1715 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb)
1718 for (UInt_t uLinks = 0; uLinks <
fvhMsSzPerLink.size(); uLinks++) {
1736 phTimeRmsZoom->Reset();
1737 phTimeResFit->Reset();
1744 if (NULL != phTimeDiff[uChanA][uChanB]) {
1746 if (0 == phTimeDiff[uChanA][uChanB]->GetEntries()) {
1747 phTimeRmsZoom->Fill(uChanA, uChanB, 0.0);
1748 phTimeResFit->Fill(uChanA, uChanB, 0.0);
1749 LOG(debug) <<
"CbmMcbm2018TofTestFee::UpdateZoomedFit => Empty input "
1750 <<
"for Chan pair " << uChanA <<
" and " << uChanB <<
" !!! ";
1755 Int_t iBinWithMax = phTimeDiff[uChanA][uChanB]->GetMaximumBin();
1756 Double_t dNbCounts = phTimeDiff[uChanA][uChanB]->Integral();
1759 Double_t dPeakPos = phTimeDiff[uChanA][uChanB]->GetXaxis()->GetBinCenter(iBinWithMax);
1760 phTimeDiff[uChanA][uChanB]->GetXaxis()->SetRangeUser(dPeakPos -
fdFitZoomWidthPs,
1764 Double_t dZoomCounts = phTimeDiff[uChanA][uChanB]->Integral();
1765 if ((dZoomCounts / dNbCounts) < 0.99) {
1766 phTimeRmsZoom->Fill(uChanA, uChanB, 0.0);
1767 phTimeResFit->Fill(uChanA, uChanB, 0.0);
1768 LOG(warning) <<
"CbmMcbm2018TofTestFee::UpdateZoomedFit => Zoom too strong, "
1769 <<
"more than 1% loss for Chan pair " << uChanA <<
" and " << uChanB <<
" !!! ";
1774 phTimeRmsZoom->Fill(uChanA, uChanB, phTimeDiff[uChanA][uChanB]->GetRMS());
1779 fitFuncPairs[uChanA][uChanB] =
new TF1(Form(
"fPair_%02d_%02d", uChanA, uChanB),
"gaus",
1782 fitFuncPairs[uChanA][uChanB]->SetParameter(0, dZoomCounts);
1783 fitFuncPairs[uChanA][uChanB]->SetParameter(1, dPeakPos);
1784 fitFuncPairs[uChanA][uChanB]->SetParameter(2, 200.0);
1786 phTimeDiff[uChanA][uChanB]->Fit(Form(
"fPair_%02d_%02d", uChanA, uChanB),
"QRM0");
1788 dRes = fitFuncPairs[uChanA][uChanB]->GetParameter(2);
1790 delete fitFuncPairs[uChanA][uChanB];
1792 phTimeResFit->Fill(uChanA, uChanB, dRes / TMath::Sqrt2());
1795 LOG(debug) <<
"CbmMcbm2018TofTestFee::UpdateZoomedFit => "
1796 <<
"For chan pair " << uChanA <<
" and " << uChanB
1797 <<
" we have zoomed RMS = " << phTimeDiff[uChanA][uChanB]->GetRMS() <<
" and a resolution of "
1798 << dRes / TMath::Sqrt2();
1801 phTimeDiff[uChanA][uChanB]->GetXaxis()->UnZoom();
1805 LOG(error) <<
"CbmMcbm2018TofTestFee::UpdateZoomedFit => Zoom width not defined, "
1806 <<
"please use SetFitZoomWidthPs, e.g. in macro, before trying this "
ClassImp(CbmConverterManager)
Bool_t bMcbmTofTestFeeUpdateZoomedFit
Bool_t bMcbmTofTestFeePrintAllHitsEna
Bool_t bMcbmTofTestFeePrintAllEpochsEna
Bool_t bMcbmTofTestFeeResetHistos
Bool_t bMcbmTofTestFeeSaveHistos
Bool_t bMcbmTofTestFeeRawDataPrint
static double dTsStartTime
static constexpr size_t size()
Int_t GetModuleId(Int_t i)
static constexpr UInt_t GetNrOfFeePerGbtx()
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()
TH2 * fhTimeRmsZoomFitPulsFeeFee
std::vector< std::vector< gdpbv100::Message > > fvmEpSupprBuffer
Buffer for suppressed epoch processing.
TH2 * fhTimeMeanPulserFeeA
[ Ch A ][ Ch B ]
std::vector< std::vector< Double_t > > fvdFeeChanMsLastPulserHit
[ fuFeeNr ][ ChanNr ]
std::vector< TH2 * > fvhPulserCountEvoPerFeeGdpb
CbmMcbm2018TofPar * fUnpackPar
std::vector< ULong64_t > fvulGdpbTsMsb
void ResetEvolutionHistograms()
uint64_t fulCurrentTsIndex
virtual void SetNbMsInTs(size_t uCoreMsNb, size_t uOverlapMsNb)
UInt_t ConvertElinkToGet4(UInt_t uElinkIdx)
void FillEpochInfo(gdpbv100::Message)
void PrintSlcInfo(gdpbv100::Message)
std::vector< UInt_t > fvuPadiToGet4
std::vector< Int_t > fviModuleId
std::vector< size_t > fvMsComponentsList
FLES containers.
UInt_t fuNbFeePlotsPerGdpb
std::vector< UInt_t > fvuStarTrigCmdLast
std::map< UInt_t, UInt_t > fGdpbIdIndexMap
Map of ID to index for the gDPBs.
TH2 * fhTimeRmsPulserFeeB
TH2 * fhTimeResFitPulsFeeFee
ULong64_t fulCurrentEpochTime
Epoch + Epoch Cycle.
TH2 * fhTimeRmsPulserFeeA
UInt_t fuNrOfChannelsPerGet4
Bool_t fbPrintAllHitsEnable
TH2 * fhTimeRmsZoomFitPulsFeeA
TCanvas * fcPulserFeeA
Canvases.
std::vector< TH1 * > fvhMsSzPerLink
const Double_t kdMaxDtPulserPs
TString fsHistoFileFullname
/** Ignore Overlap Ms: all fuOverlapMsNb MS at the end of timeslice **/
std::vector< ULong64_t > fvulCurrentEpochFull
Epoch cycle from the Ms Start message and Epoch counter flip.
std::chrono::time_point< std::chrono::system_clock > fTimeLastHistoSaving
size_t fuMsAcceptsPercent
OLD, to be cleaned out !!!!!
Double_t fdTsCoreSizeInNs
std::vector< std::vector< TH1 * > > fvhTimeDiffPulserFeeFee
std::vector< UInt_t > fvuStarTokenLast
Int_t GetArrayIndex(Int_t gdpbId, Int_t get4Id)
void SaveAllHistos(TString sFileName="")
void ProcessEpochCycle(uint64_t ulCycleData)
void PrintGenInfo(gdpbv100::Message)
std::vector< Int_t > fviRpcSide
TH2 * fhChanPulseIntervalFeeB
std::vector< ULong64_t > fvulStarTsMsb
std::vector< std::vector< TH1 * > > fvhTimeDiffPulserFeeA
TH2 * fhTimeMeanPulserFeeB
[ Ch A ][ Ch B ]
std::vector< std::vector< UInt_t > > fvuFeeChanNbHitsLastMs
Buffer for pulser channels.
TH2 * fhTimeResFitPulsFeeB
UInt_t fuRawDataPrintMsgIdx
Bool_t fbPrintAllEpochsEnable
TH2 * fhTimeResFitPulsFeeA
const UInt_t kuNbBinsDt
[ fuFeeNr ][ ChanNr ]
std::vector< int > fviMsgCounter
UInt_t fuHistoryHistoSize
void FillHitInfo(gdpbv100::Message)
std::vector< TProfile * > fvhMsSzTimePerLink
std::vector< UInt_t > fvuGet4ToElink
virtual ~CbmMcbm2018TofTestFee()
std::vector< Int_t > fviNrOfRpc
std::vector< ULong64_t > fvulStarTsMid
std::vector< UInt_t > fvuElinkToGet4
5 FEE with 8 GET4 each
void FillPattInfo(gdpbv100::Message)
virtual void AddMsComponentToList(size_t component, UShort_t usDetectorId)
std::vector< std::vector< TH1 * > > fvhTimeDiffPulserFeeB
TH2 * fhTimeRmsPulserFeeFee
void UpdateZoomedFit(std::vector< std::vector< TH1 * > > phTimeDiff, TH2 *phTimeRmsZoom, TH2 *phTimeResFit)
Double_t fdFitZoomWidthPs
std::vector< UInt_t > fvuStarDaqCmdLast
UInt_t fuNrOfChannelsPerGdpb
UInt_t fuRawDataPrintMsgNb
std::vector< ULong64_t > fvulCurrentEpoch
virtual Bool_t DoUnpack(const fles::Timeslice &ts, size_t component)
Double_t fdLastRmsUpdateTime
std::vector< ULong64_t > fvulStarTsFullLast
std::vector< ULong64_t > fvulGdpbTsLsb
void PrintSysInfo(gdpbv100::Message)
std::vector< ULong64_t > fvulCurrentEpochCycle
std::vector< ULong64_t > fvulGdpbTsFullLast
TH2 * fhChanPulseIntervalFeeA
UInt_t fuNrOfChannelsPerFee
TH2 * fhTimeMeanPulserFeeFee
[ Ch FEE A ][ Ch FEE B ]
std::vector< UInt_t > fvuGet4ToPadi
std::vector< Int_t > fviRpcType
Bool_t ReInitContainers()
void FillStarTrigInfo(gdpbv100::Message)
static const UInt_t kuNbGet4PerGbtx
TH2 * fhTimeRmsZoomFitPulsFeeB
std::vector< Bool_t > fvbFirstEpochSeen
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
const uint32_t kuTotCounterSize
@ 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 kuEpochCounterSz
const uint64_t kulEpochCycleFieldSz