// @(#)root/roostats:$Id$ /************************************************************************* * Project: RooStats * * Package: RooFit/RooStats * * Authors: * * Kyle Cranmer, Lorenzo Moneta, Gregory Schott, Wouter Verkerke * ************************************************************************* * Copyright (C) 1995-2008, Rene Brun and Fons Rademakers. * * All rights reserved. * * * * For the licensing terms see $ROOTSYS/LICENSE. * * For the list of contributors see $ROOTSYS/README/CREDITS. * *************************************************************************/ /** \class RooStats::HybridResult \ingroup Roostats Class encapsulating the result of the HybridCalculatorOriginal. This class is a fresh rewrite in RooStats of RooStatsCms/LimitResults developed by D. Piparo and G. Schott New contributions to this class have been written by Matthias Wolf (error estimation) The objects of this class store and access with lightweight methods the information calculated by LimitResults through a Lent calculation using MC toy experiments. In some ways can be considered an extended and extensible implementation of the TConfidenceLevel class (http://root.cern.ch/root/html/TConfidenceLevel.html). */ #include "RooDataHist.h" #include "RooDataSet.h" #include "RooGlobalFunc.h" // for RooFit::Extended() #include "RooNLLVar.h" #include "RooRealVar.h" #include "RooAbsData.h" #include "RooStats/HybridResult.h" #include "RooStats/HybridPlot.h" /// ClassImp for building the THtml documentation of the class using namespace std; ClassImp(RooStats::HybridResult); using namespace RooStats; //////////////////////////////////////////////////////////////////////////////// /// Construtor HybridResult::HybridResult( const char *name) : HypoTestResult(name), fTestStat_data(-999.), fComputationsNulDoneFlag(false), fComputationsAltDoneFlag(false), fSumLargerValues(false) { // HybridResult default constructor (with name ) } //////////////////////////////////////////////////////////////////////////////// /// Construtor HybridResult::HybridResult( const char *name, const std::vector& testStat_sb_vals, const std::vector& testStat_b_vals, bool sumLargerValues ) : HypoTestResult(name,0,0), fTestStat_data(-999.), fComputationsNulDoneFlag(false), fComputationsAltDoneFlag(false), fSumLargerValues(sumLargerValues) { // HybridResult constructor (with name, title and vectors of S+B and B values) int vector_size_sb = testStat_sb_vals.size(); assert(vector_size_sb>0); int vector_size_b = testStat_b_vals.size(); assert(vector_size_b>0); fTestStat_sb.reserve(vector_size_sb); for (int i=0;i= fTestStat_data ) ++larger_than_measured; } else { for (int iToy=0;iToy= fTestStat_data ) ++larger_than_measured; } else { for (int iToy=0;iToyGetTestStat_sb().size(); for (int i=0;iGetTestStat_sb()[i]); int other_size_b = other->GetTestStat_b().size(); for (int i=0;iGetTestStat_b()[i]); // if no data is present use the other's HybridResult's data if (fTestStat_data==-999.) fTestStat_data = other->GetTestStat_data(); fComputationsAltDoneFlag = false; fComputationsNulDoneFlag = false; return; } //////////////////////////////////////////////////////////////////////////////// /// prepare a plot showing a result and return a pointer to a HybridPlot object /// the needed arguments are: an object name, a title and the number of bins in the plot HybridPlot* HybridResult::GetPlot(const char* name,const char* title, int n_bins) { // default plot name TString plot_name; if ( TString(name)=="" ) { plot_name += GetName(); plot_name += "_plot"; } else plot_name = name; // default plot title TString plot_title; if ( TString(title)=="" ) { plot_title += GetTitle(); plot_title += "_plot ("; plot_title += fTestStat_b.size(); plot_title += " toys)"; } else plot_title = title; HybridPlot* plot = new HybridPlot( plot_name.Data(), plot_title.Data(), fTestStat_sb, fTestStat_b, fTestStat_data, n_bins, true ); return plot; } //////////////////////////////////////////////////////////////////////////////// /// Print out some information about the results void HybridResult::PrintMore(const char* /*options */) { std::cout << "\nResults " << GetName() << ":\n" << " - Number of S+B toys: " << fTestStat_b.size() << std::endl << " - Number of B toys: " << fTestStat_sb.size() << std::endl << " - test statistics evaluated on data: " << fTestStat_data << std::endl << " - CL_b " << CLb() << std::endl << " - CL_s+b " << CLsplusb() << std::endl << " - CL_s " << CLs() << std::endl; return; }