lcls2
C++ API: public headers of xtcdata, psalg, psdaq and psana
Loading...
Searching...
No Matches
Pds::Histogram Class Reference

Integer histogram with 2^size bins and an overflow count; unitsCvt converts a bin index to physical units when printing. More...

#include <Histogram.hh>

Public Member Functions

 Histogram (unsigned size, double unitsCvt)
 Allocate 2^size zeroed bins (size is the log2 of the bin count) and keep the units conversion unitsCvt.
 
 ~Histogram ()
 Free the bins.
 
void sum ()
 Recompute the total counts and the count-weighted sum of bin indices from the bins.
 
void dump (char *filesSpec)
 Write the non-empty bins (index times units, count), the overflow count, and the totals, mean and maximum index to the file filesSpec; prints a message if the file cannot be opened or closed.
 
void dump () const
 Print all bins, the overflow count, and the totals, mean and maximum index to stdout (calls sum()).
 
double units () const
 Return the units conversion factor per bin.
 
double weight () const
 Return the count-weighted sum of bin indices from the last sum().
 
double counts () const
 Return the total counts from the last sum().
 
unsigned overflows () const
 Return the number of indices that were beyond the last bin.
 
void bump (uint64_t index)
 Increment the bin index, or the overflow count if index is beyond the last bin, and track the largest index seen.
 
void reset ()
 Zero all bins, the overflow count, the largest index and the totals.
 

Detailed Description

Integer histogram with 2^size bins and an overflow count; unitsCvt converts a bin index to physical units when printing.

Constructor & Destructor Documentation

◆ Histogram()

Pds::Histogram::Histogram ( unsigned  size,
double  unitsCvt 
)

Allocate 2^size zeroed bins (size is the log2 of the bin count) and keep the units conversion unitsCvt.

◆ ~Histogram()

Pds::Histogram::~Histogram ( )

Free the bins.

Member Function Documentation

◆ bump()

void Pds::Histogram::bump ( uint64_t  index)
inline

Increment the bin index, or the overflow count if index is beyond the last bin, and track the largest index seen.

◆ counts()

double Pds::Histogram::counts ( ) const
inline

Return the total counts from the last sum().

◆ dump() [1/2]

void Pds::Histogram::dump ( ) const

Print all bins, the overflow count, and the totals, mean and maximum index to stdout (calls sum()).

◆ dump() [2/2]

void Pds::Histogram::dump ( char *  filesSpec)

Write the non-empty bins (index times units, count), the overflow count, and the totals, mean and maximum index to the file filesSpec; prints a message if the file cannot be opened or closed.

◆ overflows()

unsigned Pds::Histogram::overflows ( ) const
inline

Return the number of indices that were beyond the last bin.

◆ reset()

void Pds::Histogram::reset ( )

Zero all bins, the overflow count, the largest index and the totals.

◆ sum()

void Pds::Histogram::sum ( )

Recompute the total counts and the count-weighted sum of bin indices from the bins.

◆ units()

double Pds::Histogram::units ( ) const
inline

Return the units conversion factor per bin.

◆ weight()

double Pds::Histogram::weight ( ) const
inline

Return the count-weighted sum of bin indices from the last sum().


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