JayBeams  0.1
Another project to have fun coding.
Public Types | Public Member Functions | Private Attributes | List of all members
jb::explicit_cuts_binning< sample_type_t > Class Template Reference

A histogram binning_strategy for integer numbers with user defined cuts. More...

#include <explicit_cuts_binning.hpp>

Public Types

typedef sample_type_t sample_type
 type traits as required by binning_strategy_concept More...
 

Public Member Functions

 explicit_cuts_binning (std::initializer_list< sample_type > const &il)
 Constructor based on an initializer list. More...
 
template<typename iterator_t >
 explicit_cuts_binning (iterator_t begin, iterator_t end)
 Constructor based on an iterator range. More...
 
Implement binning_strategy_concept interface.

Please see binning_strategy_concept for detailed documentation of each member function.

sample_type histogram_min () const
 
sample_type histogram_max () const
 
sample_type theoretical_min () const
 
sample_type theoretical_max () const
 
std::size_t sample2bin (sample_type t) const
 
sample_type bin2sample (std::size_t i) const
 
sample_type interpolate (sample_type x_a, sample_type x_b, double y_a, double s, double q) const
 

Private Attributes

std::vector< sample_typecuts_
 

Detailed Description

template<typename sample_type_t>
class jb::explicit_cuts_binning< sample_type_t >

A histogram binning_strategy for integer numbers with user defined cuts.

This class defines histogram bins at cutting points explicity defined by the user. For example, cutting at [0, 1, 10, 100] would create 4 buckets, from 0 to 1, from 1 to 10, from 10 to 100. Samples below the minimum or maximum bucket are recorded as underflows or overflows, respectively.

Users can then create all kinds of interesting binning just by providing the right initial values, for example: [0, 1, 2, ..., 9, 10, 20, ..., 90, 100, ... , 900, 1000] offers a good tradeoff between accuracy and memory usage for tail heavy distributions.

Insertion takes O(log(n)) on the number of cuts.

Template Parameters
sample_type_tthe type of samples, should be an integer type.

Definition at line 33 of file explicit_cuts_binning.hpp.

Member Typedef Documentation

◆ sample_type

template<typename sample_type_t >
typedef sample_type_t jb::explicit_cuts_binning< sample_type_t >::sample_type

type traits as required by binning_strategy_concept

Definition at line 36 of file explicit_cuts_binning.hpp.

Constructor & Destructor Documentation

◆ explicit_cuts_binning() [1/2]

template<typename sample_type_t >
jb::explicit_cuts_binning< sample_type_t >::explicit_cuts_binning ( std::initializer_list< sample_type > const &  il)
inlineexplicit

Constructor based on an initializer list.

Definition at line 41 of file explicit_cuts_binning.hpp.

◆ explicit_cuts_binning() [2/2]

template<typename sample_type_t >
template<typename iterator_t >
jb::explicit_cuts_binning< sample_type_t >::explicit_cuts_binning ( iterator_t  begin,
iterator_t  end 
)
inline

Constructor based on an iterator range.

Definition at line 49 of file explicit_cuts_binning.hpp.

References jb::explicit_cuts_binning< sample_type_t >::cuts_.

Member Function Documentation

◆ bin2sample()

template<typename sample_type_t >
sample_type jb::explicit_cuts_binning< sample_type_t >::bin2sample ( std::size_t  i) const
inline

◆ histogram_max()

template<typename sample_type_t >
sample_type jb::explicit_cuts_binning< sample_type_t >::histogram_max ( ) const
inline

◆ histogram_min()

template<typename sample_type_t >
sample_type jb::explicit_cuts_binning< sample_type_t >::histogram_min ( ) const
inline

◆ interpolate()

template<typename sample_type_t >
sample_type jb::explicit_cuts_binning< sample_type_t >::interpolate ( sample_type  x_a,
sample_type  x_b,
double  y_a,
double  s,
double  q 
) const
inline

◆ sample2bin()

template<typename sample_type_t >
std::size_t jb::explicit_cuts_binning< sample_type_t >::sample2bin ( sample_type  t) const
inline

◆ theoretical_max()

template<typename sample_type_t >
sample_type jb::explicit_cuts_binning< sample_type_t >::theoretical_max ( ) const
inline

Definition at line 81 of file explicit_cuts_binning.hpp.

◆ theoretical_min()

template<typename sample_type_t >
sample_type jb::explicit_cuts_binning< sample_type_t >::theoretical_min ( ) const
inline

Definition at line 78 of file explicit_cuts_binning.hpp.

Member Data Documentation

◆ cuts_

template<typename sample_type_t >
std::vector<sample_type> jb::explicit_cuts_binning< sample_type_t >::cuts_
private

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