Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RooUnitTest.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Project: RooFit *
3 * Package: RooFitCore *
4 * File: $Id$
5 * Authors: *
6 * WV, Wouter Verkerke, NIKHEF, verkerke@nikhef.nl *
7 * *
8 * Copyright (c) 2000-2011, Regents of the University of California *
9 * and Stanford University. All rights reserved. *
10 * *
11 * Redistribution and use in source and binary forms, *
12 * with or without modification, are permitted according to the terms *
13 * listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
14 *****************************************************************************/
15#ifndef ROO_UNIT_TEST
16#define ROO_UNIT_TEST
17
18#include "RooTable.h"
19#include "RooWorkspace.h"
20#include "RooFitResult.h"
21#include "RooPlot.h"
22
23#include "TNamed.h"
24#include "TH1.h"
25
26#include <list>
27#include <string>
28#include <utility>
29
30class TFile;
31
32/*
33 * The tolerance for the curve test is put to 0.4 instead of 0.2 to take into
34 * account the small variations in the values of the likelihood which can occur
35 * in presence of a different treatment of floating point numbers.
36 */
37
38class RooUnitTest : public TNamed {
39public:
40 RooUnitTest(const char* name, TFile* refFile, bool writeRef, Int_t verbose) ;
41 ~RooUnitTest() override ;
42
43 void setDebug(bool flag) { _debug = flag ; }
44 void setSilentMode() ;
45 void clearSilentMode() ;
46 void regPlot(RooPlot* frame, const char* refName) ;
47 void regResult(std::unique_ptr<RooFitResult> r, const char* refName) ;
48 void regValue(double value, const char* refName) ;
49 void regTable(RooTable* t, const char* refName) ;
50 void regWS(RooWorkspace* ws, const char* refName) ;
51 void regTH(TH1* h, const char* refName) ;
52 RooWorkspace* getWS(const char* refName) ;
53 bool runTest() ;
54 bool runCompTests() ;
55 bool areTHidentical(TH1* htest, TH1* href) ;
56
57 virtual bool isTestAvailable() { return true ; }
58 virtual bool testCode() = 0 ;
59
60 virtual double htol() { return 5e-4 ; } ///< histogram test tolerance (KS dist != prob)
61#ifdef R__FAST_MATH
62 virtual double ctol() { return 2e-3 ; } ///< curve test tolerance
63#else
64 virtual double ctol() { return 4e-3 ; } ///< curve test tolerance
65#endif
66 virtual double fptol() { return 1e-5 ; } ///< fit parameter test tolerance
67 virtual double fctol() { return 1e-4 ; } ///< fit correlation test tolerance
68 virtual double vtol() { return 1e-3 ; } ///< value test tolerance
69
70 static void setMemDir(TDirectory* memDir);
71
72protected:
73
75
77 bool _debug ;
78 bool _write ;
80 std::list<std::pair<RooPlot*, std::string> > _regPlots ;
81 std::list<std::pair<RooFitResult*, std::string> > _regResults ;
82 std::list<std::pair<double, std::string> > _regValues ;
83 std::list<std::pair<RooTable*,std::string> > _regTables ;
84 std::list<std::pair<RooWorkspace*,std::string> > _regWS ;
85 std::list<std::pair<TH1*,std::string> > _regTH ;
86
87 ClassDefOverride(RooUnitTest,0) ; // Abstract base class for RooFit/RooStats unit regression tests
88} ;
89#endif
#define h(i)
Definition RSha256.hxx:106
#define e(i)
Definition RSha256.hxx:103
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
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 r
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
char name[80]
Definition TGX11.cxx:110
A RooPlot is a plot frame and a container for graphics objects within that frame.
Definition RooPlot.h:43
RooTable is the abstract interface for table objects.
Definition RooTable.h:23
RooUnit test is an abstract base class for unit regression tests for RooFit and RooStats tests perfor...
Definition RooUnitTest.h:38
std::list< std::pair< TH1 *, std::string > > _regTH
Definition RooUnitTest.h:85
bool runCompTests()
virtual double htol()
histogram test tolerance (KS dist != prob)
Definition RooUnitTest.h:60
~RooUnitTest() override
void regWS(RooWorkspace *ws, const char *refName)
void regTH(TH1 *h, const char *refName)
virtual double fptol()
fit parameter test tolerance
Definition RooUnitTest.h:66
std::list< std::pair< RooWorkspace *, std::string > > _regWS
Definition RooUnitTest.h:84
static void setMemDir(TDirectory *memDir)
Set gMemDir to memDir.
RooWorkspace * getWS(const char *refName)
void regResult(std::unique_ptr< RooFitResult > r, const char *refName)
std::list< std::pair< RooPlot *, std::string > > _regPlots
Definition RooUnitTest.h:80
void regPlot(RooPlot *frame, const char *refName)
void setDebug(bool flag)
Definition RooUnitTest.h:43
void regValue(double value, const char *refName)
void regTable(RooTable *t, const char *refName)
std::list< std::pair< RooFitResult *, std::string > > _regResults
Definition RooUnitTest.h:81
virtual double ctol()
curve test tolerance
Definition RooUnitTest.h:64
std::list< std::pair< double, std::string > > _regValues
Definition RooUnitTest.h:82
virtual bool testCode()=0
bool areTHidentical(TH1 *htest, TH1 *href)
virtual double fctol()
fit correlation test tolerance
Definition RooUnitTest.h:67
std::list< std::pair< RooTable *, std::string > > _regTables
Definition RooUnitTest.h:83
virtual double vtol()
value test tolerance
Definition RooUnitTest.h:68
TFile * _refFile
Definition RooUnitTest.h:76
virtual bool isTestAvailable()
Definition RooUnitTest.h:57
void setSilentMode()
static TDirectory * gMemDir
Definition RooUnitTest.h:74
void clearSilentMode()
The RooWorkspace is a persistable container for RooFit projects.
Describe directory structure in memory.
Definition TDirectory.h:45
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
Definition TFile.h:51
TH1 is the base class of all histogram classes in ROOT.
Definition TH1.h:58
The TNamed class is the base class for all named ROOT classes.
Definition TNamed.h:29