pflib v3.13.3-1-gf856638
Pretty Fine HGCROC Interaction Library
Loading...
Searching...
No Matches
FWHistoPool.h
1#pragma once
2#ifndef PFTOOL_TRIG_FWHISTO_H
3#define PFTOOL_TRIG_FWHISTO_H
4
5#include <array>
6#include <nlohmann/json.hpp>
7#include <optional>
8
9#include "pflib/logging/Logging.h"
10#include "pflib/zcu/UIO.h"
11
17 static const uint32_t ADDR_REG = 0x604 / 4;
19 static const uint32_t ADDR_MASK = 0x3FF0000;
21 static uint32_t FW_VERSION;
24
30 std::optional<a_time_point> time_of_last_clear_;
31
34
36 std::optional<double> get_collection_time(a_time_point now) const;
37
38 public:
40 FWHistoPool(int i_trigpath);
41
43 void clear();
44
65 void debug(int fill_val);
66
71 enum class FillValue : int {
73 DecodedSum = 0,
75 EncodedSum = 1,
77 HighPeak = 2,
79 Test = 15
80 };
81
89 std::array<uint32_t, 256> read_fw(FillValue fill_type, int index);
90
98 int index_;
103
104 public:
107 double collection_time);
109 FillValue fill_type() const;
111 int index() const;
113 const std::array<uint32_t, 256> values() const;
115 double collection_time() const;
137 nlohmann::json to_json() const;
138 };
139
149 SingleChannelHistogram read(FillValue fill_type, int ihist);
150
199
207 BlockHistogram read(FillValue fill_type);
208};
209
210#endif
a full histogram block read into memory
Definition FWHistoPool.h:154
FillValue fill_type() const
which type of fill value was put into the histogram
Definition FWHistoPool.cxx:164
double collection_time_
time histogram was filling in seconds (or zero if no last clear)
Definition FWHistoPool.h:160
nlohmann::json to_json() const
convert the histogram into UHI JSON
Definition FWHistoPool.cxx:177
FillValue fill_type_
what type of value was filled into the histogram
Definition FWHistoPool.h:156
double collection_time() const
how long was the histogram being filled?
Definition FWHistoPool.cxx:173
const std::array< std::array< uint32_t, 256 >, 8 > values() const
access the values of the histogram
Definition FWHistoPool.cxx:169
std::array< std::array< uint32_t, 256 >, 8 > values_
content of the histogram
Definition FWHistoPool.h:158
A single histogram read into memory.
Definition FWHistoPool.h:94
const std::array< uint32_t, 256 > values() const
access the values of the histogram
Definition FWHistoPool.cxx:91
FillValue fill_type() const
which type of fill value was put into the histogram
Definition FWHistoPool.cxx:85
double collection_time() const
how long was the histogram being filled?
Definition FWHistoPool.cxx:96
std::array< uint32_t, 256 > values_
content of the histogram
Definition FWHistoPool.h:100
nlohmann::json to_json() const
convert the histogram into UHI JSON
Definition FWHistoPool.cxx:112
int index() const
which index was read
Definition FWHistoPool.cxx:89
int index_
index of STC in this histogram
Definition FWHistoPool.h:98
double collection_time_
time histogram was filling in seconds (or zero if no last clear)
Definition FWHistoPool.h:102
FillValue fill_type_
what type of value was filled into the histogram
Definition FWHistoPool.h:96
read and print histograms filled by the firmware
Definition FWHistoPool.h:15
void clear()
reset all of the histograms in the pool to zero counts
Definition FWHistoPool.cxx:56
std::array< uint32_t, 256 > read_fw(FillValue fill_type, int index)
read a histogram's content from the firmware
Definition FWHistoPool.cxx:27
static uint32_t FW_VERSION
firmware version being read from (updated in constructor)
Definition FWHistoPool.h:21
std::optional< a_time_point > time_of_last_clear_
last time the clear method was called
Definition FWHistoPool.h:30
pflib::UIO uio_
handle to register area of trigpath firmware block
Definition FWHistoPool.h:23
std::optional< double > get_collection_time(a_time_point now) const
get the collection time
Definition FWHistoPool.cxx:14
SingleChannelHistogram read(FillValue fill_type, int ihist)
read the current values for the input histogram index of the input value type
Definition FWHistoPool.cxx:144
static const uint32_t ADDR_MASK
mask for writing histogram addresses
Definition FWHistoPool.h:19
pflib::logging::logger the_log_
share logging channel with histo menu
Definition FWHistoPool.h:33
void debug(int fill_val)
use the test histograms to check the functionality of the histogram block
Definition FWHistoPool.cxx:61
FillValue
the blocks of histograms are logically distinct by what values we fill into them
Definition FWHistoPool.h:71
@ Test
the test histogram codes
@ EncodedSum
the sums as unpacked but still in their 5E+4M encoding
@ HighPeak
value of rolling sum, high peaks used for trigger
@ DecodedSum
the sums as output by the decoder lut
static const uint32_t ADDR_REG
register where we write which histogram address we want to read
Definition FWHistoPool.h:17
FWHistoPool(int i_trigpath)
construct the pool for the passed trigpath index (0 or 1)
Definition FWHistoPool.cxx:49
Definition UIO.h:15
boost::log::sources::severity_channel_logger_mt< level, std::string > logger
our logger type
Definition Logging.h:39