ant
A2 ant: class-based analysis framework
ant::VarBinSettings Class Reference

#include <BinSettings.h>

+ Inheritance diagram for ant::VarBinSettings:
+ Collaboration diagram for ant::VarBinSettings:

Classes

struct  Exception
 

Public Member Functions

 VarBinSettings (std::vector< double > edges)
 BinSettings equivalent used for variable bin widths. More...
 
unsigned int Bins () const noexcept
 
unsigned int & Bins () noexcept
 
std::vector< double > Edges () const noexcept
 
std::vector< double > & Edges () noexcept
 
int getBin (const double v) const noexcept
 Get the number of the bin a value would end up in. More...
 
- Public Member Functions inherited from ant::interval< double >
constexpr interval (const double &start, const double &stop) noexcept
 
constexpr const double & Start () const noexcept
 Get the lower boundary. More...
 
double & Start () noexcept
 Get the lower boundary. More...
 
constexpr const double & Stop () const noexcept
 Get the upper boundary. More...
 
double & Stop () noexcept
 Get the upper boundary. More...
 
constexpr double Length () const noexcept
 Get the length of the interval. More...
 
constexpr double Center () const noexcept
 Get the center. More...
 
interval< double > & operator+= (const double &a)
 Add a value to both boundaries. This shifts the interval to higher values. More...
 
interval< double > & operator-= (const double &a)
 Subtract a value to both boundaries. This shifts the interval to lower values. More...
 
interval< double > & operator*= (const double &f)
 Multiply both boundaries with a factor. This scales the interval (but also moves the center if center != 0) More...
 
interval< double > & operator/= (const double &f)
 Deivide both boundaries by a factor. This scales the interval (but also moves the center if center != 0) More...
 
interval< double > operator+ (const double &a) const
 Add a value to both boundaries and return the resulting interval (a new copy) The result is shifted to higher values (if a positive, of course). More...
 
interval< double > operator- (const double &a) const
 Subtract a value to both boundaries and return the resulting interval (a new copy) The result is shifted to lower values (if a positive, of course). More...
 
interval< double > operator* (const double &f) const
 Multiply both boundaries with a factor and return the resulting interval (a new copy). The result is scaled and the center is shifted if != 0. More...
 
interval< double > operator/ (const double &f) const
 Deivide both boundaries by a factor and return the resulting interval (a new copy). The result is scaled and the center is shifted if != 0. More...
 
double operator[] (const index_t n) const
 operator []: Access boundaries array-style More...
 
constexpr bool operator== (const interval< double > &rhs) const noexcept
 
constexpr bool operator!= (const interval< double > &rhs) const noexcept
 
void SetWidth (const double &width)
 
void SetCenter (const double &center)
 
constexpr bool Contains (const double &x) const noexcept
 
constexpr bool Disjoint (const ant::interval< double > &i) const noexcept
 
void Extend (const interval< double > &other)
 Extend the interval if the given covers a larger range. More...
 
void Extend (const double &other)
 Extend the interval if the given covers a larger range. More...
 
bool tryJoinWith (const ant::interval< double > &other)
 Join another interval into this one if they overlap. More...
 
void MakeSane ()
 Make sure, start < stop. More...
 
constexpr bool IsSane () const noexcept
 
constexpr double Clip (const double &x) const
 Clip x to be inside the interval. More...
 
interval< double > & Round () noexcept
 Round boundaries to integer using std::round. More...
 
std::string AsRangeString (const std::string &label="x") const noexcept
 AsRangeString makes "mathematical" string expression of interval. More...
 

Protected Attributes

unsigned int bins
 
std::vector< double > bin_edges
 
- Protected Attributes inherited from ant::interval< double >
double _start
 
double _stop
 

Friends

std::ostream & operator<< (std::ostream &out, const BinSettings &b)
 

Additional Inherited Members

- Static Public Member Functions inherited from ant::interval< double >
static constexpr interval CenterWidth (const double center, const double width) noexcept
 Factory Function: Create interval from center and width. More...
 
static constexpr interval getMaxRange () noexcept
 
static constexpr interval getMaxPositiveRange () noexcept
 
static constexpr interval getMaxNegativeRange () noexcept
 

Constructor & Destructor Documentation

◆ VarBinSettings()

ant::VarBinSettings::VarBinSettings ( std::vector< double >  edges)
inline

BinSettings equivalent used for variable bin widths.

Parameters
edgesvector or list containing the bin edges

Member Function Documentation

◆ Bins() [1/2]

unsigned int ant::VarBinSettings::Bins ( ) const
inlinenoexcept

◆ Bins() [2/2]

unsigned int& ant::VarBinSettings::Bins ( )
inlinenoexcept

◆ Edges() [1/2]

std::vector<double> ant::VarBinSettings::Edges ( ) const
inlinenoexcept

◆ Edges() [2/2]

std::vector<double>& ant::VarBinSettings::Edges ( )
inlinenoexcept

◆ getBin()

int VarBinSettings::getBin ( const double  v) const
noexcept

Get the number of the bin a value would end up in.

Parameters
vThe Value
Returns
a bin number between 0 (lowest bin) to BinSettings::Bins-1, -1 if v is outside the interval
Note
Bin numbering is different from ROOTs TH{1..3} numbering, where the lowest bin has the index 1

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  out,
const BinSettings b 
)
friend

Member Data Documentation

◆ bin_edges

std::vector<double> ant::VarBinSettings::bin_edges
protected

◆ bins

unsigned int ant::VarBinSettings::bins
protected

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