// @(#)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_HypoTestInverterOriginal
#define ROOSTATS_HypoTestInverterOriginal



#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 HypoTestInverterOriginal : public IntervalCalculator, public TNamed {

  public:

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


    // constructor
    HypoTestInverterOriginal( 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 ~HypoTestInverterOriginal() ;

  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(HypoTestInverterOriginal,1)  // HypoTestInverterOriginal class

  };
}

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