Logo ROOT  
Reference Guide
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_t>& samplingDist, const char * varName = 0);
34 SamplingDistribution(const char *name,const char *title,
35 std::vector<Double_t>& samplingDist, std::vector<Double_t>& sampleWeights, const char * varName = 0);
36
37
38 SamplingDistribution(const char *name,const char *title, const char * varName = 0);
39
40 SamplingDistribution(const char *name,const char *title, RooDataSet& dataSet, const char * columnName = 0, const char * varName = 0);
41
42 /// Default constructor for SamplingDistribution
44
45 /// Destructor of SamplingDistribution
46 virtual ~SamplingDistribution();
47
48 /// get the inverse of the Cumulative distribution function
50
51 /// get the inverse of the Cumulative distribution function
53
54 /// get the inverse of the Cumulative distribution function
55 /// together with the inverse based on sampling variation
56 Double_t InverseCDF(Double_t pvalue, Double_t sigmaVariaton, Double_t& 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_t> & GetSamplingDistribution() const {return fSamplingDist;}
66 /// Get the sampling weights
67 const std::vector<Double_t> & GetSampleWeights() const {return fSampleWeights;}
68
69 const TString GetVarName() const {return fVarName;}
70
71 /// numerical integral in these limits
72 Double_t Integral(Double_t low, Double_t high, Bool_t normalize = kTRUE, Bool_t lowClosed = kTRUE, Bool_t highClosed = kFALSE) const;
73
74 /// numerical integral in these limits including error estimation
75 Double_t IntegralAndError(Double_t & error, Double_t low, Double_t high, Bool_t normalize = kTRUE,
76 Bool_t lowClosed = kTRUE, Bool_t highClosed = kFALSE) const;
77
78 /// calculate CDF as a special case of Integral(...) with lower limit equal to -inf
79 Double_t CDF(Double_t x) const;
80
81 private:
82
83 mutable std::vector<Double_t> fSamplingDist; /// vector of points for the sampling distribution
84 mutable std::vector<Double_t> fSampleWeights; /// vector of weights for the samples
85 // store a RooRealVar that this distribution corresponds to?
86
88
89 mutable std::vector<Double_t> fSumW; //! Cached vector with sum of the weight used to compute integral
90 mutable std::vector<Double_t> fSumW2; //! Cached vector with sum of the weight used to compute integral error
91
92 protected:
93
94 /// internal function to sort values
95 void SortValues() const;
96
97 ClassDef(SamplingDistribution,2) /// Class containing the results of the HybridCalculator
98 };
99}
100
101#endif
int Int_t
Definition: RtypesCore.h:41
const Bool_t kFALSE
Definition: RtypesCore.h:88
bool Bool_t
Definition: RtypesCore.h:59
double Double_t
Definition: RtypesCore.h:55
const Bool_t kTRUE
Definition: RtypesCore.h:87
#define ClassDef(name, id)
Definition: Rtypes.h:326
char name[80]
Definition: TGX11.cxx:109
RooDataSet is a container class to hold unbinned data.
Definition: RooDataSet.h:31
This class simply holds a sampling distribution of some test statistic.
virtual ~SamplingDistribution()
Destructor of SamplingDistribution.
Double_t InverseCDF(Double_t pvalue)
get the inverse of the Cumulative distribution function
Double_t Integral(Double_t low, Double_t high, Bool_t normalize=kTRUE, Bool_t lowClosed=kTRUE, Bool_t highClosed=kFALSE) const
numerical integral in these limits
Int_t GetSize() const
size of samples
Double_t IntegralAndError(Double_t &error, Double_t low, Double_t high, Bool_t normalize=kTRUE, Bool_t lowClosed=kTRUE, Bool_t highClosed=kFALSE) const
numerical integral in these limits including error estimation
SamplingDistribution()
Default constructor for SamplingDistribution.
Double_t CDF(Double_t x) const
calculate CDF as a special case of Integral(...) with lower limit equal to -inf
std::vector< Double_t > fSumW2
Cached vector with sum of the weight used to compute integral.
TString fVarName
vector of weights for the samples
Double_t InverseCDFInterpolate(Double_t pvalue)
get the inverse of the Cumulative distribution function
const std::vector< Double_t > & GetSamplingDistribution() const
Get test statistics values.
void Add(const SamplingDistribution *other)
merge two sampling distributions
std::vector< Double_t > fSampleWeights
vector of points for the sampling distribution
void SortValues() const
Cached vector with sum of the weight used to compute integral error.
std::vector< Double_t > fSamplingDist
const std::vector< Double_t > & GetSampleWeights() const
Get the sampling weights.
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
Basic string class.
Definition: TString.h:131
Double_t x[n]
Definition: legend1.C:17
Namespace for the RooStats classes.
Definition: Asimov.h:20