ROOT logo
// @(#)root/roostats:$Id: HybridPlot.h 30654 2009-10-09 15:07:52Z moneta $

/*************************************************************************
 * 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_HybridPlot
#define ROOSTATS_HybridPlot

#include <vector>
#include <iostream>

#ifndef ROOT_TNamed 
#include "TNamed.h"
#endif

// these  should be maybe forward decleared 
// by moving implementations in source file 
#include "TH1.h"


class TLine; 
class TLegend; 
class TH1; 
class TVirtualPad; 


namespace RooStats {

   class HybridPlot : public TNamed {

   public:

      /// Constructor
      HybridPlot(const char* name,
                 const char* title,
                 const std::vector<double> & sb_values,
                 const std::vector<double> & b_values,
                 double testStat_data,
                 int n_bins,
                 bool verbosity=true);

      /// Destructor
      ~HybridPlot();

      /// Draw on current pad
      void Draw (const char* options="");

      /// All the objects are written to rootfile
      void DumpToFile (const char* RootFileName, const char* options);

      /// Get B histo mean
      double GetBmean(){return fB_histo->GetMean();};

      /// Get B histo RMS
      double GetBrms(){return fB_histo->GetRMS();};

      /// Get B histo
      TH1F * GetBhisto(){return fB_histo;}

      /// Get B histo center
      double GetBCenter(double n_sigmas=1, bool display=false)
      {return GetHistoCenter(fB_histo,n_sigmas,display);};

      /// Get B histo integration extremes to obtain the requested area fraction
      double* GetBIntExtremes(double frac)
      {return GetHistoPvals(fB_histo,frac);};

      /// Get SB histo mean
      double GetSBmean(){return fSb_histo->GetMean();};

      /// Get SB histo center
      double GetSBCenter(double n_sigmas=1, bool display=false)
      {return GetHistoCenter(fSb_histo,n_sigmas,display);};

      /// Get SB histo RMS
      double GetSBrms(){return fSb_histo->GetRMS();};

      /// Get SB histo integration extremes to obtain the requested area fraction
      double* GetSBIntExtremes(double frac)
      {return GetHistoPvals(fSb_histo,frac);};

      /// Get B histo
      TH1F* GetSBhisto(){return fSb_histo;}

       /// Get the pad (or canvas) where it has been drawn 
      TVirtualPad * GetCanvas() { return fPad; }

      /// Write an image on disk
      void DumpToImage (const char* filename);


      /// Get the center of the histo
      double GetHistoCenter(TH1* histo, double n_rms=1,bool display_result=false);

      /// Get the "effective sigmas" of the histo
      double* GetHistoPvals (TH1* histo, double percentage);

      /// Get the median of an histogram
      double GetMedian(TH1* histo);

   private:

      TH1F* fSb_histo; // The sb Histo
      TH1F* fSb_histo_shaded; // The sb Histo shaded
      TH1F* fB_histo; // The b Histo
      TH1F* fB_histo_shaded; // The b Histo shaded
      TLine* fData_testStat_line; // The line for the data value of the test statistic
      TLegend* fLegend; // The legend of the plot
      TVirtualPad * fPad;   // The pad where it has been drawn
      bool fVerbose; // verbosity flag

      ClassDef(HybridPlot,1)   // Provides the plots for an HybridResult
   };
}

#endif
 HybridPlot.h:1
 HybridPlot.h:2
 HybridPlot.h:3
 HybridPlot.h:4
 HybridPlot.h:5
 HybridPlot.h:6
 HybridPlot.h:7
 HybridPlot.h:8
 HybridPlot.h:9
 HybridPlot.h:10
 HybridPlot.h:11
 HybridPlot.h:12
 HybridPlot.h:13
 HybridPlot.h:14
 HybridPlot.h:15
 HybridPlot.h:16
 HybridPlot.h:17
 HybridPlot.h:18
 HybridPlot.h:19
 HybridPlot.h:20
 HybridPlot.h:21
 HybridPlot.h:22
 HybridPlot.h:23
 HybridPlot.h:24
 HybridPlot.h:25
 HybridPlot.h:26
 HybridPlot.h:27
 HybridPlot.h:28
 HybridPlot.h:29
 HybridPlot.h:30
 HybridPlot.h:31
 HybridPlot.h:32
 HybridPlot.h:33
 HybridPlot.h:34
 HybridPlot.h:35
 HybridPlot.h:36
 HybridPlot.h:37
 HybridPlot.h:38
 HybridPlot.h:39
 HybridPlot.h:40
 HybridPlot.h:41
 HybridPlot.h:42
 HybridPlot.h:43
 HybridPlot.h:44
 HybridPlot.h:45
 HybridPlot.h:46
 HybridPlot.h:47
 HybridPlot.h:48
 HybridPlot.h:49
 HybridPlot.h:50
 HybridPlot.h:51
 HybridPlot.h:52
 HybridPlot.h:53
 HybridPlot.h:54
 HybridPlot.h:55
 HybridPlot.h:56
 HybridPlot.h:57
 HybridPlot.h:58
 HybridPlot.h:59
 HybridPlot.h:60
 HybridPlot.h:61
 HybridPlot.h:62
 HybridPlot.h:63
 HybridPlot.h:64
 HybridPlot.h:65
 HybridPlot.h:66
 HybridPlot.h:67
 HybridPlot.h:68
 HybridPlot.h:69
 HybridPlot.h:70
 HybridPlot.h:71
 HybridPlot.h:72
 HybridPlot.h:73
 HybridPlot.h:74
 HybridPlot.h:75
 HybridPlot.h:76
 HybridPlot.h:77
 HybridPlot.h:78
 HybridPlot.h:79
 HybridPlot.h:80
 HybridPlot.h:81
 HybridPlot.h:82
 HybridPlot.h:83
 HybridPlot.h:84
 HybridPlot.h:85
 HybridPlot.h:86
 HybridPlot.h:87
 HybridPlot.h:88
 HybridPlot.h:89
 HybridPlot.h:90
 HybridPlot.h:91
 HybridPlot.h:92
 HybridPlot.h:93
 HybridPlot.h:94
 HybridPlot.h:95
 HybridPlot.h:96
 HybridPlot.h:97
 HybridPlot.h:98
 HybridPlot.h:99
 HybridPlot.h:100
 HybridPlot.h:101
 HybridPlot.h:102
 HybridPlot.h:103
 HybridPlot.h:104
 HybridPlot.h:105
 HybridPlot.h:106
 HybridPlot.h:107
 HybridPlot.h:108
 HybridPlot.h:109
 HybridPlot.h:110
 HybridPlot.h:111
 HybridPlot.h:112
 HybridPlot.h:113
 HybridPlot.h:114
 HybridPlot.h:115
 HybridPlot.h:116
 HybridPlot.h:117
 HybridPlot.h:118
 HybridPlot.h:119
 HybridPlot.h:120
 HybridPlot.h:121
 HybridPlot.h:122
 HybridPlot.h:123
 HybridPlot.h:124
 HybridPlot.h:125
 HybridPlot.h:126