Belle II Software light-2406-ragdoll
|
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. | |
void | setPriorsTable (const std::vector< float > &priors) |
Sets the priors table from a 2D std::vector. | |
void | setErrorsTable (const std::vector< float > &errors) |
Sets the priors error table from a 2D std::vector. | |
void | setPriorValue (float x, float y, float value) |
Sets the prior value for a single bin. | |
void | setErrorValue (float x, float y, float value) |
Sets the error on the prior value for a single bin. | |
void | setAxisLabels (const std::string &labelX, const std::string &labelY) |
Sets axes labels. | |
float | getPriorInBin (int iX, int iY) const |
Returns the prior probability for a given bin. | |
float | getErrorInBin (int iX, int iY) const |
Returns the error on prior probability for a given bin. | |
float | getPriorValue (float x, float y) const |
Returns the prior probability for a given value of (x,y). | |
float | getErrorValue (float x, float y) const |
Returns the error on the prior probability for a given value of (x,y). | |
std::string | getXAxisLabel () const |
Returns the X axis label. | |
std::string | getYAxisLabel () const |
Returns the Y axis label. | |
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 if a value is within the range of an array. | |
short | findBin (float val, std::vector< float > array) const |
This function returns the position of a number in a sorted array of bin edges. | |
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. | |
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 latter are equally spaced. | |
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 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 matrices of floats (one for the probability, one for it uncertainties) plus two arrays for the bins edges. All these elements, including the matrices, 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 27 of file PIDPriorsTable.h.
|
private |
Checks if a value is within the range of an array.
text | text to display in the warning message |
val | the value |
edges | the vector of bin edge values the val has to be found in |
Definition at line 152 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 164 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 171 of file PIDPriorsTable.cc.
|
private |
This function returns the position of a number in a sorted array of bin edges, assuming that the latter are equally spaced.
val | the value |
array | the std::vector the val has to be found |
Definition at line 191 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 111 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 89 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 99 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 79 of file PIDPriorsTable.cc.
|
inline |
Returns the X axis label.
Definition at line 139 of file PIDPriorsTable.h.
|
inline |
Returns the Y axis label.
Definition at line 148 of file PIDPriorsTable.h.
void printError | ( | ) | const |
Prints the content of the error table and the axes.
Definition at line 125 of file PIDPriorsTable.cc.
void printPrior | ( | ) | const |
Prints the content of the table and the axes.
Definition at line 99 of file PIDPriorsTable.cc.
|
inline |
Sets axes labels.
labelX | the label of the X axis |
labelY | the label of the X axis |
Definition at line 85 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 17 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 probability for each bin |
Definition at line 55 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 67 of file PIDPriorsTable.cc.
|
inline |
Sets the priors table from a 2D std::vector.
priors | 2D std:vector of floats containing the prior probability for each bin |
Definition at line 44 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 52 of file PIDPriorsTable.cc.
|
private |
The array containing the bin edges for the X axis.
Definition at line 167 of file PIDPriorsTable.h.
|
private |
The array containing the bin edges for the Y axis.
Definition at line 168 of file PIDPriorsTable.h.
|
private |
The matrix with the errors on the prior probabilities.
Definition at line 170 of file PIDPriorsTable.h.
|
private |
The matrix with the prior probabilities.
Definition at line 169 of file PIDPriorsTable.h.
|
private |
label of the X axis, indicating which variable is represented here
Definition at line 171 of file PIDPriorsTable.h.
|
private |
label of the Y axis, indicating which variable is represented here
Definition at line 172 of file PIDPriorsTable.h.