MINT2
|
#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 |
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 15 of file StatisticsFinder.h.
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 14 of file StatisticsFinder.cpp.
|
virtual |
void StatisticsFinder::add | ( | const double & | x, |
const double & | weight = 1.0 |
||
) |
Add a value (with optional weight) to the StatisticsFinder
Definition at line 87 of file StatisticsFinder.cpp.
double StatisticsFinder::expX | ( | ) | const |
calculate and return the expectation value of X
Definition at line 145 of file StatisticsFinder.cpp.
double StatisticsFinder::expX2 | ( | ) | const |
calculate and return the expectation value of X^2
Definition at line 153 of file StatisticsFinder.cpp.
double StatisticsFinder::expX3 | ( | ) | const |
calculate and return the expectation value of X^3
Definition at line 161 of file StatisticsFinder.cpp.
double StatisticsFinder::expX4 | ( | ) | const |
calculate and return the expectation value of X^4
Definition at line 169 of file StatisticsFinder.cpp.
double StatisticsFinder::fourthCentralMom | ( | ) | const |
|
inline |
max value added to the StatisticsFinder
Definition at line 62 of file StatisticsFinder.h.
|
inline |
min value added to the StatisticsFinder
Definition at line 61 of file StatisticsFinder.h.
double StatisticsFinder::mean | ( | ) | const |
double StatisticsFinder::meanError | ( | ) | const |
double StatisticsFinder::median | ( | ) | const |
The median
Definition at line 54 of file StatisticsFinder.cpp.
|
private |
A warning that is shown if ordered events are needed (but haven't been stored)
Definition at line 33 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 76 of file StatisticsFinder.cpp.
|
inline |
numer of events added to the StatisticsFinder
Definition at line 43 of file StatisticsFinder.h.
|
inline |
max - min value added to the StatisticsFinder
Definition at line 64 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 179 of file StatisticsFinder.cpp.
double StatisticsFinder::varience | ( | ) | const |
calculate and return the varience
Definition at line 124 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 45 of file StatisticsFinder.cpp.
double StatisticsFinder::width | ( | ) | const |
calculate and return the width
Definition at line 131 of file StatisticsFinder.cpp.
double StatisticsFinder::widthError | ( | ) | const |
calculate and return the error on the width
Definition at line 138 of file StatisticsFinder.cpp.
|
private |
Keep a list of the values added (so the median can be found)
Definition at line 30 of file StatisticsFinder.h.
|
private |
The largest member added to the StatisticsFinder
Definition at line 18 of file StatisticsFinder.h.
|
private |
The smallest member added to the StatisticsFinder
Definition at line 17 of file StatisticsFinder.h.
|
private |
The number of events added to the StatisticsFinder
Definition at line 20 of file StatisticsFinder.h.
|
mutableprivate |
list of the values added
Definition at line 31 of file StatisticsFinder.h.
|
private |
The sum of weights
Definition at line 25 of file StatisticsFinder.h.
|
private |
The weighted sum of values added to the StatisticsFinder
Definition at line 21 of file StatisticsFinder.h.
|
private |
The weighted sum of values^2 added to the StatisticsFinder
Definition at line 22 of file StatisticsFinder.h.
|
private |
The weighted sum of values^3 added to the StatisticsFinder
Definition at line 23 of file StatisticsFinder.h.
|
private |
The weighted sum of values^4 added to the StatisticsFinder
Definition at line 24 of file StatisticsFinder.h.