41 using namespace RooStats;
45 TNamed( results->GetName(), results->GetTitle() ),
53 HypoTestInverterPlot::HypoTestInverterPlot(
const char*
name,
76 if (option.
Contains(
"CLB")) type = 1;
78 else if (option.
Contains(
"CLS" )) type = 3;
83 std::vector<unsigned int> index(nEntries);
87 std::vector<Double_t> xArray(nEntries);
88 std::vector<Double_t> yArray(nEntries);
89 std::vector<Double_t> yErrArray(nEntries);
90 for (
int i=0; i<nEntries; i++) {
95 }
else if (type == 1) {
98 }
else if (type == 2) {
101 }
else if (type == 3) {
107 TGraphErrors* graph =
new TGraphErrors(nEntries,&xArray.front(),&yArray.front(),0,&yErrArray.front());
109 if (type == 1 ) pValueName =
"CLb";
110 if (type == 2 || (type == 0 && !
fResults->
fUseCLs) ) pValueName =
"CLs+b";
112 TString
title = TString(
"Observed ") + pValueName;
113 graph->SetName(name);
114 graph->SetTitle(title);
115 graph->SetMarkerStyle(20);
116 graph->SetLineWidth(2);
132 bool doFirstBand = (nsig1 > 0);
133 bool doSecondBand = (nsig2 > nsig1);
139 std::vector<unsigned int> index(nEntries);
143 TGraph * g0 =
new TGraph;
151 if (nsig1 -
int(nsig1) < 0.01)
158 if (nsig2 -
int(nsig2) < 0.01)
173 for (
int j=0; j<nEntries; ++j) {
179 if (resultIsAsymptotic) {
181 double dsig = 2* maxSigma/ (values.size() -1) ;
182 int i0 = (int)
TMath::Floor ( ( -nsig2 + maxSigma )/dsig + 0.5);
183 int i1 = (int)
TMath::Floor ( (-nsig1 + maxSigma )/dsig + 0.5);
185 int i3 = (int)
TMath::Floor ( ( nsig1 + maxSigma)/dsig + 0.5);
186 int i4 = (int)
TMath::Floor ( ( nsig2 + maxSigma)/dsig + 0.5);
194 double *
x =
const_cast<double *
>(&values[0]);
256 bool drawAxis = !option.
Contains(
"SAME");
259 bool drawCLb = option.
Contains(
"CLB");
260 bool draw2CL = option.
Contains(
"2CL");
262 TGraphErrors * gobs = 0;
271 gplot->GetHistogram()->SetTitle(
GetTitle() );
273 else gobs->Draw(
"PL");
281 if (drawAxis && !drawObs) {
294 double x1 = gplot->GetXaxis()->GetXmin();
295 double x2 = gplot->GetXaxis()->GetXmax();
296 TLine *
line =
new TLine(x1, alpha, x2,alpha);
297 line->SetLineColor(
kRed);
302 gplot->GetYaxis()->SetTitle(
"p value");
310 gclb->SetMarkerColor(
kBlue+4);
313 if (gobs) gobs->SetMarkerColor(
kRed);
321 gclsb->SetMarkerColor(
kBlue);
323 gclsb->SetLineStyle(3);
328 gcls->SetMarkerColor(
kBlue);
330 gcls->SetLineStyle(3);
340 double verticalSize = (gexp || draw2CL || drawCLb ) ? 0.3 : 0.15;
341 double y1 = y0 + verticalSize;
343 if (gobs) l->
AddEntry(gobs,
"",
"PEL");
344 if (gclsb) l->
AddEntry(gclsb,
"",
"PEL");
345 if (gcls) l->
AddEntry(gcls,
"",
"PEL");
346 if (gclb) l->
AddEntry(gclb,
"",
"PEL");
350 for (
int i = ngraphs-1; i>=0; --i) {
353 if (i == ngraphs-1) lopt =
"L";
virtual const char * GetTitle() const
Returns title of object.
Double_t Floor(Double_t x)
virtual Double_t ConfidenceLevel() const
return confidence level
This class displays a legend box (TPaveText) containing several legend entries.
double CLbError(int index) const
return the observed CLb value for the i-th entry
TList * GetListOfGraphs() const
int ArraySize() const
number of entries in the results array
virtual void Draw(Option_t *option="")
Draw this legend with its current attributes.
std::vector< double > values
HypoTestResult is a base class for results from hypothesis tests.
A TMultiGraph is a collection of TGraph (or derived) objects.
void ToUpper()
Change string to upper case.
Double_t AddSamplingDistribution(const SamplingDistribution *samplingDist, Option_t *drawOptions="NORMALIZE HIST")
adds the sampling distribution and returns the scale factor
SamplingDistribution * GetSignalAndBackgroundTestStatDist(int index) const
This class provides the plots for the result of a study performed with any of the HypoTestCalculatorG...
double GetYError(int index) const
function to return the estimated error on the value of the confidence level for the i^th entry in the...
virtual void SetTitle(const char *title="")
Set graph title.
TMultiGraph * MakeExpectedPlot(double sig1=1, double sig2=2)
Make the expected plot and the bands nsig1 and nsig2 indicates the n-sigma value for the bands if nsi...
SamplingDistribution * GetBackgroundTestStatDist(int index) const
const std::vector< Double_t > & GetSamplingDistribution() const
Get test statistics values.
virtual TObject * At(Int_t idx) const
Returns the object at position idx. Returns 0 if idx is out of range.
const char * Data() const
HypoTestInverterResult * fResults
TGraph with assymetric error bars.
static const double x2[5]
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString...
double CLsError(int index) const
return the observed CLb value for the i-th entry
The TNamed class is the base class for all named ROOT classes.
void Quantiles(Int_t n, Int_t nprob, Double_t *x, Double_t *quantiles, Double_t *prob, Bool_t isSorted=kTRUE, Int_t *index=0, Int_t type=7)
Computes sample quantiles, corresponding to the given probabilities Parameters: x -the data sample n ...
double normal_cdf(double x, double sigma=1, double x0=0)
Cumulative distribution function of the normal (Gaussian) distribution (lower tail).
virtual void SetPointEYlow(Int_t i, Double_t eyl)
Set EYlow for point i.
static Vc_ALWAYS_INLINE Vector< T > abs(const Vector< T > &x)
virtual void Draw(Option_t *chopt="")
Draw this multigraph with its current attributes.
double CLsplusb(int index) const
return the observed CLsplusb value for the i-th entry
SamplingDistPlot * MakeTestStatPlot(int index, int type=0, int nbins=100)
Plot the test statistic distributions type =0 null and alt type = 1 only null (S+B) type = 2 only alt...
ClassImp(RooStats::HypoTestInverterPlot) using namespace RooStats
TGraphErrors * MakePlot(Option_t *opt="")
return a TGraphErrors with the obtained observed p-values resultinf from the scan By default (Option ...
SamplingDistribution * GetExpectedPValueDist(int index) const
return expected distribution of p-values (Cls or Clsplusb)
TPaveLabel title(3, 27.1, 15, 28.7,"ROOT Environment and Tools")
virtual void SetFillColor(Color_t fcolor)
virtual const char * GetName() const
Returns name of object.
SamplingDistribution * GetAltTestStatDist(int index) const
This class simply holds a sampling distribution of some test statistic.
static double fgAsymptoticMaxSigma
double GetXValue(int index) const
function to return the value of the parameter of interest for the i^th entry in the results ...
virtual Int_t GetSize() const
static const double x1[5]
double CLs(int index) const
return the observed CLb value for the i-th entry
HypoTestInverterResult class: holds the array of hypothesis test results and compute a confidence int...
TLegendEntry * AddEntry(const TObject *obj, const char *label="", Option_t *option="lpf")
Add a new entry to this legend.
Class to plot an HypoTestInverterResult, result of the HypoTestInverter calculator.
~HypoTestInverterPlot()
destructor
double GetYValue(int index) const
function to return the value of the confidence level for the i^th entry in the results ...
double CLsplusbError(int index) const
return the observed CLsplusb value for the i-th entry
TH1F * GetHistogram() const
Returns a pointer to the histogram used to draw the axis.
This class provides simple and straightforward utilities to plot SamplingDistribution objects...
Mother of all ROOT objects.
virtual TObject * First() const
Return the first object in the list. Returns 0 when list is empty.
virtual void SetPoint(Int_t i, Double_t x, Double_t y)
Set x and y values for point number i.
void Draw(Option_t *opt="")
Draw the scan result in the current canvas Possible options: "" (default): draw observed + expected w...
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
virtual void Add(TGraph *graph, Option_t *chopt="")
Add a new graph to the list of graphs.
RooAbsArg is the common abstract base class for objects that represent a value (of arbitrary type) an...
double CLb(int index) const
return the observed CLb value for the i-th entry
virtual void SetTitle(const char *title="")
Change (i.e. set) the title of the TNamed.
virtual void SetPointEYhigh(Int_t i, Double_t eyh)
Set EYhigh for point i.
void SortItr(Iterator first, Iterator last, IndexIterator index, Bool_t down=kTRUE)
SamplingDistribution * GetNullTestStatDist(int index) const
same in terms of alt and null
std::vector< double > fXValues
max sigma value used to scan asymptotic expected p values