/usr/include/root/RooStats/HypoTestInverterResult.h is in libroot-roofit-dev 5.34.19+dfsg-1.2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 | // @(#)root/roostats:$Id$
// Author: Kyle Cranmer, Lorenzo Moneta, Gregory Schott, Wouter Verkerke
/*************************************************************************
* Copyright (C) 1995-2008, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* *
* For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/
#ifndef ROOSTATS_HypoTestInverterResult
#define ROOSTATS_HypoTestInverterResult
#ifndef ROOSTATS_SimpleInterval
#include "RooStats/SimpleInterval.h"
#endif
#include "RooStats/HypoTestResult.h"
class RooRealVar;
namespace RooStats {
class SamplingDistribution;
class HypoTestInverterResult : public SimpleInterval {
public:
// default constructor
explicit HypoTestInverterResult(const char* name = 0);
// constructor
HypoTestInverterResult( const char* name,
const RooRealVar& scannedVariable,
double cl ) ;
HypoTestInverterResult( const HypoTestInverterResult& other, const char* name );
// destructor
virtual ~HypoTestInverterResult();
// operator =
HypoTestInverterResult& operator = (const HypoTestInverterResult& other);
// remove points that appear to have failed.
int ExclusionCleanup();
// merge with the content of another HypoTestInverterResult object
bool Add( const HypoTestInverterResult& otherResult );
//add the result of a single point (an HypoTestRsult)
bool Add( Double_t x, const HypoTestResult & result );
// function to return the value of the parameter of interest for the i^th entry in the results
double GetXValue( int index ) const ;
// function to return the value of the confidence level for the i^th entry in the results
double GetYValue( int index ) const ;
// function to return the estimated error on the value of the confidence level for the i^th entry in the results
double GetYError( int index ) const ;
// return the observed CLsplusb value for the i-th entry
double CLsplusb( int index) const;
// return the observed CLb value for the i-th entry
double CLb( int index) const;
// return the observed CLb value for the i-th entry
double CLs( int index) const;
// return the observed CLsplusb value for the i-th entry
double CLsplusbError( int index) const;
// return the observed CLb value for the i-th entry
double CLbError( int index) const;
// return the observed CLb value for the i-th entry
double CLsError( int index) const;
// return a pointer to the i^th result object
HypoTestResult* GetResult( int index ) const ;
double GetLastYValue( ) const { return GetYValue( fXValues.size()-1); }
double GetLastXValue( ) const { return GetXValue( fXValues.size()-1); }
double GetLastYError( ) const { return GetYError( fXValues.size()-1); }
HypoTestResult * GetLastResult( ) const { return GetResult( fXValues.size()-1); }
// number of entries in the results array
int ArraySize() const { return fXValues.size(); };
int FindIndex(double xvalue) const;
// set the size of the test (rate of Type I error) (eg. 0.05 for a 95% Confidence Interval)
virtual void SetTestSize( Double_t size ) { fConfidenceLevel = 1.-size; }
// set the confidence level for the interval (eg. 0.95 for a 95% Confidence Interval)
virtual void SetConfidenceLevel( Double_t cl ) { fConfidenceLevel = cl; }
// set CLs threshold for exclusion cleanup function
inline void SetCLsCleanupThreshold( Double_t th ) { fCLsCleanupThreshold = th; }
// flag to switch between using CLsb (default) or CLs as confidence level
void UseCLs( bool on = true ) { fUseCLs = on; }
// query if one sided result
bool IsOneSided() const { return !fIsTwoSided; }
// query if two sided result
bool IsTwoSided() const { return fIsTwoSided; }
// lower and upper bound of the confidence interval (to get upper/lower limits, multiply the size( = 1-confidence level ) by 2
Double_t LowerLimit();
Double_t UpperLimit();
// rough estimation of the error on the computed bound of the confidence interval
// Estimate of lower limit error
//function evaluates only a rought error on the lower limit. Be careful when using this estimation
Double_t LowerLimitEstimatedError();
// Estimate of lower limit error
//function evaluates only a rought error on the lower limit. Be careful when using this estimation
Double_t UpperLimitEstimatedError();
// return expected distribution of p-values (Cls or Clsplusb)
SamplingDistribution * GetExpectedPValueDist(int index) const;
SamplingDistribution * GetBackgroundTestStatDist(int index ) const;
SamplingDistribution * GetSignalAndBackgroundTestStatDist(int index) const;
// same in terms of alt and null
SamplingDistribution * GetNullTestStatDist(int index) const {
return GetSignalAndBackgroundTestStatDist(index);
}
SamplingDistribution * GetAltTestStatDist(int index) const {
return GetBackgroundTestStatDist(index);
}
// get expected lower limit distributions
// implemented using interpolation
// The size for the sampling distribution is given (by default is given by the average number of toy/point)
SamplingDistribution* GetLowerLimitDistribution() const { return GetLimitDistribution(true); }
// get expected upper limit distributions
// implemented using interpolation
SamplingDistribution* GetUpperLimitDistribution() const { return GetLimitDistribution(false); }
// get Limit value correspnding at the desired nsigma level (0) is median -1 sigma is 1 sigma
double GetExpectedLowerLimit(double nsig = 0, const char * opt = "" ) const ;
// get Limit value correspnding at the desired nsigma level (0) is median -1 sigma is 1 sigma
double GetExpectedUpperLimit(double nsig = 0, const char * opt = "") const ;
double FindInterpolatedLimit(double target, bool lowSearch = false, double xmin=1, double xmax=0);
enum InterpolOption_t { kLinear, kSpline };
// set the interpolation option, linear (kLinear ) or spline (kSpline)
void SetInterpolationOption( InterpolOption_t opt) { fInterpolOption = opt; }
InterpolOption_t GetInterpolationOption() const { return fInterpolOption; }
private:
double CalculateEstimatedError(double target, bool lower = true, double xmin = 1, double xmax = 0);
int FindClosestPointIndex(double target, int mode = 0, double xtarget = 0);
SamplingDistribution* GetLimitDistribution(bool lower ) const;
double GetExpectedLimit(double nsig, bool lower, const char * opt = "" ) const ;
double GetGraphX(const TGraph & g, double y0, bool lowSearch, double &xmin, double &xmax) const;
double GetGraphX(const TGraph & g, double y0, bool lowSearch = true) const {
double xmin=1; double xmax = 0;
return GetGraphX(g,y0,lowSearch,xmin,xmax);
}
protected:
bool fUseCLs;
bool fIsTwoSided; // two sided scan (look for lower/upper limit)
bool fInterpolateLowerLimit;
bool fInterpolateUpperLimit;
bool fFittedLowerLimit;
bool fFittedUpperLimit;
InterpolOption_t fInterpolOption; // interpolatation option (linear or spline)
double fLowerLimitError;
double fUpperLimitError;
double fCLsCleanupThreshold;
static double fgAsymptoticMaxSigma; // max sigma value used to scan asymptotic expected p values
std::vector<double> fXValues;
TList fYObjects; // list of HypoTestResult for each point
TList fExpPValues; // list of expected sampling distribution for each point
friend class HypoTestInverter;
friend class HypoTestInverterPlot;
friend class HypoTestInverterOriginal;
ClassDef(HypoTestInverterResult,5) // HypoTestInverterResult class
};
}
#endif
|