CbmRoot
Loading...
Searching...
No Matches
CbmStsUnpackAlgoLegacy.h
Go to the documentation of this file.
1/* Copyright (C) 2019-2021 Fair GmbH, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Pierre-Alain Loizeau, Dominik Smith [committer] */
4
5#ifndef CbmStsUnpackAlgoLegacy_H
6#define CbmStsUnpackAlgoLegacy_H
7
8#include "CbmErrorMessage.h" // REMARK see remark in CbmStsUnpackConfig
10#include "StsXyterFinalHit.h"
11#include "StsXyterMessage.h"
12
13// CbmRoot
14
15// C++11
16#include <chrono>
17
18// C/C++
19#include <map>
20#include <vector>
21
24
26 public:
29
32
35
36 virtual bool init();
37 virtual void reset();
38
39 bool InitParameters();
40
41 //virtual bool Unpack(const fles::Timeslice& ts, const uint32_t uMsComp);
42
43 inline void SetTimeOffsetNs(double dOffsetIn = 0.0) { fdTimeOffsetNs = dOffsetIn; }
44 virtual void MaskNoisyChannel(const uint32_t uFeb, const uint32_t uChan, const bool bMasked = true);
45
46 protected:
58 bool unpack(const fles::Timeslice* ts, std::uint16_t icomp, UInt_t imslice);
59
60 private:
62 std::vector<bool> fvbMaskedComponents;
63
67 uint32_t fuNbFebs;
68 std::map<uint32_t, uint32_t> fDpbIdIndexMap;
69 void InitDpbIdIndexMap();
70
71 std::vector<std::vector<std::vector<int32_t>>>
73 std::vector<bool> fvbFebPulser;
74 std::vector<int32_t> fviFebAddress;
75 std::vector<int32_t> fviFebSide;
76 std::vector<double> fvdFebAdcGain;
77 std::vector<double> fvdFebAdcOffs;
78
85 bool initParSet(FairParGenericSet* parset);
86
93 bool initParSet(CbmMcbm2018StsPar* parset);
94
95 void InitInternalStatus();
96 void InitTempVectors(std::vector<int32_t>* viModuleType, std::vector<int32_t>* viModAddress,
97 std::vector<std::vector<std::vector<int32_t>>>* viFebModuleIdx,
98 std::vector<std::vector<bool>>* vbCrobActiveFlag,
99 std::vector<std::vector<std::vector<int32_t>>>* viFebModuleSide);
100
101 void PrintActiveCrobs(const std::vector<std::vector<bool>>& vbCrobActiveFlag);
102 void PrintAddressMaps(const std::vector<std::vector<std::vector<int32_t>>>& viFebModuleIdx,
103 const std::vector<std::vector<std::vector<int32_t>>>& viFebModuleSide);
104
106 void AddHitsToDigiVect(std::vector<stsxyter::FinalHit>* vmHitsIn, std::vector<CbmStsDigi>* vDigiVectOut);
107
109 uint64_t GetFullTimeStamp(const uint16_t usRawTs);
110
114 std::vector<std::vector<bool>>
116
120
122 uint32_t fuCurrDpbIdx;
124 std::vector<uint64_t> fvulCurrentTsMsb;
125 std::vector<uint32_t> fvuCurrentTsMsbCycle;
127 double fdStartTime;
129 std::chrono::steady_clock::time_point
133 std::vector<stsxyter::FinalHit>
135
137 static const uint32_t kuMaxTsMsbDiffDuplicates = 8;
138 std::vector<std::vector<uint16_t>> fvvusLastTsChan;
139 std::vector<std::vector<uint16_t>>
141 std::vector<std::vector<uint32_t>>
143 std::vector<std::vector<uint16_t>>
145
146 void ProcessHitInfo(const stsxyter::Message& mess);
147 void ProcessTsMsbInfo(const stsxyter::Message& mess, uint32_t uMessIdx = 0, uint32_t uMsIdx = 0);
148 void ProcessEpochInfo(const stsxyter::Message& mess);
149 void ProcessStatusInfo(const stsxyter::Message& mess, uint32_t uIdx);
150 void ProcessErrorInfo(const stsxyter::Message& mess);
151
152 void RefreshTsMsbFields(const size_t uMsIdx);
153 void LoopMsMessages(const uint8_t* msContent, const uint32_t uSize, const size_t uMsIdx);
154
155 ClassDef(CbmStsUnpackAlgoLegacy, 1)
156};
157
158#endif
Baseclass for the Sts unpacker algorithms.
uint64_t GetFullTimeStamp(const uint16_t usRawTs)
Get full time stamp from raw time stamp.
std::vector< double > fvdFebAdcGain
Module side for each FEB, [ NbDpb * NbCrobPerDpb * NbFebsPerCrob ].
void PrintAddressMaps(const std::vector< std::vector< std::vector< int32_t > > > &viFebModuleIdx, const std::vector< std::vector< std::vector< int32_t > > > &viFebModuleSide)
void ProcessEpochInfo(const stsxyter::Message &mess)
void ProcessErrorInfo(const stsxyter::Message &mess)
void InitTempVectors(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)
std::vector< uint64_t > fvulCurrentTsMsb
std::map< uint32_t, uint32_t > fDpbIdIndexMap
Number of FEBs with StsXyter ASICs.
std::vector< stsxyter::FinalHit > fvmHitsInMs
Hits time-sorting.
CbmMcbm2018StsPar * fUnpackPar
Settings from parameter file.
bool initParSet(FairParGenericSet *parset)
ADC offset in e-, [ NbDpb * NbCrobPerDpb * NbFebsPerCrob ].
void InitDpbIdIndexMap()
Map of DPB Identifier to DPB index.
CbmStsUnpackAlgoLegacy(const CbmStsUnpackAlgoLegacy &)=delete
Copy constructor - not implemented.
std::vector< bool > fvbMaskedComponents
Control flags.
std::vector< std::vector< uint16_t > > fvvusLastTsChan
std::vector< std::vector< bool > > fvvbMaskedChannels
uint32_t fuCurrDpbIdx
Current data properties.
CbmStsUnpackAlgoLegacy & operator=(const CbmStsUnpackAlgoLegacy &)=delete
Assignment operator - not implemented.
void RefreshTsMsbFields(const size_t uMsIdx)
std::vector< int32_t > fviFebSide
STS address for each FEB, [ NbDpb * NbCrobPerDpb * NbFebsPerCrob ].
virtual void MaskNoisyChannel(const uint32_t uFeb, const uint32_t uChan, const bool bMasked=true)
Mask a Noisy Channel.
void SetTimeOffsetNs(double dOffsetIn=0.0)
void PrintActiveCrobs(const std::vector< std::vector< bool > > &vbCrobActiveFlag)
void ProcessStatusInfo(const stsxyter::Message &mess, uint32_t uIdx)
std::chrono::steady_clock::time_point ftStartTimeUnix
void ProcessHitInfo(const stsxyter::Message &mess)
TS MSB cycle of last hit message for each channel, [ AsicIdx ][ Chan ].
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.
std::vector< std::vector< std::vector< int32_t > > > fviFebType
std::vector< std::vector< uint32_t > > fvvuLastTsMsbChan
ADC of last hit message for each channel, [ AsicIdx ][ Chan ].
void ProcessTsMsbInfo(const stsxyter::Message &mess, uint32_t uMessIdx=0, uint32_t uMsIdx=0)
void AddHitsToDigiVect(std::vector< stsxyter::FinalHit > *vmHitsIn, std::vector< CbmStsDigi > *vDigiVectOut)
Add the hits to the output buffer as Digis.
void LoopMsMessages(const uint8_t *msContent, const uint32_t uSize, const size_t uMsIdx)
uint64_t fulCurrentMsIdx
Vector of channel masks, [ NbFeb ][ NbCHanInFeb ], used only if fbUseChannelMask is true.
std::vector< double > fvdFebAdcOffs
ADC gain in e-/b, [ NbDpb * NbCrobPerDpb * NbFebsPerCrob ].
double fdTimeOffsetNs
User settings: Data correction parameters.
std::vector< uint32_t > fvuCurrentTsMsbCycle
Current TS MSB for each DPB.
std::vector< std::vector< uint16_t > > fvvusLastTsMsbCycleChan
TS MSB of last hit message for each channel, [ AsicIdx ][ Chan ].
std::vector< int32_t > fviFebAddress
Pulser flag for each FEB, [ NbDpb * NbCrobPerDpb * NbFebsPerCrob ].
std::vector< std::vector< uint16_t > > fvvusLastAdcChan
TS of last hit message for each channel, [ AsicIdx ][ Chan ].
std::vector< bool > fvbFebPulser
FEB type, [ NbDpb ][ NbCrobPerDpb ][ NbFebsPerCrob ], 0 = A, 1 = B, -1 if inactive.
static const uint32_t kuMaxTsMsbDiffDuplicates
All hits (time in bins, ADC in bins, asic, channel) in last MS, sorted with "<" operator.