00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 #include "RooStats/HypoTestPlot.h"
00019 
00020 
00021 ClassImp(RooStats::HypoTestPlot)
00022 
00023 using namespace RooStats;
00024 #include "TStyle.h"
00025 
00026 HypoTestPlot::HypoTestPlot(HypoTestResult& result, Int_t bins) :
00027    SamplingDistPlot(bins),
00028    fHypoTestResult(&result)
00029 {
00030    ApplyResult(result);
00031 }
00032 
00033 void HypoTestPlot::ApplyResult(HypoTestResult& result) {
00034    fLegend = new TLegend(0.70,0.95-0.2*0.66,0.95,0.95);
00035 
00036    const SamplingDistribution *alt = result.GetAltDistribution();
00037    const SamplingDistribution *null = result.GetNullDistribution();
00038    if(!result.HasTestStatisticData()) {
00039       if(alt) AddSamplingDistribution(alt, "NORMALIZE HIST");
00040       if(null) AddSamplingDistribution(null, "NORMALIZE HIST");
00041    }else{
00042       if(!result.GetPValueIsRightTail()) {
00043          if(alt) AddSamplingDistributionShaded(alt, result.GetTestStatisticData(), RooNumber::infinity(), "NORMALIZE HIST");
00044          if(null) AddSamplingDistributionShaded(null, -RooNumber::infinity(), result.GetTestStatisticData(), "NORMALIZE HIST");
00045       }else{
00046          if(alt) AddSamplingDistributionShaded(alt, -RooNumber::infinity(), result.GetTestStatisticData(), "NORMALIZE HIST");
00047          if(null) AddSamplingDistributionShaded(null, result.GetTestStatisticData(), RooNumber::infinity(), "NORMALIZE HIST");
00048       }
00049    }
00050 
00051    if(result.HasTestStatisticData()) {
00052       Float_t theMin(0.), theMax(0.), theYMax(0.);
00053       GetAbsoluteInterval(theMin, theMax, theYMax);
00054 
00055       AddLine(result.GetTestStatisticData(), 0, result.GetTestStatisticData(), theYMax*0.66, "test statistic data");
00056    }
00057 
00058    ApplyDefaultStyle();
00059 }
00060 
00061 void HypoTestPlot::ApplyDefaultStyle(void) {
00062    if(!fHypoTestResult) return;
00063 
00064    const SamplingDistribution *alt = fHypoTestResult->GetAltDistribution();
00065    const SamplingDistribution *null = fHypoTestResult->GetNullDistribution();
00066 
00067    if(alt) {
00068       SetLineWidth(2, alt);
00069       SetLineColor(kBlue, alt);
00070    }
00071    if(null) {
00072       SetLineWidth(2, null);
00073       SetLineColor(kRed, null);
00074    }
00075 }