CbmRoot
Loading...
Searching...
No Matches
tof/UnpackMS.h
Go to the documentation of this file.
1/* Copyright (C) 2022 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Dominik Smith [committer] */
4#pragma once
5
6#include "CbmTofDigi.h"
7#include "CriGet4Mess001.h"
8#include "Definitions.h"
9#include "MicrosliceDescriptor.hpp"
10#include "Timeslice.hpp"
11#include "UnpackMSBase.h"
12
13#include <cassert>
14#include <cstddef>
15#include <cstdint>
16#include <memory>
17#include <sstream>
18#include <vector>
19
20namespace cbm::algo::tof
21{
22
29 std::vector<uint32_t> fChannelUId;
30 int32_t fTimeOffset = 0.;
31 };
32
38 struct UnpackPar {
39 std::vector<UnpackElinkPar> fElinkParams = {};
40 };
41
52 uint32_t fNumErrInvalidMsSize = 0;
63 std::string print()
64 {
65 std::stringstream ss;
66 ss << "errors " << fNumNonHitOrTsbMessage << " | " << fNumErrElinkOutOfRange << " | "
69 return ss.str();
70 }
71 };
72
80 };
81
88 class UnpackMS : public UnpackMSBase<CbmTofDigi, UnpackMonitorData, UnpackAuxData> {
89
90 public:
92 UnpackMS(const UnpackPar& pars);
93
95 ~UnpackMS() override;
96
103 Result_t operator()(const uint8_t* msContent, const fles::MicrosliceDescriptor& msDescr,
104 const uint64_t tTimeslice) const override;
105
109 void SetParams(std::unique_ptr<UnpackPar> params) { fParams = *(std::move(params)); }
110
111 private: // types
116
117 private: // methods
123 void ProcessHitMessage(const critof001::Message& message, std::vector<CbmTofDigi>& digiVec,
124 UnpackMonitorData& monitor, TimeSpec& time) const;
125
129 void ProcessEpochMessage(const critof001::Message& message, TimeSpec& time) const;
130
131 private: // members
133 };
134
135} // namespace cbm::algo::tof
std::tuple< std::vector< Digi_t >, Monitor_t, Aux_t > Result_t
Unpack algorithm for STS.
Result_t operator()(const uint8_t *msContent, const fles::MicrosliceDescriptor &msDescr, const uint64_t tTimeslice) const override
Algorithm execution.
void ProcessEpochMessage(const critof001::Message &message, TimeSpec &time) const
Process an epoch message.
UnpackPar fParams
Parameter container.
~UnpackMS() override
Destructor.
void SetParams(std::unique_ptr< UnpackPar > params)
Set the parameter container.
UnpackMS(const UnpackPar &pars)
Default constructor.
void ProcessHitMessage(const critof001::Message &message, std::vector< CbmTofDigi > &digiVec, UnpackMonitorData &monitor, TimeSpec &time) const
Process a hit message.
std::uint32_t u32
Definition Definitions.h:21
std::uint64_t u64
Definition Definitions.h:23
TOF Unpacking parameters for one eLink / ASIC.
int32_t fTimeOffset
Time calibration parameter.
std::vector< uint32_t > fChannelUId
CbmTofAddress for different channels.
u64 currentTsTime
Unix time of timeslice in units of epoch length.
u32 currentEpochInTs
Current epoch number relative to timeslice start epoch.
uint32_t fNumErrInvalidMsSize
Microslice size is not multiple of message size.
uint32_t fNumErrTimestampOverflow
Overflow in 64 bit time stamp.
uint32_t fNumErrElinkOutOfRange
Elink not contained in parameters.
uint32_t fNumErrInvalidLastMessage
Last message is not EndOfMs.
uint32_t fNumErrInvalidAsicEpochs
Epoch did not match merged one for an asic.
uint32_t fNumErrInvalidStartEpoch
Microslice index doesn't match first epoch.
uint32_t fNumErrInvalidFirstMessage
First message is not EPOCH.
Parameters required for the STS unpacking (specific to one component)
std::vector< UnpackElinkPar > fElinkParams
Parameters for each eLink.