00001 // @(#)root/roostats:$Id: HypoTestInverterResult.h 36230 2010-10-09 20:21:02Z wouter $ 00002 // Author: Kyle Cranmer, Lorenzo Moneta, Gregory Schott, Wouter Verkerke 00003 /************************************************************************* 00004 * Copyright (C) 1995-2008, Rene Brun and Fons Rademakers. * 00005 * All rights reserved. * 00006 * * 00007 * For the licensing terms see $ROOTSYS/LICENSE. * 00008 * For the list of contributors see $ROOTSYS/README/CREDITS. * 00009 *************************************************************************/ 00010 00011 #ifndef ROOSTATS_HypoTestInverterResult 00012 #define ROOSTATS_HypoTestInverterResult 00013 00014 00015 00016 #ifndef ROOSTATS_SimpleInterval 00017 #include "RooStats/SimpleInterval.h" 00018 #endif 00019 00020 #include "RooStats/HypoTestResult.h" 00021 00022 class RooRealVar; 00023 00024 namespace RooStats { 00025 00026 class HypoTestInverterResult : public SimpleInterval { 00027 00028 public: 00029 00030 // default constructor 00031 explicit HypoTestInverterResult(const char* name = 0); 00032 00033 // constructor 00034 HypoTestInverterResult( const char* name, 00035 const RooRealVar& scannedVariable, 00036 double cl ) ; 00037 00038 // destructor 00039 virtual ~HypoTestInverterResult(); 00040 00041 // function to return the value of the parameter of interest for the i^th entry in the results 00042 double GetXValue( int index ) const ; 00043 00044 // function to return the value of the confidence level for the i^th entry in the results 00045 double GetYValue( int index ) const ; 00046 00047 // function to return the estimated error on the value of the confidence level for the i^th entry in the results 00048 double GetYError( int index ) const ; 00049 00050 // return a pointer to the i^th result object 00051 HypoTestResult* GetResult( int index ) const ; 00052 00053 // number of entries in the results array 00054 int ArraySize() const { return fXValues.size(); }; 00055 00056 // set the size of the test (rate of Type I error) (eg. 0.05 for a 95% Confidence Interval) 00057 virtual void SetTestSize( Double_t size ) { fConfidenceLevel = 1.-size; } 00058 00059 // set the confidence level for the interval (eg. 0.95 for a 95% Confidence Interval) 00060 virtual void SetConfidenceLevel( Double_t cl ) { fConfidenceLevel = cl; } 00061 00062 // flag to switch between using CLsb (default) or CLs as confidence level 00063 void UseCLs( bool on = true ) { fUseCLs = on; } 00064 00065 // lower and upper bound of the confidence interval (to get upper/lower limits, multiply the size( = 1-confidence level ) by 2 00066 Double_t LowerLimit(); 00067 Double_t UpperLimit(); 00068 00069 // rough estimation of the error on the computed bound of the confidence interval 00070 // Estimate of lower limit error 00071 //function evaluates only a rought error on the lower limit. Be careful when using this estimation 00072 Double_t LowerLimitEstimatedError(); 00073 00074 // Estimate of lower limit error 00075 //function evaluates only a rought error on the lower limit. Be careful when using this estimation 00076 Double_t UpperLimitEstimatedError(); 00077 00078 private: 00079 00080 // merge with the content of another HypoTestInverterResult object 00081 bool Add( const HypoTestInverterResult& otherResult ); 00082 00083 double CalculateEstimatedError(double target); 00084 int FindClosestPointIndex(double target); 00085 double FindInterpolatedLimit(double target); 00086 00087 protected: 00088 00089 bool fUseCLs; 00090 bool fInterpolateLowerLimit; 00091 bool fInterpolateUpperLimit; 00092 00093 std::vector<double> fXValues; 00094 00095 TList fYObjects; 00096 00097 friend class HypoTestInverter; 00098 00099 ClassDef(HypoTestInverterResult,1) // HypoTestInverterResult class 00100 }; 00101 } 00102 00103 #endif