Celeritas 0.6.0-13+develop.01c2c09e
Loading...
Searching...
No Matches
Public Member Functions | List of all members
celeritas::test::Histogram Class Reference

Calculate the histogram of a set of values. More...

#include <Histogram.hh>

Public Types

Type aliases
using Dbl2 = Array< double, 2 >
 
using VecCount = std::vector< size_type >
 
using VecDbl = std::vector< double >
 

Public Member Functions

 Histogram (size_type num_bins, Dbl2 domain)
 Contruct with the number of bins and domain.
 
void operator() (double value)
 Update the histogram with a value.
 
void operator() (VecDbl const &values)
 Update the histogram with a vector of values.
 
VecCount constcounts () const
 Get the histogram.
 
VecDbl calc_density () const
 Get the result as a probability desnity.
 
size_type underflow () const
 Get the number of samples below the lower bound.
 
size_type overflow () const
 Get the number of samples above the upper bound.
 
double min () const
 
double max () const
 

Detailed Description

Calculate the histogram of a set of values.

Values outside of the input domain are saved to the underflow and overflow bins. All bins are half-open except for the rightmost bin, which will include values equal to the upper domain boundary.

To test that all samples are within the domain:

EXPECT_EQ(0, hist.underflow())
<< "Encountered values as low as " << hist.min();
EXPECT_EQ(0, hist.overflow())
<< "Encountered values as high as " << hist.max();
Note
This class uses double precision since values are being accumulated and tallied and only on host.

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