19#include "FairRootManager.h"
21#include "FairRunOnline.h"
22#include "FairRuntimeDb.h"
25#include "TClonesArray.h"
30#include "THttpServer.h"
32#include "TPaveStats.h"
34#include "TProfile2D.h"
170 LOG(info) <<
"Initializing Get4 monitor";
172 FairRootManager* ioman = FairRootManager::Instance();
173 if (ioman == NULL) { LOG(fatal) <<
"No FairRootManager instance"; }
180 LOG(info) <<
"Setting parameter containers for " << GetName();
186 LOG(info) <<
"Init parameter containers for " << GetName();
208 LOG(info) <<
"ReInit parameter containers for " << GetName();
238 LOG(info) <<
"GDPB Id of TOF " << i <<
" : " << std::hex <<
fUnpackPar->GetGdpbId(i) << std::dec;
251 for (UInt_t uGbtx = 0; uGbtx <
fuNrOfGbtx; ++uGbtx) {
258 TString sPrintoutLine =
"Nr. of RPCs per GBTx: ";
259 for (UInt_t uGbtx = 0; uGbtx <
fuNrOfGbtx; ++uGbtx)
260 sPrintoutLine += Form(
" %2d",
fviNrOfRpc[uGbtx]);
261 LOG(info) << sPrintoutLine;
263 sPrintoutLine =
"RPC type per GBTx: ";
264 for (UInt_t uGbtx = 0; uGbtx <
fuNrOfGbtx; ++uGbtx)
265 sPrintoutLine += Form(
" %2d",
fviRpcType[uGbtx]);
266 LOG(info) << sPrintoutLine;
268 sPrintoutLine =
"RPC side per GBTx: ";
269 for (UInt_t uGbtx = 0; uGbtx <
fuNrOfGbtx; ++uGbtx)
270 sPrintoutLine += Form(
" %2d",
fviRpcSide[uGbtx]);
271 LOG(info) << sPrintoutLine;
273 sPrintoutLine =
"Module ID per GBTx: ";
274 for (UInt_t uGbtx = 0; uGbtx <
fuNrOfGbtx; ++uGbtx)
276 LOG(info) << sPrintoutLine;
296 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
336 UInt_t uGet4topadi[32] = {4, 3, 2, 1,
337 8, 7, 6, 5, 12, 11, 10, 9, 16, 15, 14, 13, 20, 19,
338 18, 17, 24, 23, 22, 21, 28, 27, 26, 25, 32, 31, 30, 29};
340 UInt_t uPaditoget4[32] = {4, 3, 2, 1,
341 12, 11, 10, 9, 20, 19, 18, 17, 28, 27, 26, 25, 32, 31,
342 30, 29, 8, 7, 6, 5, 16, 15, 14, 13, 24, 23, 22, 21};
353 UInt_t kuElinkToGet4[
kuNbGet4PerGbtx] = {27, 2, 7, 3, 31, 26, 30, 1, 33, 37, 32, 13, 9, 14,
354 10, 15, 17, 21, 16, 35, 34, 38, 25, 24, 0, 6, 20, 23,
355 18, 22, 28, 4, 29, 5, 19, 36, 39, 8, 12, 11};
356 UInt_t kuGet4ToElink[
kuNbGet4PerGbtx] = {24, 7, 1, 3, 31, 33, 25, 2, 37, 12, 14, 39, 38, 11,
357 13, 15, 18, 16, 28, 34, 26, 17, 29, 27, 23, 22, 5, 0,
358 30, 32, 6, 4, 10, 8, 20, 19, 35, 9, 21, 36};
380 TString sMsSzName = Form(
"MsSz_link_%02lu", component);
381 TString sMsSzTitle = Form(
"Size of MS from link %02lu; Ms Size [bytes]", component);
382 fvhMsSzPerLink[component] =
new TH1F(sMsSzName.Data(), sMsSzTitle.Data(), 160000, 0., 20000.);
384 sMsSzName = Form(
"MsSzTime_link_%02lu", component);
385 sMsSzTitle = Form(
"Size of MS vs time for gDPB of link %02lu; Time[s] ; Ms Size [bytes]", component);
388 THttpServer* server = FairRunOnline::Instance()->GetHttpServer();
398 LOG(info) <<
"Added MS size histo for component (link): " << component;
411 LOG(info) <<
"create Histos for " <<
fuNrOfGdpbs <<
" gDPBs ";
413 THttpServer* server = FairRunOnline::Instance()->GetHttpServer();
422 Double_t dBinSzG4v2 = (6250. / 112.);
437 if (uChanA < uChanB) {
439 new TH1I(Form(
"hTimeDiffPulser_g%02u_gbt%1u_f%1u_ch%02u_ch%02u",
fuGdpbA,
fuGbtxA,
fuFeeA, uChanA, uChanB),
440 Form(
"Time difference for pulser on gDPB %02u GBTx %02u FEE "
441 "%1u channels %02u and %02u; DeltaT [ps]; Counts",
446 new TH1I(Form(
"hTimeDiffPulser_g%02u_gbt%1u_f%1u_ch%02u_ch%02u",
fuGdpbB,
fuGbtxB,
fuFeeB, uChanA, uChanB),
447 Form(
"Time difference for pulser on gDPB %02u GBTx %02u FEE "
448 "%1u channels %02u and %02u; DeltaT [ps]; Counts",
458 new TH1I(Form(
"hTimeDiffPulser_g%02u_gbt%1u_f%1u_ch%02u_g%02u_gbt%1u_f%1u_ch%02u",
fuGdpbA,
fuGbtxA,
fuFeeA,
460 Form(
"Time difference for pulser on gDPB %02u GBTx %02u FEE %1u "
461 "channel %02u and gDPB %02u GBTx %02u FEE %1u channel %02u; "
462 "DeltaT [ps]; Counts",
469 name =
"hTimeMeanPulserFeeA";
471 "Time difference Mean for each channel pairs "
472 "in FEE A; Chan A; Chan B ; Mean [ps]",
476 name =
"hTimeRmsPulserFeeA";
478 "Time difference RMS for each channel pairs "
479 "in FEE A; Chan A; Chan B; RMS [ps]",
483 name =
"hTimeRmsZoomFitPulsFeeA";
485 "Time difference RMS after zoom for each channel pairs in FEE A; "
486 "Chan A; Chan B; RMS [ps]",
490 name =
"hTimeResFitPulsFeeA";
492 "Time difference Res from fit for each channel pairs in FEE A; "
493 "Chan A; Chan B; Sigma [ps]",
498 name =
"hTimeMeanPulserFeeB";
500 "Time difference Mean for each channel pairs "
501 "in FEE B; Chan A; Chan B ; Mean [ps]",
505 name =
"hTimeRmsPulserFeeB";
507 "Time difference RMS for each channel pairs "
508 "in FEE B; Chan A; Chan B; RMS [ps]",
512 name =
"hTimeRmsZoomFitPulsFeeB";
514 "Time difference RMS after zoom for each channel pairs in FEE B; "
515 "Chan A; Chan B; RMS [ps]",
519 name =
"hTimeResFitPulsFeeB";
521 "Time difference Res from fit for each channel pairs in FEE B; "
522 "Chan A; Chan B; Sigma [ps]",
527 name =
"hTimeMeanPulserFeeFee";
529 "Time difference Mean for each channel pairs in FEE A & B; Chan "
530 "FEE A; Chan FEE B ; Mean [ps]",
534 name =
"hTimeRmsPulserFeeFee";
536 "Time difference RMS for each channel pairs in FEE A & B; Chan "
537 "FEE A; Chan FEE B; RMS [ps]",
541 name =
"hTimeRmsZoomFitPulsFeeFee";
543 "Time difference RMS after zoom for each channel pairs in FEE A & "
544 "B; Chan FEE A; Chan FEE B; RMS [ps]",
548 name =
"hTimeResFitPulsFeeFee";
550 "Time difference Res from fit for each channel pairs in FEE A & "
551 "B; Chan FEE A; Chan FEE B; Sigma [ps]",
556 name =
"hChanTotFeeA";
557 fhChanTotFeeA =
new TH2D(name.Data(),
"TOT distribution per channel in FEE A; Chan FEE A; TOT [bin]; Counts []",
560 name =
"hChanTotFeeB";
561 fhChanTotFeeB =
new TH2D(name.Data(),
"TOT distribution per channel in FEE B; Chan FEE B; TOT [bin]; Counts []",
567 uint32_t iNbBinsLog = 0;
570 double* dBinsLog = dBinsLogVector.data();
573 name =
"hChanPulseIntervalFeeA";
575 "Pulses time interval per channel in FEE A; Time interval [ns]; "
576 "Chan FEE A; Counts []",
578 name =
"hChanPulseIntervalFeeB";
580 "Pulses time interval per channel in FEE B; Time interval [ns]; "
581 "Chan FEE B; Counts []",
584 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
585 name = Form(
"hPulserCountEvoPerFeeGdpb%02u", uGdpb);
587 new TH2D(name.Data(), Form(
"Pulser count per FEE in gDPB %02u; time in run [s]; FEE []", uGdpb),
625 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
630 server->RegisterCommand(
"/Reset_All_eTOF",
"bMcbmTofTestFeeResetHistos=kTRUE");
631 server->RegisterCommand(
"/Save_All_eTof",
"bMcbmTofTestFeeSaveHistos=kTRUE");
632 server->RegisterCommand(
"/Update_PulsFit",
"bMcbmTofTestFeeUpdateZoomedFit=kTRUE");
633 server->RegisterCommand(
"/Print_Raw_Data",
"bMcbmTofTestFeeRawDataPrint=kTRUE");
634 server->RegisterCommand(
"/Print_AllHits",
"bMcbmTofTestFeePrintAllHitsEna=kTRUE");
635 server->RegisterCommand(
"/Print_AllEps",
"bMcbmTofTestFeePrintAllEpochsEna=kTRUE");
637 server->Restrict(
"/Reset_All_eTof",
"allow=admin");
638 server->Restrict(
"/Save_All_eTof",
"allow=admin");
639 server->Restrict(
"/Update_PulsFit",
"allow=admin");
640 server->Restrict(
"/Print_Raw_Data",
"allow=admin");
641 server->Restrict(
"/Print_AllHits",
"allow=admin");
642 server->Restrict(
"/Print_AllEps",
"allow=admin");
650 fcPulserFeeA =
new TCanvas(
"cPulserFeeA",
"Time difference RMS for channels on FEE A", w,
h);
677 fcPulserFeeB =
new TCanvas(
"cPulserFeeB",
"Time difference RMS for channels on FEE A", w,
h);
704 fcPulserFeeFee =
new TCanvas(
"cPulserFeeFee",
"Time difference RMS for channels on FEE A VS FEE B", w,
h);
731 fcPulseProp =
new TCanvas(
"cPulseProp",
"Pulse properties for each channel on FEE A and FEE B", w,
h);
766 fcMsSizeAll =
dynamic_cast<TCanvas*
>(gROOT->FindObject(
"cMsSizeAll"));
768 fcMsSizeAll =
new TCanvas(
"cMsSizeAll",
"Evolution of MS size in last 300 s", w,
h);
770 LOG(info) <<
"Created MS size canvas in TOF monitor";
773 LOG(info) <<
"Recovered MS size canvas in TOF monitor";
775 LOG(info) <<
"Leaving CreateHistograms";
781 LOG(info) <<
"Reset eTOF STAR histos ";
786 LOG(info) <<
"Start saving eTOF STAR histos ";
810 std::chrono::time_point<std::chrono::system_clock> timeCurrent = std::chrono::system_clock::now();
817 else if (300 < elapsed_seconds.count()) {
818 std::time_t cTimeCurrent = std::chrono::system_clock::to_time_t(timeCurrent);
820 std::strftime(tempBuff, 80,
"%F %T", localtime(&cTimeCurrent));
833 LOG(debug1) <<
"Timeslice contains " << ts.num_microslices(component) <<
"microslices.";
839 Int_t messageType = -111;
843 for (UInt_t uMsIdx = 0; uMsIdx < uNbMsLoop; uMsIdx++) {
851 auto msDescriptor = ts.descriptor(uMsComp, uMsIdx);
867 constexpr uint32_t kuBytesPerMessage = 8;
870 auto msDescriptor = ts.descriptor(uMsComp, uMsIdx);
872 fdMsIndex =
static_cast<double>(msDescriptor.idx);
874 const uint8_t* msContent =
reinterpret_cast<const uint8_t*
>(ts.content(uMsComp, uMsIdx));
876 uint32_t
size = msDescriptor.size;
878 if (
size > 0) LOG(debug) <<
"Microslice: " << msDescriptor.idx <<
" has size: " <<
size;
898 if (0 != (
size % kuBytesPerMessage))
899 LOG(error) <<
"The input microslice buffer does NOT "
900 <<
"contain only complete nDPB messages!";
903 uint32_t uNbMessages = (
size - (
size % kuBytesPerMessage)) / kuBytesPerMessage;
911 LOG(info) <<
"---------------------------------------------------------------";
922 LOG(warning) <<
"Could not find the gDPB index for AFCK id 0x" << std::hex <<
fuGdpbId << std::dec
924 << uMsCompIdx <<
"\n"
925 <<
"If valid this index has to be added in the TOF "
926 "parameter file in the RocIdArray field";
933 const uint64_t* pInBuff =
reinterpret_cast<const uint64_t*
>(msContent);
934 for (uint32_t uIdx = 0; uIdx < uNbMessages; uIdx++) {
936 uint64_t ulData =
static_cast<uint64_t
>(pInBuff[uIdx]);
964 <<
" set in parameters.";
966 switch (messageType) {
986 LOG(info) <<
"Epoch: " << Form(
"0x%08x ",
fuGdpbId) <<
", Merg"
987 <<
", Link " << std::setw(1) << mess.
getGdpbEpLinkId() <<
", epoch " << std::setw(8)
998 LOG(info) <<
"Epoch: " << Form(
"0x%08x ",
fuGdpbId) <<
", " << std::setw(4) <<
fuGet4Nr <<
", Link "
999 << std::setw(1) << mess.
getGdpbEpLinkId() <<
", epoch " << std::setw(8)
1001 <<
", Data loss " << std::setw(1) << mess.
getGdpbEpDataLoss() <<
", Epoch loss "
1034 LOG(error) <<
"Message type " << std::hex << std::setw(2) << static_cast<uint16_t>(messageType)
1035 <<
" not included in Get4 unpacker.";
1045 Bool_t bChanOkFeeA = kFALSE;
1046 Bool_t bChanOkFeeB = kFALSE;
1055 Double_t dTimeDiff = 1e3
1063 Double_t dTimeDiff = 1e3
1073 Double_t dTimeDiff = 1e3
1130 LOG(info) <<
"CbmMcbm2018TofTestFee::ProcessEpochCyle => "
1134 <<
" In data 0x" <<
FormatHexPrintout(ulCycleData, 16,
'0',
true) <<
" Cycle 0x"
1163 if (0 < ulCurEpochGdpbGet4) ulCurEpochGdpbGet4--;
1172 UInt_t uRemappedChannelNrInFee =
fvuGet4ToPadi[uChannelNrInFee];
1176 uRemappedChannelNrInFee = uChannelNrInFee;
1207 uRemappedChannelNrInFee);
1212 uRemappedChannelNrInFee);
1220 LOG(info) <<
"Hit: " << Form(
"0x%08x ",
fuGdpbId) <<
", " << std::setw(2) <<
fuGet4Nr <<
", " << std::setw(3)
1221 << uChannel <<
", " << std::setw(3) << uTot <<
", epoch " << std::setw(3) << ulCurEpochGdpbGet4
1222 <<
", FullTime Clk " << Form(
"%12lu ", ulHitTime) <<
", FullTime s " << Form(
"%12.9f ", dHitTime / 1e9)
1223 <<
", FineTime " << uFts;
1246 if (0 < iBufferSize) {
1247 LOG(debug) <<
"Now processing stored messages for for get4 " <<
fuGet4Nr <<
" with epoch number "
1254 for (
Int_t iMsgIdx = 0; iMsgIdx < iBufferSize; iMsgIdx++) {
1286 uint64_t uData = mess.
getData();
1288 LOG(debug) <<
"Get4 MSG type " << mType <<
" from gdpbId " <<
fuGdpbId <<
", getId " <<
fuGet4Id <<
", (hit channel) "
1289 << channel <<
" data " << std::hex << uData;
1297 <<
" for board ID " << std::hex << std::setw(4) <<
fuGdpbId << std::dec;
1305 LOG(debug) <<
" +++++++ > gDPB: " << std::hex << std::setw(4) <<
fuGdpbId << std::dec
1306 <<
", Chip = " << std::setw(2) << mess.
getGdpbGenChipId() <<
", Chan = " << std::setw(1)
1309 << std::setw(2) << uData << std::dec <<
" -- GET4 V1 Error Event";
1311 LOG(debug) <<
" +++++++ >gDPB: " << std::hex << std::setw(4) <<
fuGdpbId << std::dec
1312 <<
", Chip = " << std::setw(2) << mess.
getGdpbGenChipId() <<
", Chan = " << std::setw(1)
1315 << std::setw(2) << uData << std::dec <<
" -- GET4 V1 Error Event ";
1319 LOG(debug) <<
"Unknown GET4 message, data: " << std::hex << std::setw(8) << mess.
getGdpbSysUnkwData() << std::dec
1320 <<
" Full message: " << std::hex << std::setw(16) << mess.
getData() << std::dec;
1325 LOG(info) << Form(
"GET4 Resynchronization: Get4:0x%04x ", mess.
getGdpbGenChipId()) << std::hex << std::setw(4)
1328 LOG(info) <<
"GET4 synchronization pulse missing in gDPB " << std::hex << std::setw(4) <<
fuGdpbId << std::dec;
1332 LOG(debug) <<
"ASIC pattern for missmatch, disable or resync";
1360 if( 0x90 == fuCurrentMsSysId )
1361 uBadAsic = 32 * usIndex + uBit;
1362 } // if( ( uPattern >> uBit ) & 0x1 )
1365 } // case gdpbv100::PATT_MISSMATCH:
1366 case gdpbv100::PATT_ENABLE:
1368 for( UInt_t uBit = 0; uBit < 32; ++uBit )
1369 if( ( uPattern >> uBit ) & 0x1 )
1371 UInt_t uBadAsic = ConvertElinkToGet4( 32 * usIndex + uBit );
1373 if( 0x90 == fuCurrentMsSysId )
1374 uBadAsic = 32 * usIndex + uBit;
1375 } // if( ( uPattern >> uBit ) & 0x1 )
1378 } // case gdpbv100::PATT_ENABLE:
1379 case gdpbv100::PATT_RESYNC:
1381 LOG(debug) << Form( "RESYNC pattern message => Type %d, Index %2d, Pattern 0x%08X", usType, usIndex, uPattern );
1383 for( UInt_t uBit = 0; uBit < 32; ++uBit )
1384 if( ( uPattern >> uBit ) & 0x1 )
1386 UInt_t uBadAsic = ConvertElinkToGet4( 32 * usIndex + uBit );
1388 if( 0x90 == fuCurrentMsSysId )
1389 uBadAsic = 32 * usIndex + uBit;
1390 } // if( ( uPattern >> uBit ) & 0x1 )
1393 } // case gdpbv100::PATT_RESYNC:
1396 LOG(debug) << "Crazy pattern message, subtype " << usType;
1399 } // switch( usType )
1408 switch (iMsgIndex) {
1418 ULong64_t ulNewStarTsFull =
1429 LOG(warning) <<
"Possible error: identical STAR tokens found twice in "
1430 "a row => ignore 2nd! "
1454 <<
" new = " << Form(
"%16llu", ulNewStarTsFull) <<
" Diff = -"
1469 if( fuCurrentMs < fuCoreMs )
1472 if( 0 <= fdStartTime )
1475 if( fuHistoryHistoSize < 1e-9 * (fvulGdpbTsFullLast[fuGdpbNr] * gdpbv100::kdClockCycleSizeNs - fdStartTime) )
1477 ResetEvolutionHistograms();
1478 fdStartTime = fvulGdpbTsFullLast[fuGdpbNr] * gdpbv100::kdClockCycleSizeNs;
1479 } // if( fuHistoryHistoSize < 1e-9 * (fulGdpbTsFullLast * gdpbv100::kdClockCycleSizeNs - fdStartTime) )
1481 fvhTriggerRate[fuGdpbNr]->Fill( 1e-9 * ( fvulGdpbTsFullLast[fuGdpbNr] * gdpbv100::kdClockCycleSizeNs - fdStartTime ) );
1482 fvhStarTokenEvo[fuGdpbNr]->Fill( 1e-9 * ( fvulGdpbTsFullLast[fuGdpbNr] * gdpbv100::kdClockCycleSizeNs - fdStartTime ),
1483 fvuStarTokenLast[fuGdpbNr] );
1484 fvhStarTrigGdpbTsEvo[fuGdpbNr]->Fill( 1e-9 * ( fvulGdpbTsFullLast[fuGdpbNr] * gdpbv100::kdClockCycleSizeNs - fdStartTime ),
1485 fvulGdpbTsFullLast[fuGdpbNr] );
1486 fvhStarTrigStarTsEvo[fuGdpbNr]->Fill( 1e-9 * ( fvulGdpbTsFullLast[fuGdpbNr] * gdpbv100::kdClockCycleSizeNs - fdStartTime ),
1487 fvulStarTsFullLast[fuGdpbNr] );
1488 } // if( 0 < fdStartTime )
1489 else fdStartTime = fvulGdpbTsFullLast[fuGdpbNr] * gdpbv100::kdClockCycleSizeNs;
1490 fvhCmdDaqVsTrig[fuGdpbNr]->Fill( fvuStarDaqCmdLast[fuGdpbNr], fvuStarTrigCmdLast[fuGdpbNr] );
1491 } // if( fuCurrentMs < fuCoreMs )
1495 default: LOG(error) <<
"Unknown Star Trigger messageindex: " << iMsgIndex;
1504 TString message_type;
1507 case 0: message_type =
"NOP";
break;
1508 case 1: message_type =
"HIT";
break;
1509 case 2: message_type =
"EPOCH";
break;
1510 case 3: message_type =
"SYNC";
break;
1511 case 4: message_type =
"AUX";
break;
1512 case 5: message_type =
"EPOCH2";
break;
1513 case 6: message_type =
"GET4";
break;
1514 case 7: message_type =
"SYS";
break;
1515 case 8: message_type =
"GET4_SLC";
break;
1516 case 9: message_type =
"GET4_32B";
break;
1517 case 10: message_type =
"GET4_SYS";
break;
1518 default: message_type =
"UNKNOWN";
break;
1520 LOG(info) << message_type <<
" messages: " <<
fviMsgCounter[i];
1578 TFile* oldFile = gFile;
1579 TDirectory* oldDir = gDirectory;
1581 TFile* histoFile = NULL;
1582 if (
"" != sFileName) {
1584 histoFile =
new TFile(sFileName,
"RECREATE");
1588 gDirectory->mkdir(
"TofDt");
1589 gDirectory->cd(
"TofDt");
1605 gDirectory->cd(
"..");
1609 gDirectory->mkdir(
"TofDtFeeA");
1610 gDirectory->cd(
"TofDtFeeA");
1614 gDirectory->cd(
"..");
1616 gDirectory->mkdir(
"TofDtFeeB");
1617 gDirectory->cd(
"TofDtFeeB");
1621 gDirectory->cd(
"..");
1623 gDirectory->mkdir(
"TofDtFeeFee");
1624 gDirectory->cd(
"TofDtFeeFee");
1628 gDirectory->cd(
"..");
1630 gDirectory->mkdir(
"TofPulse");
1631 gDirectory->cd(
"TofPulse");
1636 gDirectory->cd(
"..");
1638 gDirectory->mkdir(
"TofCnt");
1639 gDirectory->cd(
"TofCnt");
1640 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb)
1642 gDirectory->cd(
"..");
1644 gDirectory->mkdir(
"Flib_Raw");
1645 gDirectory->cd(
"Flib_Raw");
1646 for (UInt_t uLinks = 0; uLinks <
fvhMsSzPerLink.size(); uLinks++) {
1653 TH1* pMissedTsH1 =
dynamic_cast<TH1*
>(gROOT->FindObjectAny(
"Missed_TS"));
1654 if (NULL != pMissedTsH1) pMissedTsH1->Write();
1656 TProfile* pMissedTsEvoP =
dynamic_cast<TProfile*
>(gROOT->FindObjectAny(
"Missed_TS_Evo"));
1657 if (NULL != pMissedTsEvoP) pMissedTsEvoP->Write();
1659 gDirectory->cd(
"..");
1667 if (
"" != sFileName) {
1674 gDirectory = oldDir;
1679 LOG(info) <<
"Reseting all TOF histograms.";
1714 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb)
1717 for (UInt_t uLinks = 0; uLinks <
fvhMsSzPerLink.size(); uLinks++) {
1735 phTimeRmsZoom->Reset();
1736 phTimeResFit->Reset();
1743 if (NULL != phTimeDiff[uChanA][uChanB]) {
1745 if (0 == phTimeDiff[uChanA][uChanB]->GetEntries()) {
1746 phTimeRmsZoom->Fill(uChanA, uChanB, 0.0);
1747 phTimeResFit->Fill(uChanA, uChanB, 0.0);
1748 LOG(debug) <<
"CbmMcbm2018TofTestFee::UpdateZoomedFit => Empty input "
1749 <<
"for Chan pair " << uChanA <<
" and " << uChanB <<
" !!! ";
1754 Int_t iBinWithMax = phTimeDiff[uChanA][uChanB]->GetMaximumBin();
1755 Double_t dNbCounts = phTimeDiff[uChanA][uChanB]->Integral();
1758 Double_t dPeakPos = phTimeDiff[uChanA][uChanB]->GetXaxis()->GetBinCenter(iBinWithMax);
1759 phTimeDiff[uChanA][uChanB]->GetXaxis()->SetRangeUser(dPeakPos -
fdFitZoomWidthPs,
1763 Double_t dZoomCounts = phTimeDiff[uChanA][uChanB]->Integral();
1764 if ((dZoomCounts / dNbCounts) < 0.99) {
1765 phTimeRmsZoom->Fill(uChanA, uChanB, 0.0);
1766 phTimeResFit->Fill(uChanA, uChanB, 0.0);
1767 LOG(warning) <<
"CbmMcbm2018TofTestFee::UpdateZoomedFit => Zoom too strong, "
1768 <<
"more than 1% loss for Chan pair " << uChanA <<
" and " << uChanB <<
" !!! ";
1773 phTimeRmsZoom->Fill(uChanA, uChanB, phTimeDiff[uChanA][uChanB]->GetRMS());
1778 fitFuncPairs[uChanA][uChanB] =
new TF1(Form(
"fPair_%02d_%02d", uChanA, uChanB),
"gaus",
1781 fitFuncPairs[uChanA][uChanB]->SetParameter(0, dZoomCounts);
1782 fitFuncPairs[uChanA][uChanB]->SetParameter(1, dPeakPos);
1783 fitFuncPairs[uChanA][uChanB]->SetParameter(2, 200.0);
1785 phTimeDiff[uChanA][uChanB]->Fit(Form(
"fPair_%02d_%02d", uChanA, uChanB),
"QRM0");
1787 dRes = fitFuncPairs[uChanA][uChanB]->GetParameter(2);
1789 delete fitFuncPairs[uChanA][uChanB];
1791 phTimeResFit->Fill(uChanA, uChanB, dRes / TMath::Sqrt2());
1794 LOG(debug) <<
"CbmMcbm2018TofTestFee::UpdateZoomedFit => "
1795 <<
"For chan pair " << uChanA <<
" and " << uChanB
1796 <<
" we have zoomed RMS = " << phTimeDiff[uChanA][uChanB]->GetRMS() <<
" and a resolution of "
1797 << dRes / TMath::Sqrt2();
1800 phTimeDiff[uChanA][uChanB]->GetXaxis()->UnZoom();
1804 LOG(error) <<
"CbmMcbm2018TofTestFee::UpdateZoomedFit => Zoom width not defined, "
1805 <<
"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()
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