// @(#)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_HypoTestInverterPlot
#define ROOSTATS_HypoTestInverterPlot

#include "TNamed.h"

class TGraphErrors; 
class TMultiGraph;


namespace RooStats {   

   class HypoTestInverterResult; 
   class SamplingDistPlot;

   /**
      Class to plot an HypoTestInverterResult,  result of the HypoTestInverter calculator
      
      It can be used to plot the obtained p-values ( CLb, CLs+b or CLs) for each scanned point and 
      the test statistic distributions (when a calculator based on pseudo-experiments is used) for the two 
      hypotheses. 
      
      \ingroup Roostats
   */

   
   class HypoTestInverterPlot : public TNamed {
     
   public:

      // constructor
      HypoTestInverterPlot(HypoTestInverterResult* results ) ;
 
      HypoTestInverterPlot( const char* name, 
                            const char* title,
                            HypoTestInverterResult* results ) ;
     
      /// return a TGraphErrors with the obtained observed p-values 
      /// resultinf from the scan 
      /// By default (Option = "") return CLs or CLsb depending if the flag UseCLs is set 
      /// If Option = "CLb"   return  CLb plot
      ///           = "CLs+b" return  CLs+b plot  independently of the flag 
      ///           = "CLs"   return  CLs plot  independently of the flag 
      TGraphErrors* MakePlot(Option_t *opt="") ;

      /// Make the expected plot and the bands 
      /// nsig1 and nsig2 indicates the n-sigma value for the bands
      /// if nsig1 = 0 no band is computed (only expected value)
      /// if nsig2 > nsig1 (default is nsig1=1 and nsig2=2) the second band is also done.
      /// The first band is drawn in green while the second in yellow 
      /// The plot (expected value + bands) is returned as a TMultiGraph object
      TMultiGraph* MakeExpectedPlot(double sig1=1, double sig2=2) ;

      /// Plot the test statistic distributions
      /// type =0  null and alt 
      /// type = 1 only null (S+B)
      /// type = 2 only alt  (B)
      SamplingDistPlot * MakeTestStatPlot(int index, int type=0, int nbins = 100);


      /// Draw the scan result in the current canvas 
      /// Possible options:
      ///   ""  (default): draw observed + expected with 1 and 2 sigma bands 
      ///   SAME : draw in the current axis 
      ///   OBS  :  draw only the observed plot 
      ///   EXP  :  draw only the expected plot 
      ///   CLB  : draw also  CLb
      ///   2CL  : drow both  CLs+b and CLs
      void Draw(Option_t *opt="");

      /// destructor
      ~HypoTestInverterPlot() ;

   private:

      HypoTestInverterResult* fResults;

   protected:

      ClassDef(HypoTestInverterPlot,1)  // HypoTestInverterPlot class

   };
}

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