Logo ROOT   6.16/01
Reference Guide
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/** \class RooStats::HypoTestPlot
12 \ingroup Roostats
13
14This class provides the plots for the result of a study performed with any of the
15HypoTestCalculatorGeneric (e.g. HybridCalculator or FrequentistCalculator) class.
16
17 */
18
22
23#include "TStyle.h"
24
26
27using namespace RooStats;
28using namespace std;
29
30////////////////////////////////////////////////////////////////////////////////
31
32HypoTestPlot::HypoTestPlot(HypoTestResult& result, Int_t bins, Option_t* opt) :
33 SamplingDistPlot(bins),
34 fHypoTestResult(&result)
35{
36 ApplyResult(result, opt);
37}
39 SamplingDistPlot(bins,min,max),
40 fHypoTestResult(&result)
41{
42 ApplyResult(result, opt);
43}
44
45////////////////////////////////////////////////////////////////////////////////
46
48 fLegend = new TLegend(0.55,0.95-0.3*0.66,0.95,0.95);
49
50 const SamplingDistribution *alt = result.GetAltDistribution();
51 const SamplingDistribution *null = result.GetNullDistribution();
52 if(!result.HasTestStatisticData()) {
53 if(alt) AddSamplingDistribution(alt, opt);
54 if(null) AddSamplingDistribution(null, opt);
55 }else{
56 if(result.GetPValueIsRightTail()) {
59 }else{
62 }
63 }
64
65 if(result.HasTestStatisticData()) {
66 Double_t theMin(0.), theMax(0.), theYMax(0.);
67 GetAbsoluteInterval(theMin, theMax, theYMax);
68
69 AddLine(result.GetTestStatisticData(), 0, result.GetTestStatisticData(), theYMax*0.66, "test statistic data");
70 }
71
73}
74
75////////////////////////////////////////////////////////////////////////////////
76
78 if(!fHypoTestResult) return;
79
82
83 if(alt) {
84 SetLineWidth(2, alt);
85 SetLineColor(kBlue, alt);
86 }
87 if(null) {
88 SetLineWidth(2, null);
89 SetLineColor(kRed, null);
90 }
91}
int Int_t
Definition: RtypesCore.h:41
double Double_t
Definition: RtypesCore.h:55
const char Option_t
Definition: RtypesCore.h:62
#define ClassImp(name)
Definition: Rtypes.h:363
@ kRed
Definition: Rtypes.h:63
@ kBlue
Definition: Rtypes.h:63
static Double_t infinity()
Return internal infinity representation.
Definition: RooNumber.cxx:49
This class provides the plots for the result of a study performed with any of the HypoTestCalculatorG...
Definition: HypoTestPlot.h:22
void ApplyDefaultStyle(void)
Set default style options (also called in the constructor that takes a HypoTestResult).
void ApplyResult(HypoTestResult &result, Option_t *opt="NORMALIZE HIST")
Applies a HypoTestResult.
HypoTestPlot()
Constructor.
Definition: HypoTestPlot.h:25
HypoTestResult * fHypoTestResult
Definition: HypoTestPlot.h:36
HypoTestResult is a base class for results from hypothesis tests.
Bool_t GetPValueIsRightTail(void) const
Double_t GetTestStatisticData(void) const
SamplingDistribution * GetNullDistribution(void) const
Bool_t HasTestStatisticData(void) const
SamplingDistribution * GetAltDistribution(void) const
This class provides simple and straightforward utilities to plot SamplingDistribution objects.
void AddLine(Double_t x1, Double_t y1, Double_t x2, Double_t y2, const char *title=NULL)
add a line
Double_t AddSamplingDistribution(const SamplingDistribution *samplingDist, Option_t *drawOptions="NORMALIZE HIST")
adds the sampling distribution and returns the scale factor
void GetAbsoluteInterval(Double_t &theMin, Double_t &theMax, Double_t &theYMax) const
void SetLineWidth(Width_t lwidth, const SamplingDistribution *samplDist=0)
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.
void SetLineColor(Color_t color, const SamplingDistribution *samplDist=0)
Sets line color for given sampling distribution and fill color for the associated shaded TH1F.
This class simply holds a sampling distribution of some test statistic.
This class displays a legend box (TPaveText) containing several legend entries.
Definition: TLegend.h:23
@(#)root/roostats:$Id$ Author: George Lewis, Kyle Cranmer
Definition: Asimov.h:20
STL namespace.