WireCellToolkit
Wire Cell Simulation, Signal Process and Reconstruction Toolki for Liquid Argon Detectors
WireCell::Binning Class Reference

#include <Binning.h>

Public Member Functions

 Binning (int nbins, double minval, double maxval)
 
 Binning ()
 
void set (int nbins, double minval, double maxval)
 
int nbins () const
 
double min () const
 
double max () const
 
double span () const
 Return the max-min. More...
 
std::pair< double, double > range () const
 
std::pair< int, int > irange () const
 
double binsize () const
 
int bin (double val) const
 
double center (int ind) const
 
int edge_index (double val) const
 
double edge (int ind) const
 
bool inside (double val) const
 
bool inbounds (int bin) const
 Return true if bin is in bounds. More...
 
std::pair< int, int > sample_bin_range (double minval, double maxval) const
 

Detailed Description

A binning is a uniform discretization of a linear space.

This class largely provides methods that give semantic labels to various calculations related to a binned region.

Definition at line 15 of file Binning.h.

Constructor & Destructor Documentation

◆ Binning() [1/2]

WireCell::Binning::Binning ( int  nbins,
double  minval,
double  maxval 
)
inline

Create a binning

Parameters
nbinsgives the number of uniform, discrete separation between bounds.
minvalgives the lower bound of the linear space (low edge of bin 0)
maxvalgives the upper bound of the linear space (high edge of bin nbins-1)

Definition at line 26 of file Binning.h.

Here is the call graph for this function:

◆ Binning() [2/2]

WireCell::Binning::Binning ( )
inline

Definition at line 29 of file Binning.h.

Member Function Documentation

◆ bin()

int WireCell::Binning::bin ( double  val) const
inline

Return the bin containing value. If val is in range, return value is [0,nbins-1] but no range checking is performed.

Definition at line 80 of file Binning.h.

Here is the caller graph for this function:

◆ binsize()

double WireCell::Binning::binsize ( ) const
inline

Definition at line 73 of file Binning.h.

Here is the caller graph for this function:

◆ center()

double WireCell::Binning::center ( int  ind) const
inline

Return the center value of given bin. Range checking is not done.

Definition at line 86 of file Binning.h.

Here is the caller graph for this function:

◆ edge()

double WireCell::Binning::edge ( int  ind) const
inline

Return the position of the given bin edge. Range checking is not done.

Definition at line 99 of file Binning.h.

Here is the caller graph for this function:

◆ edge_index()

int WireCell::Binning::edge_index ( double  val) const
inline

Return the edge, nominally in [0,nbins] closest to the given value. Range checking is not done so returned edge may be outside of range.

Definition at line 93 of file Binning.h.

◆ inbounds()

bool WireCell::Binning::inbounds ( int  bin) const
inline

Return true if bin is in bounds.

Definition at line 110 of file Binning.h.

◆ inside()

bool WireCell::Binning::inside ( double  val) const
inline

Return true value is in range. Range is considered half open. Ig, edge(nbins) is not inside range.

Definition at line 105 of file Binning.h.

◆ irange()

std::pair<int, int> WireCell::Binning::irange ( ) const
inline

Definition at line 68 of file Binning.h.

◆ max()

double WireCell::Binning::max ( ) const
inline

Definition at line 52 of file Binning.h.

Here is the caller graph for this function:

◆ min()

double WireCell::Binning::min ( ) const
inline

Definition at line 47 of file Binning.h.

Here is the caller graph for this function:

◆ nbins()

int WireCell::Binning::nbins ( ) const
inline

Definition at line 42 of file Binning.h.

Here is the caller graph for this function:

◆ range()

std::pair<double, double> WireCell::Binning::range ( ) const
inline

Definition at line 62 of file Binning.h.

◆ sample_bin_range()

std::pair<int,int> WireCell::Binning::sample_bin_range ( double  minval,
double  maxval 
) const
inline

Return half-open bin range which covers the range of values. Bounds are forced to return values in [0,nbins].

Definition at line 116 of file Binning.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set()

void WireCell::Binning::set ( int  nbins,
double  minval,
double  maxval 
)
inline

Definition at line 34 of file Binning.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ span()

double WireCell::Binning::span ( ) const
inline

Return the max-min.

Definition at line 57 of file Binning.h.


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