CbmRoot
Loading...
Searching...
No Matches
much/UnpackMS.h
Go to the documentation of this file.
1/* Copyright (C) 2021 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Pierre-Alain Loizeau, Volker Friese [committer] */
4#pragma once
5
6#include "CbmMuchDigi.h"
7#include "MicrosliceDescriptor.hpp"
8#include "StsXyterMessage.h"
9#include "Timeslice.hpp"
11
12#include <cassert>
13#include <cstddef>
14#include <cstdint>
15#include <memory>
16#include <sstream>
17#include <vector>
18
19namespace cbm::algo::much
20{
21
22
29 std::vector<uint32_t> fAddress;
30 std::vector<bool> fChanMask;
31 int64_t fTimeOffset = 0;
32 };
33
34
40 struct UnpackPar {
41 std::vector<UnpackElinkPar> fElinkParams = {};
42 };
43
44
81
89 };
90
97 class UnpackMS : public UnpackMSBase<CbmMuchDigi, UnpackMonitorData, UnpackAuxData> {
98
99 public:
101 UnpackMS(const UnpackPar& pars);
102
104 ~UnpackMS() override;
105
106
113 Result_t operator()(const uint8_t* msContent, const fles::MicrosliceDescriptor& msDescr,
114 const uint64_t tTimeslice) const override;
115
116 private: // datatypes
117 struct TimeSpec {
118 uint64_t currentTsTime = 0;
119 uint64_t currentCycle = 0;
120 uint32_t currentEpoch = 0;
121 uint64_t currentEpochTime = 0;
122 };
123
124
125 private: // methods
131 void ProcessHitMessage(const stsxyter::Message& message, const TimeSpec& time, std::vector<CbmMuchDigi>& digiVec,
132 UnpackMonitorData& monitor) const;
133
137 void ProcessTsmsbMessage(const stsxyter::Message& message, TimeSpec& time) const;
138
139
140 private: // members
142
145
148
150 static constexpr uint32_t fkClockCycleNom = stsxyter::kulClockCycleNom;
151 static constexpr uint32_t fkClockCycleDen = stsxyter::kulClockCycleDen;
152
155 };
156
157
158} // namespace cbm::algo::much
std::tuple< std::vector< Digi_t >, Monitor_t, Aux_t > Result_t
static constexpr uint32_t fkClockCycleDen
void ProcessTsmsbMessage(const stsxyter::Message &message, TimeSpec &time) const
Process an epoch message (TS_MSB)
UnpackMS(const UnpackPar &pars)
Construct with parameters.
void ProcessHitMessage(const stsxyter::Message &message, const TimeSpec &time, std::vector< CbmMuchDigi > &digiVec, UnpackMonitorData &monitor) const
Process a hit message.
static constexpr uint64_t fkEpochLength
~UnpackMS() override
Destructor.
static constexpr uint64_t fkEpochsPerCycle
Result_t operator()(const uint8_t *msContent, const fles::MicrosliceDescriptor &msDescr, const uint64_t tTimeslice) const override
Algorithm execution.
static constexpr uint32_t fkClockCycleNom
UnpackPar fParams
Parameter container.
static constexpr uint64_t fkCycleLength
static constexpr uint32_t kulClockCycleDen
Clock cycle denominator, equivalent to 2*160 MHz clock.
static constexpr uint32_t kuHitNbTsBinsBinning
static constexpr uint32_t kulClockCycleNom
Clock cycle nominator [ns], equivalent to 2*160 MHz clock.
static constexpr uint32_t kuTsMsbNbTsBinsBinning
STS Unpacking parameters for one eLink / ASIC.
std::vector< bool > fChanMask
Channel masking flags.
std::vector< uint32_t > fAddress
CbmMuchAddress for different channels.
int64_t fTimeOffset
Time calibration parameter.
uint64_t currentCycle
Current epoch cycle.
uint64_t currentEpochTime
Current epoch time relative to timeslice in clock cycles.
uint32_t currentEpoch
Current epoch number within epoch cycle.
uint64_t currentTsTime
Unix time of timeslice in units of epoch length.
void add(const UnpackMonitorData &rhs)
uint32_t fNumErrElinkOutOfRange
Elink not contained in parameters.
uint32_t fNumErrInvalidMsSize
Microslice size is not multiple of message size.
uint32_t fNumErrInvalidFirstMessage
First message is not TS_MSB or second is not EPOCH.
uint32_t fNumErrTimestampUnderflow
Underflow in 64 bit time stamp if offsetting.
uint32_t fNumErrTimestampOverflow
Overflow in 64 bit time stamp.
Parameters required for the STS unpacking (specific to one component)
std::vector< UnpackElinkPar > fElinkParams
Parameters for each eLink.