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

a full histogram block read into memory More...

#include <FWHistoPool.h>

Collaboration diagram for FWHistoPool::BlockHistogram:
[legend]

Public Member Functions

 BlockHistogram (FillValue fill_type, std::array< std::array< uint32_t, 256 >, 8 > values, double collection_time)
 
FillValue fill_type () const
 which type of fill value was put into the histogram
 
const std::array< std::array< uint32_t, 256 >, 8 > values () const
 access the values of the histogram
 
double collection_time () const
 how long was the histogram being filled?
 
nlohmann::json to_json () const
 convert the histogram into UHI JSON
 

Private Attributes

FillValue fill_type_
 what type of value was filled into the histogram
 
std::array< std::array< uint32_t, 256 >, 8 > values_
 content of the histogram
 
double collection_time_
 time histogram was filling in seconds (or zero if no last clear)
 

Detailed Description

a full histogram block read into memory

Member Function Documentation

◆ to_json()

nlohmann::json FWHistoPool::BlockHistogram::to_json ( ) const

convert the histogram into UHI JSON

This JSON output is helpful for loading into python plotting. If only the output from this function is written to the file, then the histogram can be loaded with

import json
import uhi.io.json
import hist
with open('path/to/hists.json') as f:
h_ir = json.load(f, object_hook=uhi.io.json.object_hook)
h = hist.Hist(h_ir)
# h is a 2D histogram where the first axis is the STC
# and the second axis is the sum

The collection time is included in the histogram's 'metadata' in the JSON for scaling the plot later if desired.

Returns
JSON representation of list of histograms

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