CbmRoot
Loading...
Searching...
No Matches
CbmStar2019MonitorTof.h
Go to the documentation of this file.
1/* Copyright (C) 2018-2019 Facility for Antiproton and Ion Research in Europe, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Pierre-Alain Loizeau [committer] */
4
5// -----------------------------------------------------------------------------
6// ----- -----
7// ----- CbmStar2019MonitorTof -----
8// ----- Created 10.07.2018 by P.-A. Loizeau -----
9// ----- -----
10// -----------------------------------------------------------------------------
11
12#ifndef CbmStar2019MonitorTof_H
13#define CbmStar2019MonitorTof_H
14
15#include "Timeslice.hpp"
16
17#include "gDpbMessv100.h"
18//#include "CbmTofStarData.h"
19//#include "CbmTofStarData2018.h"
20
21#include "CbmMcbmUnpack.h"
22
23#include "Rtypes.h"
24#include "TClonesArray.h"
25
26#include <chrono>
27#include <map>
28#include <vector>
29
31
32class TCanvas;
33class TH1;
34class TH2;
35class TProfile;
36class TProfile2D;
37
39public:
41 virtual ~CbmStar2019MonitorTof();
42
43 virtual Bool_t Init();
44
45 virtual Bool_t DoUnpack(const fles::Timeslice& ts, size_t component);
46
47 virtual void Reset();
48
49 virtual void Finish();
50
51 void SetParContainers();
52
53 Bool_t InitContainers();
54
55 Bool_t ReInitContainers();
56
57 void SetMsLimitLevel(size_t uAcceptBoundaryPct = 100) { fuMsAcceptsPercent = uAcceptBoundaryPct; }
59
60 virtual void AddMsComponentToList(size_t component, UShort_t usDetectorId);
61 virtual void SetNbMsInTs(size_t uCoreMsNb, size_t uOverlapMsNb);
62 void SetIgnoreMsOverlap(Bool_t bEnaFlag = kTRUE) { fbIgnoreOverlapMs = bEnaFlag; }
63 void SetMsOverlap(size_t uOverlapMsNb = 1) { fuOverlapMsNb = uOverlapMsNb; }
64 size_t GetMsOverlap() { return fuOverlapMsNb; }
65
66 inline void SetFitZoomWidthPs(Double_t inZoomWidth = 1000.0) { fdFitZoomWidthPs = inZoomWidth; }
67 inline void SetHistoryHistoSize(UInt_t inHistorySizeSec = 1800) { fuHistoryHistoSize = inHistorySizeSec; }
68 inline void SetHistoryHistoSizeLong(UInt_t inHistorySizeMin = 1800) { fuHistoryHistoSizeLong = inHistorySizeMin; }
69
70 inline void EnablePulserMode(Bool_t bEnaFlag = kTRUE) { fbPulserModeEnable = bEnaFlag; }
71 inline void EnableCoincidenceMaps(Bool_t bEnaFlag = kTRUE) { fbCoincMapsEnable = bEnaFlag; }
72
73 void SaveAllHistos(TString sFileName = "");
74 void ResetAllHistos();
78 void UpdateZoomedFit();
79
80private:
82 std::vector<size_t> fvMsComponentsList;
86
89 size_t fuTotalMsNb;
91 size_t fuCoreMs;
92 Double_t fdMsSizeInNs;
96
99 UInt_t fuNrOfGdpbs; // Total number of GDPBs in the system
100 UInt_t fuNrOfFeePerGdpb; // Number of FEBs per GDPB
101 UInt_t fuNrOfGet4PerFee; // Number of GET4s per FEE
102 UInt_t fuNrOfChannelsPerGet4; // Number of channels in each GET4
103
104 UInt_t fuNrOfChannelsPerFee; // Number of channels in each FEE
105 UInt_t fuNrOfGet4; // Total number of Get4 chips in the system
106 UInt_t fuNrOfGet4PerGdpb; // Number of GET4s per GDPB
107 UInt_t fuNrOfChannelsPerGdpb; // Number of channels per GDPB
108
111 std::vector<Int_t> fviNrOfRpc;
112 std::vector<Int_t> fviRpcType;
113 std::vector<Int_t> fviRpcSide;
114 std::vector<Int_t> fviModuleId;
115
116 const UInt_t kuNbFeePerGbtx = 5;
117 const UInt_t kuNbGbtxPerGdpb = 6;
118
126
128 uint64_t fulCurrentTsIndex; // Idx of the current TS
129 size_t fuCurrentMs; // Idx of the current MS in TS (0 to fuTotalMsNb)
130 Double_t fdMsIndex; // Time in ns of current MS from its index
131 UInt_t fuGdpbId; // Id (hex number) of the GDPB for current message
132 UInt_t fuGdpbNr; // running number (0 to fuNrOfGdpbs) of the GDPB for current message
133 UInt_t fuGet4Id; // running number (0 to fuNrOfGet4PerGdpb) of the Get4 chip of a unique GDPB for current message
134 UInt_t fuGet4Nr; // running number (0 to fuNrOfGet4) of the Get4 chip in the system for current message
136 std::vector<int> fviMsgCounter;
137
139 std::vector<ULong64_t> fvulGdpbTsMsb;
140 std::vector<ULong64_t> fvulGdpbTsLsb;
141 std::vector<ULong64_t> fvulStarTsMsb;
142 std::vector<ULong64_t> fvulStarTsMid;
143 std::vector<ULong64_t> fvulGdpbTsFullLast;
144 std::vector<ULong64_t> fvulStarTsFullLast;
145 std::vector<UInt_t> fvuStarTokenLast;
146 std::vector<UInt_t> fvuStarDaqCmdLast;
147 std::vector<UInt_t> fvuStarTrigCmdLast;
148
155 std::vector<ULong64_t> fvulCurrentEpoch;
156 std::vector<Bool_t> fvbFirstEpochSeen;
157 std::vector<ULong64_t> fvulCurrentEpochCycle;
158 std::vector<ULong64_t> fvulCurrentEpochFull;
159
163 std::map<UInt_t, UInt_t> fGdpbIdIndexMap;
164
166 std::vector<std::vector<gdpbv100::Message>> fvmEpSupprBuffer;
167
169 std::vector<UInt_t> fvuFeeNbHitsLastMs;
170 std::vector<Double_t> fdTsLastPulserHit;
171
173 std::vector<std::vector<UInt_t>> fvuCoincNbHitsLastMs;
174 std::vector<std::vector<Double_t>> fvdCoincTsLastHit;
175
177 // Default value for nb bins in Pulser time difference histos
178 const UInt_t kuNbBinsDt = 2000;
179 Double_t dMinDt;
180 Double_t dMaxDt;
181 // Default number of FEE per channels histograms
184 // Evolution plots control
185 Double_t fdStartTime;
190 // Pulser plots
193 // Flesnet
194 TCanvas* fcMsSizeAll;
195 std::vector<TH1*> fvhMsSzPerLink;
196 std::vector<TProfile*> fvhMsSzTimePerLink;
197
198 // Messages types and flags
215 std::vector<TH2*> fvhGdpbGet4MessType;
216 std::vector<TH2*> fvhGdpbGet4ChanScm;
217 std::vector<TH2*> fvhGdpbGet4ChanErrors;
228 std::vector<TH2*> fvhGdpbPatternMissmatchEvo;
229 std::vector<TH2*> fvhGdpbPatternEnableEvo;
230 std::vector<TH2*> fvhGdpbPatternResyncEvo;
231
232 // Hit messages
234 std::vector<TH2*> fvhRawFt_gDPB;
235 std::vector<TH2*> fvhRawTot_gDPB;
236 std::vector<TH1*> fvhChCount_gDPB;
237 std::vector<TH2*> fvhChannelRate_gDPB;
238 std::vector<TH2*> fvhRemapTot_gDPB;
239 std::vector<TH1*> fvhRemapChCount_gDPB;
240 std::vector<TH2*> fvhRemapChRate_gDPB;
241 std::vector<TH1*> fvhFeeRate_gDPB;
242 std::vector<TH1*> fvhFeeErrorRate_gDPB;
243 std::vector<TProfile*> fvhFeeErrorRatio_gDPB;
244 std::vector<TH1*> fvhFeeRateLong_gDPB;
245 std::vector<TH1*> fvhFeeErrorRateLong_gDPB;
246 std::vector<TProfile*> fvhFeeErrorRatioLong_gDPB;
247
248 const UInt_t kuNbFeeSide = 5;
249 std::vector<TH2*> fvhRemapTotSideA_mod;
250 std::vector<TH2*> fvhRemapTotSideB_mod;
252 std::vector<TH1*> fvhModRate;
253 std::vector<TH1*> fvhModErrorRate;
254 std::vector<TProfile*> fvhModErrorRatio;
255
257 std::vector<TH1*> fvhTokenMsgType;
258 std::vector<TH1*> fvhTriggerRate;
259 std::vector<TH2*> fvhCmdDaqVsTrig;
260 std::vector<TH2*> fvhStarTokenEvo;
261 std::vector<TProfile*> fvhStarTrigGdpbTsEvo;
262 std::vector<TProfile*> fvhStarTrigStarTsEvo;
263
265 const Double_t kdMaxDtPulserPs = 300e3;
266 std::vector<std::vector<TH1*>> fvhTimeDiffPulser;
271 std::vector<TProfile*> fvhPulserTimeDiffEvoGbtxGbtx;
272 std::vector<std::vector<TProfile*>> fvvhPulserTimeDiffEvoGdpbGdpb;
273
275 std::vector<TH2*> fvhCoincMapAllChanGdpb;
276 std::vector<TProfile2D*> fvhCoincMeanAllChanGdpb;
277
278 void CreateHistograms();
279
280 void ProcessEpochCycle(uint64_t ulCycleData);
288
289 inline Int_t GetArrayIndex(Int_t gdpbId, Int_t get4Id) { return gdpbId * fuNrOfGet4PerGdpb + get4Id; }
290
292 std::vector<UInt_t> fvuPadiToGet4;
293 std::vector<UInt_t> fvuGet4ToPadi;
294
296 static const UInt_t kuNbGet4PerGbtx = 5 * 8;
297 std::vector<UInt_t> fvuElinkToGet4;
298 std::vector<UInt_t> fvuGet4ToElink;
299 inline UInt_t ConvertElinkToGet4(UInt_t uElinkIdx)
300 {
301 return fvuElinkToGet4[uElinkIdx % kuNbGet4PerGbtx] + kuNbGet4PerGbtx * (uElinkIdx / kuNbGet4PerGbtx);
302 }
303 inline UInt_t ConvertGet4ToElink(UInt_t uGet4Idx)
304 {
305 return fvuGet4ToElink[uGet4Idx % kuNbGet4PerGbtx] + kuNbGet4PerGbtx * (uGet4Idx / kuNbGet4PerGbtx);
306 }
307
309 std::chrono::time_point<std::chrono::system_clock> fTimeLastHistoSaving;
310
313
314 ClassDef(CbmStar2019MonitorTof, 1)
315};
316
317#endif
std::vector< ULong64_t > fvulStarTsMsb
UInt_t ConvertElinkToGet4(UInt_t uElinkIdx)
ULong64_t fulCurrentEpochTime
Epoch + Epoch Cycle.
std::vector< TProfile * > fvhStarTrigGdpbTsEvo
std::vector< TProfile * > fvhStarTrigStarTsEvo
std::vector< UInt_t > fvuFeeNbHitsLastMs
Buffer for pulser channels.
std::vector< TH1 * > fvhFeeErrorRateLong_gDPB
std::vector< TH2 * > fvhGdpbGet4ChanScm
std::vector< Int_t > fviNrOfRpc
std::vector< ULong64_t > fvulStarTsMid
std::vector< TProfile2D * > fvhCoincMeanAllChanGdpb
void SetIgnoreMsOverlap(Bool_t bEnaFlag=kTRUE)
void FillHitInfo(gdpbv100::Message)
virtual void AddMsComponentToList(size_t component, UShort_t usDetectorId)
virtual void SetNbMsInTs(size_t uCoreMsNb, size_t uOverlapMsNb)
void PrintSysInfo(gdpbv100::Message)
std::vector< TH1 * > fvhModRate
module plots
std::vector< TH2 * > fvhGdpbPatternEnableEvo
TH2 * fhGet4MessType
Per GET4 in system.
std::vector< TH2 * > fvhRawFt_gDPB
TODO: Channel rate plots!
std::vector< TH2 * > fvhCmdDaqVsTrig
void EnableCoincidenceMaps(Bool_t bEnaFlag=kTRUE)
void SaveAllHistos(TString sFileName="")
std::vector< TProfile * > fvhPulserTimeDiffEvoGbtxGbtx
std::vector< std::vector< TH1 * > > fvhTimeDiffPulser
std::vector< TProfile * > fvhFeeErrorRatioLong_gDPB
std::vector< Int_t > fviRpcSide
std::vector< Bool_t > fvbFirstEpochSeen
const UInt_t kuNbBinsDt
[ fuNrOfGdpbs ][ fuNrOfChannelsPerGdpb ]
std::vector< TH2 * > fvhRawTot_gDPB
std::vector< std::vector< UInt_t > > fvuCoincNbHitsLastMs
[ fuFeeNr ]
std::vector< TH2 * > fvhGdpbGet4MessType
Per GET4 in gDPB.
void ProcessEpochCycle(uint64_t ulCycleData)
std::vector< TProfile * > fvhModErrorRatio
std::vector< TH2 * > fvhRemapChRate_gDPB
std::vector< ULong64_t > fvulCurrentEpochCycle
std::vector< TH2 * > fvhRemapTotSideB_mod
std::vector< ULong64_t > fvulCurrentEpochFull
Epoch cycle from the Ms Start message and Epoch counter flip.
std::vector< UInt_t > fvuStarTrigCmdLast
std::map< UInt_t, UInt_t > fGdpbIdIndexMap
Map of ID to index for the gDPBs.
void FillEpochInfo(gdpbv100::Message)
void FillPattInfo(gdpbv100::Message)
std::vector< TH1 * > fvhMsSzPerLink
static const UInt_t kuNbGet4PerGbtx
TH2 * fhScmScalerCounters
Slow control messages.
std::vector< std::vector< Double_t > > fvdCoincTsLastHit
[ fuNrOfGdpbs ][ fuNrOfChannelsPerGdpb ]
Int_t GetArrayIndex(Int_t gdpbId, Int_t get4Id)
void FillStarTrigInfo(gdpbv100::Message)
TH2 * fhPatternMissmatch
Pattern messages per gDPB.
std::vector< TH1 * > fvhTriggerRate
std::vector< TH1 * > fvhFeeRate_gDPB
std::vector< Double_t > fdTsLastPulserHit
[ fuFeeNr ]
std::vector< TH2 * > fvhStarTokenEvo
std::vector< TH2 * > fvhGdpbGet4ChanErrors
void SetFitZoomWidthPs(Double_t inZoomWidth=1000.0)
std::vector< Int_t > fviModuleId
UInt_t ConvertGet4ToElink(UInt_t uGet4Idx)
void EnablePulserMode(Bool_t bEnaFlag=kTRUE)
std::vector< size_t > fvMsComponentsList
FLES containers.
void SetMsOverlap(size_t uOverlapMsNb=1)
std::vector< UInt_t > fvuStarDaqCmdLast
std::vector< ULong64_t > fvulStarTsFullLast
std::vector< std::vector< gdpbv100::Message > > fvmEpSupprBuffer
Buffer for suppressed epoch processing.
std::vector< TH2 * > fvhGdpbPatternMissmatchEvo
Per MS in gDPB.
std::vector< TH2 * > fvhChannelRate_gDPB
std::vector< UInt_t > fvuPadiToGet4
std::vector< TH2 * > fvhCoincMapAllChanGdpb
std::vector< TH2 * > fvhRemapTotSideA_mod
std::vector< UInt_t > fvuElinkToGet4
5 FEE with 8 GET4 each
std::vector< TH1 * > fvhChCount_gDPB
std::vector< ULong64_t > fvulCurrentEpoch
std::vector< ULong64_t > fvulGdpbTsMsb
std::vector< ULong64_t > fvulGdpbTsLsb
std::vector< TH1 * > fvhModErrorRate
std::vector< ULong64_t > fvulGdpbTsFullLast
std::vector< UInt_t > fvuGet4ToPadi
std::vector< int > fviMsgCounter
void PrintGenInfo(gdpbv100::Message)
CbmStar2019TofPar * fUnpackPar
std::vector< UInt_t > fvuStarTokenLast
std::chrono::time_point< std::chrono::system_clock > fTimeLastHistoSaving
void SetHistoryHistoSizeLong(UInt_t inHistorySizeMin=1800)
std::vector< TH1 * > fvhFeeErrorRate_gDPB
std::vector< TH1 * > fvhFeeRateLong_gDPB
void PrintSlcInfo(gdpbv100::Message)
std::vector< UInt_t > fvuGet4ToElink
void SetMsLimitLevel(size_t uAcceptBoundaryPct=100)
std::vector< TProfile * > fvhMsSzTimePerLink
std::vector< Int_t > fviRpcType
std::vector< TH2 * > fvhGdpbPatternResyncEvo
std::vector< TH2 * > fvhRemapTot_gDPB
std::vector< TH1 * > fvhTokenMsgType
CbmStar2019MonitorTof(const CbmStar2019MonitorTof &)
size_t fuMsAcceptsPercent
/‍** Ignore Overlap Ms: all fuOverlapMsNb MS at the end of timeslice **‍/
std::vector< std::vector< TProfile * > > fvvhPulserTimeDiffEvoGdpbGdpb
CbmStar2019MonitorTof operator=(const CbmStar2019MonitorTof &)
std::vector< TH1 * > fvhRemapChCount_gDPB
std::vector< TProfile * > fvhFeeErrorRatio_gDPB
virtual Bool_t DoUnpack(const fles::Timeslice &ts, size_t component)
void SetHistoryHistoSize(UInt_t inHistorySizeSec=1800)