npstat is hosted by Hepforge, IPPP Durham
NPStat  5.10.0

#include <BinSummary.hh>

Public Member Functions

 BinSummary (double location, double rangeDown, double rangeUp)
 
 BinSummary (double location, double rangeDown, double rangeUp, double minValue, double maxValue)
 
 BinSummary (double location, double stdev)
 
 BinSummary ()
 
 BinSummary (const BinSummary &)
 
BinSummaryoperator= (const BinSummary &)
 
template<class Accumulator >
 BinSummary (const Accumulator &acc)
 
template<class Accumulator >
BinSummaryoperator= (const Accumulator &acc)
 
 BinSummary (bool location)
 
 BinSummary (unsigned char location)
 
 BinSummary (int location)
 
 BinSummary (long location)
 
 BinSummary (float location)
 
 BinSummary (double location)
 
BinSummaryoperator= (const double &location)
 
BinSummaryoperator= (const bool &loc)
 
BinSummaryoperator= (const unsigned char &loc)
 
BinSummaryoperator= (const int &loc)
 
BinSummaryoperator= (const long &loc)
 
BinSummaryoperator= (const float &loc)
 
double location () const
 
double rangeDown () const
 
double rangeUp () const
 
double stdev () const
 
double min () const
 
double max () const
 
double noThrowStdev (double valueIfNoData=0.0) const
 
double noThrowMin (double valueIfNoData=-DBL_MAX) const
 
double noThrowMax (double valueIfNoData=DBL_MAX) const
 
bool hasStdev () const
 
bool hasMin () const
 
bool hasMax () const
 
bool hasLimits () const
 
void setLocation (double newValue)
 
void setStdev (double newValue)
 
void setRangeDown (double newValue)
 
void setRangeUp (double newValue)
 
void setRanges (double newRangeDown, double newRangeUp)
 
void setMin (double newValue)
 
void setMax (double newValue)
 
void setLimits (double newMin, double newMax)
 
void setLocationAndLimits (double newLocation, double newMin, double newMax)
 
void shift (double delta)
 
void scaleWidth (double scale)
 
void symmetrizeRanges ()
 
BinSummaryoperator*= (double scaleFactor)
 
BinSummaryoperator/= (const double denom)
 
BinSummary operator* (const double r) const
 
BinSummary operator/ (const double r) const
 
BinSummaryoperator+= (const BinSummary &r)
 
BinSummaryoperator-= (const BinSummary &r)
 
BinSummary operator+ (const BinSummary &r) const
 
BinSummary operator- (const BinSummary &r) const
 
bool operator== (const BinSummary &r) const
 
bool operator!= (const BinSummary &r) const
 
gs::ClassId classId () const
 
bool write (std::ostream &of) const
 

Static Public Member Functions

static const char * classname ()
 
static unsigned version ()
 
static void restore (const gs::ClassId &id, std::istream &in, BinSummary *acc)
 

Detailed Description

A type which can be used as a histogram bin in order to display bin values as mean with variance or as a five-number summary in box plots

Constructor & Destructor Documentation

◆ BinSummary() [1/6]

npstat::BinSummary::BinSummary ( double  location,
double  rangeDown,
double  rangeUp 
)

Both rangeDown and rangeUp arguments in this constructor must be non-negative

◆ BinSummary() [2/6]

npstat::BinSummary::BinSummary ( double  location,
double  rangeDown,
double  rangeUp,
double  minValue,
double  maxValue 
)

Both rangeDown and rangeUp arguments in this constructor must be non-negative. "minValue" and "maxValue" complete the five-number summary.

◆ BinSummary() [3/6]

npstat::BinSummary::BinSummary ( double  location,
double  stdev 
)

This constructor sets both rangeDown and rangeUp to the same value (which must be non-negative)

◆ BinSummary() [4/6]

npstat::BinSummary::BinSummary ( )

The default constructor is equivalent to BinSummary(0.0, 0.0)

◆ BinSummary() [5/6]

template<class Accumulator >
npstat::BinSummary::BinSummary ( const Accumulator &  acc)

Converting constructor from accumulator classes. If accumulators on the right side contain no data, BinSummary will look as if it was made by the default constructor.

◆ BinSummary() [6/6]

npstat::BinSummary::BinSummary ( bool  location)

Constructors from a single number (the location)

Member Function Documentation

◆ hasStdev()

bool npstat::BinSummary::hasStdev ( ) const

Check if the corresponding quantity is set

◆ location()

double npstat::BinSummary::location ( ) const
inline

Standard plotting accessor

◆ min()

double npstat::BinSummary::min ( ) const

min() and max() will throw std::runtime_error in case the corresponding quantities are not set

◆ noThrowStdev()

double npstat::BinSummary::noThrowStdev ( double  valueIfNoData = 0.0) const

This accessor will not throw an exception in case the corresponding quantities are undefined. Instead, it will return its argument.

◆ operator!=()

bool npstat::BinSummary::operator!= ( const BinSummary r) const
inline

Logical negation of operator==

◆ operator*()

BinSummary npstat::BinSummary::operator* ( const double  r) const
inline

Multiplication of all elements by a constant

◆ operator*=()

BinSummary& npstat::BinSummary::operator*= ( double  scaleFactor)

In-place multiplication of all elements by a constant

◆ operator+()

BinSummary npstat::BinSummary::operator+ ( const BinSummary r) const
inline

Binary addition of two summaries

◆ operator+=()

BinSummary& npstat::BinSummary::operator+= ( const BinSummary r)

Add another summary to this one assuming that both represent independent Gaussian distributions.

This operator will work only in the case lower and upper ranges are symmetric in both summaries. If either min or max are undefined in any of the summaries, both of them will be undefined in this object after this operator runs. Uncertainties are added in quadrature.

◆ operator-()

BinSummary npstat::BinSummary::operator- ( const BinSummary r) const
inline

Binary subtraction of two summaries

◆ operator-=()

BinSummary& npstat::BinSummary::operator-= ( const BinSummary r)

Subtract another summary from this one assuming that both represent independent Gaussian distributions.

This operator will work only in the case lower and upper ranges are symmetric in both summaries. If either min or max are undefined in any of the summaries, both of them will be undefined in this object after this operator runs. Note that "-=" does not undo "+=": it is assumed that the correlation is 0 in both cases and uncertainties are added in quadrature.

◆ operator/()

BinSummary npstat::BinSummary::operator/ ( const double  r) const
inline

Division of all elements by a constant

◆ operator/=()

BinSummary& npstat::BinSummary::operator/= ( const double  denom)
inline

In-place division of all elements by a constant

◆ operator=() [1/2]

template<class Accumulator >
BinSummary& npstat::BinSummary::operator= ( const Accumulator &  acc)
inline

Converting assignment operator from accumulator classes

◆ operator=() [2/2]

BinSummary& npstat::BinSummary::operator= ( const double &  location)

Assignment operators from a single number (the location)

◆ operator==()

bool npstat::BinSummary::operator== ( const BinSummary r) const

Comparison for equality

◆ scaleWidth()

void npstat::BinSummary::scaleWidth ( double  scale)

Change the width of the represented distribution by a certain factor

◆ setLocation()

void npstat::BinSummary::setLocation ( double  newValue)

Modifier method (what it does is obvious from the method name). Will throw std::invalid_argument in case changing the value would result in an inconsistent object.

◆ shift()

void npstat::BinSummary::shift ( double  delta)

Shift the location of the represented distribution

◆ stdev()

double npstat::BinSummary::stdev ( ) const

stdev() throws std::runtime_error in case rangeDown() and rangeUp() would return different values

◆ symmetrizeRanges()

void npstat::BinSummary::symmetrizeRanges ( )

Symmetrize the ranges. Equivalent to calling setStdev() with the value set to the arithmetic average of the upper and lower range.


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