CbmRoot
Loading...
Searching...
No Matches
CbmMcbm2018UnpackerAlgoTrdR.h
Go to the documentation of this file.
1/* Copyright (C) 2020-2021 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Dennis Spicker, Florian Uhlig [committer], Pascal Raisig */
4
11#ifndef CbmMcbm2018UnpackerAlgoTrdR_H
12#define CbmMcbm2018UnpackerAlgoTrdR_H
13
14#include "CbmStar2019Algo.h"
15#include "CbmTrdDigi.h"
16#include "CbmTrdParSetAsic.h"
17#include "CbmTrdParSetDigi.h"
18#include "CbmTrdParSetGain.h"
19#include "CbmTrdParSetGas.h"
21
22#include "TH1.h"
23#include "TH2.h"
24#include "TObjArray.h"
25#include "TProfile.h"
26#include "TString.h"
27
34class CbmMcbm2018UnpackerAlgoTrdR : public CbmStar2019Algo<CbmTrdDigi> {
35public:
40
45
46 virtual Bool_t Init();
47 virtual void Reset();
48 virtual void Finish();
49
50 Bool_t InitContainers();
51 Bool_t ReInitContainers();
52 TList* GetParList();
53
54 Bool_t InitParameters();
55
56 Bool_t ProcessTs(const fles::Timeslice& ts);
57 Bool_t ProcessTs(const fles::Timeslice& ts, size_t /*component*/) { return ProcessTs(ts); }
58
66 Bool_t ProcessMs(const fles::Timeslice& ts, size_t uMsCompIdx, size_t uMsIdx);
67
68 void AddMsComponentToList(size_t component, UShort_t usDetectorId);
69 void SetNbMsInTs(size_t uCoreMsNb, size_t uOverlapMsNb);
70
99 void SetActiveHistograms(std::vector<bool> isActiveHistoVec) { fIsActiveHistoVec = isActiveHistoVec; }
100 Bool_t CreateHistograms();
102
103 Bool_t FillHistograms();
104 Bool_t FillHistograms(CbmTrdDigi const& digi);
105 Bool_t FillHistograms(CbmTrdRawMessageSpadic const& raw);
106 Bool_t ResetHistograms();
107
108
109 std::vector<CbmTrdRawMessageSpadic> GetRawMessageVector() { return *(fTrdRawMessageVector); }
110 TString GetRefGeoTag() { return fRefGeoTag; }
111
112 void SetMonitorMode(Bool_t bFlagIn = kTRUE) { fbMonitorMode = bFlagIn; }
113 void SetDebugMonitorMode(Bool_t bFlagIn = kTRUE) { fbDebugMonitorMode = bFlagIn; }
114 void SetWriteOutput(Bool_t bFlagIn = kTRUE) { fbWriteOutput = bFlagIn; }
115 void SetDebugWriteOutput(Bool_t bFlagIn = kTRUE) { fbDebugWriteOutput = bFlagIn; }
116 void SetDebugSortOutput(Bool_t bFlagIn = kTRUE) { fbDebugSortOutput = bFlagIn; }
117 inline void SetTimeOffsetNs(Double_t dOffsetIn = 0.0) { fdTimeOffsetNs = dOffsetIn; }
118
119 void SetTimeshiftsMap(std::map<size_t, std::vector<Int_t>>* setvalue)
120 {
121 fmapTimeshifts.clear();
122 fmapTimeshifts.insert(setvalue->begin(), setvalue->end());
123 }
125
129 void SetBaselineAvg(Bool_t bFlagIn = kTRUE) { fbBaselineAvg = bFlagIn; }
130
136 Bool_t SetDigiOutputPointer(std::vector<CbmTrdDigi>* const pVector);
137
143 Bool_t SetRawOutputPointer(std::vector<CbmTrdRawMessageSpadic>* const pVector,
144 std::vector<std::pair<size_t, size_t>>* const qVector = nullptr);
145
146 void SetRefGeoTag(TString geoTag) { fRefGeoTag = geoTag; }
148 void SetMsSizeInNs(Double_t msSizeInNs) { fdMsSizeInNs = msSizeInNs; } // TODO handle this with asic parameter files
149
150private:
152 std::shared_ptr<CbmTrdDigi> MakeDigi(CbmTrdRawMessageSpadic raw);
153
155 Spadic::MsMessageType GetMessageType(const uint64_t msg);
156
158 Spadic::MsInfoType GetInfoType(const uint64_t msg);
159
160 CbmTrdRawMessageSpadic CreateRawMessage(const uint64_t word, fles::MicrosliceDescriptor msDesc);
161
163 Int_t GetNumRda(Int_t nsamples);
164
171 int16_t ExtractSample(const uint64_t word, uint8_t sample, Bool_t multihit = kFALSE);
172
173 // Control flags
178 Bool_t fbDebugSortOutput = kTRUE;
180
182 Double_t fdTimeOffsetNs = 0.0;
183
185 std::vector<CbmTrdDigi>* fTrdDigiVector;
186
188 std::vector<CbmTrdRawMessageSpadic>* fTrdRawMessageVector;
189
191 std::vector<std::pair<size_t, size_t>>* fSpadicInfoMsgVector;
192
193 //std::map< TString, std::shared_ptr<TH1> > fHistoMap ;
194
196 std::vector<bool> fIsActiveHistoVec;
197 TObjArray fHistoArray;
198 std::vector<size_t> fLastDigiTimeVec;
199
206 //CbmTrdRawToDigiR *fRawToDigi ;
207
209 ULong64_t fNbTimeslices;
210 ULong64_t fCurrTsIdx;
211 UInt_t fMsIndex;
212 Double_t fTsStartTime;
214 Double_t fMsTime;
215 ULong64_t fSpadicEpoch;
216
217 ULong64_t fLastFulltime;
218
220 ULong64_t fNbSpadicRawMsg;
221 ULong64_t fNbWildRda;
223 ULong64_t fNbUnkownWord;
225
228 TString fRefGeoTag;
233
234 std::map<size_t, Int_t> fSpadicMap;
236
237 std::map<Int_t, std::vector<Int_t>> fAsicChannelMap;
239
240 std::map<size_t, std::vector<Int_t>> fmapTimeshifts = {};
242
243 std::vector<Int_t>* fvecTimeshiftsPar = nullptr;
245
246 bool
248
250 static const UInt_t kBytesPerWord = 8;
251
252 ClassDef(CbmMcbm2018UnpackerAlgoTrdR, 1)
253};
254
255#endif
Timeslice unpacker algorithm for Spadic v.2.2 .
ULong64_t fNbSpadicErrorMsg
Number of Spadic error Messages.
ULong64_t fNbUnkownWord
Number of unknown data words in the Microslice stream.
void SetActiveHistograms(std::vector< bool > isActiveHistoVec)
std::map< Int_t, std::vector< Int_t > > fAsicChannelMap
Map to retrieve module channelId from asicAddress and asicChannel.
CbmTrdParSetDigi * fDigiPar
CbmTrdParameter container.
Bool_t ProcessTs(const fles::Timeslice &ts)
void SetDebugSortOutput(Bool_t bFlagIn=kTRUE)
void SetTimeOffsetNs(Double_t dOffsetIn=0.0)
std::vector< bool > fIsActiveHistoVec
Stores all Histograms.
Double_t fTsStartTime
Time in ns of current TS from the index of the first MS first componen.
bool fIsFirstChannelsElinkEven
define if the first 16 channels (00..15) are found on the even (set true) or odd (false) eLinkId,...
std::map< size_t, Int_t > fSpadicMap
Map to retrieve asic address from CriId/CrobId/ElinkId (see CbmTrdHardwareSetupR)
Spadic::MsMessageType GetMessageType(const uint64_t msg)
Bool_t CreateHistograms()
Goes through fIsActiveHistoVec and creates the activated histograms.
CbmMcbm2018UnpackerAlgoTrdR & operator=(const CbmMcbm2018UnpackerAlgoTrdR &)=delete
Copy assignment operator - not implemented.
Bool_t fbBaselineAvg
Set to true if Baseline Averaging is activated in Spadic.
Bool_t ProcessMs(const fles::Timeslice &ts, size_t uMsCompIdx, size_t uMsIdx)
Unpacks one Microslice.
Bool_t fbMonitorMode
Switch ON the filling of a minimal set of histograms.
void AddMsComponentToList(size_t component, UShort_t usDetectorId)
CbmTrdParSetGain * fGainPar
CbmTrdParameter container.
Bool_t ProcessTs(const fles::Timeslice &ts, size_t)
int16_t ExtractSample(const uint64_t word, uint8_t sample, Bool_t multihit=kFALSE)
Extract a Sample from a given SOM or RDA word.
void SetMonitorMode(Bool_t bFlagIn=kTRUE)
void SetMsSizeInNs(Double_t msSizeInNs)
ULong64_t fNbWildRda
Number of RDA Words outside of a Message.
void SetTimeshiftsMap(std::map< size_t, std::vector< Int_t > > *setvalue)
In the mCbm 2020 beamtime timeshifts changing during the run of the correlation time to the Bmon have...
CbmTrdRawMessageSpadic CreateRawMessage(const uint64_t word, fles::MicrosliceDescriptor msDesc)
Bool_t SetDigiOutputPointer(std::vector< CbmTrdDigi > *const pVector)
Set fTrdDigiVector to the address of pVector.
std::vector< CbmTrdRawMessageSpadic > * fTrdRawMessageVector
Output Spadic raw messages for debugging.
Bool_t fbDebugWriteOutput
If ON the raw messages output vector is filled and written to disk.
ULong64_t fNbTimeslices
Instance of RawToDigi class.
Double_t fTsStopTimeCore
End Time in ns of current TS Core from the index of the first MS first componen.
std::vector< CbmTrdRawMessageSpadic > GetRawMessageVector()
ULong64_t fNbSpadicEpochMsg
Number of Spadic Epoch Messages.
Spadic::MsInfoType GetInfoType(const uint64_t msg)
Bool_t fbDebugSortOutput
If ON the raw messages output vector is sorted within time.
void SetBaselineAvg(Bool_t bFlagIn=kTRUE)
Call this when Spadic Average-Baseline feature is enabled.
std::map< size_t, std::vector< Int_t > > fmapTimeshifts
Map containing the timeshift parameters for the correction of the µSlice timeshifts....
Double_t fdTimeOffsetNs
User settings: Data correction parameters.
ULong64_t fCurrTsIdx
Index of current Timeslice.
CbmMcbm2018UnpackerAlgoTrdR(const CbmMcbm2018UnpackerAlgoTrdR &)=delete
Copy constructor - not implemented.
CbmTrdParSetAsic * fAsicPar
CbmTrdParameter container.
std::vector< std::pair< size_t, size_t > > * fSpadicInfoMsgVector
vector< pair< fulltime, word > >
std::shared_ptr< CbmTrdDigi > MakeDigi(CbmTrdRawMessageSpadic raw)
std::vector< CbmTrdDigi > * fTrdDigiVector
Output Digi vector.
void SetWriteOutput(Bool_t bFlagIn=kTRUE)
void SetNbMsInTs(size_t uCoreMsNb, size_t uOverlapMsNb)
CbmTrdParSetGas * fGasPar
CbmTrdParameter container.
Bool_t SetRawOutputPointer(std::vector< CbmTrdRawMessageSpadic > *const pVector, std::vector< std::pair< size_t, size_t > > *const qVector=nullptr)
Set fTrdRawMessageVector to the address of pVector.
ULong64_t fSpadicEpoch
Epoch counter (30 bits). Counts overflow of Spadic timestamp (11 bits).
TString fRefGeoTag
Naming tag for the reference geometry, parameters are loaded according to this tag.
Bool_t fbDebugMonitorMode
Switch ON the filling of a additional set of histograms.
std::vector< Int_t > * fvecTimeshiftsPar
Vector containing the timeshift parameters for the correction of the µSlice timeshifts for a given ts...
static const UInt_t kBytesPerWord
Constants.
Bool_t CreateHistogram(ECbmTrdUnpackerHistograms iHisto)
create the histogram correlated to iHisto
Bool_t fbWriteOutput
If ON the output Vector of digis is written to disk.
UInt_t fMsIndex
Index of current MS within the TS.
TList * fParContList
Parameters and Address mapping.
Double_t fMsTime
Start Time in ns of current MS from its index field in header.
void SetDebugMonitorMode(Bool_t bFlagIn=kTRUE)
void SetDebugWriteOutput(Bool_t bFlagIn=kTRUE)
Describe TRD module ASIC settings (electronic gain, delays, etc)
Describe TRD module working settings (HV, etc)
Base class for storing raw information which comes from the Spadic v2.2 trough flib or from a tsa fil...