CbmRoot
Loading...
Searching...
No Matches
cbm::algo::trd::UnpackMS< sys_ver > Class Template Reference

#include <UnpackMS.h>

Inheritance diagram for cbm::algo::trd::UnpackMS< sys_ver >:
[legend]
Collaboration diagram for cbm::algo::trd::UnpackMS< sys_ver >:
[legend]

Classes

struct  MsContext
 

Public Types

using Digi_t
 
using Monitor_t
 
using Aux_t
 
using Result_t
 

Public Member Functions

 UnpackMS (const UnpackPar &pars)
 Construct from parameters.
 
 ~UnpackMS () override=default
 Destructor.
 
Result_t operator() (const uint8_t *msContent, const fles::MicrosliceDescriptor &msDescr, const uint64_t tTimeslice) const override
 Algorithm execution.
 
void SetParams (std::unique_ptr< UnpackPar > params)
 Set the parameter container.
 
UnpackMS< 0x01 >::Result_t operator() (const uint8_t *msContent, const fles::MicrosliceDescriptor &msDescr, const uint64_t tTimeslice) const
 

Private Member Functions

void digestOutput (std::unique_ptr< CbmTrdDigi > digi, CbmTrdRawMessageSpadic raw)
 Handle the output created by the explicit algorithms. E.g. write to output vectors.
 
Spadic::MsInfoType digestBufInfoFlags (const std::uint32_t frame) const
 Digest the aditional flags stored in the 4 "cccc" bits of the EPO messages.
 
void digestMsFlags (const std::uint16_t flags, UnpackMonitorData &monitor) const
 Digest the flags of the currently unpacked µSlice.
 
void digestInfoMsg (const std::uint32_t frame) const
 Digest a info message run all default information forwarding from the msg.
 
std::int16_t extractSample (size_t *adcbuffer, size_t *nadcbits) const
 Extract one adc sample from a given adcbuffer.
 
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 is a plain sample or the averaged baseline calculation. The latter is not a 9 bit signed integer, but a 9 bit floating point number 7 digits before the point and 2 afterwards.
 
Spadic::MsInfoType getInfoType (const std::uint32_t frame) const
 Identify the InfoType of a 64bit InfoMessage word inside a Microslice.
 
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_MSB sets are already compared at the FPGA level.
 
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.
 
CbmTrdDigi makeDigi (CbmTrdRawMessageSpadic raw, MsContext &ctx) const
 Create an actual digi from the raw message.
 
CbmTrdDigi makeDigi (Spadic::FexWord< sys_ver > fw, size_t fMsStartTimeRel) const
 Create an actual digi from the fex message.
 
uint64_t GetBinTimeShift (const std::vector< std::int16_t > *) const
 Get the Bin Time Shift value.
 
std::float_t GetMaxAdcValue (const std::vector< std::int16_t > *samples) const
 Get the MaxAdc value.
 
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 (Spadic::FexWord< 0x10 > fw, size_t fMsStartTimeRel) const
 

Static Private Member Functions

static CbmTrdDigi::eTriggerType GetDigiTriggerType (Spadic::eTriggerType tt)
 Get the Digi Trigger Type from the raw message triggertype.
 

Private Attributes

UnpackPar fParams = {}
 Parameter container.
 

Static Private Attributes

static constexpr std::uint8_t fBytesPerWord = 8
 Bytes per spadic frame stored in the microslices.
 
static constexpr std::uint8_t fStreamsPerWord = 2
 Number of streams per word.
 
static constexpr size_t fNrOfPresamples = 1
 Number of samples not considered for max adc.
 
static constexpr float_t fAsicClockCycle = 62.5
 Clock length of Spadic in ns.
 
static constexpr std::uint16_t fTsMsbLength = 16000
 length of one ts_msb in [ns]
 
static constexpr size_t fTsMsbLengthCC = fTsMsbLength / fAsicClockCycle
 length of one ts_msb in [cc]
 
static constexpr size_t fPeakingBinMin = fNrOfPresamples
 First sample to look for the max adc.
 
static constexpr size_t fPeakingBinMax = static_cast<size_t>(120.0 / fAsicClockCycle + fNrOfPresamples + 5)
 Last sample to look for the max adc Default value is set based on the Shaping time + 5 samples safety margin.
 

Detailed Description

template<uint8_t sys_ver>
class cbm::algo::trd::UnpackMS< sys_ver >

Definition at line 110 of file trd/UnpackMS.h.

Member Typedef Documentation

◆ Aux_t

Definition at line 23 of file UnpackMSBase.h.

◆ Digi_t

Definition at line 21 of file UnpackMSBase.h.

◆ Monitor_t

Definition at line 22 of file UnpackMSBase.h.

◆ Result_t

Definition at line 25 of file UnpackMSBase.h.

Constructor & Destructor Documentation

◆ UnpackMS()

template<uint8_t sys_ver>
cbm::algo::trd::UnpackMS< sys_ver >::UnpackMS ( const UnpackPar & pars)
inline

Construct from parameters.

Definition at line 114 of file trd/UnpackMS.h.

◆ ~UnpackMS()

template<uint8_t sys_ver>
cbm::algo::trd::UnpackMS< sys_ver >::~UnpackMS ( )
overridedefault

Destructor.

Member Function Documentation

◆ digestBufInfoFlags()

template<uint8_t sys_ver>
template Spadic::MsInfoType cbm::algo::trd::UnpackMS< sys_ver >::digestBufInfoFlags ( const std::uint32_t frame) const
private

Digest the aditional flags stored in the 4 "cccc" bits of the EPO messages.

Parameters
frame
Returns
Spadic::MsInfoType

Definition at line 20 of file trd/UnpackMS.cxx.

References Spadic::kChannelBuf, Spadic::kChannelBufM, and Spadic::kOrdFifoBuf.

◆ digestInfoMsg()

template<uint8_t sys_ver>
template void cbm::algo::trd::UnpackMS< sys_ver >::digestInfoMsg ( const std::uint32_t frame) const
private

Digest a info message run all default information forwarding from the msg.

Parameters
frame

Save info message if needed.

Definition at line 34 of file trd/UnpackMS.cxx.

◆ digestMsFlags()

template<uint8_t sys_ver>
template void cbm::algo::trd::UnpackMS< sys_ver >::digestMsFlags ( const std::uint16_t flags,
UnpackMonitorData & monitor ) const
private

Digest the flags of the currently unpacked µSlice.

Parameters
flagsflags stored in the µSlice descriptor
storageof monitoring data

Definition at line 46 of file trd/UnpackMS.cxx.

References cbm::algo::trd::UnpackMonitorData::fNumCrcValidFlags, cbm::algo::trd::UnpackMonitorData::fNumDataErrorFlags, cbm::algo::trd::UnpackMonitorData::fNumOverflowFlimFlags, and cbm::algo::trd::UnpackMonitorData::fNumOverflowUserFlags.

◆ digestOutput()

template<uint8_t sys_ver>
void cbm::algo::trd::UnpackMS< sys_ver >::digestOutput ( std::unique_ptr< CbmTrdDigi > digi,
CbmTrdRawMessageSpadic raw )
private

Handle the output created by the explicit algorithms. E.g. write to output vectors.

Parameters
digi
raw

◆ extractAvgSample()

template<uint8_t sys_ver>
template std::float_t cbm::algo::trd::UnpackMS< sys_ver >::extractAvgSample ( size_t * adcbuffer,
size_t * nadcbits ) const
private

Extract the baseline average sample from a given adcbuffer. Depending on the Spadic settings sample-0 is a plain sample or the averaged baseline calculation. The latter is not a 9 bit signed integer, but a 9 bit floating point number 7 digits before the point and 2 afterwards.

Parameters
[in]adcbuffer
[in,out]nadcbits
Returns
std::float_t

Definition at line 67 of file trd/UnpackMS.cxx.

◆ extractSample()

template<uint8_t sys_ver>
template std::int16_t cbm::algo::trd::UnpackMS< sys_ver >::extractSample ( size_t * adcbuffer,
size_t * nadcbits ) const
private

Extract one adc sample from a given adcbuffer.

Parameters
[in]adcbuffer
[in,out]nadcbits
Returns
std::int16_t

Definition at line 97 of file trd/UnpackMS.cxx.

◆ GetBaseline()

template<uint8_t sys_ver>
template float_t cbm::algo::trd::UnpackMS< sys_ver >::GetBaseline ( const std::vector< std::int16_t > * samples) const
private

Get the Baseline value The digi charge is an unsigned. Hence, we need to get the baseline to 0.

Parameters
samples
Returns
float_t

Definition at line 397 of file trd/UnpackMS.cxx.

◆ GetBinTimeShift()

template<uint8_t sys_ver>
uint64_t cbm::algo::trd::UnpackMS< sys_ver >::GetBinTimeShift ( const std::vector< std::int16_t > * ) const
inlineprivate

Get the Bin Time Shift value.

Parameters
samples
Returns
ULong64_t

Definition at line 244 of file trd/UnpackMS.h.

◆ GetDigiTriggerType()

template<uint8_t sys_ver>
template CbmTrdDigi::eTriggerType cbm::algo::trd::UnpackMS< sys_ver >::GetDigiTriggerType ( Spadic::eTriggerType tt)
staticprivate

Get the Digi Trigger Type from the raw message triggertype.

Parameters
tt
Returns
CbmTrdDigi::eTriggerType

Definition at line 348 of file trd/UnpackMS.cxx.

References Spadic::kGlobal, Spadic::kNeigh, CbmTrdDigi::kNeighbor, CbmTrdDigi::kNTrg, Spadic::kSandN, CbmTrdDigi::kSelf, and Spadic::kSelf.

◆ getInfoType()

template<uint8_t sys_ver>
template Spadic::MsInfoType cbm::algo::trd::UnpackMS< sys_ver >::getInfoType ( const std::uint32_t frame) const
private

Identify the InfoType of a 64bit InfoMessage word inside a Microslice.

Definition at line 121 of file trd/UnpackMS.cxx.

References Spadic::kBOM, Spadic::kBUF, Spadic::kMIS, Spadic::kMSB, Spadic::kUNU, and L_.

◆ GetMaxAdcValue()

template<uint8_t sys_ver>
template float_t cbm::algo::trd::UnpackMS< sys_ver >::GetMaxAdcValue ( const std::vector< std::int16_t > * samples) const
private

Get the MaxAdc value.

Parameters
samples
Returns
Float_t

Definition at line 367 of file trd/UnpackMS.cxx.

◆ getMessageType()

template<uint8_t sys_ver>
template Spadic::MsMessageType cbm::algo::trd::UnpackMS< sys_ver >::getMessageType ( const std::uint32_t frame) const
private

Identify the message type of a given 32bit frame inside a Microslice.

Definition at line 164 of file trd/UnpackMS.cxx.

References Spadic::kEOM, Spadic::kEPO, Spadic::kINF, Spadic::kNUL, Spadic::kRDA, Spadic::kSOM, and Spadic::kUNK.

◆ getTsMsb()

template<uint8_t sys_ver>
template std::uint8_t cbm::algo::trd::UnpackMS< sys_ver >::getTsMsb ( const std::uint32_t frame,
UnpackMonitorData & monitor ) const
private

Get the ts_msb information from the TS_MSB(kEPO) frame. We take the first of the 3 The 3 redundant TS_MSB sets are already compared at the FPGA level.

Parameters
frame
storageof monitoring data
Returns
ts_msb value

Definition at line 201 of file trd/UnpackMS.cxx.

References cbm::algo::trd::UnpackMonitorData::fNumNonMajorTsMsb.

◆ makeDigi() [1/3]

◆ makeDigi() [2/3]

◆ makeDigi() [3/3]

template<uint8_t sys_ver>
CbmTrdDigi cbm::algo::trd::UnpackMS< sys_ver >::makeDigi ( Spadic::FexWord< sys_ver > fw,
size_t fMsStartTimeRel ) const
private

Create an actual digi from the fex message.

Parameters
fw

Definition at line 230 of file trd/UnpackMS.cxx.

◆ makeRaw()

template<uint8_t sys_ver>
template CbmTrdRawMessageSpadic cbm::algo::trd::UnpackMS< sys_ver >::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
private

Create a CbmTrdRawMessageSpadic from the hit message input.

Parameters
word
criIdid of the cri that send the µSlice
criobIdid of the crob that send the µSlice (currently not used set to 0 062021 PR)
istream
Returns
CbmTrdRawMessageSpadic
Todo
Check if we can get rid of the future obsolete microslice stuff.

Definition at line 324 of file trd/UnpackMS.cxx.

References cbm::algo::trd::UnpackMS< sys_ver >::MsContext::fMsStartTimeRelCC, and cbm::algo::trd::UnpackMS< sys_ver >::MsContext::fNrTsMsbVec.

◆ operator()() [1/2]

◆ operator()() [2/2]

template<std::uint8_t sys_ver>
template UnpackMS< 0x10 >::Result_t cbm::algo::trd::UnpackMS< sys_ver >::operator() ( const uint8_t * msContent,
const fles::MicrosliceDescriptor & msDescr,
const uint64_t tTimeslice ) const
overridevirtual

Algorithm execution.

Parameters
msContentMicroslice payload
msDescrMicroslice descriptor
tTimesliceUnix start time of timeslice [ns]
Returns
TRD digi data

Implements cbm::algo::UnpackMSBase< CbmTrdDigi, UnpackMonitorData, UnpackAuxData >.

Definition at line 419 of file trd/UnpackMS.cxx.

References Spadic::BytesPerWord().

◆ SetParams()

template<uint8_t sys_ver>
void cbm::algo::trd::UnpackMS< sys_ver >::SetParams ( std::unique_ptr< UnpackPar > params)
inline

Set the parameter container.

Parameters
paramsPointer to parameter container

Definition at line 133 of file trd/UnpackMS.h.

References cbm::algo::trd::UnpackMS< sys_ver >::fParams.

Member Data Documentation

◆ fAsicClockCycle

template<uint8_t sys_ver>
float_t cbm::algo::trd::UnpackMS< sys_ver >::fAsicClockCycle = 62.5
staticconstexprprivate

Clock length of Spadic in ns.

Definition at line 276 of file trd/UnpackMS.h.

◆ fBytesPerWord

template<uint8_t sys_ver>
std::uint8_t cbm::algo::trd::UnpackMS< sys_ver >::fBytesPerWord = 8
staticconstexprprivate

Bytes per spadic frame stored in the microslices.

Definition at line 265 of file trd/UnpackMS.h.

◆ fNrOfPresamples

template<uint8_t sys_ver>
size_t cbm::algo::trd::UnpackMS< sys_ver >::fNrOfPresamples = 1
staticconstexprprivate

Number of samples not considered for max adc.

Definition at line 273 of file trd/UnpackMS.h.

◆ fParams

template<uint8_t sys_ver>
UnpackPar cbm::algo::trd::UnpackMS< sys_ver >::fParams = {}
private

Parameter container.

Definition at line 148 of file trd/UnpackMS.h.

Referenced by cbm::algo::trd::UnpackMS< sys_ver >::SetParams().

◆ fPeakingBinMax

template<uint8_t sys_ver>
size_t cbm::algo::trd::UnpackMS< sys_ver >::fPeakingBinMax = static_cast<size_t>(120.0 / fAsicClockCycle + fNrOfPresamples + 5)
staticconstexprprivate

Last sample to look for the max adc Default value is set based on the Shaping time + 5 samples safety margin.

Remarks
the peaking time strongly depends on the input signal. Effective range of the shaping time is between 120 and 240 ns.

Definition at line 293 of file trd/UnpackMS.h.

◆ fPeakingBinMin

template<uint8_t sys_ver>
size_t cbm::algo::trd::UnpackMS< sys_ver >::fPeakingBinMin = fNrOfPresamples
staticconstexprprivate

First sample to look for the max adc.

Definition at line 285 of file trd/UnpackMS.h.

◆ fStreamsPerWord

template<uint8_t sys_ver>
std::uint8_t cbm::algo::trd::UnpackMS< sys_ver >::fStreamsPerWord = 2
staticconstexprprivate

Number of streams per word.

For the msg format used from 2021 ongoing we have 2 parallel streams per word. * All data from eLinks 0..20 go to one stream and 21..41 to the other

Definition at line 270 of file trd/UnpackMS.h.

◆ fTsMsbLength

template<uint8_t sys_ver>
std::uint16_t cbm::algo::trd::UnpackMS< sys_ver >::fTsMsbLength = 16000
staticconstexprprivate

length of one ts_msb in [ns]

Definition at line 279 of file trd/UnpackMS.h.

◆ fTsMsbLengthCC

template<uint8_t sys_ver>
size_t cbm::algo::trd::UnpackMS< sys_ver >::fTsMsbLengthCC = fTsMsbLength / fAsicClockCycle
staticconstexprprivate

length of one ts_msb in [cc]

Definition at line 282 of file trd/UnpackMS.h.


The documentation for this class was generated from the following files: