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