CbmRoot
Loading...
Searching...
No Matches
CbmTrdUnpackAlgoBaseR.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] */
4
21#ifndef CbmTrdUnpackAlgoBaseR_H
22#define CbmTrdUnpackAlgoBaseR_H
23
25#include "CbmRecoUnpackAlgo.tmpl"
26#include "CbmTrdDigi.h"
27#include "CbmTrdParSetAsic.h"
30#include "CbmTrdSpadic.h"
31#include "CbmTrdUnpackMonitor.h"
32#include "Timeslice.hpp" // timeslice
33
34#include <FairTask.h> // for InitStatus
35
36#include <Rtypes.h> // for types
37#include <RtypesCore.h>
38
39#include <cstddef>
40#include <cstdint>
41#include <memory>
42#include <utility>
43
44class CbmTrdUnpackAlgoBaseR : public CbmRecoUnpackAlgo<CbmTrdDigi, CbmTrdRawMessageSpadic, std::pair<size_t, size_t>> {
45 public:
47 CbmTrdUnpackAlgoBaseR(std::string name);
48
50 virtual ~CbmTrdUnpackAlgoBaseR();
51
54
57
58 // Setters
60 void SetMonitor(std::shared_ptr<CbmTrdUnpackMonitor> monitor) { fMonitor = monitor; }
61
67 void SetRawToDigiMethod(std::shared_ptr<CbmTrdRawToDigiBaseR> value) { fRTDMethod = value; }
68
74 void SetSpadicObject(std::shared_ptr<CbmTrdSpadic> value) { fSpadic = value; }
75
81 void SetElinkTimeOffsetMap(std::map<std::uint32_t, std::vector<std::int32_t>> map) { fElinkTimeOffsetMap = map; }
82
88 std::int32_t GetElinkTimeOffset(std::uint32_t criid, std::uint8_t elinkid)
89 {
90 return (fElinkTimeOffsetMap.find(criid) == fElinkTimeOffsetMap.end() ? 0 : fElinkTimeOffsetMap[criid].at(elinkid));
91 }
92
93 protected:
100 void digestOutput(std::unique_ptr<CbmTrdDigi> digi, CbmTrdRawMessageSpadic raw);
101
103 void finish()
104 {
106 // Finish the monitor if we have one
107 if (fMonitor) fMonitor->Finish();
108 }
109
111 virtual void finishDerived() = 0;
112
121 virtual std::uint32_t getAsicAddress(std::uint32_t criid, std::uint32_t crobid, std::uint32_t elinkid);
122
131 std::uint32_t getChannelId(std::uint32_t asicaddress, std::uint32_t elinkid, std::uint32_t elinkchannelid);
132
138 virtual Bool_t init();
139
140 // Initialise par set, the base function handles the casting to distribute the pointers to their explicit functions
141
148 Bool_t initParSet(FairParGenericSet* parset);
149
159
169
179
180
181 // Monitoring
183 std::shared_ptr<CbmTrdUnpackMonitor> fMonitor = nullptr;
184
185 // Parameter storage members
187 std::shared_ptr<CbmTrdSpadic> fSpadic = nullptr;
188
190 std::shared_ptr<CbmTrdRawToDigiBaseR> fRTDMethod = nullptr;
191
193 std::map<size_t, Int_t> fSpadicAddressMap = {};
194
196 std::map<Int_t, std::vector<Int_t>> fAsicChannelMap = {};
197
199 std::map<size_t, std::vector<Int_t>> fTimeshiftsMap = {};
200
204
206 size_t fNrWildRda = 0;
207
209 size_t fNrWildEom = 0;
210
212 size_t fNrMissingEom = 0;
213
215 size_t fNrWildNul = 0;
216
218 size_t fNrUnknownWords = 0;
219
221 static constexpr std::uint16_t fTsMsbLength = 16000;
222
225
227 std::map<std::uint32_t, std::vector<std::int32_t>> fElinkTimeOffsetMap;
228
229 private:
230 ClassDef(CbmTrdUnpackAlgoBaseR, 2)
231};
232
233#endif // CbmTrdUnpackAlgoBaseR_H
Base class for extracting of information from raw signals to digi level.
Software representation of the SPADIC v2.2+.
Monitor class to monitor the data from the Trd unpacker algorithms.
bool Bool_t
Describe TRD module ASIC settings (electronic gain, delays, etc)
Base class for storing raw information which comes from the Spadic v2.2 trough flib or from a tsa fil...
static Double_t GetClockCycle()
Get the Clock Cycle.
std::shared_ptr< CbmTrdRawToDigiBaseR > fRTDMethod
raw to digi extraction method, set in the task
virtual void finishDerived()=0
Function that allows special calls during Finish in the derived algos.
void SetRawToDigiMethod(std::shared_ptr< CbmTrdRawToDigiBaseR > value)
Set the Raw To Digi Method.
std::map< Int_t, std::vector< Int_t > > fAsicChannelMap
Map to retrieve module channelId from asicAddress and asicChannel.
void SetSpadicObject(std::shared_ptr< CbmTrdSpadic > value)
Set the Spadic Object.
void digestOutput(std::unique_ptr< CbmTrdDigi > digi, CbmTrdRawMessageSpadic raw)
Handle the output created by the explicit algorithms. E.g. write to output vectors.
CbmTrdUnpackAlgoBaseR(const CbmTrdUnpackAlgoBaseR &)=delete
Copy constructor - not implemented.
Bool_t initParSet(FairParGenericSet *parset)
Handles the distribution of the hidden derived classes to their explicit functions.
size_t fNrMissingEom
Number of missing EOM frames to finish a SOM frame.
size_t fTsMsbLengthCC
length of one ts_msb in [cc]
std::shared_ptr< CbmTrdUnpackMonitor > fMonitor
Potential (online) monitor for the unpacking process.
std::shared_ptr< CbmTrdSpadic > fSpadic
Spadic software reprensentation object.
virtual Bool_t init()
Additional initialisation function for all BaseR derived algorithms.
std::map< std::uint32_t, std::vector< std::int32_t > > fElinkTimeOffsetMap
Map to store time offsets for each CRI&Elink combination.
size_t fNrWildRda
Number of rda frames outside of a SOM frame range.
size_t fNrUnknownWords
Number of unknown words.
std::int32_t GetElinkTimeOffset(std::uint32_t criid, std::uint8_t elinkid)
Get the time offeset to be substracted from the digis which come from a specific CRI.
virtual std::uint32_t getAsicAddress(std::uint32_t criid, std::uint32_t crobid, std::uint32_t elinkid)
Get the Asic Address (CbmAddress scheme) for the given hardware Ids.
CbmTrdUnpackAlgoBaseR(std::string name)
Create the Cbm Trd Unpack AlgoBase object.
std::uint32_t getChannelId(std::uint32_t asicaddress, std::uint32_t elinkid, std::uint32_t elinkchannelid)
Get the Channel Id (CbmAddress scheme) for the given hardware Ids.
Bool_t fIsFirstChannelsElinkEven
Define if the first 16 channels (00..15) are found on the even (set true) or odd (false) eLinkId....
virtual ~CbmTrdUnpackAlgoBaseR()
Destroy the Cbm Trd Unpack Task object.
size_t fNrWildEom
Number of eom frames outside of a SOM frame range.
void SetElinkTimeOffsetMap(std::map< std::uint32_t, std::vector< std::int32_t > > map)
Register a time offeset to be substracted from the digis which come from a specific CRI.
void SetMonitor(std::shared_ptr< CbmTrdUnpackMonitor > monitor)
Set a predefined monitor.
size_t fNrWildNul
Number of wild null words, should only appear at the end of a µSlice.
void finish()
Finish function for this algorithm base clase.
static constexpr std::uint16_t fTsMsbLength
length of one ts_msb in [ns]
std::map< size_t, Int_t > fSpadicAddressMap
Map to retrieve asic address from CriId/CrobId/ElinkId (see CbmTrdHardwareSetupR)
std::map< size_t, std::vector< Int_t > > fTimeshiftsMap
Map containing the timeshift parameters for the correction of the µSlice timeshifts....
CbmTrdUnpackAlgoBaseR & operator=(const CbmTrdUnpackAlgoBaseR &)=delete
Assignment operator - not implemented.