CbmRoot
Loading...
Searching...
No Matches
CbmStar2019EventBuilderEtofAlgo.h
Go to the documentation of this file.
1/* Copyright (C) 2018-2020 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// ----- CbmStar2019EventBuilderEtofAlgo -----
8// ----- Created 03.11.2018 by P.-A. Loizeau -----
9// ----- -----
10// -----------------------------------------------------------------------------
11
12#ifndef CbmStar2019EventBuilderEtofAlgo_H
13#define CbmStar2019EventBuilderEtofAlgo_H
14
15#include "CbmStar2019Algo.h"
16#include "CbmTofDigi.h"
17#include "CbmTofStarData2019.h"
18
19#include <bitset>
20#include <chrono>
21#include <map>
22#include <vector>
23
24#include "gDpbMessv100.h"
25
27/*
28class TCanvas;
29class THttpServer;
30*/
31class TH1;
32class TH2;
33class TProfile;
34
36public:
39
40 virtual Bool_t Init();
41 virtual void Reset();
42 virtual void Finish();
43
44 Bool_t InitContainers();
45 Bool_t ReInitContainers();
46 TList* GetParList();
47
48 Bool_t InitParameters();
49
50 Bool_t ProcessTs(const fles::Timeslice& ts);
51 Bool_t ProcessTs(const fles::Timeslice& ts, size_t /*component*/) { return ProcessTs(ts); }
52 Bool_t ProcessMs(const fles::Timeslice& ts, size_t uMsCompIdx, size_t uMsIdx);
53
54 void AddMsComponentToList(size_t component, UShort_t usDetectorId);
55
56 Bool_t BuildEvents();
57 std::vector<CbmTofStarSubevent2019>& GetEventBuffer() { return fvEventsBuffer; }
58
59 Bool_t CreateHistograms();
60 Bool_t FillHistograms();
61 Bool_t ResetHistograms();
62
63 inline void SetMonitorMode(Bool_t bFlagIn = kTRUE) { fbMonitorMode = bFlagIn; }
64 inline void SetDebugMonitorMode(Bool_t bFlagIn = kTRUE) { fbDebugMonitorMode = bFlagIn; }
65 inline void SetStoreLostEventMsg(Bool_t bFlagIn = kTRUE) { fbStoreLostEventMsg = bFlagIn; }
66 inline void SetAddStatusToEvent(Bool_t bFlagIn = kTRUE) { fbAddStatusToEvent = bFlagIn; }
67 inline void SetPulserTotLimits(UInt_t uMin, UInt_t uMax)
68 {
69 fuMinTotPulser = uMin;
70 fuMaxTotPulser = uMax;
71 }
72
73private:
77 Bool_t
80
82 static const UInt_t kuMaxNbErrorsPerGdpbPerEvent =
83 500;
84
88 UInt_t fuNrOfGdpbs; // Total number of GDPBs in the system
89 std::map<UInt_t, UInt_t> fGdpbIdIndexMap; // gDPB ID to index map
90 UInt_t fuNrOfFeePerGdpb; // Number of FEBs per GDPB
91 UInt_t fuNrOfGet4PerFee; // Number of GET4s per FEE
92 UInt_t fuNrOfChannelsPerGet4; // Number of channels in each GET4
93
94 UInt_t fuNrOfChannelsPerFee; // Number of channels in each FEE
95 UInt_t fuNrOfGet4; // Total number of Get4 chips in the system
96 UInt_t fuNrOfGet4PerGdpb; // Number of GET4s per GDPB
97 UInt_t fuNrOfChannelsPerGdpb; // Number of channels per GDPB
99 UInt_t fuNrOfGbtx;
101 std::vector<Int_t> fviNrOfRpc;
102 std::vector<Int_t> fviRpcType;
103 std::vector<Int_t> fviRpcSide;
104 std::vector<Int_t> fviModuleId;
107 std::vector<Double_t> fdStarTriggerDeadtime;
108 std::vector<Double_t> fdStarTriggerDelay;
109 std::vector<Double_t> fdStarTriggerWinSize;
110
114
116 ULong64_t fulCurrentTsIndex; // Idx of the current TS
117 Double_t fdTsStartTime; // Time in ns of current TS from the index of the first MS first component
118 Double_t fdTsStopTimeCore; // End Time in ns of current TS Core from the index of the first MS first component
119 size_t fuCurrentMs; // Idx of the current MS in TS (0 to fuTotalMsNb)
120 Double_t fdMsTime; // Time in ns of current MS from its index field in header
121 UInt_t fuMsIndex; // Index of current MS within the TS
122 UInt_t fuGdpbId; // Id (hex number) of the GDPB for current message
123 UInt_t fuGdpbNr; // running number (0 to fuNrOfGdpbs) of the GDPB for current message
124 UInt_t fuGet4Id; // running number (0 to fuNrOfGet4PerGdpb) of the Get4 chip of a unique GDPB for current message
125 UInt_t fuGet4Nr; // running number (0 to fuNrOfGet4) of the Get4 chip in the system for current message
127
129 std::vector<ULong64_t> fvulCurrentEpoch;
130 std::vector<ULong64_t> fvulCurrentEpochCycle;
131 std::vector<ULong64_t> fvulCurrentEpochFull;
132
134 std::vector<std::vector<gdpbv100::Message>> fvvmEpSupprBuffer;
135 std::vector<std::vector<gdpbv100::FullMessage>>
137 std::vector<std::vector<gdpbv100::FullMessage>> fvvBufferMessages;
138 std::vector<std::vector<CbmTofStarTrigger2019>> fvvBufferTriggers;
139 std::vector<CbmTofStarSubevent2019> fvEventsBuffer;
140
145 std::vector<ULong64_t> fvulGdpbTsMsb;
146 std::vector<ULong64_t> fvulGdpbTsLsb;
147 std::vector<ULong64_t> fvulStarTsMsb;
148 std::vector<ULong64_t> fvulStarTsMid;
149 std::vector<ULong64_t> fvulGdpbTsFullLast;
150 std::vector<ULong64_t> fvulStarTsFullLast;
151 std::vector<UInt_t> fvuStarTokenLast;
152 std::vector<UInt_t> fvuStarDaqCmdLast;
153 std::vector<UInt_t> fvuStarTrigCmdLast;
154 std::vector<ULong64_t> fvulGdpbTsFullLastCore;
155 std::vector<ULong64_t> fvulStarTsFullLastCore;
156 std::vector<UInt_t> fvuStarTokenLastCore;
157 std::vector<UInt_t> fvuStarDaqCmdLastCore;
158 std::vector<UInt_t> fvuStarTrigCmdLastCore;
159
161 std::vector<Double_t> fvdMessCandidateTimeStart;
162 std::vector<Double_t> fvdMessCandidateTimeStop;
163 std::vector<Double_t> fvdTrigCandidateTimeStart;
164 std::vector<Double_t> fvdTrigCandidateTimeStop;
167
169 static const uint32_t kuNbMsgPerPattern = 8;
170 static const uint32_t kuNbAsicPerGdpb = 240;
171 std::vector<std::bitset<kuNbAsicPerGdpb>> fvbGdpbLastMissmatchPattern;
172 std::vector<std::bitset<kuNbAsicPerGdpb>> fvbGdpbLastEnablePattern;
173 std::vector<std::bitset<kuNbAsicPerGdpb>> fvbGdpbLastResyncPattern;
174 std::vector<std::vector<std::pair<uint64_t,
175 std::bitset<kuNbAsicPerGdpb>>>>
177
178
180 std::vector<TH1*> fvhHitsTimeToTriggerRaw;
182 std::vector<TH1*> fvhHitsTimeToTriggerSel;
185 std::vector<TH1*> fvhTriggerDt;
186 std::vector<TH1*> fvhTriggerDistributionInTs;
187 std::vector<TH1*> fvhTriggerDistributionInMs;
188 std::vector<TH1*> fvhMessDistributionInMs;
202 TCanvas* fcTrigDistMs;
203 TCanvas* fcMessDistMs;
205 TCanvas* fcTriggerStats;
206
207 void ProcessEpochCycle(uint64_t ulCycleData);
210
211 void ProcessEpSupprBuffer(uint32_t uGdpbNr);
212 void StoreMessageInBuffer(gdpbv100::FullMessage fullMess, uint32_t uGdpbNr);
213
214 void ProcessHit(gdpbv100::Message mess, uint64_t ulCurEpochGdpbGet4);
215 void ProcessSlCtrl(gdpbv100::Message mess, uint64_t ulCurEpochGdpbGet4);
216 void ProcessSysMess(gdpbv100::Message mess, uint64_t ulCurEpochGdpbGet4);
217 void ProcessPattern(gdpbv100::Message mess, uint64_t ulCurEpochGdpbGet4);
218
220 gdpbv100::FullMessage CreateStatusMessage(uint16_t uGdpbId, uint32_t uIndex,
221 std::pair<uint64_t, std::bitset<kuNbAsicPerGdpb>> statusIn);
222
225
227};
228
229#endif
std::vector< ULong64_t > fvulStarTsMsb
[sector]
std::vector< std::vector< std::pair< uint64_t, std::bitset< kuNbAsicPerGdpb > > > > fvSectorStatusPattern
[sector][asic] Exclude from dictionnary
std::vector< TH2 * > fvhHitsTimeToTriggerSelVsDaq
[sector]
Bool_t ProcessTs(const fles::Timeslice &ts, size_t)
std::vector< std::bitset< kuNbAsicPerGdpb > > fvbGdpbLastResyncPattern
[sector][asic] Exclude from dictionnary
std::vector< UInt_t > fvuStarDaqCmdLast
[sector]
Bool_t ProcessMs(const fles::Timeslice &ts, size_t uMsCompIdx, size_t uMsIdx)
std::vector< UInt_t > fvuStarTokenLastCore
[sector]
std::vector< ULong64_t > fvulGdpbTsFullLastCore
[sector]
std::vector< UInt_t > fvuStarTrigCmdLastCore
[sector]
std::vector< TH1 * > fvhHitsTimeToTriggerSel
[sector], extra monitor for debug
void ProcessSlCtrl(gdpbv100::Message mess, uint64_t ulCurEpochGdpbGet4)
std::vector< TH1 * > fvhTriggerDistributionInMs
[sector], extra monitor for debug
std::vector< CbmTofStarSubevent2019 > & GetEventBuffer()
std::vector< std::vector< gdpbv100::FullMessage > > fvvBufferMessages
[sector], buffer to make sure GET4 errors 0-12 are always transmitted
std::vector< TH1 * > fvhTriggerDt
[sector], extra monitor for debug
std::vector< TH1 * > fvhHitsTimeToTriggerRaw
[sector][Update]<time, [asic]> Exclude from dictionnary
std::vector< std::vector< gdpbv100::Message > > fvvmEpSupprBuffer
Epoch + Epoch Cycle.
Bool_t fbAddStatusToEvent
Switch ON the insertion of the LostEvent messages from GET4s with the critical errors (default is fal...
std::vector< ULong64_t > fvulStarTsFullLastCore
[sector]
gdpbv100::FullMessage CreateStatusMessage(uint16_t uGdpbId, uint32_t uIndex, std::pair< uint64_t, std::bitset< kuNbAsicPerGdpb > > statusIn)
std::vector< Double_t > fdStarTriggerDelay
[sector]
Bool_t fbDebugMonitorMode
Switch ON the filling of a minimal set of histograms.
TCanvas * fcMessDistMs
All sectors, extra monitor for debug.
TH2 * fhRawTriggersStatsCore
extra monitor for debug
std::vector< TH1 * > fvhTriggerDistributionInTs
[sector], extra monitor for debug
std::vector< std::vector< gdpbv100::FullMessage > > fvvBufferMajorAsicErrors
[sector]
std::vector< std::bitset< kuNbAsicPerGdpb > > fvbGdpbLastEnablePattern
[sector][asic] Exclude from dictionnary
std::vector< ULong64_t > fvulStarTsFullLast
[sector]
std::vector< TH2 * > fvhHitsTimeToTriggerSelVsTrig
[sector], extra monitor for debug
std::vector< Double_t > fvdTrigCandidateTimeStart
[sector]
TCanvas * fcEventBuildStats
All sectors, extra monitor for debug.
std::vector< Double_t > fvdMessCandidateTimeStart
[sector]
TH2 * fhRawTriggersStatsOver
extra monitor for debug
Bool_t fbStoreLostEventMsg
Switch ON the filling of a additional set of histograms.
void AddMsComponentToList(size_t component, UShort_t usDetectorId)
void StoreMessageInBuffer(gdpbv100::FullMessage fullMess, uint32_t uGdpbNr)
std::vector< std::vector< CbmTofStarTrigger2019 > > fvvBufferTriggers
[sector]
void SetPulserTotLimits(UInt_t uMin, UInt_t uMax)
void ProcessEpochCycle(uint64_t ulCycleData)
All sectors, extra monitor for debug.
std::vector< std::bitset< kuNbAsicPerGdpb > > fvbGdpbLastMissmatchPattern
std::vector< ULong64_t > fvulCurrentEpochFull
Epoch cycle from the Ms Start message and Epoch counter flip.
void ProcessSysMess(gdpbv100::Message mess, uint64_t ulCurEpochGdpbGet4)
void ProcessHit(gdpbv100::Message mess, uint64_t ulCurEpochGdpbGet4)
std::vector< ULong64_t > fvulGdpbTsFullLast
[sector]
void ProcessPattern(gdpbv100::Message mess, uint64_t ulCurEpochGdpbGet4)
Bool_t ProcessTs(const fles::Timeslice &ts)
std::vector< TH2 * > fvhHitsTimeToTriggerRawPulser
[sector]
CbmStar2019EventBuilderEtofAlgo(const CbmStar2019EventBuilderEtofAlgo &)
TProfile * fhEventSizeDistributionInTs
extra monitor for debug
std::vector< Double_t > fvdMessCandidateTimeStop
[sector]
std::vector< ULong64_t > fvulGdpbTsLsb
[sector]
TH1 * fhEventNbPerTs
[sector], extra monitor for debug
std::vector< Double_t > fvdTrigCandidateTimeStop
[sector]
std::vector< UInt_t > fvuStarTrigCmdLast
[sector]
std::vector< TH1 * > fvhMessDistributionInMs
[sector], extra monitor for debug
TH2 * fhMissingTriggersEvolution
extra monitor for debug
Double_t fdAllowedTriggersSpread
Event window limits.
std::vector< Double_t > fdStarTriggerWinSize
[sector]
static const UInt_t kuMaxNbErrorsPerGdpbPerEvent
Switch ON the readout and insertion of STATUS pattern message (default is true)
std::vector< CbmTofStarSubevent2019 > fvEventsBuffer
[sector]
std::vector< ULong64_t > fvulCurrentEpoch
Current time references for each GDPB: merged epoch marker, epoch cycle, full epoch [fuNrOfGdpbs].
TH2 * fhRawTriggersStatsSel
extra monitor for debug
TCanvas * fcTimeToTrigRaw
extra monitor for debug
CbmStar2019EventBuilderEtofAlgo operator=(const CbmStar2019EventBuilderEtofAlgo &)
CbmStar2019TofPar * fUnpackPar
Correspond to ~6000 error messages max per event, leaving 2000 for hits and epoch.
static const uint32_t kuNbMsgPerPattern
ASIC status monitoring.
std::vector< ULong64_t > fvulStarTsMid
[sector]
std::vector< UInt_t > fvuStarDaqCmdLastCore
[sector]