pflib v3.14.3-4-g3289bd3
Pretty Fine HGCROC Interaction Library
Loading...
Searching...
No Matches
HcalECONTCaptureFrame.h
1#pragma once
2#ifndef PFLIB_PACKING_SINGLEECONTCAPTUREFRAME_H
3#define PFLIB_PACKING_SINGLEECONTCAPTUREFRAME_H
4
5#include <optional>
6
7#include "pflib/logging/Logging.h"
8#include "pflib/packing/ECONTCaptureHeader.h"
9#include "pflib/packing/Reader.h"
10
11namespace pflib::packing {
12
19 mutable ::pflib::logging::logger the_log_{::pflib::logging::get("decoding")};
20
21 public:
53 mutable ::pflib::logging::logger the_log_{
54 ::pflib::logging::get("decoding")};
55 static constexpr std::size_t N_STC = 8;
57 std::array<int, N_STC> stc_sums_;
58 int bx_;
59
60 public:
61 void from(std::span<uint32_t> data);
63 int bx() const;
65 int stc_sum(int i_stc) const;
67 int encoded_stc_sum(int i_stc) const;
69 int max_tc(int i_stc) const;
70 };
71
72 HcalECONTCaptureFrame() = default;
73 HcalECONTCaptureFrame(std::span<uint32_t> data);
74 Reader& read(Reader& r);
75 void from(std::span<uint32_t> data);
76 const SingleECONTSample& sample(std::optional<int> i_econt = {},
77 std::optional<int> i_sample = {}) const;
78 int bx(std::optional<int> i_econt = {},
79 std::optional<int> i_sample = {}) const;
80 int stc_sum(int i_stc, std::optional<int> i_econt = {},
81 std::optional<int> i_sample = {}) const;
82 int encoded_stc_sum(int i_stc, std::optional<int> i_econt = {},
83 std::optional<int> i_sample = {}) const;
84 int max_tc(int i_stc, std::optional<int> i_econt = {},
85 std::optional<int> i_sample = {}) const;
86 const ECONTCaptureHeader& header() const;
87 int n_econt() const;
88 int length() const;
89 int version() const;
90 int econ_id() const;
91 int pre_samples() const;
92 std::size_t n_samples() const;
93
94 private:
95 ECONTCaptureHeader header_;
97};
98
99} // namespace pflib::packing
100
101#endif
Each ECON-T sample has the following struture, assuming.
Definition HcalECONTCaptureFrame.h:52
int encoded_stc_sum(int i_stc) const
the raw value trasmitted by the ECON-T
Definition HcalECONTCaptureFrame.cxx:39
int stc_sum(int i_stc) const
decode the 5E+4M encoding into a linearized sum value
Definition HcalECONTCaptureFrame.cxx:35
int bx() const
bx counter for this sample of STC sums
Definition HcalECONTCaptureFrame.cxx:33
int max_tc(int i_stc) const
index of the TC within the STC that was the maximum
Definition HcalECONTCaptureFrame.cxx:43
A capture frame has one or more SingleECONTSamples along with two headers written by the firmware tha...
Definition HcalECONTCaptureFrame.h:18
void from(std::span< uint32_t > data)
Definition HcalECONTCaptureFrame.cxx:51
Reading a raw data stream with some underlying backend.
Definition Reader.h:19
logger get(const std::string &name)
Gets a logger with the input name for its channel.
Definition Logging.cxx:24