HyperPlot  v1
Bin and visualise multidimensional datasets
Public Member Functions | Private Member Functions | Private Attributes | List of all members
StatisticsFinder Class Reference

Detailed Description

HyperPlot, Author: Sam Harnew, sam.h.nosp@m.arne.nosp@m.w@gma.nosp@m.il.c.nosp@m.om , Date: Dec 2015

Used to find statistics for a dataset.

Definition at line 16 of file StatisticsFinder.h.

#include <StatisticsFinder.h>

Inheritance diagram for StatisticsFinder:
MeanFinder MinMaxFinder WidthErrorFinder WidthFinder

Public Member Functions

 StatisticsFinder (bool mean=1, bool width=1, bool widthError=1, bool keepOrderedEvents=0)
 
double median () const
 
double numEvents () const
 
void add (const double &x, const double &weight=1.0)
 
double mean () const
 
double meanError () const
 
double varience () const
 
double width () const
 
double widthError () const
 
double expX () const
 
double expX2 () const
 
double expX3 () const
 
double expX4 () const
 
double secondCentralMom () const
 
double fourthCentralMom () const
 
const double & getMin () const
 
const double & getMax () const
 
double range () const
 
virtual ~StatisticsFinder ()
 

Private Member Functions

bool needOrderedEvents () const
 
void warnIfWeightedEvents () const
 
bool notEnoughInformation (const double &val) const
 

Private Attributes

double _min
 
double _max
 
double _nEvents
 
double _wSum
 
double _wSum2
 
double _wSum3
 
double _wSum4
 
double _sumW
 
int _keepOrderedEvents
 
std::vector< double > _orderedEvents
 

Constructor & Destructor Documentation

StatisticsFinder::StatisticsFinder ( bool  mean = 1,
bool  width = 1,
bool  widthError = 1,
bool  keepOrderedEvents = 0 
)

In the constuctor you decide what things you want to be stored once you start adding values. This will determine what statistics you are able to calcuate later

Definition at line 11 of file StatisticsFinder.cpp.

StatisticsFinder::~StatisticsFinder ( )
virtual

Destructor

Definition at line 182 of file StatisticsFinder.cpp.

Member Function Documentation

void StatisticsFinder::add ( const double &  x,
const double &  weight = 1.0 
)

Add a value (with optional weight) to the StatisticsFinder

Definition at line 74 of file StatisticsFinder.cpp.

double StatisticsFinder::expX ( ) const

calculate and return the expectation value of X

Definition at line 132 of file StatisticsFinder.cpp.

double StatisticsFinder::expX2 ( ) const

calculate and return the expectation value of X^2

Definition at line 140 of file StatisticsFinder.cpp.

double StatisticsFinder::expX3 ( ) const

calculate and return the expectation value of X^3

Definition at line 148 of file StatisticsFinder.cpp.

double StatisticsFinder::expX4 ( ) const

calculate and return the expectation value of X^4

Definition at line 156 of file StatisticsFinder.cpp.

double StatisticsFinder::fourthCentralMom ( ) const

calculate and return the second central moment

E[(X - E(X))^4] = E[X^4] - 4E[X]E[X^3] + 6E[X]^2 E[X^2] - 3 E[X]^4

Definition at line 175 of file StatisticsFinder.cpp.

const double& StatisticsFinder::getMax ( ) const
inline

max value added to the StatisticsFinder

Definition at line 63 of file StatisticsFinder.h.

const double& StatisticsFinder::getMin ( ) const
inline

min value added to the StatisticsFinder

Definition at line 62 of file StatisticsFinder.h.

double StatisticsFinder::mean ( ) const

calculate and return the mean

Definition at line 97 of file StatisticsFinder.cpp.

double StatisticsFinder::meanError ( ) const

calculate and return the error on the mean

Definition at line 104 of file StatisticsFinder.cpp.

double StatisticsFinder::median ( ) const

The median

Definition at line 51 of file StatisticsFinder.cpp.

bool StatisticsFinder::needOrderedEvents ( ) const
private

A warning that is shown if ordered events are needed (but haven't been stored)

Definition at line 30 of file StatisticsFinder.cpp.

bool StatisticsFinder::notEnoughInformation ( const double &  val) const
private

A warning that is shown if not enough information has been provided to calculate what you want

Definition at line 63 of file StatisticsFinder.cpp.

double StatisticsFinder::numEvents ( ) const
inline

numer of events added to the StatisticsFinder

Definition at line 44 of file StatisticsFinder.h.

double StatisticsFinder::range ( ) const
inline

max - min value added to the StatisticsFinder

Definition at line 65 of file StatisticsFinder.h.

double StatisticsFinder::secondCentralMom ( ) const

calculate and return the second central moment

E[(X - E(X))^2] = E[X^2] - E[X]^2

Definition at line 166 of file StatisticsFinder.cpp.

double StatisticsFinder::varience ( ) const

calculate and return the varience

Definition at line 111 of file StatisticsFinder.cpp.

void StatisticsFinder::warnIfWeightedEvents ( ) const
private

A warning that is shown if the value being returned is meaningless because weights have been used

Definition at line 42 of file StatisticsFinder.cpp.

double StatisticsFinder::width ( ) const

calculate and return the width

Definition at line 118 of file StatisticsFinder.cpp.

double StatisticsFinder::widthError ( ) const

calculate and return the error on the width

Definition at line 125 of file StatisticsFinder.cpp.

Member Data Documentation

int StatisticsFinder::_keepOrderedEvents
private

Keep a list of the values added (so the median can be found)

Definition at line 31 of file StatisticsFinder.h.

double StatisticsFinder::_max
private

The largest member added to the StatisticsFinder

Definition at line 19 of file StatisticsFinder.h.

double StatisticsFinder::_min
private

The smallest member added to the StatisticsFinder

Definition at line 18 of file StatisticsFinder.h.

double StatisticsFinder::_nEvents
private

The number of events added to the StatisticsFinder

Definition at line 21 of file StatisticsFinder.h.

std::vector<double> StatisticsFinder::_orderedEvents
private

list of the values added

Definition at line 32 of file StatisticsFinder.h.

double StatisticsFinder::_sumW
private

The sum of weights

Definition at line 26 of file StatisticsFinder.h.

double StatisticsFinder::_wSum
private

The weighted sum of values added to the StatisticsFinder

Definition at line 22 of file StatisticsFinder.h.

double StatisticsFinder::_wSum2
private

The weighted sum of values^2 added to the StatisticsFinder

Definition at line 23 of file StatisticsFinder.h.

double StatisticsFinder::_wSum3
private

The weighted sum of values^3 added to the StatisticsFinder

Definition at line 24 of file StatisticsFinder.h.

double StatisticsFinder::_wSum4
private

The weighted sum of values^4 added to the StatisticsFinder

Definition at line 25 of file StatisticsFinder.h.


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