Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
24
25using namespace RooStats;
26using namespace std;
27
28////////////////////////////////////////////////////////////////////////////////
29
31 SamplingDistPlot(bins),
32 fHypoTestResult(&result)
33{
34 ApplyResult(result, opt);
35}
37 SamplingDistPlot(bins,min,max),
38 fHypoTestResult(&result)
39{
40 ApplyResult(result, opt);
41}
42
43////////////////////////////////////////////////////////////////////////////////
44
46 fLegend = new TLegend(0.55,0.95-0.3*0.66,0.95,0.95);
47
48 const SamplingDistribution *alt = result.GetAltDistribution();
49 const SamplingDistribution *null = result.GetNullDistribution();
50 if(!result.HasTestStatisticData()) {
51 if(alt) AddSamplingDistribution(alt, opt);
52 if(null) AddSamplingDistribution(null, opt);
53 }else{
54 if(result.GetPValueIsRightTail()) {
57 }else{
60 }
61 }
62
63 if(result.HasTestStatisticData()) {
64 Double_t theMin(0.), theMax(0.), theYMax(0.);
65 GetAbsoluteInterval(theMin, theMax, theYMax);
66
67 AddLine(result.GetTestStatisticData(), 0, result.GetTestStatisticData(), theYMax*0.66, "test statistic data");
68 }
69
71}
72
73////////////////////////////////////////////////////////////////////////////////
74
76 if(!fHypoTestResult) return;
77
80
81 if(alt) {
82 SetLineWidth(2, alt);
83 SetLineColor(kBlue, alt);
84 }
85 if(null) {
86 SetLineWidth(2, null);
87 SetLineColor(kRed, null);
88 }
89}
const char Option_t
Definition RtypesCore.h:66
#define ClassImp(name)
Definition Rtypes.h:364
@ kRed
Definition Rtypes.h:66
@ kBlue
Definition Rtypes.h:66
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...
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.
HypoTestResult * fHypoTestResult
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
Namespace for the RooStats classes.
Definition Asimov.h:19