ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
HypoTestPlot.cxx
Go to the documentation of this file.
1 // @(#)root/roostats:$Id$
2 // Author: Sven Kreiss June 2010
3 /*************************************************************************
4  * Copyright (C) 1995-2008, Rene Brun and Fons Rademakers. *
5  * All rights reserved. *
6  * *
7  * For the licensing terms see $ROOTSYS/LICENSE. *
8  * For the list of contributors see $ROOTSYS/README/CREDITS. *
9  *************************************************************************/
10 
11 #include "RooStats/HypoTestPlot.h"
14 
15 #include "TStyle.h"
16 
18 
19 using namespace RooStats;
20 using namespace std;
21 
22 HypoTestPlot::HypoTestPlot(HypoTestResult& result, Int_t bins, Option_t* opt) :
23  SamplingDistPlot(bins),
24  fHypoTestResult(&result)
25 {
26  ApplyResult(result, opt);
27 }
28 HypoTestPlot::HypoTestPlot(HypoTestResult& result, Int_t bins, Double_t min, Double_t max, Option_t* opt) :
29  SamplingDistPlot(bins,min,max),
30  fHypoTestResult(&result)
31 {
32  ApplyResult(result, opt);
33 }
34 
36  fLegend = new TLegend(0.55,0.95-0.3*0.66,0.95,0.95);
37 
38  const SamplingDistribution *alt = result.GetAltDistribution();
40  if(!result.HasTestStatisticData()) {
41  if(alt) AddSamplingDistribution(alt, opt);
42  if(null) AddSamplingDistribution(null, opt);
43  }else{
44  if(result.GetPValueIsRightTail()) {
47  }else{
50  }
51  }
52 
53  if(result.HasTestStatisticData()) {
54  Double_t theMin(0.), theMax(0.), theYMax(0.);
55  GetAbsoluteInterval(theMin, theMax, theYMax);
56 
57  AddLine(result.GetTestStatisticData(), 0, result.GetTestStatisticData(), theYMax*0.66, "test statistic data");
58  }
59 
61 }
62 
64  if(!fHypoTestResult) return;
65 
68 
69  if(alt) {
70  SetLineWidth(2, alt);
71  SetLineColor(kBlue, alt);
72  }
73  if(null) {
74  SetLineWidth(2, null);
75  SetLineColor(kRed, null);
76  }
77 }
static Vc_ALWAYS_INLINE int_v min(const int_v &x, const int_v &y)
Definition: vector.h:433
void GetAbsoluteInterval(Double_t &theMin, Double_t &theMax, Double_t &theYMax) const
This class displays a legend box (TPaveText) containing several legend entries.
Definition: TLegend.h:35
void SetLineColor(Color_t color, const SamplingDistribution *samplDist=0)
Sets line color for given sampling distribution and fill color for the associated shaded TH1F...
const char Option_t
Definition: RtypesCore.h:62
void ApplyResult(HypoTestResult &result, Option_t *opt="NORMALIZE HIST")
Applies a HypoTestResult.
Definition: Rtypes.h:61
HypoTestResult is a base class for results from hypothesis tests.
Double_t AddSamplingDistribution(const SamplingDistribution *samplingDist, Option_t *drawOptions="NORMALIZE HIST")
adds the sampling distribution and returns the scale factor
This class provides the plots for the result of a study performed with any of the HypoTestCalculatorG...
Definition: HypoTestPlot.h:37
int Int_t
Definition: RtypesCore.h:41
SamplingDistribution * GetAltDistribution(void) const
const TKDTreeBinning * bins
null_t< F > null()
void SetLineWidth(Width_t lwidth, const SamplingDistribution *samplDist=0)
ClassImp(RooStats::HypoTestPlot) using namespace RooStats
void ApplyDefaultStyle(void)
Set default style options (also called in the constructor that takes a HypoTestResult).
Double_t AddSamplingDistributionShaded(const SamplingDistribution *samplingDist, Double_t minShaded, Double_t maxShaded, Option_t *drawOptions="NORMALIZE HIST")
Like AddSamplingDistribution, but also sets a shaded area in the minShaded and maxShaded boundaries...
HypoTestResult * fHypoTestResult
Definition: HypoTestPlot.h:51
static Double_t infinity()
Return internal infinity representation.
Definition: RooNumber.cxx:49
Bool_t HasTestStatisticData(void) const
Bool_t GetPValueIsRightTail(void) const
This class simply holds a sampling distribution of some test statistic.
double Double_t
Definition: RtypesCore.h:55
void AddLine(Double_t x1, Double_t y1, Double_t x2, Double_t y2, const char *title=NULL)
add a line
SamplingDistribution * GetNullDistribution(void) const
static Vc_ALWAYS_INLINE int_v max(const int_v &x, const int_v &y)
Definition: vector.h:440
Double_t GetTestStatisticData(void) const
double result[121]
Definition: Rtypes.h:61