HypoTestPlot.cxx

Go to the documentation of this file.
00001 // @(#)root/roostats:$Id: HypoTestPlot.cxx 36602 2010-11-11 16:52:13Z moneta $
00002 // Author: Sven Kreiss   June 2010
00003 /*************************************************************************
00004  * Copyright (C) 1995-2008, Rene Brun and Fons Rademakers.               *
00005  * All rights reserved.                                                  *
00006  *                                                                       *
00007  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00008  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00009  *************************************************************************/
00010 
00011 /**
00012  * Class HypoTestPlot
00013  * This class provides the plots for the result of a study performed with e.g. the
00014  * HybridCalculator2 class.
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 }

Generated on Tue Jul 5 15:14:34 2011 for ROOT_528-00b_version by  doxygen 1.5.1