Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
SamplingDistribution.h
Go to the documentation of this file.
1// @(#)root/roostats:$Id$
2
3/*************************************************************************
4 * Project: RooStats *
5 * Package: RooFit/RooStats *
6 * Authors: *
7 * Kyle Cranmer, Lorenzo Moneta, Gregory Schott, Wouter Verkerke *
8 *************************************************************************
9 * Copyright (C) 1995-2008, Rene Brun and Fons Rademakers. *
10 * All rights reserved. *
11 * *
12 * For the licensing terms see $ROOTSYS/LICENSE. *
13 * For the list of contributors see $ROOTSYS/README/CREDITS. *
14 *************************************************************************/
15
16#ifndef ROOSTATS_SamplingDistribution
17#define ROOSTATS_SamplingDistribution
18
19#include "TNamed.h"
20
21#include "Rtypes.h"
22#include "RooDataSet.h"
23
24#include <vector>
25
26namespace RooStats {
27
29
30 public:
31
32 /// Constructor for SamplingDistribution
33 SamplingDistribution(const char *name,const char *title, std::vector<double>& samplingDist, const char * varName = nullptr);
34 SamplingDistribution(const char *name,const char *title,
35 std::vector<double>& samplingDist, std::vector<double>& sampleWeights, const char * varName = nullptr);
36
37
38 SamplingDistribution(const char *name,const char *title, const char * varName = nullptr);
39
40 SamplingDistribution(const char *name,const char *title, RooDataSet& dataSet, const char * columnName = nullptr, const char * varName = nullptr);
41
42 /// Default constructor for SamplingDistribution
44
45 /// Destructor of SamplingDistribution
46 ~SamplingDistribution() override;
47
48 /// get the inverse of the Cumulative distribution function
49 double InverseCDF(double pvalue);
50
51 /// get the inverse of the Cumulative distribution function
52 double InverseCDFInterpolate(double pvalue);
53
54 /// get the inverse of the Cumulative distribution function
55 /// together with the inverse based on sampling variation
56 double InverseCDF(double pvalue, double sigmaVariaton, double& inverseVariation);
57
58 /// merge two sampling distributions
59 void Add(const SamplingDistribution* other);
60
61 /// size of samples
62 Int_t GetSize() const{return fSamplingDist.size();}
63
64 /// Get test statistics values
65 const std::vector<double> & GetSamplingDistribution() const {return fSamplingDist;}
66 /// Get the sampling weights
67 const std::vector<double> & GetSampleWeights() const {return fSampleWeights;}
68
69 const TString GetVarName() const {return fVarName;}
70
71 /// numerical integral in these limits
72 double Integral(double low, double high, bool normalize = true, bool lowClosed = true, bool highClosed = false) const;
73
74 /// numerical integral in these limits including error estimation
75 double IntegralAndError(double & error, double low, double high, bool normalize = true,
76 bool lowClosed = true, bool highClosed = false) const;
77
78 /// calculate CDF as a special case of Integral(...) with lower limit equal to -inf
79 double CDF(double x) const;
80
81 private:
82
83 mutable std::vector<double> fSamplingDist; ///< vector of points for the sampling distribution
84 mutable std::vector<double> fSampleWeights; ///< vector of weights for the samples
85
87
88 mutable std::vector<double> fSumW; ///<! Cached vector with sum of the weight used to compute integral
89 mutable std::vector<double> fSumW2; ///<! Cached vector with sum of the weight used to compute integral error
90
91 protected:
92
93 /// internal function to sort values
94 void SortValues() const;
95
96 ClassDefOverride(SamplingDistribution,2) /// Class containing the results of the HybridCalculator
97 };
98}
99
100#endif
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
char name[80]
Definition TGX11.cxx:110
Container class to hold unbinned data.
Definition RooDataSet.h:57
This class simply holds a sampling distribution of some test statistic.
double Integral(double low, double high, bool normalize=true, bool lowClosed=true, bool highClosed=false) const
numerical integral in these limits
double CDF(double x) const
calculate CDF as a special case of Integral(...) with lower limit equal to -inf
~SamplingDistribution() override
Destructor of SamplingDistribution.
std::vector< double > fSumW2
! Cached vector with sum of the weight used to compute integral error
double InverseCDFInterpolate(double pvalue)
get the inverse of the Cumulative distribution function
const std::vector< double > & GetSampleWeights() const
Get the sampling weights.
Int_t GetSize() const
size of samples
std::vector< double > fSumW
! Cached vector with sum of the weight used to compute integral
SamplingDistribution()
Default constructor for SamplingDistribution.
std::vector< double > fSamplingDist
vector of points for the sampling distribution
double IntegralAndError(double &error, double low, double high, bool normalize=true, bool lowClosed=true, bool highClosed=false) const
numerical integral in these limits including error estimation
double InverseCDF(double pvalue)
get the inverse of the Cumulative distribution function
void Add(const SamplingDistribution *other)
merge two sampling distributions
void SortValues() const
internal function to sort values
std::vector< double > fSampleWeights
vector of weights for the samples
const std::vector< double > & GetSamplingDistribution() const
Get test statistics values.
The TNamed class is the base class for all named ROOT classes.
Definition TNamed.h:29
Basic string class.
Definition TString.h:139
Double_t x[n]
Definition legend1.C:17
Namespace for the RooStats classes.
Definition Asimov.h:19