13 #include "FairLogger.h"
14 #include "FairRootManager.h"
16 #include "FairRunOnline.h"
17 #include "FairRuntimeDb.h"
23 #include "TPaveStats.h"
38 fbEtofFeeIndexing(kTRUE)
39 , fvbMaskedComponents()
47 , fuNrOfChannelsPerGet4(0)
48 , fuNrOfChannelsPerFee(0)
50 , fuNrOfGet4PerGdpb(0)
51 , fuNrOfChannelsPerGdpb(0)
58 , fdTsStopTimeCore(-1.0)
61 , fuCurrentEquipmentId(0)
67 , fvulCurrentEpochCycle()
68 , fvulCurrentEpochFull()
75 , fuHistoryHistoSize(1800)
76 , fvvhFeePairPulserTimeDiff()
77 , fhPulserTimeDiffMean(nullptr)
78 , fhPulserTimeDiffRms(nullptr)
79 , fhPulserTimeDiffRmsZoom(nullptr)
80 , fhPulserRmsGdpbToRefEvo(nullptr)
81 , fhPulserRmsGbtxToRefEvo(nullptr) {}
89 LOG(info) <<
"Initializing mCBM T0 2019 monitor algo";
102 LOG(info) <<
"Init parameter containers for CbmStar2019MonitorPulserAlgo";
108 LOG(info) <<
"**********************************************";
109 LOG(info) <<
"ReInit parameter containers for CbmStar2019MonitorPulserAlgo";
154 LOG(info) <<
"GDPB Id of TOF " <<
i <<
" : " << std::hex
160 LOG(info) <<
"Timeslice parameters: each MS is " <<
fdMsSizeInNs <<
" ns";
166 LOG(fatal) <<
"Selected sector out of bounds relative to parameter file: "
169 LOG(info) <<
"Selected sector "
171 <<
" for single sector analysis";
178 LOG(info) <<
"Using eTOF indexing with only 3 FEE per GBTx instead of 5";
186 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
197 UShort_t usDetectorId) {
206 <<
"CbmStar2019MonitorPulserAlgo::AddMsComponentToList => Component "
207 << component <<
" with detector ID 0x" << std::hex << usDetectorId
208 << std::dec <<
" added to list";
214 fdTsStartTime =
static_cast<Double_t
>(ts.descriptor(0, 0).idx);
233 LOG(info) <<
"In each TS " <<
fuNbMsLoop <<
" MS will be looped over";
249 <<
fuMsIndex <<
" for component " << uMsComp;
264 auto msDescriptor = ts.descriptor(uMsCompIdx, uMsIdx);
266 const uint8_t* msContent =
267 reinterpret_cast<const uint8_t*
>(ts.content(uMsCompIdx, uMsIdx));
269 uint32_t uSize = msDescriptor.size;
272 LOG(debug) <<
"Microslice: " <<
fulCurrentMsIdx <<
" from EqId " << std::hex
288 <<
"---------------------------------------------------------------";
290 LOG(warning) <<
"Could not find the gDPB index for AFCK id 0x" << std::hex
293 <<
" component " << uMsCompIdx <<
"\n"
294 <<
"If valid this index has to be added in the TOF "
295 "parameter file in the DbpIdArray field";
311 LOG(error) <<
"The input microslice buffer does NOT "
312 <<
"contain only complete nDPB messages!";
315 uint32_t uNbMessages =
319 Int_t messageType = -111;
320 const uint64_t* pInBuff =
reinterpret_cast<const uint64_t*
>(msContent);
321 for (uint32_t uIdx = 0; uIdx < uNbMessages; uIdx++) {
323 uint64_t ulData =
static_cast<uint64_t
>(pInBuff[uIdx]);
340 LOG(warning) <<
"Message with Get4 ID too high: " <<
fuGet4Id <<
" VS "
343 switch (messageType) {
347 LOG(fatal) <<
"This monitor does not support 24b hit messages!!!.";
361 LOG(fatal) <<
"This event builder does not support unmerged epoch "
377 LOG(fatal) <<
"Message type " << std::hex << std::setw(2)
378 <<
static_cast<uint16_t
>(messageType)
379 <<
" not included in Get4 data format.";
393 LOG(warning) <<
"CbmStar2019MonitorPulserAlgo::ProcessEpochCycle => "
394 <<
" Missmatch in epoch cycles detected for Gdpb "
396 <<
", probably fake cycles due to epoch index corruption! "
397 << Form(
" Current cycle 0x%09llX New cycle 0x%09llX",
402 LOG(info) <<
"CbmStar2019EventBuilderEtofAlgo::ProcessEpochCycle => "
404 << Form(
": Current cycle 0x%09llX New cycle 0x%09llX",
432 if (0 == iBufferSize)
return;
434 LOG(debug) <<
"Now processing stored messages for for gDPB " <<
fuCurrDpbIdx
445 if (0 == ulCurEpochGdpbGet4)
return;
448 ulCurEpochGdpbGet4--;
450 Int_t messageType = -111;
451 for (Int_t iMsgIdx = 0; iMsgIdx < iBufferSize; iMsgIdx++) {
463 switch (messageType) {
478 LOG(error) <<
"Message type " << std::hex << std::setw(2)
479 <<
static_cast<uint16_t
>(messageType)
480 <<
" not included in Get4 unpacker.";
498 UInt_t uChannelNrInFee =
526 std::string sFolder =
"eTofMoni";
528 LOG(info) <<
"create Histos for eTOF monitoring ";
587 UInt_t uFeeIndexA = uFeeA;
589 uFeeIndexA = 3 * (uFeeA / 5) + (uFeeA % 5);
592 UInt_t uFeeIdA = uFeeIndexA - (3 * 6 * uGdpbA);
600 UInt_t uFeeIndexB = uFeeB;
603 uFeeIndexB = 3 * (uFeeB / 5) + (uFeeB % 5);
611 UInt_t uFeeIdB = uFeeIndexB - (3 * 6 * uGdpbB);
613 new TH1I(Form(
"hFeePairPulserTimeDiff_s%02u_f%1u_s%02u_f%1u",
618 Form(
"Time difference for pulser on sector %02u FEE %1u and "
619 "sector %02u FEE %1u; DeltaT [ps]; Counts",
629 Form(
"TofDt/s%03u", uFeeIndexA));
646 "hPulserTimeDiffMean",
647 "Time difference Mean for each FEE pairs; FEE A; FEE B ; Mean [ps]",
656 new TH2D(
"hPulserTimeDiffRms",
657 "Time difference RMS for each FEE pairs; FEE A; FEE B ; RMS [ps]",
666 new TH2D(
"hPulserTimeDiffRmsZoom",
667 "Time difference RMS for each FEE pairs after zoom on peak; FEE "
668 "A; FEE B ; RMS [ps]",
678 new TH2D(
"hPulserRmsGdpbToRefEvo",
679 "Evo. of Time difference RMS for selected FEE of each sector to "
680 "the 1st; Time in run [s] A; Sector ; RMS [ps]",
689 "hPulserTimeDiffRmsZoom",
690 "Evo. of Time difference RMS for selected FEE pairs of each GBTx to the "
691 "1st in same sector; Time in run [s] A; FEE ; RMS [ps]",
701 new TH2D(
"hPulserRmsGdpbToRefEvo",
702 "Evo. of Time difference RMS for selected FEE of each gDPb to "
703 "the 1st; Time in run [s] A; gDPB ; RMS [ps]",
712 "hPulserTimeDiffRmsZoom",
713 "Evo. of Time difference RMS for selected FEE pairs of each GBTx to the "
714 "1st in same gDPB; Time in run [s] A; FEE ; RMS [ps]",
732 fcSummary =
new TCanvas(
"cSummary",
"Pulser Monitoring Summary");
791 UInt_t uFeeIndexA = uFeeA;
792 UInt_t uFeeIndexB = uFeeB;
795 uFeeIndexA = 3 * (uFeeA / 5) + (uFeeA % 5);
796 uFeeIndexB = 3 * (uFeeB / 5) + (uFeeB % 5);
821 Double_t dZoomCounts =
825 if ((dZoomCounts / dNbCounts) < 0.8) {
870 UInt_t uFeeIndexA = uFeeA;
871 UInt_t uFeeIndexB = uFeeB;
874 uFeeIndexA = 3 * (uFeeA / 5) + (uFeeA % 5);
875 uFeeIndexB = 3 * (uFeeB / 5) + (uFeeB % 5);
899 Double_t dZoomCounts =
903 if ((dZoomCounts / dNbCounts) < 0.8) {
906 <<
"CbmStar2019MonitorPulserAlgo::FillHistograms => Zoom too strong, "
907 <<
"more than 20% loss for FEE pair " << uFeeA <<
" and " << uFeeB
921 LOG(info) <<
"Stats FEE A " << std::setw(3) << uFeeIndexA <<
" FEE B "
922 << std::setw(3) << uFeeIndexB