Class PDF
Defined in File PDF.h
Class Documentation
-
class PDF
Implement a probability density function. In order to avoid duplicating code, this class is also able to store the chi2 curve. By construction the xaxis of the pdf is linearly sampled.
Public Functions
-
PDF(const double min, const double max, const size_t size)
Standard constructor.
- Parameters:
min – start value for the x axis
max – end value for the x axis
size – number of points on the x axis grid The resulting points on the grid are thus : \(x[k] = min + k\frac{max-min}{size-1}\)
-
inline ~PDF()
Destructor. Clear internal vectors xaxis, vPDF, chi2.
-
double normalization()
Normalize the vPDF vector to 1.
A simple trapezoidal rule is used.
-
vector<double> cumulant()
-
void chi2toPDF()
Compute \(e^{-\chi^2/2}\) from the vector of \(\chi^2\) values chi2.
-
int chi2mini()
index of the minimum \(\chi^2\) value
-
pair<double, double> uncMin(double dchi)
compute the bounds of the confidence interval defined by \(\chi^2_{min} + dchi\)
-
double probaBay(double xvalue)
return the inverse cumulative function at xvalue
-
size_t index(const double inVal) const
return the vector index where the pdf vector is closest to inVal
- Parameters:
inVal – input value
- Returns:
: return i so that pdf[i]<=inVal<pdf[i+1] if possible else return i=0 if inVal<pdf[0] or i=size-1 if inVal>pdf[size-1] ! return the vector index where the pdf vector is closest to inVal
-
void secondMax(const double win)
search for high peaks in The ML function vs xaxis, and sort them from highest to smallest peaks in ML
-
double levelCumu2x(float xval)
-
pair<double, double> improve_extremum(bool is_chi2) const
Improve the the grid extremum by quadratic approximation around it
In all these cases, the returned pair is current min and its y value. !
- Parameters:
is_chi2 – is the extremum to be found for the chi2 yaxis (a minimum or the PDF yaxis (a maximum)
- Returns:
(xmin, ymin): the pair x,y at the found minimum unless :
for chi2 fit one of the 3 y values set to HIGH_CHI2
for the PDF fit one of the 3 y values set to 0
if the distance between the midpoint in x (the grid minimum) and any of the other 2 points is more than 0.5 in x.
-
pair<double, double> confidence_interval(float level)
Compute the confidence interval around the chi2min
- Parameters:
level – confidence level (value to add to the min chi2 to define the interval)
- Returns:
pair: the bounds of the interval !
-
pair<double, double> credible_interval(float level, double val)
Compute a credible interval on the PDF
- Parameters:
level – confidence level
val – the value around which the interval is computed The interval is symmetric as built : level/2 is the mass on each side of
val, unless the boundaries are met. In this case the mass is maximised to the boundary, and the rest is allocated on the other side !
-
inline size_t size() const
Return the size of the x array.
-
PDF(const double min, const double max, const size_t size)