CbmRoot
Loading...
Searching...
No Matches
CbmMcbm2018MonitorTofPulser.h
Go to the documentation of this file.
1/* Copyright (C) 2018-2021 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// ----- CbmMcbm2018MonitorTofPulser -----
8// ----- Created 10.07.2018 by P.-A. Loizeau -----
9// ----- -----
10// -----------------------------------------------------------------------------
11
12#ifndef CbmMcbm2018MonitorTofPulser_H
13#define CbmMcbm2018MonitorTofPulser_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
30class CbmDigi;
32
33class TCanvas;
34class TH1;
35class TH2;
36class TProfile;
37class TProfile2D;
38
40public:
43
44 virtual Bool_t Init();
45
46 virtual Bool_t DoUnpack(const fles::Timeslice& ts, size_t component);
47
48 virtual void Reset();
49
50 virtual void Finish();
51
52 void SetParContainers();
53
54 Bool_t InitContainers();
55
56 Bool_t ReInitContainers();
57
58 void FillOutput(CbmDigi* digi);
59
60 void SetMsLimitLevel(size_t uAcceptBoundaryPct = 100) { fuMsAcceptsPercent = uAcceptBoundaryPct; }
62
63 virtual void AddMsComponentToList(size_t component, UShort_t usDetectorId);
64 virtual void SetNbMsInTs(size_t uCoreMsNb, size_t uOverlapMsNb);
65 void SetIgnoreMsOverlap(Bool_t bEnaFlag = kTRUE) { fbIgnoreOverlapMs = bEnaFlag; }
66 void SetMsOverlap(size_t uOverlapMsNb = 1) { fuOverlapMsNb = uOverlapMsNb; }
67 size_t GetMsOverlap() { return fuOverlapMsNb; }
68
69 inline void SetFitZoomWidthPs(Double_t inZoomWidth = 1000.0) { fdFitZoomWidthPs = inZoomWidth; }
70 inline void SetHistoryHistoSize(UInt_t inHistorySizeSec = 1800) { fuHistoryHistoSize = inHistorySizeSec; }
71 inline void SetHistoryHistoSizeLong(UInt_t inHistorySizeMin = 1800) { fuHistoryHistoSizeLong = inHistorySizeMin; }
72
73 inline void SetDiamondDpbIdx(UInt_t uIdx = 2) { fuDiamondDpbIdx = uIdx; }
74
75 void SaveAllHistos(TString sFileName = "");
76 void ResetAllHistos();
80 void UpdateZoomedFit();
81
82 void SetHistoFileName(TString sFileName = "data/SetupHistos.root") { fsHistoFileFullname = sFileName; }
83
84 void UseDaqBuffer(Bool_t) {};
85
86 void UpdateNormedDnlInl();
87
88private:
90 std::vector<size_t> fvMsComponentsList;
94
97
100 size_t fuTotalMsNb;
102 size_t fuCoreMs;
103 Double_t fdMsSizeInNs;
107
110 UInt_t fuNrOfGdpbs; // Total number of GDPBs in the system
111 UInt_t fuNrOfFeePerGdpb; // Number of FEBs per GDPB
112 UInt_t fuNrOfGet4PerFee; // Number of GET4s per FEE
113 UInt_t fuNrOfChannelsPerGet4; // Number of channels in each GET4
114
115 UInt_t fuNrOfChannelsPerFee; // Number of channels in each FEE
116 UInt_t fuNrOfGet4; // Total number of Get4 chips in the system
117 UInt_t fuNrOfGet4PerGdpb; // Number of GET4s per GDPB
118 UInt_t fuNrOfChannelsPerGdpb; // Number of channels per GDPB
119
122 std::vector<Int_t> fviNrOfRpc;
123 std::vector<Int_t> fviRpcType;
124 std::vector<Int_t> fviRpcSide;
125 std::vector<Int_t> fviModuleId;
126
127 const UInt_t kuNbFeePerGbtx = 5;
128 const UInt_t kuNbGbtxPerGdpb = 6;
129
137
139 uint64_t fulCurrentTsIndex; // Idx of the current TS
140 size_t fuCurrentMs; // Idx of the current MS in TS (0 to fuTotalMsNb)
141 size_t fuCurrentMsSysId; // SysId of the current MS in TS (0 to fuTotalMsNb)
142 Double_t fdMsIndex; // Time in ns of current MS from its index
143 UInt_t fuGdpbId; // Id (hex number) of the GDPB for current message
144 UInt_t fuGdpbNr; // running number (0 to fuNrOfGdpbs) of the GDPB for current message
145 UInt_t fuGet4Id; // running number (0 to fuNrOfGet4PerGdpb) of the Get4 chip of a unique GDPB for current message
146 UInt_t fuGet4Nr; // running number (0 to fuNrOfGet4) of the Get4 chip in the system for current message
148 std::vector<int> fviMsgCounter;
149
151 std::vector<ULong64_t> fvulGdpbTsMsb;
152 std::vector<ULong64_t> fvulGdpbTsLsb;
153 std::vector<ULong64_t> fvulStarTsMsb;
154 std::vector<ULong64_t> fvulStarTsMid;
155 std::vector<ULong64_t> fvulGdpbTsFullLast;
156 std::vector<ULong64_t> fvulStarTsFullLast;
157 std::vector<UInt_t> fvuStarTokenLast;
158 std::vector<UInt_t> fvuStarDaqCmdLast;
159 std::vector<UInt_t> fvuStarTrigCmdLast;
160
167 std::vector<ULong64_t> fvulCurrentEpoch;
168 std::vector<Bool_t> fvbFirstEpochSeen;
169 std::vector<ULong64_t> fvulCurrentEpochCycle;
170 std::vector<ULong64_t> fvulCurrentEpochFull;
171
175 std::map<UInt_t, UInt_t> fGdpbIdIndexMap;
176
178 std::vector<std::vector<gdpbv100::Message>> fvmEpSupprBuffer;
179
181 std::vector<UInt_t> fvuFeeNbHitsLastMs;
182 std::vector<Double_t> fdTsLastPulserHit;
183
185 std::vector<std::vector<UInt_t>> fvuCoincNbHitsLastMs;
186 std::vector<std::vector<Double_t>> fvdCoincTsLastHit;
187
189 // Default value for nb bins in Pulser time difference histos
190 const UInt_t kuNbBinsDt = 2000;
191 Double_t dMinDt;
192 Double_t dMaxDt;
193 // Default number of FEE per channels histograms
196 // Evolution plots control
197 Double_t fdStartTime;
202 // Pulser plots
205 // Flesnet
206 TCanvas* fcMsSizeAll;
207 std::vector<TH1*> fvhMsSzPerLink;
208 std::vector<TProfile*> fvhMsSzTimePerLink;
209
210 // Messages types and flags
212 const Double_t kdMaxDtPulserPs = 300e3;
213 std::vector<std::vector<TH1*>> fvhTimeDiffPulser;
219 std::vector<TProfile*> fvhPulserTimeDiffEvoGbtxGbtx;
220 std::vector<std::vector<TProfile*>> fvvhPulserTimeDiffEvoGdpbGdpb;
221
222 static const UInt_t kuNbRefFeeEvo = 2;
223 const UInt_t kuRefFeeEvoIdx[kuNbRefFeeEvo] = {0, 60};
224 std::vector<std::vector<TProfile*>> fvvhPulserTimeDiffEvoFeeFee;
225
226 std::vector<TH2*> fhFeeFtDistribPerCh = {};
227 std::vector<TH2*> fhFeeFtNormDnl = {};
228 std::vector<TH2*> fhFeeFtNormInl = {};
229
230 void CreateHistograms();
231
232 void ProcessEpochCycle(uint64_t ulCycleData);
240
241 inline Int_t GetArrayIndex(Int_t gdpbId, Int_t get4Id) { return gdpbId * fuNrOfGet4PerGdpb + get4Id; }
242
244 std::vector<UInt_t> fvuPadiToGet4;
245 std::vector<UInt_t> fvuGet4ToPadi;
246
248 static const UInt_t kuNbGet4PerGbtx = 5 * 8;
249 std::vector<UInt_t> fvuElinkToGet4;
250 std::vector<UInt_t> fvuGet4ToElink;
251 inline UInt_t ConvertElinkToGet4(UInt_t uElinkIdx)
252 {
253 return fvuElinkToGet4[uElinkIdx % kuNbGet4PerGbtx] + kuNbGet4PerGbtx * (uElinkIdx / kuNbGet4PerGbtx);
254 }
255 inline UInt_t ConvertGet4ToElink(UInt_t uGet4Idx)
256 {
257 return fvuGet4ToElink[uGet4Idx % kuNbGet4PerGbtx] + kuNbGet4PerGbtx * (uGet4Idx / kuNbGet4PerGbtx);
258 }
259
261 std::chrono::time_point<std::chrono::system_clock> fTimeLastHistoSaving;
262
265
266 ClassDef(CbmMcbm2018MonitorTofPulser, 1)
267};
268
269#endif
virtual Bool_t DoUnpack(const fles::Timeslice &ts, size_t component)
void SetHistoryHistoSizeLong(UInt_t inHistorySizeMin=1800)
std::chrono::time_point< std::chrono::system_clock > fTimeLastHistoSaving
void SetFitZoomWidthPs(Double_t inZoomWidth=1000.0)
void SetHistoryHistoSize(UInt_t inHistorySizeSec=1800)
size_t fuMsAcceptsPercent
OLD, to be cleaned out !!!!!
void SetIgnoreMsOverlap(Bool_t bEnaFlag=kTRUE)
void SetMsOverlap(size_t uOverlapMsNb=1)
std::vector< TProfile * > fvhPulserTimeDiffEvoGbtxGbtx
void SetMsLimitLevel(size_t uAcceptBoundaryPct=100)
CbmMcbm2018MonitorTofPulser(const CbmMcbm2018MonitorTofPulser &)
std::map< UInt_t, UInt_t > fGdpbIdIndexMap
Map of ID to index for the gDPBs.
std::vector< ULong64_t > fvulCurrentEpochCycle
Int_t GetArrayIndex(Int_t gdpbId, Int_t get4Id)
std::vector< std::vector< TProfile * > > fvvhPulserTimeDiffEvoGdpbGdpb
std::vector< std::vector< TH1 * > > fvhTimeDiffPulser
virtual void SetNbMsInTs(size_t uCoreMsNb, size_t uOverlapMsNb)
std::vector< ULong64_t > fvulGdpbTsFullLast
void SetHistoFileName(TString sFileName="data/SetupHistos.root")
std::vector< std::vector< UInt_t > > fvuCoincNbHitsLastMs
[ fuFeeNr ]
std::vector< TProfile * > fvhMsSzTimePerLink
const UInt_t kuNbBinsDt
[ fuNrOfGdpbs ][ fuNrOfChannelsPerGdpb ]
CbmMcbm2018MonitorTofPulser operator=(const CbmMcbm2018MonitorTofPulser &)
std::vector< std::vector< Double_t > > fvdCoincTsLastHit
[ fuNrOfGdpbs ][ fuNrOfChannelsPerGdpb ]
std::vector< UInt_t > fvuElinkToGet4
5 FEE with 8 GET4 each
UInt_t ConvertElinkToGet4(UInt_t uElinkIdx)
std::vector< UInt_t > fvuFeeNbHitsLastMs
Buffer for pulser channels.
void ProcessEpochCycle(uint64_t ulCycleData)
ULong64_t fulCurrentEpochTime
Epoch + Epoch Cycle.
std::vector< std::vector< TProfile * > > fvvhPulserTimeDiffEvoFeeFee
std::vector< ULong64_t > fvulStarTsFullLast
std::vector< ULong64_t > fvulCurrentEpochFull
Epoch cycle from the Ms Start message and Epoch counter flip.
const UInt_t kuRefFeeEvoIdx[kuNbRefFeeEvo]
virtual void AddMsComponentToList(size_t component, UShort_t usDetectorId)
std::vector< std::vector< gdpbv100::Message > > fvmEpSupprBuffer
Buffer for suppressed epoch processing.
std::vector< ULong64_t > fvulCurrentEpoch
TString fsHistoFileFullname
/‍** Ignore Overlap Ms: all fuOverlapMsNb MS at the end of timeslice **‍/
std::vector< size_t > fvMsComponentsList
FLES containers.
std::vector< Double_t > fdTsLastPulserHit
[ fuFeeNr ]