CbmRoot
Loading...
Searching...
No Matches
CbmMcbm2018TofTestFee.h
Go to the documentation of this file.
1/* Copyright (C) 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// ----- CbmMcbm2018TofTestFee -----
8// ----- Created 10.07.2018 by P.-A. Loizeau -----
9// ----- -----
10// -----------------------------------------------------------------------------
11
12#ifndef CbmMcbm2018TofTestFee_H
13#define CbmMcbm2018TofTestFee_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 ~CbmMcbm2018TofTestFee();
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 SelectTestFees(UInt_t uGdpbA, UInt_t uGbtxA, UInt_t uFeeA, UInt_t uGdpbB, UInt_t uGbtxB, UInt_t uFeeB)
67 {
68 fuGdpbA = uGdpbA;
69 fuGbtxA = uGbtxA;
70 fuFeeA = uFeeA;
71 fuGdpbB = uGdpbB;
72 fuGbtxB = uGbtxB;
73 fuFeeB = uFeeB;
74 }
75 inline void SetFitZoomWidthPs(Double_t inZoomWidth = 1000.0) { fdFitZoomWidthPs = inZoomWidth; }
76 inline void SetHistoryHistoSize(UInt_t inHistorySizeSec = 1800) { fuHistoryHistoSize = inHistorySizeSec; }
77
78 void SaveAllHistos(TString sFileName = "");
79 void ResetAllHistos();
81 void UpdateZoomedFit(std::vector<std::vector<TH1*>> phTimeDiff, TH2* phTimeRmsZoom, TH2* phTimeResFit);
82
83 void SetHistoFileName(TString sFileName = "data/HistosTofFeeTest.root") { fsHistoFileFullname = sFileName; }
84
85 void UseDaqBuffer(Bool_t) {};
86
87private:
89 std::vector<size_t> fvMsComponentsList;
93
96
99 size_t fuTotalMsNb;
101 size_t fuCoreMs;
102 Double_t fdMsSizeInNs;
106
109 UInt_t fuNrOfGdpbs; // Total number of GDPBs in the system
110 UInt_t fuNrOfFeePerGdpb; // Number of FEBs per GDPB
111 UInt_t fuNrOfGet4PerFee; // Number of GET4s per FEE
112 UInt_t fuNrOfChannelsPerGet4; // Number of channels in each GET4
113
114 UInt_t fuNrOfChannelsPerFee; // Number of channels in each FEE
115 UInt_t fuNrOfGet4; // Total number of Get4 chips in the system
116 UInt_t fuNrOfGet4PerGdpb; // Number of GET4s per GDPB
117 UInt_t fuNrOfChannelsPerGdpb; // Number of channels per GDPB
118
121 std::vector<Int_t> fviNrOfRpc;
122 std::vector<Int_t> fviRpcType;
123 std::vector<Int_t> fviRpcSide;
124 std::vector<Int_t> fviModuleId;
125
126 const UInt_t kuNbFeePerGbtx = 5;
127 const UInt_t kuNbGbtxPerGdpb = 6;
128
134
136 uint64_t fulCurrentTsIndex; // Idx of the current TS
137 size_t fuCurrentMs; // Idx of the current MS in TS (0 to fuTotalMsNb)
138 size_t fuCurrentMsSysId; // SysId of the current MS in TS (0 to fuTotalMsNb)
139 Double_t fdMsIndex; // Time in ns of current MS from its index
140 UInt_t fuGdpbId; // Id (hex number) of the GDPB for current message
141 UInt_t fuGdpbNr; // running number (0 to fuNrOfGdpbs) of the GDPB for current message
142 UInt_t fuGet4Id; // running number (0 to fuNrOfGet4PerGdpb) of the Get4 chip of a unique GDPB for current message
143 UInt_t fuGet4Nr; // running number (0 to fuNrOfGet4) of the Get4 chip in the system for current message
145 std::vector<int> fviMsgCounter;
146
148 std::vector<ULong64_t> fvulGdpbTsMsb;
149 std::vector<ULong64_t> fvulGdpbTsLsb;
150 std::vector<ULong64_t> fvulStarTsMsb;
151 std::vector<ULong64_t> fvulStarTsMid;
152 std::vector<ULong64_t> fvulGdpbTsFullLast;
153 std::vector<ULong64_t> fvulStarTsFullLast;
154 std::vector<UInt_t> fvuStarTokenLast;
155 std::vector<UInt_t> fvuStarDaqCmdLast;
156 std::vector<UInt_t> fvuStarTrigCmdLast;
157
164 std::vector<ULong64_t> fvulCurrentEpoch;
165 std::vector<Bool_t> fvbFirstEpochSeen;
166 std::vector<ULong64_t> fvulCurrentEpochCycle;
167 std::vector<ULong64_t> fvulCurrentEpochFull;
168
172 std::map<UInt_t, UInt_t> fGdpbIdIndexMap;
173
175 std::vector<std::vector<gdpbv100::Message>> fvmEpSupprBuffer;
176
178 std::vector<std::vector<UInt_t>> fvuFeeChanNbHitsLastMs;
179 std::vector<std::vector<Double_t>> fvdFeeChanMsLastPulserHit;
180
182 // Default value for nb bins in Pulser time difference histos
183 const UInt_t kuNbBinsDt = 2000;
184 Double_t dMinDt;
185 Double_t dMaxDt;
186 // Default number of FEE per channels histograms
189 // Evolution plots control
190 Double_t fdStartTime;
195 // Pulser plots
198 // Flesnet
199 TCanvas* fcMsSizeAll;
200 std::vector<TH1*> fvhMsSzPerLink;
201 std::vector<TProfile*> fvhMsSzTimePerLink;
202
203 // Messages types and flags
205 static const UInt_t kuNbTestFee = 2;
206 const Double_t kdMaxDtPulserPs = 300e3;
207
208 UInt_t fuGdpbA;
209 UInt_t fuGbtxA;
210 UInt_t fuFeeA;
212 UInt_t fuGdpbB;
213 UInt_t fuGbtxB;
214 UInt_t fuFeeB;
216
217 std::vector<std::vector<TH1*>> fvhTimeDiffPulserFeeA;
222
223 std::vector<std::vector<TH1*>> fvhTimeDiffPulserFeeB;
228
229 std::vector<std::vector<TH1*>> fvhTimeDiffPulserFeeFee;
234
237
240
242
244 TCanvas* fcPulserFeeA;
245 TCanvas* fcPulserFeeB;
247 TCanvas* fcPulseProp;
248
249 void CreateHistograms();
250
251 void ProcessEpochCycle(uint64_t ulCycleData);
259
260 inline Int_t GetArrayIndex(Int_t gdpbId, Int_t get4Id) { return gdpbId * fuNrOfGet4PerGdpb + get4Id; }
261
263 std::vector<UInt_t> fvuPadiToGet4;
264 std::vector<UInt_t> fvuGet4ToPadi;
265
267 static const UInt_t kuNbGet4PerGbtx = 5 * 8;
268 std::vector<UInt_t> fvuElinkToGet4;
269 std::vector<UInt_t> fvuGet4ToElink;
270 inline UInt_t ConvertElinkToGet4(UInt_t uElinkIdx)
271 {
272 return fvuElinkToGet4[uElinkIdx % kuNbGet4PerGbtx] + kuNbGet4PerGbtx * (uElinkIdx / kuNbGet4PerGbtx);
273 }
274 inline UInt_t ConvertGet4ToElink(UInt_t uGet4Idx)
275 {
276 return fvuGet4ToElink[uGet4Idx % kuNbGet4PerGbtx] + kuNbGet4PerGbtx * (uGet4Idx / kuNbGet4PerGbtx);
277 }
278
280 std::chrono::time_point<std::chrono::system_clock> fTimeLastHistoSaving;
281
284
285 ClassDef(CbmMcbm2018TofTestFee, 1)
286};
287
288#endif
std::vector< std::vector< gdpbv100::Message > > fvmEpSupprBuffer
Buffer for suppressed epoch processing.
CbmMcbm2018TofTestFee(const CbmMcbm2018TofTestFee &)
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
virtual void SetNbMsInTs(size_t uCoreMsNb, size_t uOverlapMsNb)
UInt_t ConvertElinkToGet4(UInt_t uElinkIdx)
void FillEpochInfo(gdpbv100::Message)
void PrintSlcInfo(gdpbv100::Message)
UInt_t ConvertGet4ToElink(UInt_t uGet4Idx)
std::vector< UInt_t > fvuPadiToGet4
std::vector< Int_t > fviModuleId
std::vector< size_t > fvMsComponentsList
FLES containers.
std::vector< UInt_t > fvuStarTrigCmdLast
std::map< UInt_t, UInt_t > fGdpbIdIndexMap
Map of ID to index for the gDPBs.
ULong64_t fulCurrentEpochTime
Epoch + Epoch Cycle.
TCanvas * fcPulserFeeA
Canvases.
std::vector< TH1 * > fvhMsSzPerLink
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.
void SetMsOverlap(size_t uOverlapMsNb=1)
std::chrono::time_point< std::chrono::system_clock > fTimeLastHistoSaving
size_t fuMsAcceptsPercent
OLD, to be cleaned out !!!!!
std::vector< std::vector< TH1 * > > fvhTimeDiffPulserFeeFee
static const UInt_t kuNbTestFee
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
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.
const UInt_t kuNbBinsDt
[ fuFeeNr ][ ChanNr ]
std::vector< int > fviMsgCounter
void FillHitInfo(gdpbv100::Message)
std::vector< TProfile * > fvhMsSzTimePerLink
void SetIgnoreMsOverlap(Bool_t bEnaFlag=kTRUE)
std::vector< UInt_t > fvuGet4ToElink
std::vector< Int_t > fviNrOfRpc
std::vector< ULong64_t > fvulStarTsMid
CbmMcbm2018TofTestFee operator=(const CbmMcbm2018TofTestFee &)
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
void SetHistoryHistoSize(UInt_t inHistorySizeSec=1800)
void UpdateZoomedFit(std::vector< std::vector< TH1 * > > phTimeDiff, TH2 *phTimeRmsZoom, TH2 *phTimeResFit)
std::vector< UInt_t > fvuStarDaqCmdLast
std::vector< ULong64_t > fvulCurrentEpoch
void SetFitZoomWidthPs(Double_t inZoomWidth=1000.0)
virtual Bool_t DoUnpack(const fles::Timeslice &ts, size_t component)
std::vector< ULong64_t > fvulStarTsFullLast
std::vector< ULong64_t > fvulGdpbTsLsb
void PrintSysInfo(gdpbv100::Message)
std::vector< ULong64_t > fvulCurrentEpochCycle
std::vector< ULong64_t > fvulGdpbTsFullLast
void SelectTestFees(UInt_t uGdpbA, UInt_t uGbtxA, UInt_t uFeeA, UInt_t uGdpbB, UInt_t uGbtxB, UInt_t uFeeB)
TH2 * fhTimeMeanPulserFeeFee
[ Ch FEE A ][ Ch FEE B ]
std::vector< UInt_t > fvuGet4ToPadi
std::vector< Int_t > fviRpcType
void FillStarTrigInfo(gdpbv100::Message)
void SetMsLimitLevel(size_t uAcceptBoundaryPct=100)
static const UInt_t kuNbGet4PerGbtx
void SetHistoFileName(TString sFileName="data/HistosTofFeeTest.root")
std::vector< Bool_t > fvbFirstEpochSeen