-
Notifications
You must be signed in to change notification settings - Fork 6
/
statistics.hh
46 lines (34 loc) · 1.33 KB
/
statistics.hh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#ifndef __STATISTICS_HH__
#define __STATISTICS_HH__
#include <vector>
#include "fit.hh"
class TF1;
class TH1D;
class TGraph;
// lognormal distribution where par[0] is the median and par[1] is the variance
double lognormal(double *x, double *par);
// gaussian distribution where par[0] is the median and par[1] is the variance
double gaussian(double *x, double *par);
// gamma distribution where par[0] is the median and par[1] is the variance
double gamma(double *x, double *par);
// evaluate the interval given a posterior distribution, alpha, and left side tail
std::pair<double, double> evaluateInterval(TGraph* posterior, double alpha=0.05, double leftsidetail=0.0);
// get the quantiles for a set of numbers/limits
void getQuantiles(std::vector<double>& limits, double &median, std::pair<double, double>& onesigma, std::pair<double, double>& twosigma);
// get a random lognormal value given a value for the median and variance
class RandomPrior
{
public:
RandomPrior(int priorType, double median, double variance, double min, double max);
virtual ~RandomPrior();
double getRandom(void) const;
double getXmin(void) const;
double getXmax(void) const;
double eval(double x) const;
int getPriorType(void) const;
private:
TF1* priorfcn_;
static int counter_;
int priorType_;
};
#endif