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;
26
27////////////////////////////////////////////////////////////////////////////////
28
30 SamplingDistPlot(bins),
31 fHypoTestResult(&result)
32{
33 ApplyResult(result, opt);
34}
35HypoTestPlot::HypoTestPlot(HypoTestResult& result, Int_t bins, double min, double max, Option_t* opt) :
36 SamplingDistPlot(bins,min,max),
37 fHypoTestResult(&result)
38{
39 ApplyResult(result, opt);
40}
41
42////////////////////////////////////////////////////////////////////////////////
43
45 fLegend = new TLegend(0.55,0.95-0.3*0.66,0.95,0.95);
46
47 const SamplingDistribution *alt = result.GetAltDistribution();
48 const SamplingDistribution *null = result.GetNullDistribution();
49 if(!result.HasTestStatisticData()) {
50 if(alt) AddSamplingDistribution(alt, opt);
51 if(null) AddSamplingDistribution(null, opt);
52 }else{
53 if(result.GetPValueIsRightTail()) {
54 if(alt) AddSamplingDistributionShaded(alt, result.GetTestStatisticData(), RooNumber::infinity(), opt);
55 if(null) AddSamplingDistributionShaded(null, result.GetTestStatisticData(), RooNumber::infinity() , opt);
56 }else{
57 if(alt) AddSamplingDistributionShaded(alt, -RooNumber::infinity(), result.GetTestStatisticData(), opt);
58 if(null) AddSamplingDistributionShaded(null, - RooNumber::infinity(), result.GetTestStatisticData() , opt);
59 }
60 }
61
62 if(result.HasTestStatisticData()) {
63 double theMin(0.);
64 double theMax(0.);
65 double theYMax(0.);
66 GetAbsoluteInterval(theMin, theMax, theYMax);
67
68 AddLine(result.GetTestStatisticData(), 0, result.GetTestStatisticData(), theYMax*0.66, "test statistic data");
69 }
70
72}
73
74////////////////////////////////////////////////////////////////////////////////
75
77 if(!fHypoTestResult) return;
78
81
82 if(alt) {
83 SetLineWidth(2, alt);
84 SetLineColor(kBlue, alt);
85 }
86 if(null) {
87 SetLineWidth(2, null);
88 SetLineColor(kRed, null);
89 }
90}
const char Option_t
Definition RtypesCore.h:66
#define ClassImp(name)
Definition Rtypes.h:382
@ kRed
Definition Rtypes.h:66
@ kBlue
Definition Rtypes.h:66
Option_t Option_t SetLineWidth
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
Option_t Option_t SetLineColor
static constexpr double infinity()
Return internal infinity representation.
Definition RooNumber.h:25
This class provides the plots for the result of a study performed with any of the HypoTestCalculatorG...
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.
SamplingDistribution * GetNullDistribution(void) const
SamplingDistribution * GetAltDistribution(void) const
This class provides simple and straightforward utilities to plot SamplingDistribution objects.
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 AddLine(double x1, double y1, double x2, double y2, const char *title=nullptr)
add a line
double AddSamplingDistribution(const SamplingDistribution *samplingDist, Option_t *drawOptions="NORMALIZE HIST")
adds the sampling distribution and returns the scale factor
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