ROOT logo
ROOT » ROOFIT » ROOSTATS » RooStats::HypoTestInverter

class RooStats::HypoTestInverter: public RooStats::IntervalCalculator


   HypoTestInverter class for performing an hypothesis test inversion by scanning the hypothesis test results of an
  HypoTestCalculator  for various values of the parameter of interest. By looking at the confidence level curve of
 the result  an upper limit, where it intersects the desired confidence level, can be derived.
 The class implements the RooStats::IntervalCalculator interface and returns an  RooStats::HypoTestInverterResult class.
 The result is a SimpleInterval, which via the method UpperLimit returns to the user the upper limit value.

The  HypoTestInverter implements various option for performing the scan. HypoTestInverter::RunFixedScan will scan using a fixed grid the parameter of interest. HypoTestInverter::RunAutoScan will perform an automatic scan to find optimally the curve and it will stop until the desired precision is obtained.
The confidence level value at a given point can be done via  HypoTestInverter::RunOnePoint.
The class can scan the CLs+b values or alternativly CLs (if the method HypoTestInverter::UseCLs has been called).


   Contributions to this class have been written by Giovanni Petrucciani and Annapaola Decosa

Function Members (Methods)

public:
virtual~HypoTestInverter()
static TClass*Class()
voidClear()
virtual Double_tConfidenceLevel() const
RooStats::HypoTestCalculatorGeneric*GetHypoTestCalculator() const
virtual RooStats::HypoTestInverterResult*GetInterval() const
RooStats::SamplingDistribution*GetLowerLimitDistribution(bool rebuild = false, int nToys = 100)
RooStats::TestStatistic*GetTestStatistic() const
RooStats::SamplingDistribution*GetUpperLimitDistribution(bool rebuild = false, int nToys = 100)
RooStats::HypoTestInverterHypoTestInverter()
RooStats::HypoTestInverterHypoTestInverter(RooStats::HypoTestCalculatorGeneric& hc, RooRealVar* scannedVariable = 0, double size = 0.05)
RooStats::HypoTestInverterHypoTestInverter(RooStats::HybridCalculator& hc, RooRealVar* scannedVariable = 0, double size = 0.05)
RooStats::HypoTestInverterHypoTestInverter(RooStats::FrequentistCalculator& hc, RooRealVar* scannedVariable, double size = 0.05)
RooStats::HypoTestInverterHypoTestInverter(RooStats::AsymptoticCalculator& hc, RooRealVar* scannedVariable, double size = 0.05)
RooStats::HypoTestInverterHypoTestInverter(RooAbsData& data, RooStats::ModelConfig& sb, RooStats::ModelConfig& b, RooRealVar* scannedVariable = 0, RooStats::HypoTestInverter::ECalculatorType type = kFrequentist, double size = 0.05)
virtual TClass*IsA() const
RooStats::SamplingDistribution*RebuildDistributions(bool isUpper = true, int nToys = 100, TList* clsDist = 0, TList* clsbDist = 0, TList* clbDist = 0, const char* outputfile = "HypoTestInverterRebuiltDist.root")
boolRunFixedScan(int nBins, double xMin, double xMax, bool scanLog = false) const
boolRunLimit(double& limit, double& limitErr, double absTol = 0, double relTol = 0, const double* hint = 0) const
boolRunOnePoint(double thisX, bool adaptive = false, double clTarget = -1) const
voidSetAutoScan()
static voidSetCloseProof(Bool_t flag)
virtual voidSetConfidenceLevel(Double_t cl)
virtual voidSetData(RooAbsData&)
voidSetFixedScan(int nBins, double xMin = 1, double xMax = -1, bool scanLog = false)
voidSetMaximumToys(int ntoys)
virtual voidSetModel(const RooStats::ModelConfig&)
voidSetNumErr(double err)
virtual voidSetTestSize(Double_t size)
boolSetTestStatistic(RooStats::TestStatistic& stat)
voidSetVerbose(int level = 1)
virtual voidShowMembers(TMemberInspector&)
virtual Double_tSize() const
virtual voidStreamer(TBuffer&)
voidStreamerNVirtual(TBuffer& ClassDef_StreamerNVirtual_b)
voidUseCLs(bool on = true)

Data Members

public:
enum ECalculatorType { kUndefined
kHybrid
kFrequentist
kAsymptotic
};
private:
RooStats::HypoTestInverter::ECalculatorTypefCalcType
RooStats::HypoTestCalculatorGeneric*fCalculator0pointer to the calculator passed in the constructor
auto_ptr<RooStats::HypoTestCalculatorGeneric>fHC
auto_ptr<TGraphErrors>fLimitPlot! plot of limits
intfMaxToysmaximum number of toys to run
intfNBins
doublefNumErr
RooStats::HypoTestInverterResult*fResultspointer to the result
boolfScanLog
RooRealVar*fScannedVariablepointer to the constrained variable
doublefSize
intfTotalToysRun
boolfUseCLs
intfVerbose
doublefXmax
doublefXmin
static doublefgAbsAccuracy
static stringfgAlgo
static doublefgCLAccuracy
static boolfgCloseProof
static unsigned intfgNToys
static doublefgRelAccuracy

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

void SetCloseProof(Bool_t flag)
 set flag to close proof for every new run
RooRealVar * GetVariableToScan(const RooStats::HypoTestCalculatorGeneric& hc)
 get  the variable to scan
 try first with null model if not go to alternate model
void CheckInputModels(const RooStats::HypoTestCalculatorGeneric& hc, const RooRealVar& scanVar)
 check  the model given the given hypotestcalculator
HypoTestInverter()
 default constructor (doesn't do anything)
HypoTestInverter( HypoTestCalculatorGeneric& hc, RooRealVar* scannedVariable, double size )
 Constructor from a HypoTestCalculatorGeneric
 The HypoTest calculator must be a FrequentistCalculator or HybridCalculator type
 Other type of calculators are not supported.
 The calculator must be created before by using the S+B model for the null and
 the B model for the alt
 If no variable to scan are given they are assumed to be the first variable
 from the parameter of interests of the null model
HypoTestInverter( HybridCalculator& hc, RooRealVar* scannedVariable, double size )
 Constructor from a reference to a HybridCalculator
 The calculator must be created before by using the S+B model for the null and
 the B model for the alt
 If no variable to scan are given they are assumed to be the first variable
 from the parameter of interests of the null model
HypoTestInverter( FrequentistCalculator& hc, RooRealVar* scannedVariable, double size )
 Constructor from a reference to a FrequentistCalculator
 The calculator must be created before by using the S+B model for the null and
 the B model for the alt
 If no variable to scan are given they are assumed to be the first variable
 from the parameter of interests of the null model
HypoTestInverter( AsymptoticCalculator& hc, RooRealVar* scannedVariable, double size )
 Constructor from a reference to a AsymptoticCalculator
 The calculator must be created before by using the S+B model for the null and
 the B model for the alt
 If no variable to scan are given they are assumed to be the first variable
 from the parameter of interests of the null model
HypoTestInverter(RooAbsData& data, RooStats::ModelConfig& sb, RooStats::ModelConfig& b, RooRealVar* scannedVariable = 0, RooStats::HypoTestInverter::ECalculatorType type = kFrequentist, double size = 0.05)
 Constructor from a model for B model and a model for S+B.
 An HypoTestCalculator (Hybrid of Frequentis) will be created using the
 S+B model as the null and the B model as the alternate
 If no variable to scan are given they are assumed to be the first variable
 from the parameter of interests of the null model
HypoTestInverter(const RooStats::HypoTestInverter& rhs)
 copy-constructor
 NOTE: this class does not copy the contained result and
 the HypoTestCalculator, but only the pointers
 It requires the original HTI to be alive
HypoTestInverter & operator=(const RooStats::HypoTestInverter& rhs)
 assignment operator
 NOTE: this class does not copy the contained result and
 the HypoTestCalculator, but only the pointers
 It requires the original HTI to be alive
~HypoTestInverter()
 destructor (delete the HypoTestInverterResult)
TestStatistic * GetTestStatistic() const
 return the test statistic which is or will be used by the class
bool SetTestStatistic(RooStats::TestStatistic& stat)
 set the test statistic to use
void Clear()
 delete contained result and graph
void CreateResults() const
 create a new HypoTestInverterResult to hold all computed results
HypoTestInverterResult* GetInterval() const
 Run a fixed scan or the automatic scan depending on the configuration
 Return if needed a copy of the result object which will be managed by the user
HypoTestResult * Eval(RooStats::HypoTestCalculatorGeneric& hc, bool adaptive, double clsTarget) const
 Run the Hypothesis test at a previous configured point
(internal function called by RunOnePoint)
bool RunFixedScan(int nBins, double xMin, double xMax, bool scanLog = false) const
 Run a Fixed scan in npoints between min and max
bool RunOnePoint(double thisX, bool adaptive = false, double clTarget = -1) const
 run only one point at the given POI value
bool RunLimit(double& limit, double& limitErr, double absTol = 0, double relTol = 0, const double* hint = 0) const
 run an automatic scan until the desired accurancy is reached
 Start by default from the full interval (min,max) of the POI and then via bisection find the line crossing
 the target line
 Optionally an hint can be provided and the scan will be done closer to that value
 If by bisection the desired accuracy will not be reached a fit to the points is performed
SamplingDistribution * GetLowerLimitDistribution(bool rebuild = false, int nToys = 100)
 get the distribution of lower limit
 if rebuild = false (default) it will re-use the results of the scan done
 for obtained the observed limit and no extra toys will be generated
 if rebuild a new set of B toys will be done and the procedure will be repeted
 for each toy
SamplingDistribution * GetUpperLimitDistribution(bool rebuild = false, int nToys = 100)
 get the distribution of lower limit
 if rebuild = false (default) it will re-use the results of the scan done
 for obtained the observed limit and no extra toys will be generated
 if rebuild a new set of B toys will be done and the procedure will be repeted
 for each toy
 The nuisance parameter value used for rebuild is the current one in the model
 so it is user responsability to set to the desired value (nomi
void SetData(RooAbsData& )
SamplingDistribution * RebuildDistributions(bool isUpper = true, int nToys = 100, TList* clsDist = 0, TList* clsbDist = 0, TList* clbDist = 0, const char* outputfile = "HypoTestInverterRebuiltDist.root")
 rebuild the sampling distributions by
 generating some toys and find for each of theam a new upper limit
 Return the upper limit distribution and optionally also the pValue distributions for Cls, Clsb and Clbxs
 as a TList for each scanned point
 The method uses the present parameter value. It is user responsability to give the current parameters to rebuild the distributions
 It returns a upper or lower limit distribution depending on the isUpper flag, however it computes also the lower limit distribution and it is saved in the
 output file as an histogram
void SetFixedScan(int nBins, double xMin = 1, double xMax = -1, bool scanLog = false)
 set for a fixed scan in nbins
void SetAutoScan()
 set auto scan (default)
{ SetFixedScan(0); }
void UseCLs(bool on = true)
{ fUseCLs = on; if (fResults) fResults->UseCLs(on); }
void SetModel(const RooStats::ModelConfig& )
{ }
void SetTestSize(Double_t size)
 set the size of the test (rate of Type I error) ( Eg. 0.05 for a 95% Confidence Interval)
{fSize = size; if (fResults) fResults->SetTestSize(size); }
void SetConfidenceLevel(Double_t cl)
 set the confidence level for the interval (eg. 0.95 for a 95% Confidence Interval)
{fSize = 1.-cl; if (fResults) fResults->SetConfidenceLevel(cl); }
Double_t Size() const
 Get the size of the test (eg. rate of Type I error)
{return fSize;}
Double_t ConfidenceLevel() const
 Get the Confidence level for the test
{return 1.-fSize;}
HypoTestCalculatorGeneric * GetHypoTestCalculator() const
 retrieved a reference to the internally used HypoTestCalculator
 it might be invalid when the class is deleted
{ return fCalculator0; }
void SetVerbose(int level = 1)
 set verbose level (0,1,2)
{ fVerbose = level; }
void SetMaximumToys(int ntoys)
 set maximum number of toys
{ fMaxToys = ntoys;}
void SetNumErr(double err)
 set numerical error in test statistic evaluation (default is zero)
{ fNumErr = err; }