![]() |
Belle II Software
release-05-02-19
|
This class holds the prior distribution for a single particle species. More...
#include <PIDPriorsTable.h>
Public Member Functions | |
void | setBinEdges (const std::vector< float > &binEdgesX, const std::vector< float > &binEdgesY) |
Sets the bin edges arrays. More... | |
void | setPriorsTable (const std::vector< float > &priors) |
Sets the priors table from a 2D std::vector. More... | |
void | setErrorsTable (const std::vector< float > &errors) |
Sets the priors error table from a 2D std::vector. More... | |
void | setPriorValue (float x, float y, float value) |
Sets the prior value for a single bin. More... | |
void | setErrorValue (float x, float y, float value) |
Sets the error on the prior value for a single bin. More... | |
void | setAxisLabels (const std::string &labelX, const std::string &labelY) |
Sets axes lables. More... | |
float | getPriorInBin (int iX, int iY) const |
Returns the prior probability for a given bin. More... | |
float | getErrorInBin (int iX, int iY) const |
Returns the error on prior probability for a given bin. More... | |
float | getPriorValue (float x, float y) const |
Returns the prior probability for a given value of (x,y). More... | |
float | getErrorValue (float x, float y) const |
Returns the error on the prior probability for a given value of (x,y). More... | |
std::string | getXAxisLabel () const |
Returns the X axis label. More... | |
std::string | getYAxisLabel () const |
Returns the Y axis label. More... | |
void | printPrior () const |
Prints the content of the table and the axes. | |
void | printError () const |
Prints the content of the error table and the axes. | |
Private Member Functions | |
bool | checkRange (const std::string &text, float val, const std::vector< float > &edges) const |
Checks is a values is withing the range of an array. More... | |
short | findBin (float val, std::vector< float > array) const |
This function returns the position of a number in a sorted array of bin edges. More... | |
short | findBinFast (float val, std::vector< float > array) const |
This function returns the position of a number in a sorted array of bin edges This implementation should be more clever than the binary search implemented in findBin, but at the very end it seems to be slower. More... | |
short | findBinWithFixedWidth (float val, std::vector< float > array) const |
This function returns the position of a number in a sorted array of bin edges, assuming that the atter are equally spaced. More... | |
Private Attributes | |
std::vector< float > | m_binEdgesX = {} |
The array containing the bin edges for the X axis. | |
std::vector< float > | m_binEdgesY = {} |
The array containing the bin edges for the Y axis. | |
std::vector< float > | m_priors |
The matrix with the prior probabilities. | |
std::vector< float > | m_errors |
The the matrix with the errors on the prior probabilities. | |
std::string | m_xAxisLabel = "" |
label of the X axis, indicating which variable is represented here | |
std::string | m_yAxisLabel = "" |
label of the Y axis, indicating which variable is represented here | |
This class holds the prior distribution for a single particle species.
Its basic data members are two 2D matrixes of floats (one for the probablity, one for it uncertainties) plus two arrays for the bins edges. All these elements, including the matrixes, are implemented as 1 dimensional vectors. The PIDPriors class that is stored in the database is basically nothing but a collection of 6 of these objects, one per particle species.
Definition at line 37 of file PIDPriorsTable.h.
|
private |
Checks is a values is withing the range of an array.
val | the value |
array | the std::vector the val has to be found |
Definition at line 153 of file PIDPriorsTable.cc.
|
private |
This function returns the position of a number in a sorted array of bin edges.
val | the value |
array | the std::vector the val has to be found |
Definition at line 165 of file PIDPriorsTable.cc.
|
private |
This function returns the position of a number in a sorted array of bin edges This implementation should be more clever than the binary search implemented in findBin, but at the very end it seems to be slower.
It's kept in here just in case someone passes by and finds a way to speed it up.
val | the value |
array | the std::vector the val has to be found |
Definition at line 172 of file PIDPriorsTable.cc.
|
private |
This function returns the position of a number in a sorted array of bin edges, assuming that the atter are equally spaced.
val | the value |
array | the std::vector the val has to be found |
Definition at line 192 of file PIDPriorsTable.cc.
|
inline |
Returns the error on prior probability for a given bin.
If the bin is outside of the table boundaries, 0 will be returned.
iX | bin number on the X axis |
iY | bin number on the Y axis |
Definition at line 121 of file PIDPriorsTable.h.
float getErrorValue | ( | float | x, |
float | y | ||
) | const |
Returns the error on the prior probability for a given value of (x,y).
If the bin is outside of the table boundaries, 0 will be returned.
x | the x-value of the x coordinate |
y | the y-value of the y coordinate |
Definition at line 90 of file PIDPriorsTable.cc.
|
inline |
Returns the prior probability for a given bin.
If the bin is outside of the table boundaries, 0 will be returned.
iX | bin number on the X axis |
iY | bin number on the Y axis |
Definition at line 109 of file PIDPriorsTable.h.
float getPriorValue | ( | float | x, |
float | y | ||
) | const |
Returns the prior probability for a given value of (x,y).
If the bin is outside of the table boundaries, 0 will be returned.
x | the x-value of the x coordinate |
y | the y-value of the y coordinate |
Definition at line 80 of file PIDPriorsTable.cc.
|
inline |
|
inline |
|
inline |
Sets axes lables.
labelX | the label of the X axis |
labelY | the label of the X axis |
Definition at line 95 of file PIDPriorsTable.h.
void setBinEdges | ( | const std::vector< float > & | binEdgesX, |
const std::vector< float > & | binEdgesY | ||
) |
Sets the bin edges arrays.
Please notice that setting the axes will also automatically clear the tables.
binEdgesX | the vector of bin edges for the X axis |
binEdgesY | the vector of bin edges for the Y axis |
Definition at line 18 of file PIDPriorsTable.cc.
|
inline |
Sets the priors error table from a 2D std::vector.
errors | 2D std:vector of floats containing the error on the prior probaiblity for each bin |
Definition at line 65 of file PIDPriorsTable.h.
void setErrorValue | ( | float | x, |
float | y, | ||
float | value | ||
) |
Sets the error on the prior value for a single bin.
x | the x-value of the x coordinate |
y | the y-value of the y coordinate |
value | the x-value of the prior probability error associated to x and y |
Definition at line 68 of file PIDPriorsTable.cc.
|
inline |
Sets the priors table from a 2D std::vector.
priors | 2D std:vector of floats containing the prior probaiblity for each bin |
Definition at line 54 of file PIDPriorsTable.h.
void setPriorValue | ( | float | x, |
float | y, | ||
float | value | ||
) |
Sets the prior value for a single bin.
x | the x-value of the x coordinate |
y | the y-value of the y coordinate |
value | the x-value of the prior probability associated to x and y |
Definition at line 53 of file PIDPriorsTable.cc.