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
23
24using namespace RooStats;
25
26////////////////////////////////////////////////////////////////////////////////
27
29 SamplingDistPlot(bins),
30 fHypoTestResult(&result)
31{
32 ApplyResult(result, opt);
33}
34HypoTestPlot::HypoTestPlot(HypoTestResult& result, Int_t bins, double min, double max, Option_t* opt) :
35 SamplingDistPlot(bins,min,max),
36 fHypoTestResult(&result)
37{
38 ApplyResult(result, opt);
39}
40
41////////////////////////////////////////////////////////////////////////////////
42
44 fLegend = new TLegend(0.55,0.95-0.3*0.66,0.95,0.95);
45
46 const SamplingDistribution *alt = result.GetAltDistribution();
47 const SamplingDistribution *null = result.GetNullDistribution();
48 if(!result.HasTestStatisticData()) {
49 if(alt) AddSamplingDistribution(alt, opt);
50 if(null) AddSamplingDistribution(null, opt);
51 }else{
52 if(result.GetPValueIsRightTail()) {
55 }else{
58 }
59 }
60
61 if(result.HasTestStatisticData()) {
62 double theMin(0.);
63 double theMax(0.);
64 double 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
78 const SamplingDistribution *alt = fHypoTestResult->GetAltDistribution();
79 const SamplingDistribution *null = fHypoTestResult->GetNullDistribution();
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}
int Int_t
Signed integer 4 bytes (int).
Definition RtypesCore.h:59
const char Option_t
Option string (const char).
Definition RtypesCore.h:80
@ kRed
Definition Rtypes.h:67
@ kBlue
Definition Rtypes.h:67
static constexpr double infinity()
Return internal infinity representation.
Definition RooNumber.h:25
HypoTestPlot()=default
Constructor.
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.
HypoTestResult * fHypoTestResult
HypoTestResult is a base class for results from hypothesis tests.
bool HasTestStatisticData(void) const
double GetTestStatisticData(void) const
bool GetPValueIsRightTail(void) const
SamplingDistribution * GetNullDistribution(void) const
SamplingDistribution * GetAltDistribution(void) const
void GetAbsoluteInterval(double &theMin, double &theMax, double &theYMax) const
double AddSamplingDistributionShaded(const SamplingDistribution *samplingDist, double minShaded, double maxShaded, Option_t *drawOptions="NORMALIZE HIST")
Like AddSamplingDistribution, but also sets a shaded area in the minShaded and maxShaded boundaries.
void SetLineWidth(Width_t lwidth, const SamplingDistribution *sampleDist=nullptr)
void AddLine(double x1, double y1, double x2, double y2, const char *title=nullptr)
add a line
void SetLineColor(Color_t color, const SamplingDistribution *sampleDist=nullptr)
Sets line color for given sampling distribution and fill color for the associated shaded TH1F.
double AddSamplingDistribution(const SamplingDistribution *samplingDist, Option_t *drawOptions="NORMALIZE HIST")
adds the sampling distribution and returns the scale factor
SamplingDistPlot(Int_t nbins=100)
Constructors for SamplingDistribution.
This class simply holds a sampling distribution of some test statistic.
Namespace for the RooStats classes.
Definition CodegenImpl.h:66