pflib v3.14.3-4-g3289bd3
Pretty Fine HGCROC Interaction Library
Loading...
Searching...
No Matches
TrigAlgoOutput.h
1#pragma once
2#ifndef PFLIB_PACKING_TRIGALGOOUTPUT_H
3#define PFLIB_PACKING_TRIGALGOOUTPUT_H
4
5#include <bitset>
6#include <optional>
7
8#include "pflib/logging/Logging.h"
9#include "pflib/packing/ECONTCaptureHeader.h"
10#include "pflib/packing/Reader.h"
11
12namespace pflib::packing {
13
15 public:
32 const SingleBXOutput& sample) {
33 o << "{ is_high_peak: " << sample.is_high_peak_
34 << ", algo_history: " << sample.algo_trigger_history_
35 << ", gated_history: " << sample.gated_trigger_history_
36 << ", econ_tdata_dv: " << sample.econ_tdata_dv_
37 << ", algo_trigger: " << sample.algo_trigger_
38 << ", gated_trigger: " << sample.gated_trigger_ << " }";
39 return o;
40 }
41 };
42 const SingleBXOutput& sample(std::optional<int> i_sample = {}) const;
43 TrigAlgoOutput() = default;
44 TrigAlgoOutput(std::span<uint32_t> data);
45 void from(std::span<uint32_t> data);
46 Reader& read(Reader& r);
47 std::size_t n_samples() const;
48 const ECONTCaptureHeader& header() const;
49 int length() const;
50 bool is_high_peak(int i_stc, std::optional<int> i_sample = {}) const;
52 bool trigger(std::optional<int> i_sample = {}) const;
54 bool algo_trigger(std::optional<int> i_sample = {}) const;
55 bool econ_tdata_dv(std::optional<int> i_sample = {}) const;
56
57 private:
58 mutable ::pflib::logging::logger the_log_{::pflib::logging::get("decoding")};
60 ECONTCaptureHeader header_;
61};
62
63} // namespace pflib::packing
64
65#endif
Definition TrigAlgoOutput.h:14
bool algo_trigger(std::optional< int > i_sample={}) const
reports if the algo would have triggered
Definition TrigAlgoOutput.cxx:68
bool trigger(std::optional< int > i_sample={}) const
reports the gated trigger i.e. if a readout request would be sent
Definition TrigAlgoOutput.cxx:64
logger get(const std::string &name)
Gets a logger with the input name for its channel.
Definition Logging.cxx:24
std::bitset< 5 > algo_trigger_history_
the last 5 clk ticks of the algo trigger
Definition TrigAlgoOutput.h:20
bool algo_trigger_
if the algorithm would trigger
Definition TrigAlgoOutput.h:24
std::bitset< 5 > gated_trigger_history_
the last 5 clk ticks of the actual trigger
Definition TrigAlgoOutput.h:22
friend std::ostream & operator<<(std::ostream &o, const SingleBXOutput &sample)
print human readable sample
Definition TrigAlgoOutput.h:31
bool gated_trigger_
if a trigger was actually sent (the trigger may be prevented by the single-shot gate)
Definition TrigAlgoOutput.h:27
bool econ_tdata_dv_
if the link alignment was valid
Definition TrigAlgoOutput.h:29
std::bitset< 16 > is_high_peak_
whether STC i had a high peak
Definition TrigAlgoOutput.h:18