10#include "MicrosliceDescriptor.hpp"
11#include "Timeslice.hpp"
81 return (numErrors > 0 ?
true :
false);
109 template<u
int8_t sys_ver>
127 Result_t operator()(
const uint8_t* msContent,
const fles::MicrosliceDescriptor& msDescr,
128 const uint64_t tTimeslice)
const override;
183 std::int16_t
extractSample(
size_t* adcbuffer,
size_t* nadcbits)
const;
218 std::uint16_t elinkId, std::uint8_t istream,
MsContext& ctx)
const;
251 std::float_t
GetMaxAdcValue(
const std::vector<std::int16_t>* samples)
const;
259 float_t
GetBaseline(
const std::vector<std::int16_t>* samples)
const;
Base class for storing raw information which comes from the Spadic v2.2 trough flib or from a tsa fil...
std::tuple< std::vector< Digi_t >, Monitor_t, Aux_t > Result_t
static constexpr std::uint16_t fTsMsbLength
length of one ts_msb in [ns]
float_t GetBaseline(const std::vector< std::int16_t > *samples) const
Get the Baseline value The digi charge is an unsigned. Hence, we need to get the baseline to 0.
Spadic::MsMessageType getMessageType(const std::uint32_t frame) const
Identify the message type of a given 32bit frame inside a Microslice.
CbmTrdDigi makeDigi(CbmTrdRawMessageSpadic raw, MsContext &ctx) const
Create an actual digi from the raw message.
Spadic::MsInfoType getInfoType(const std::uint32_t frame) const
Identify the InfoType of a 64bit InfoMessage word inside a Microslice.
std::float_t GetMaxAdcValue(const std::vector< std::int16_t > *samples) const
Get the MaxAdc value.
std::int16_t extractSample(size_t *adcbuffer, size_t *nadcbits) const
Extract one adc sample from a given adcbuffer.
static constexpr std::uint8_t fStreamsPerWord
Number of streams per word.
static constexpr size_t fTsMsbLengthCC
length of one ts_msb in [cc]
CbmTrdRawMessageSpadic makeRaw(const std::uint32_t frame, std::uint16_t criId, std::uint8_t crobId, std::uint16_t elinkId, std::uint8_t istream, MsContext &ctx) const
Create a CbmTrdRawMessageSpadic from the hit message input.
Spadic::MsInfoType digestBufInfoFlags(const std::uint32_t frame) const
Digest the aditional flags stored in the 4 "cccc" bits of the EPO messages.
static CbmTrdDigi::eTriggerType GetDigiTriggerType(Spadic::eTriggerType tt)
Get the Digi Trigger Type from the raw message triggertype.
~UnpackMS() override=default
Destructor.
static constexpr size_t fPeakingBinMax
Last sample to look for the max adc Default value is set based on the Shaping time + 5 samples safety...
void SetParams(std::unique_ptr< UnpackPar > params)
Set the parameter container.
uint64_t GetBinTimeShift(const std::vector< std::int16_t > *) const
Get the Bin Time Shift value.
static constexpr size_t fPeakingBinMin
First sample to look for the max adc.
static constexpr size_t fNrOfPresamples
Number of samples not considered for max adc.
static constexpr float_t fAsicClockCycle
Clock length of Spadic in ns.
void digestInfoMsg(const std::uint32_t frame) const
Digest a info message run all default information forwarding from the msg.
std::float_t extractAvgSample(size_t *adcbuffer, size_t *nadcbits) const
Extract the baseline average sample from a given adcbuffer. Depending on the Spadic settings sample-0...
Result_t operator()(const uint8_t *msContent, const fles::MicrosliceDescriptor &msDescr, const uint64_t tTimeslice) const override
Algorithm execution.
UnpackPar fParams
Parameter container.
UnpackMS(const UnpackPar &pars)
Construct from parameters.
std::uint8_t getTsMsb(const std::uint32_t frame, UnpackMonitorData &monitor) const
Get the ts_msb information from the TS_MSB(kEPO) frame. We take the first of the 3 The 3 redundant TS...
static constexpr std::uint8_t fBytesPerWord
Bytes per spadic frame stored in the microslices.
void digestMsFlags(const std::uint16_t flags, UnpackMonitorData &monitor) const
Digest the flags of the currently unpacked µSlice.
void digestOutput(std::unique_ptr< CbmTrdDigi > digi, CbmTrdRawMessageSpadic raw)
Handle the output created by the explicit algorithms. E.g. write to output vectors.
TRD Unpacking parameters for one CROB.
std::vector< UnpackElinkPar > fElinkParams
Parameters for each eLink.
TRD Unpacking parameters for one eLink.
std::vector< uint32_t > fChanAddress
CbmTrdAddress for different channels.
uint32_t fAddress
Asic address.
uint64_t fTimeOffset
Time calibration parameter.
std::vector< std::uint8_t > fNrTsMsbVec
Counter for the ts_msb used to reconstruct the time.
size_t fLastFulltime
Time of the last succesful digest hit message.
size_t fMsStartTimeRelCC
Start time of the current µSlice relative to the Timeslice start time in Spadic CC.
Monitoring data for TRD unpacking.
size_t fNumOverflowFlimFlags
counter for inf/error flags from the µSlices
size_t fNumUnknownWords
Number of unknown words.
size_t fNumCrcValidFlags
counter for inf/error flags from the µSlices
size_t fNumCreatedRawMsgs
counter of created raw messages
size_t fNumWildEom
Number of eom frames outside of a SOM frame range.
size_t fNumNonMajorTsMsb
Counter for the ts_msb used to reconstruct the time.
size_t fNumWildRda
Number of rda frames outside of a SOM frame range.
size_t fNumOverflowUserFlags
counter for inf/error flags from the µSlices
size_t fNumCorruptEom
Number of corrupted EOM frames.
size_t fNumDataErrorFlags
counter for inf/error flags from the µSlices
size_t fNumElinkMis
Number of SOM to RDA/EOM mismatches.
size_t fNumMissingEom
Number of missing EOM frames to finish a SOM frame.
size_t fNumEpochMsgs
counter of created raw messages
size_t fNumWildNul
Number of wild null words, should only appear at the end of a µSlice.
size_t fNumCreatedInfoMsgs
counter of created info messages
Parameters required for the TRD unpacking (specific to one component)
float_t fMaxAdcToEnergyCal
max adc to energy in keV
std::vector< UnpackCrobPar > fCrobParams
Parameters for each CROB.
uint32_t fNumAsicsPerModule
Number of ASICS per module.
uint32_t fNumChansPerAsic
Number of channels per ASIC.
bool fUseBaselineAvg
Is baseline average function of Spadic activated.