CbmRoot
Loading...
Searching...
No Matches
CbmStsUnpackAlgo.h
Go to the documentation of this file.
1/* Copyright (C) 2021 Goethe-University, Frankfurt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Pierre-Alain Loizeau, Pascal Raisig [committer], Dominik Smith */
4
21#ifndef CbmStsUnpackAlgo_H
22#define CbmStsUnpackAlgo_H
23
24#include "CbmMcbm2018StsPar.h"
26
27
29 public:
32
34 virtual ~CbmStsUnpackAlgo();
35
38
41
49 virtual void MaskNoisyChannel(const uint32_t uFeb, const uint32_t uChan, const bool bMasked = true);
50
52 void SetMonitor(std::shared_ptr<CbmStsUnpackMonitor> monitor) { fMonitor = monitor; }
53
54 protected:
62 uint32_t getAsicIndex(uint32_t dpbidx, uint32_t crobidx, uint16_t elinkidx);
63
70 uint64_t getFullTimeStamp(const uint16_t usRawTs);
71
77 Bool_t init();
78
81
84
91 Bool_t initParSet(FairParGenericSet* parset);
92
99 Bool_t initParSet(CbmMcbm2018StsPar* parset);
100
102 void initTempVectors(CbmMcbm2018StsPar* parset, std::vector<int32_t>* viModuleType,
103 std::vector<int32_t>* viModAddress,
104 std::vector<std::vector<std::vector<int32_t>>>* viFebModuleIdx,
105 std::vector<std::vector<bool>>* vbCrobActiveFlag,
106 std::vector<std::vector<std::vector<int32_t>>>* viFebModuleSide);
117 void loopMsMessages(const uint8_t* msContent, const uint32_t uSize, const size_t uMsIdx);
118
120 void printActiveCrobs(CbmMcbm2018StsPar* parset, const std::vector<std::vector<bool>>& vbCrobActiveFlag);
121
123 void printAddressMaps(CbmMcbm2018StsPar* parset, const std::vector<std::vector<std::vector<int32_t>>>& viFebModuleIdx,
124 const std::vector<std::vector<std::vector<int32_t>>>& viFebModuleSide);
125
127 void processEpochInfo(const stsxyter::Message& /*mess*/) { return; };
128
130 void processErrorInfo(const stsxyter::Message& mess);
131
133 void processHitInfo(const stsxyter::Message& mess);
134
136 void processStatusInfo(const stsxyter::Message& mess, uint32_t uIdx);
137
139 void processTsMsbInfo(const stsxyter::Message& mess, uint32_t uMessIdx, uint32_t uMsIdx);
140
142 void refreshTsMsbFields(const uint32_t imslice, const size_t mstime);
143
153 bool setDerivedTsParameters(size_t /*itimeslice*/) { return true; }
154
166 bool unpack(const fles::Timeslice* ts, std::uint16_t icomp, UInt_t imslice);
167
168 // Monitoring
170 uint64_t fMsStartTime = 0;
171
172 // Parameter members
174 std::map<uint32_t, uint32_t> fDpbIdIndexMap = {};
175
177 uint32_t fuCurrDpbIdx = 0;
178
180 std::vector<bool> fvbMaskedComponents;
181
183 uint32_t fuNbFebs = 0;
184
186 std::vector<uint32_t> fvbFebAdcCut = {};
187
189 uint32_t fNrElinksPerCrob = 0;
190
192 uint32_t fNrAsicsPerCrob = 0;
193
195 uint32_t fNrAsicsPerFeb = 0;
196
198 uint32_t fNrChsPerAsic = 0;
199
201 uint32_t fNrChsPerFeb = 0;
202
204 uint32_t fNrCrobPerDpb = 0;
205
207 uint32_t fNrFebsPerCrob = 0;
208
210 std::vector<int> fElinkIdxToFebIdxVec = {};
211
213 std::vector<std::pair<uint32_t, uint32_t>> fElinkIdxToAsicIdxVec = {};
214
216 bool fbUseChannelMask = false;
217
219 std::vector<std::vector<bool>> fvvbMaskedChannels = {};
220
222 std::vector<std::vector<std::vector<int32_t>>> fviFebType = {};
223
225 std::vector<bool> fvbFebPulser;
227 std::vector<int32_t> fviFebAddress;
229 std::vector<int32_t> fviFebSide;
231 std::vector<double> fvdFebAdcGain;
233 std::vector<double> fvdFebAdcOffs;
234
236 std::vector<uint64_t> fvulCurrentTsMsb = {};
238 std::vector<uint32_t> fvuCurrentTsMsbCycle = {};
239
241 uint64_t fulTsStartInTsMsb = 0;
243 std::vector<uint64_t> fulTsMsbIndexInTs = {};
244
246 static const uint32_t kuMaxTsMsbDiffDuplicates = 8;
248 std::vector<std::vector<uint16_t>> fvvusLastTsChan = {};
250 std::vector<std::vector<uint16_t>> fvvusLastAdcChan = {};
252 std::vector<std::vector<uint64_t>> fvvulLastTsMsbChan = {};
253
254 private:
255 ClassDef(CbmStsUnpackAlgo, 2)
256};
257
258#endif // CbmStsUnpackAlgo_H
Baseclass for the Sts unpacker algorithms.
std::shared_ptr< CbmStsUnpackMonitor > fMonitor
Potential (online) monitor for the unpacking process.
uint32_t fuCurrDpbIdx
Current dpb id.
std::vector< std::vector< bool > > fvvbMaskedChannels
Vector of channel masks, [ NbFeb ][ NbCHanInFeb ], used only if fbUseChannelMask is true.
static const uint32_t kuMaxTsMsbDiffDuplicates
Duplicate hits suppression.
bool setDerivedTsParameters(size_t)
Set the Derived Ts Parameters.
std::vector< double > fvdFebAdcOffs
ADC offset in e-, [ NbDpb * NbCrobPerDpb * NbFebsPerCrob ].
void initInternalStatus(CbmMcbm2018StsPar *parset)
experts please add description here
std::vector< int32_t > fviFebSide
Module side for each FEB, [ NbDpb * NbCrobPerDpb * NbFebsPerCrob ].
std::vector< uint32_t > fvuCurrentTsMsbCycle
Current TS MSB cycle for DPB.
void initDpbIdIndexMap(CbmMcbm2018StsPar *parset)
Initialize the DpbIdIndexMap with the information from the parset.
uint32_t fNrAsicsPerFeb
Number of ASICs per FEB.
uint32_t fNrCrobPerDpb
Number of CROBs per DPB.
std::vector< uint64_t > fvulCurrentTsMsb
Current TS MSB for each DPB.
void SetMonitor(std::shared_ptr< CbmStsUnpackMonitor > monitor)
Set a predefined monitor.
Bool_t initParSet(FairParGenericSet *parset)
Handles the distribution of the hidden derived classes to their explicit functions.
void processEpochInfo(const stsxyter::Message &)
experts please add description marked as not used currently
std::vector< std::vector< uint64_t > > fvvulLastTsMsbChan
TS MSB in TS of last hit message for each channel, [ AsicIdx ][ Chan ].
std::vector< bool > fvbMaskedComponents
Masked components to print out missing component only once.
void processErrorInfo(const stsxyter::Message &mess)
experts please add description
std::vector< int > fElinkIdxToFebIdxVec
Vector used for the translation between eLink index and FEB index.
virtual ~CbmStsUnpackAlgo()
Destroy the Cbm Sts Unpack Task object.
void loopMsMessages(const uint8_t *msContent, const uint32_t uSize, const size_t uMsIdx)
Main loop over the sts xyter messages in the µSlices.
uint32_t fNrFebsPerCrob
Number of FEBs per CROB.
CbmStsUnpackAlgo()
Create the Cbm Sts Unpack AlgoBase object.
std::map< uint32_t, uint32_t > fDpbIdIndexMap
Map of DPB Identifier to DPB index.
uint32_t fNrElinksPerCrob
Number of eLinks per CROB.
std::vector< std::pair< uint32_t, uint32_t > > fElinkIdxToAsicIdxVec
Vector used for the translation between eLink index and Asic index first is feb type A second is feb ...
virtual void MaskNoisyChannel(const uint32_t uFeb, const uint32_t uChan, const bool bMasked=true)
Mask a Noisy Channel.
Bool_t init()
Intialisation at begin of run. Special inits of the derived algos.
uint32_t getAsicIndex(uint32_t dpbidx, uint32_t crobidx, uint16_t elinkidx)
Get the Asic Index.
uint64_t fulTsStartInTsMsb
Start time of the TS expressed in TS_MSB instead of ns.
uint64_t getFullTimeStamp(const uint16_t usRawTs)
Get the Full Time Stamp from raw time stamp.
bool fbUseChannelMask
flag if channel mask is to be used or not. Set automatically via MaskNoisyChannels
bool unpack(const fles::Timeslice *ts, std::uint16_t icomp, UInt_t imslice)
Unpack a given microslice. To be implemented in the derived unpacker algos.
void processStatusInfo(const stsxyter::Message &mess, uint32_t uIdx)
experts please add description
std::vector< bool > fvbFebPulser
Pulser flag for each FEB, [ NbDpb * NbCrobPerDpb * NbFebsPerCrob ].
uint32_t fNrChsPerAsic
Number of Channels per Asic.
std::vector< std::vector< std::vector< int32_t > > > fviFebType
FEB type, [ NbDpb ][ NbCrobPerDpb ][ NbFebsPerCrob ], 0 = A, 1 = B, -1 if inactive.
std::vector< std::vector< uint16_t > > fvvusLastAdcChan
ADC of last hit message for each channel, [ AsicIdx ][ Chan ].
uint32_t fuNbFebs
Number of FEBs with StsXyter ASICs.
CbmStsUnpackAlgo(const CbmStsUnpackAlgo &)=delete
Copy constructor - not implemented.
std::vector< std::vector< uint16_t > > fvvusLastTsChan
TS of last hit message for each channel, [ AsicIdx ][ Chan ].
void processTsMsbInfo(const stsxyter::Message &mess, uint32_t uMessIdx, uint32_t uMsIdx)
experts please add description
std::vector< uint64_t > fulTsMsbIndexInTs
Current TS MSB cycle for DPB relative to TS start.
void printActiveCrobs(CbmMcbm2018StsPar *parset, const std::vector< std::vector< bool > > &vbCrobActiveFlag)
experts please add description
uint64_t fMsStartTime
Current µSlice time.
uint32_t fNrAsicsPerCrob
Number of ASICs per CROB.
CbmStsUnpackAlgo & operator=(const CbmStsUnpackAlgo &)=delete
Assignment operator - not implemented.
std::vector< int32_t > fviFebAddress
STS address for each FEB, [ NbDpb * NbCrobPerDpb * NbFebsPerCrob ].
uint32_t fNrChsPerFeb
Number of Channels per FEB.
void initTempVectors(CbmMcbm2018StsPar *parset, std::vector< int32_t > *viModuleType, std::vector< int32_t > *viModAddress, std::vector< std::vector< std::vector< int32_t > > > *viFebModuleIdx, std::vector< std::vector< bool > > *vbCrobActiveFlag, std::vector< std::vector< std::vector< int32_t > > > *viFebModuleSide)
Initialize and transfer the informations to the parameters storage vectors.
void printAddressMaps(CbmMcbm2018StsPar *parset, const std::vector< std::vector< std::vector< int32_t > > > &viFebModuleIdx, const std::vector< std::vector< std::vector< int32_t > > > &viFebModuleSide)
experts please add description
void refreshTsMsbFields(const uint32_t imslice, const size_t mstime)
experts please add description here
void processHitInfo(const stsxyter::Message &mess)
Process the information of the hit message and create a StsDigi from it.
std::vector< uint32_t > fvbFebAdcCut
ADC cuts for FEBs.
std::vector< double > fvdFebAdcGain
ADC gain in e-/b, [ NbDpb * NbCrobPerDpb * NbFebsPerCrob ].