CbmRoot
Loading...
Searching...
No Matches
bmon/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 "CbmBmonDigi.h"
7#include "CriGet4Mess001.h"
8#include "MicrosliceDescriptor.hpp"
9#include "Timeslice.hpp"
10#include "UnpackMSBase.h"
11
12#include <cassert>
13#include <cstddef>
14#include <cstdint>
15#include <memory>
16#include <sstream>
17#include <vector>
18
19namespace cbm::algo::bmon
20{
21
22
29 std::vector<uint32_t> fChannelUId;
30 int32_t fTimeOffset = 0.;
31 };
32
33
39 struct UnpackPar {
40 std::vector<UnpackElinkPar> fElinkParams = {};
41 };
42
43
54 uint32_t fNumErrInvalidMsSize = 0;
65 std::string print()
66 {
67 std::stringstream ss;
68 ss << "errors " << fNumNonHitOrTsbMessage << " | " << fNumErrElinkOutOfRange << " | "
71 return ss.str();
72 }
73 };
74
82 };
83
91 class UnpackMS : public UnpackMSBase<CbmBmonDigi, UnpackMonitorData, UnpackAuxData> {
92
93 public:
95 UnpackMS(const UnpackPar& pars);
96
98 ~UnpackMS() override;
99
100
107 Result_t operator()(const uint8_t* msContent, const fles::MicrosliceDescriptor& msDescr,
108 const uint64_t tTimeslice) const override;
109
113 void SetParams(std::unique_ptr<UnpackPar> params) { fParams = *(std::move(params)); }
114
115 private: // datatypes
116 struct TimeSpec {
117 uint64_t currentTsTime;
119 };
120
121 private: // methods
127 void ProcessHitMessage(const critof001::Message& message, const TimeSpec& time, std::vector<CbmBmonDigi>& digiVec,
128 UnpackMonitorData& monitor) const;
129
133 void ProcessEpochMessage(const critof001::Message& message, TimeSpec& time) const;
134
135
136 private: // members
138 };
139
140
141} // namespace cbm::algo::bmon
std::tuple< std::vector< Digi_t >, Monitor_t, Aux_t > Result_t
UnpackPar fParams
Parameter container.
UnpackMS(const UnpackPar &pars)
Construct from parameters.
~UnpackMS() override
Destructor.
void ProcessHitMessage(const critof001::Message &message, const TimeSpec &time, std::vector< CbmBmonDigi > &digiVec, UnpackMonitorData &monitor) const
Process a hit message.
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 (TS_MSB)
void SetParams(std::unique_ptr< UnpackPar > params)
Set the parameter container.
Bmon Unpacking parameters for one eLink / ASIC.
int32_t fTimeOffset
Time calibration parameter.
std::vector< uint32_t > fChannelUId
CbmBmonAddress for different channels.
uint64_t currentTsTime
Unix time of timeslice in units of epoch length.
uint32_t currentEpochInTs
Current epoch number relative to timeslice start epoch.
uint32_t fNumErrElinkOutOfRange
Elink not contained in parameters.
uint32_t fNumErrInvalidFirstMessage
First message is not EPOCH.
uint32_t fNumErrInvalidStartEpoch
Microslice index doesn't match first epoch.
uint32_t fNumErrInvalidMsSize
Microslice size is not multiple of message size.
uint32_t fNumErrInvalidLastMessage
Last message is not EndOfMs.
uint32_t fNumErrInvalidAsicEpochs
Epoch did not match merged one for an asic.
uint32_t fNumErrTimestampOverflow
Overflow in 64 bit time stamp.
Parameters required for the BMON unpacking (specific to one component)
std::vector< UnpackElinkPar > fElinkParams
Parameters for each eLink.