13 #include "FairLogger.h"
14 #include "FairRootManager.h"
16 #include "FairRunOnline.h"
17 #include "FairRuntimeDb.h"
23 #include "TPaveStats.h"
46 , fuNrOfChannelsPerGet4(0)
47 , fuNrOfChannelsPerFee(0)
49 , fuNrOfGet4PerGdpb(0)
50 , fuNrOfChannelsPerGdpb(0)
57 , fdTsStopTimeCore(-1.0)
60 , fuCurrentEquipmentId(0)
66 , fvulCurrentEpochCycle()
67 , fvulCurrentEpochFull()
74 , fuHistoryHistoSize(1800)
75 , fvvhFeePairPulserTimeDiff()
76 , fhPulserTimeDiffMean(nullptr)
77 , fhPulserTimeDiffRms(nullptr)
78 , fhPulserTimeDiffRmsZoom(nullptr)
79 , fhPulserRmsGdpbToRefEvo(nullptr)
80 , fhPulserRmsGbtxToRefEvo(nullptr) {}
88 LOG(info) <<
"Initializing mCBM T0 2019 monitor algo";
101 LOG(info) <<
"Init parameter containers for CbmMcbm2018MonitorAlgoTofPulser";
107 LOG(info) <<
"**********************************************";
109 <<
"ReInit parameter containers for CbmMcbm2018MonitorAlgoTofPulser";
154 LOG(info) <<
"GDPB Id of TOF " <<
i <<
" : " << std::hex
160 LOG(info) <<
"Timeslice parameters: each MS is " <<
fdMsSizeInNs <<
" ns";
165 LOG(fatal) <<
"Selected gDPB out of bounds relative to parameter file: "
169 <<
" for single gDPB analysis";
181 for (UInt_t uGdpb = 0; uGdpb <
fuNrOfGdpbs; ++uGdpb) {
193 UShort_t usDetectorId) {
202 <<
"CbmMcbm2018MonitorAlgoTofPulser::AddMsComponentToList => Component "
203 << component <<
" with detector ID 0x" << std::hex << usDetectorId
204 << std::dec <<
" added to list";
210 fdTsStartTime =
static_cast<Double_t
>(ts.descriptor(0, 0).idx);
229 LOG(info) <<
"In each TS " <<
fuNbMsLoop <<
" MS will be looped over";
245 <<
fuMsIndex <<
" for component " << uMsComp;
260 auto msDescriptor = ts.descriptor(uMsCompIdx, uMsIdx);
262 const uint8_t* msContent =
263 reinterpret_cast<const uint8_t*
>(ts.content(uMsCompIdx, uMsIdx));
265 uint32_t uSize = msDescriptor.size;
269 LOG(debug) <<
"Microslice: " <<
fulCurrentMsIdx <<
" from EqId " << std::hex
285 <<
"---------------------------------------------------------------";
287 LOG(warning) <<
"Could not find the gDPB index for AFCK id 0x" << std::hex
290 <<
" component " << uMsCompIdx <<
"\n"
291 <<
"If valid this index has to be added in the TOF "
292 "parameter file in the DbpIdArray field";
308 LOG(error) <<
"The input microslice buffer does NOT "
309 <<
"contain only complete nDPB messages!";
312 uint32_t uNbMessages =
316 Int_t messageType = -111;
317 const uint64_t* pInBuff =
reinterpret_cast<const uint64_t*
>(msContent);
318 for (uint32_t uIdx = 0; uIdx < uNbMessages; uIdx++) {
320 uint64_t ulData =
static_cast<uint64_t
>(pInBuff[uIdx]);
339 LOG(warning) <<
"Message with Get4 ID too high: " <<
fuGet4Id <<
" VS "
342 switch (messageType) {
346 LOG(fatal) <<
"This monitor does not support 24b hit messages!!!.";
360 LOG(fatal) <<
"This event builder does not support unmerged epoch "
376 LOG(fatal) <<
"Message type " << std::hex << std::setw(2)
377 <<
static_cast<uint16_t
>(messageType)
378 <<
" not included in Get4 data format.";
392 LOG(warning) <<
"CbmMcbm2018MonitorAlgoTofPulser::ProcessEpochCycle => "
393 <<
" Missmatch in epoch cycles detected for Gdpb "
395 <<
", probably fake cycles due to epoch index corruption! "
396 << Form(
" Current cycle 0x%09llX New cycle 0x%09llX",
401 LOG(info) <<
"CbmMcbm2018MonitorAlgoTofPulser::ProcessEpochCycle => "
403 << Form(
": Current cycle 0x%09llX New cycle 0x%09llX",
431 if (0 == iBufferSize)
return;
433 LOG(debug) <<
"Now processing stored messages for for gDPB " <<
fuCurrDpbIdx
444 if (0 == ulCurEpochGdpbGet4)
return;
447 ulCurEpochGdpbGet4--;
449 Int_t messageType = -111;
450 for (Int_t iMsgIdx = 0; iMsgIdx < iBufferSize; iMsgIdx++) {
465 switch (messageType) {
480 LOG(error) <<
"Message type " << std::hex << std::setw(2)
481 <<
static_cast<uint16_t
>(messageType)
482 <<
" not included in Get4 unpacker.";
500 UInt_t uChannelNrInFee =
528 std::string sFolder =
"mTofMoni";
530 LOG(info) <<
"create Histos for mTof monitoring ";
552 UInt_t uFeeIndexA = uFeeA;
554 UInt_t uFeeIdA = uFeeIndexA - (3 * 6 * uGdpbA);
561 UInt_t uFeeIndexB = uFeeB;
566 UInt_t uFeeIdB = uFeeIndexB - (3 * 6 * uGdpbB);
568 new TH1I(Form(
"hFeePairPulserTimeDiff_s%02u_f%1u_s%02u_f%1u",
573 Form(
"Time difference for pulser on gDPB %02u FEE %1u and "
574 "gDPB %02u FEE %1u; DeltaT [ps]; Counts",
584 Form(
"TofDt/s%03u", uFeeIndexA));
596 "hPulserTimeDiffMean",
597 "Time difference Mean for each FEE pairs; FEE A; FEE B ; Mean [ps]",
606 new TH2D(
"hPulserTimeDiffRms",
607 "Time difference RMS for each FEE pairs; FEE A; FEE B ; RMS [ps]",
616 new TH2D(
"hPulserTimeDiffRmsZoom",
617 "Time difference RMS for each FEE pairs after zoom on peak; FEE "
618 "A; FEE B ; RMS [ps]",
628 new TH2D(
"hPulserRmsGdpbToRefEvo",
629 "Evo. of Time difference RMS for selected FEE of each gDPb to the "
630 "1st; Time in run [s] A; gDPB ; RMS [ps]",
639 new TH2D(
"hPulserTimeDiffRmsZoom",
640 "Evo. of Time difference RMS for selected FEE pairs of each GBTx "
641 "to the 1st in same gDPB; Time in run [s] A; FEE ; RMS [ps]",
658 fcSummary =
new TCanvas(
"cSummary",
"Pulser Monitoring Summary");
717 UInt_t uFeeIndexA = uFeeA;
718 UInt_t uFeeIndexB = uFeeB;
742 Double_t dZoomCounts =
746 if ((dZoomCounts / dNbCounts) < 0.8) {
791 UInt_t uFeeIndexA = uFeeA;
792 UInt_t uFeeIndexB = uFeeB;
815 Double_t dZoomCounts =
819 if ((dZoomCounts / dNbCounts) < 0.8) {
821 LOG(warning) <<
"CbmMcbm2018MonitorAlgoTofPulser::FillHistograms => "
823 <<
"more than 20% loss for FEE pair " << uFeeA <<
" and "
837 LOG(info) <<
"Stats FEE A " << std::setw(3) << uFeeIndexA <<
" FEE B "
838 << std::setw(3) << uFeeIndexB