11 #ifndef ROOSTATS_HypoTestInverterResult
12 #define ROOSTATS_HypoTestInverterResult
24 class SamplingDistribution;
26 class HypoTestInverterResult :
public SimpleInterval {
31 explicit HypoTestInverterResult(
const char* name = 0);
34 HypoTestInverterResult(
const char* name,
35 const RooRealVar& scannedVariable,
38 HypoTestInverterResult(
const HypoTestInverterResult& other,
const char* name );
41 virtual ~HypoTestInverterResult();
44 HypoTestInverterResult& operator = (
const HypoTestInverterResult& other);
47 int ExclusionCleanup();
50 bool Add(
const HypoTestInverterResult& otherResult );
53 bool Add( Double_t x,
const HypoTestResult & result );
56 double GetXValue(
int index )
const ;
59 double GetYValue(
int index )
const ;
62 double GetYError(
int index )
const ;
65 double CLsplusb(
int index)
const;
68 double CLb(
int index)
const;
71 double CLs(
int index)
const;
74 double CLsplusbError(
int index)
const;
77 double CLbError(
int index)
const;
80 double CLsError(
int index)
const;
83 HypoTestResult* GetResult(
int index )
const ;
85 double GetLastYValue( )
const {
return GetYValue( fXValues.size()-1); }
87 double GetLastXValue( )
const {
return GetXValue( fXValues.size()-1); }
89 double GetLastYError( )
const {
return GetYError( fXValues.size()-1); }
91 HypoTestResult * GetLastResult( )
const {
return GetResult( fXValues.size()-1); }
94 int ArraySize()
const {
return fXValues.size(); };
96 int FindIndex(
double xvalue)
const;
99 virtual void SetTestSize( Double_t size ) { fConfidenceLevel = 1.-size; }
102 virtual void SetConfidenceLevel( Double_t cl ) { fConfidenceLevel = cl; }
105 inline void SetCLsCleanupThreshold( Double_t th ) { fCLsCleanupThreshold = th; }
108 void UseCLs(
bool on =
true ) { fUseCLs = on; }
111 bool IsOneSided()
const {
return !fIsTwoSided; }
113 bool IsTwoSided()
const {
return fIsTwoSided; }
116 Double_t LowerLimit();
117 Double_t UpperLimit();
122 Double_t LowerLimitEstimatedError();
126 Double_t UpperLimitEstimatedError();
130 SamplingDistribution * GetExpectedPValueDist(
int index)
const;
132 SamplingDistribution * GetBackgroundTestStatDist(
int index )
const;
134 SamplingDistribution * GetSignalAndBackgroundTestStatDist(
int index)
const;
137 SamplingDistribution * GetNullTestStatDist(
int index)
const {
138 return GetSignalAndBackgroundTestStatDist(index);
140 SamplingDistribution * GetAltTestStatDist(
int index)
const {
141 return GetBackgroundTestStatDist(index);
147 SamplingDistribution* GetLowerLimitDistribution()
const {
return GetLimitDistribution(
true); }
151 SamplingDistribution* GetUpperLimitDistribution()
const {
return GetLimitDistribution(
false); }
154 double GetExpectedLowerLimit(
double nsig = 0,
const char * opt =
"" )
const ;
157 double GetExpectedUpperLimit(
double nsig = 0,
const char * opt =
"")
const ;
160 double FindInterpolatedLimit(
double target,
bool lowSearch =
false,
double xmin=1,
double xmax=0);
162 enum InterpolOption_t { kLinear, kSpline };
165 void SetInterpolationOption( InterpolOption_t opt) { fInterpolOption = opt; }
167 InterpolOption_t GetInterpolationOption()
const {
return fInterpolOption; }
172 double CalculateEstimatedError(
double target,
bool lower =
true,
double xmin = 1,
double xmax = 0);
174 int FindClosestPointIndex(
double target,
int mode = 0,
double xtarget = 0);
176 SamplingDistribution* GetLimitDistribution(
bool lower )
const;
178 double GetExpectedLimit(
double nsig,
bool lower,
const char * opt =
"" )
const ;
180 double GetGraphX(
const TGraph & g,
double y0,
bool lowSearch,
double &xmin,
double &xmax)
const;
181 double GetGraphX(
const TGraph & g,
double y0,
bool lowSearch =
true)
const {
182 double xmin=1;
double xmax = 0;
183 return GetGraphX(g,y0,lowSearch,xmin,xmax);
191 bool fInterpolateLowerLimit;
192 bool fInterpolateUpperLimit;
193 bool fFittedLowerLimit;
194 bool fFittedUpperLimit;
195 InterpolOption_t fInterpolOption;
197 double fLowerLimitError;
198 double fUpperLimitError;
200 double fCLsCleanupThreshold;
202 static double fgAsymptoticMaxSigma;
203 static int fgAsymptoticNumPoints;
205 std::vector<double> fXValues;
210 friend class HypoTestInverter;
211 friend class HypoTestInverterPlot;
212 friend class HypoTestInverterOriginal;
214 ClassDef(HypoTestInverterResult,5)