HyperPlot
v1
Bin and visualise multidimensional datasets
|
HyperPlot, Author: Sam Harnew, sam.h , Date: Dec 2015 arne w@gma il.c om
Used to find statistics for a dataset.
Definition at line 16 of file StatisticsFinder.h.
#include <StatisticsFinder.h>
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 |
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.
|
virtual |
Destructor
Definition at line 182 of file StatisticsFinder.cpp.
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.
|
inline |
max value added to the StatisticsFinder
Definition at line 63 of file StatisticsFinder.h.
|
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.
|
private |
A warning that is shown if ordered events are needed (but haven't been stored)
Definition at line 30 of file StatisticsFinder.cpp.
|
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.
|
inline |
numer of events added to the StatisticsFinder
Definition at line 44 of file StatisticsFinder.h.
|
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.
|
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.
|
private |
Keep a list of the values added (so the median can be found)
Definition at line 31 of file StatisticsFinder.h.
|
private |
The largest member added to the StatisticsFinder
Definition at line 19 of file StatisticsFinder.h.
|
private |
The smallest member added to the StatisticsFinder
Definition at line 18 of file StatisticsFinder.h.
|
private |
The number of events added to the StatisticsFinder
Definition at line 21 of file StatisticsFinder.h.
|
private |
list of the values added
Definition at line 32 of file StatisticsFinder.h.
|
private |
The sum of weights
Definition at line 26 of file StatisticsFinder.h.
|
private |
The weighted sum of values added to the StatisticsFinder
Definition at line 22 of file StatisticsFinder.h.
|
private |
The weighted sum of values^2 added to the StatisticsFinder
Definition at line 23 of file StatisticsFinder.h.
|
private |
The weighted sum of values^3 added to the StatisticsFinder
Definition at line 24 of file StatisticsFinder.h.
|
private |
The weighted sum of values^4 added to the StatisticsFinder
Definition at line 25 of file StatisticsFinder.h.