// @(#)root/roostats:$Id$

/*************************************************************************
 * Project: RooStats                                                     *
 * Package: RooFit/RooStats                                              *
 * Authors:                                                              *
 *   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_HybridResult
#define ROOSTATS_HybridResult

#ifndef ROOSTATS_HypoTestResult
#include "RooStats/HypoTestResult.h"
#endif

namespace RooStats {

   class HybridPlot;

   class HybridResult : public HypoTestResult {

   public:

      /// Default constructor 
      explicit HybridResult(const char *name = 0);

      /// Constructor for HybridResult
      HybridResult(const char *name,
		   const std::vector<double>& testStat_sb_vals,
                   const std::vector<double>& testStat_b_vals, 
		   bool sumLargerValues=true);


      /// Destructor of HybridResult
      virtual ~HybridResult();

      void SetDataTestStatistics(double testStat_data_val);

      void Add(HybridResult* other);

      HybridPlot* GetPlot(const char* name,const char* title, int n_bins);

      void PrintMore(const char* options);

      /// Get test statistics values for the sb model
      std::vector<double> GetTestStat_sb(){return fTestStat_sb;}

      /// Get test statistics values for the b model
      std::vector<double> GetTestStat_b(){return fTestStat_b;}

      /// Get test statistics value for data
      double GetTestStat_data(){ return fTestStat_data;}

      // Return p-value for null hypothesis
      Double_t NullPValue() const;

      // Return p-value for alternate hypothesis
      Double_t AlternatePValue() const;

      /// The error on the "confidence level" of the null hypothesis
      Double_t CLbError() const;
      
      /// The error on the "confidence level" of the alternative hypothesis
      Double_t CLsplusbError() const;
      
      /// The error on the ratio CLs+b/CLb
      Double_t CLsError() const;

   private:

      std::vector<double> fTestStat_b; // vector of results for B-only toy-MC
      std::vector<double> fTestStat_sb; // vector of results for S+B toy-MC
      double fTestStat_data; // results (test statistics) evaluated for data

      mutable bool fComputationsNulDoneFlag; // flag if the fNullPValue computation have been already done or not (ie need to be refreshed)
      mutable bool fComputationsAltDoneFlag; // flag if the fAlternatePValue computation have been already done or not (ie need to be refreshed)
      bool fSumLargerValues; // p-value for velues of testStat >= testStat_data (or testStat <= testStat_data)
 
   protected:

      ClassDef(HybridResult,1)  // Class containing the results of the HybridCalculator
   };
}

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