CbmRoot
Loading...
Searching...
No Matches
CbmTrdUnpackFaspAlgo.h
Go to the documentation of this file.
1/* Copyright (C) 2021 Goethe-University Frankfurt, Frankfurt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Pascal Raisig [committer], Alexandru Bercuci */
4
22#ifndef CbmTrdUnpackFaspAlgo_H
23#define CbmTrdUnpackFaspAlgo_H
24
25#include "CbmRecoUnpackAlgo.tmpl"
26#include "CbmTrdDigi.h"
27#include "CbmTrdParFasp.h"
28#include "CbmTrdParSetAsic.h"
30#include "Timeslice.hpp" // timeslice
31
32#include <Rtypes.h> // for types
33#include <RtypesCore.h>
34
35#include <cstddef>
36#include <cstdint>
37#include <memory>
38#include <utility>
39
40// TODO to be defined in correlation with time offsets (AB 20.05.22)
41#define NCRI 40 // no of CRI in the system (5/TRD-2D_FASP module)
42#define NCOLS 8 // no of cols / FASP
43
45class CbmTrdUnpackFaspAlgo : public CbmRecoUnpackAlgo<CbmTrdDigi> {
46 public:
76 enum class eMessageLength : int
77 {
78 kMessCh = 4,
79 kMessType = 1,
80 kMessTlab = 7,
81 kMessData = 14,
82 kMessFasp = 6,
83 kMessEpoch = 21
84 };
86 {
87 kData = 0,
88 kEpoch = 1,
89 kNone
90 };
91 enum class eMessageVersion : int
92 {
93 kMessLegacy = 2,
94 kMess24 = 3,
96 };
99
101 virtual ~CbmTrdUnpackFaspAlgo();
102
105
108
109
112 public:
113 CbmTrdFaspMessage() = default;
115 virtual ~CbmTrdFaspMessage() = default;
116 CbmTrdFaspMessage(uint8_t rob, uint8_t asic, uint8_t c, uint8_t typ, uint8_t t, uint16_t d, uint8_t l);
117 virtual int getFaspIdMod() const { return fasp + rob * NFASPCROB; }
118 virtual eMessageType getType(uint32_t w) const;
119 virtual void print() const;
120 virtual void readDW(uint32_t w);
121 virtual void readEW(uint32_t w);
122
123 public:
125 uint8_t ch = 0;
126 uint8_t type = 0;
127 uint8_t tlab = 0;
128 uint16_t data = 0;
129 uint32_t epoch = 0;
130 uint32_t mod = 0;
131 uint8_t rob = 0;
132 uint8_t elink = 0;
133 uint8_t fasp = 0;
134 };
136 public:
138 virtual eMessageType getType(uint32_t w) const;
139 virtual void readDW(uint32_t w);
140 virtual void readEW(uint32_t w);
141 };
143 virtual const CbmTrdParSetAsic* GetAsicPar() const { return &fAsicSet; }
153 virtual std::vector<std::pair<std::string, std::shared_ptr<FairParGenericSet>>>*
154 GetParContainerRequest(std::string geoTag, std::uint32_t runId);
157 void SetMonitor(std::shared_ptr<CbmTrdUnpackFaspMonitor> monitor) { fMonitor = monitor; }
158
160 uint32_t ResetTimeslice();
161
162 protected:
165 bool pushDigis(std::vector<CbmTrdUnpackFaspAlgo::CbmTrdFaspMessage> messages, const uint16_t mod_id);
171 ULong64_t fTime = 0;
172
174 void finish()
175 {
176 if (fMonitor) fMonitor->Finish();
177 }
178
184 virtual Bool_t init() { return kTRUE; }
185
186 // Initialise par set, the base function handles the casting to distribute the pointers to their explicit functions
187
194 Bool_t initParSet(FairParGenericSet* parset);
195
206 bool unpack(const fles::Timeslice* ts, std::uint16_t icomp, UInt_t imslice);
207
211 void FinalizeComponent();
212
213 // Constants
215 static const std::uint8_t fBytesPerWord = 4;
216
217 private:
218 std::map<uint16_t, std::pair<uint16_t, uint16_t>>* fCompMap = nullptr;
219 std::array<std::vector<CbmTrdDigi>, NFASPMOD* NFASPCH> fDigiBuffer = {
220 {}};
222 std::shared_ptr<CbmTrdUnpackFaspMonitor> fMonitor = nullptr;
223 std::vector<uint16_t> fModuleId = {};
227
228 ClassDef(CbmTrdUnpackFaspAlgo, 4) // unpack FASP read-out detectors
229};
230
231#endif // CbmTrdUnpackFaspAlgo_H
Monitor class for the unpacker algorithms (CbmTrdUnpackFasp) of FASP data.
Describe TRD module ASIC settings (electronic gain, delays, etc)
virtual eMessageType getType(uint32_t w) const
Data structure for unpacking the FASP word.
uint8_t elink
optical link for read-out unit (up or down, starting with v2024)
uint8_t tlab
time of the digi inside the epoch
uint8_t type
message type 0 = data, 1 = epoch
uint8_t rob
Read-Out unit id in the module.
virtual eMessageType getType(uint32_t w) const
uint32_t mod
full module address according to CbmTrdAddress
uint32_t epoch
epoch id (not used for the moment)
CbmTrdFaspMessage(const CbmTrdFaspMessage &)=default
std::array< std::vector< CbmTrdDigi >, NFASPMOD *NFASPCH > fDigiBuffer
CbmTrdUnpackFaspAlgo(const CbmTrdUnpackFaspAlgo &)=delete
Copy constructor - not implemented.
uint32_t ResetTimeslice()
Check and assure there are no data left-overs.
virtual std::vector< std::pair< std::string, std::shared_ptr< FairParGenericSet > > > * GetParContainerRequest(std::string geoTag, std::uint32_t runId)
Get the requested parameter containers. Return the required parameter containers together with the pa...
static const std::uint8_t fBytesPerWord
Bytes per FASP frame stored in the microslices (32 bits words)
bool unpack(const fles::Timeslice *ts, std::uint16_t icomp, UInt_t imslice)
Unpack a given microslice.
std::map< uint16_t, std::pair< uint16_t, uint16_t > > * fCompMap
eMessageLength
Bytes per FASP frame stored in the microslices (32 bits words)
@ kMess24
unpacker version for 2-board FASPRO+GETS HW
@ kMessNoDef
unpacker version for 1-board FASPRO HW first used 18.06.24 (mCBM)
eMessageType mess_type(uint32_t wd)
Get message type from the FASP word.
void SetMonitor(std::shared_ptr< CbmTrdUnpackFaspMonitor > monitor)
Set a predefined monitor.
CbmTrdUnpackFaspAlgo()
Create the Cbm Trd Unpack AlgoBase object.
std::vector< uint16_t > fModuleId
CbmTrdFaspMessage * fMess
void finish()
Finish function for this algorithm base clase.
Bool_t initParSet(FairParGenericSet *parset)
Handles the distribution of the hidden derived classes to their explicit functions.
CbmTrdUnpackFaspAlgo & operator=(const CbmTrdUnpackFaspAlgo &)=delete
Assignment operator - not implemented.
void FinalizeComponent()
Finalize component (e.g. copy from temp buffers)
std::shared_ptr< CbmTrdUnpackFaspMonitor > fMonitor
Potential (online) monitor for the unpacking process.
bool pushDigis(std::vector< CbmTrdUnpackFaspAlgo::CbmTrdFaspMessage > messages, const uint16_t mod_id)
virtual const CbmTrdParSetAsic * GetAsicPar() const
CbmTrdParSetDigi * fDigiSet
virtual Bool_t init()
Additional initialisation function for all BaseR derived algorithms.
virtual ~CbmTrdUnpackFaspAlgo()
Destroy the Cbm Trd Unpack Task object.
ULong64_t fTime
Time offset for digi wrt the TS start, expressed in 80 MHz clks. It contains:
#define NFASPCH
#define NFASPMOD
#define NFASPCROB