Logo ROOT   6.08/07
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 #ifndef ROOT_TNamed
20 #include "TNamed.h"
21 #endif
22 
23 #include "Rtypes.h"
24 #include "RooDataSet.h"
25 
26 
27 #include <vector>
28 
29 
30 namespace RooStats {
31 
32  /**
33 
34  \ingroup Roostats
35 
36  This class simply holds a sampling distribution of some test statistic.
37  The distribution can either be an empirical distribution (eg. the samples themselves) or
38  a weighted set of points (eg. for the FFT method).
39  The class supports merging.
40 
41  */
42 
43 
44  class SamplingDistribution : public TNamed {
45 
46  public:
47 
48  /// Constructor for SamplingDistribution
49  SamplingDistribution(const char *name,const char *title, std::vector<Double_t>& samplingDist, const char * varName = 0);
50  SamplingDistribution(const char *name,const char *title,
51  std::vector<Double_t>& samplingDist, std::vector<Double_t>& sampleWeights, const char * varName = 0);
52 
53 
54  SamplingDistribution(const char *name,const char *title, const char * varName = 0);
55 
56  SamplingDistribution(const char *name,const char *title, RooDataSet& dataSet, const char * columnName = 0, const char * varName = 0);
57 
58  /// Default constructor for SamplingDistribution
60 
61  /// Destructor of SamplingDistribution
62  virtual ~SamplingDistribution();
63 
64  /// get the inverse of the Cumulative distribution function
66 
67  /// get the inverse of the Cumulative distribution function
69 
70  /// get the inverse of the Cumulative distribution function
71  /// together with the inverse based on sampling variation
72  Double_t InverseCDF(Double_t pvalue, Double_t sigmaVariaton, Double_t& inverseVariation);
73 
74  /// merge two sampling distributions
75  void Add(const SamplingDistribution* other);
76 
77  /// size of samples
78  Int_t GetSize() const{return fSamplingDist.size();}
79 
80  /// Get test statistics values
81  const std::vector<Double_t> & GetSamplingDistribution() const {return fSamplingDist;}
82  /// Get the sampling weights
83  const std::vector<Double_t> & GetSampleWeights() const {return fSampleWeights;}
84 
85  const TString GetVarName() const {return fVarName;}
86 
87  /// numerical integral in these limits
88  Double_t Integral(Double_t low, Double_t high, Bool_t normalize = kTRUE, Bool_t lowClosed = kTRUE, Bool_t highClosed = kFALSE) const;
89 
90  /// numerical integral in these limits including error estimation
91  Double_t IntegralAndError(Double_t & error, Double_t low, Double_t high, Bool_t normalize = kTRUE,
92  Bool_t lowClosed = kTRUE, Bool_t highClosed = kFALSE) const;
93 
94  /// calculate CDF as a special case of Integral(...) with lower limit equal to -inf
95  Double_t CDF(Double_t x) const;
96 
97  private:
98 
99  mutable std::vector<Double_t> fSamplingDist; /// vector of points for the sampling distribution
100  mutable std::vector<Double_t> fSampleWeights; /// vector of weights for the samples
101  // store a RooRealVar that this distribution corresponds to?
102 
104 
105  mutable std::vector<Double_t> fSumW; //! Chached vector with sum of the weight used to compute integral
106  mutable std::vector<Double_t> fSumW2; //! Chached vector with sum of the weight used to compute integral error
107 
108  protected:
109 
110  /// internal function to sort values
111  void SortValues() const;
112 
113  ClassDef(SamplingDistribution,2) /// Class containing the results of the HybridCalculator
114  };
115 }
116 
117 #endif
const std::vector< Double_t > & GetSamplingDistribution() const
Get test statistics values.
std::vector< Double_t > fSumW2
Chached vector with sum of the weight used to compute integral.
TString fVarName
vector of weights for the samples
Double_t InverseCDF(Double_t pvalue)
get the inverse of the Cumulative distribution function
Basic string class.
Definition: TString.h:137
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
const std::vector< Double_t > & GetSampleWeights() const
Get the sampling weights.
std::vector< Double_t > fSampleWeights
vector of points for the sampling distribution
Double_t x[n]
Definition: legend1.C:17
#define ClassDef(name, id)
Definition: Rtypes.h:254
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:33
Double_t InverseCDFInterpolate(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
void SortValues() const
Chached vector with sum of the weight used to compute integral error.
std::vector< Double_t > fSamplingDist
Double_t CDF(Double_t x) const
calculate CDF as a special case of Integral(...) with lower limit equal to -inf
virtual ~SamplingDistribution()
Destructor of SamplingDistribution.
Int_t GetSize() const
size of samples
void Add(const SamplingDistribution *other)
merge two sampling distributions
RooDataSet is a container class to hold unbinned data.
Definition: RooDataSet.h:29
This class simply holds a sampling distribution of some test statistic.
Namespace for the RooStats classes.
Definition: Asimov.h:20
double Double_t
Definition: RtypesCore.h:55
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.
const Bool_t kTRUE
Definition: Rtypes.h:91
char name[80]
Definition: TGX11.cxx:109