ROOT logo
// @(#)root/roostats:$Id: HypoTestInverter.h 31798 2009-12-10 14:57:15Z moneta $
// 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_HypoTestInverter
#define ROOSTATS_HypoTestInverter



#ifndef ROOSTATS_IntervalCalculator
#include "RooStats/IntervalCalculator.h"
#endif

#ifndef ROOSTATS_HypoTestCalculator
#include "RooStats/HypoTestCalculator.h"
#endif

#ifndef  ROOSTATS_HypoTestInverterResult
#include "RooStats/HypoTestInverterResult.h"
#endif

class RooRealVar;


namespace RooStats {

  class HypoTestInverter : public IntervalCalculator, public TNamed {

  public:

    // default constructor (used only for I/O)
    HypoTestInverter();


    // constructor
    HypoTestInverter( HypoTestCalculator& myhc0,
		      RooRealVar& scannedVariable, 
                      double size = 0.05) ;

     

    virtual HypoTestInverterResult* GetInterval() const { return fResults; } ;

    bool RunAutoScan( double xMin, double xMax, double target, double epsilon=0.005, unsigned int numAlgorithm=0 );

    bool RunFixedScan( int nBins, double xMin, double xMax );

    bool RunOnePoint( double thisX );

    void UseCLs( bool on = true) { fUseCLs = on; if (fResults) fResults->UseCLs(on);   }

    virtual void  SetData(RooAbsData &) { } // not needed

    virtual void SetModel(const ModelConfig &) { } // not needed 

    // 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) {fSize = size; if (fResults) fResults->SetTestSize(size); }
    // set the confidence level for the interval (eg. 0.95 for a 95% Confidence Interval)
    virtual void SetConfidenceLevel(Double_t cl) {fSize = 1.-cl;  if (fResults) fResults->SetConfidenceLevel(cl); }
    // Get the size of the test (eg. rate of Type I error)
    virtual Double_t Size() const {return fSize;}
    // Get the Confidence level for the test
    virtual Double_t ConfidenceLevel()  const {return 1.-fSize;}
 
    // destructor
    virtual ~HypoTestInverter() ;

  private:

    void CreateResults(); 

    HypoTestCalculator* fCalculator0;   // pointer to the calculator passed in the constructor
    RooRealVar* fScannedVariable;     // pointer to the constrained variable
    HypoTestInverterResult* fResults;

    bool fUseCLs;
    double fSize;

  protected:

    ClassDef(HypoTestInverter,1)  // HypoTestInverter class

  };
}

#endif
 HypoTestInverter.h:1
 HypoTestInverter.h:2
 HypoTestInverter.h:3
 HypoTestInverter.h:4
 HypoTestInverter.h:5
 HypoTestInverter.h:6
 HypoTestInverter.h:7
 HypoTestInverter.h:8
 HypoTestInverter.h:9
 HypoTestInverter.h:10
 HypoTestInverter.h:11
 HypoTestInverter.h:12
 HypoTestInverter.h:13
 HypoTestInverter.h:14
 HypoTestInverter.h:15
 HypoTestInverter.h:16
 HypoTestInverter.h:17
 HypoTestInverter.h:18
 HypoTestInverter.h:19
 HypoTestInverter.h:20
 HypoTestInverter.h:21
 HypoTestInverter.h:22
 HypoTestInverter.h:23
 HypoTestInverter.h:24
 HypoTestInverter.h:25
 HypoTestInverter.h:26
 HypoTestInverter.h:27
 HypoTestInverter.h:28
 HypoTestInverter.h:29
 HypoTestInverter.h:30
 HypoTestInverter.h:31
 HypoTestInverter.h:32
 HypoTestInverter.h:33
 HypoTestInverter.h:34
 HypoTestInverter.h:35
 HypoTestInverter.h:36
 HypoTestInverter.h:37
 HypoTestInverter.h:38
 HypoTestInverter.h:39
 HypoTestInverter.h:40
 HypoTestInverter.h:41
 HypoTestInverter.h:42
 HypoTestInverter.h:43
 HypoTestInverter.h:44
 HypoTestInverter.h:45
 HypoTestInverter.h:46
 HypoTestInverter.h:47
 HypoTestInverter.h:48
 HypoTestInverter.h:49
 HypoTestInverter.h:50
 HypoTestInverter.h:51
 HypoTestInverter.h:52
 HypoTestInverter.h:53
 HypoTestInverter.h:54
 HypoTestInverter.h:55
 HypoTestInverter.h:56
 HypoTestInverter.h:57
 HypoTestInverter.h:58
 HypoTestInverter.h:59
 HypoTestInverter.h:60
 HypoTestInverter.h:61
 HypoTestInverter.h:62
 HypoTestInverter.h:63
 HypoTestInverter.h:64
 HypoTestInverter.h:65
 HypoTestInverter.h:66
 HypoTestInverter.h:67
 HypoTestInverter.h:68
 HypoTestInverter.h:69
 HypoTestInverter.h:70
 HypoTestInverter.h:71
 HypoTestInverter.h:72
 HypoTestInverter.h:73
 HypoTestInverter.h:74
 HypoTestInverter.h:75
 HypoTestInverter.h:76
 HypoTestInverter.h:77
 HypoTestInverter.h:78
 HypoTestInverter.h:79
 HypoTestInverter.h:80
 HypoTestInverter.h:81
 HypoTestInverter.h:82
 HypoTestInverter.h:83
 HypoTestInverter.h:84
 HypoTestInverter.h:85
 HypoTestInverter.h:86
 HypoTestInverter.h:87
 HypoTestInverter.h:88
 HypoTestInverter.h:89
 HypoTestInverter.h:90
 HypoTestInverter.h:91
 HypoTestInverter.h:92