pflib v3.13.3-1-gf856638
Pretty Fine HGCROC Interaction Library
Loading...
Searching...
No Matches
FWHistoPool Class Reference

read and print histograms filled by the firmware More...

#include <FWHistoPool.h>

Collaboration diagram for FWHistoPool:
[legend]

Classes

class  BlockHistogram
 a full histogram block read into memory More...
 
class  SingleChannelHistogram
 A single histogram read into memory. More...
 

Public Types

enum class  FillValue : int { DecodedSum = 0 , EncodedSum = 1 , HighPeak = 2 , Test = 15 }
 the blocks of histograms are logically distinct by what values we fill into them More...
 

Public Member Functions

 FWHistoPool (int i_trigpath)
 construct the pool for the passed trigpath index (0 or 1)
 
void clear ()
 reset all of the histograms in the pool to zero counts
 
void debug (int fill_val)
 use the test histograms to check the functionality of the histogram block
 
std::array< uint32_t, 256 > read_fw (FillValue fill_type, int index)
 read a histogram's content from the firmware
 
SingleChannelHistogram read (FillValue fill_type, int ihist)
 read the current values for the input histogram index of the input value type
 
BlockHistogram read (FillValue fill_type)
 read the current values of a block of histograms of the input value type
 

Private Types

using the_clock = std::chrono::high_resolution_clock
 type of clock we'll use to measure collection time
 
using a_time_point = std::chrono::time_point<the_clock>
 a time point for our clock
 

Private Member Functions

std::optional< double > get_collection_time (a_time_point now) const
 get the collection time
 

Private Attributes

pflib::UIO uio_
 handle to register area of trigpath firmware block
 
std::optional< a_time_pointtime_of_last_clear_
 last time the clear method was called
 
pflib::logging::logger the_log_
 share logging channel with histo menu
 

Static Private Attributes

static const uint32_t ADDR_REG = 0x604 / 4
 register where we write which histogram address we want to read
 
static const uint32_t ADDR_MASK = 0x3FF0000
 mask for writing histogram addresses
 
static uint32_t FW_VERSION = 0
 firmware version being read from (updated in constructor)
 

Detailed Description

read and print histograms filled by the firmware

Member Enumeration Documentation

◆ FillValue

enum class FWHistoPool::FillValue : int
strong

the blocks of histograms are logically distinct by what values we fill into them

Enumerator
DecodedSum 

the sums as output by the decoder lut

EncodedSum 

the sums as unpacked but still in their 5E+4M encoding

HighPeak 

value of rolling sum, high peaks used for trigger

Test 

the test histogram codes

Member Function Documentation

◆ debug()

void FWHistoPool::debug ( int fill_val)

use the test histograms to check the functionality of the histogram block

The fill value is split across the four test histograms. The lowest 2 bits go into test histogram 0. The next lowest 2 bits go into test histogram 1 multiplied by 4. The next lowest 2 bits go into test histogram 2 multiplied by 16. The next lowest 2 bits go into test histogram 3 multiplied by 64.

For example, a value of 85 (= 0b01010101) should cause bin 1 of histogram 0, bin 4 of histogram 1, bin 16 of histogram 2, and bin 64 of histogram 2 to increment by one.

After doing this single fill, all of the test histograms are printed to the terminal to view the resulting values.

Note
Since the fill happens on each BX clock and the register that is normally being used to fill the test histograms is zero, the zero-bin should also have a large number in it.

◆ read() [1/2]

FWHistoPool::BlockHistogram FWHistoPool::read ( FillValue fill_type)

read the current values of a block of histograms of the input value type

Parameters
[in]fill_typeFillValue choosing which block of histograms to read
Returns
the block histogram read in

◆ read() [2/2]

FWHistoPool::SingleChannelHistogram FWHistoPool::read ( FWHistoPool::FillValue fill_type,
int ihist )

read the current values for the input histogram index of the input value type

Parameters
[in]fill_typeFillValue choosing which block of histograms to read from
[in]ihistindex of histogram within that block [0,7]
Returns
the current histogram

◆ read_fw()

std::array< uint32_t, 256 > FWHistoPool::read_fw ( FWHistoPool::FillValue fill_type,
int index )

read a histogram's content from the firmware

Parameters
[in]fill_typeblock of histograms to read from
[in]indexindex of the histogram we want in that block
Returns
histogram content

The documentation for this class was generated from the following files: