Logo ROOT  
Reference Guide
RooUnitTest.cxx
Go to the documentation of this file.
1/*****************************************************************************
2 * Project: RooFit *
3 * Package: RooFitCore *
4 * @(#)root/roofitcore:$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
16/**
17\file RooUnitTest.cxx
18\class RooUnitTest
19\ingroup Roofitcore
20
21RooUnit test is an abstract base class for unit regression tests for
22RooFit and RooStats tests performed in stressRooFit and stressRooStats
23Implementations of this class must implement abstract method testCode()
24which defines the regression test to be performed. Inside testCode()
25the regression test can define objects on which the regression is performed.
26These are:
27Object | function
28----------------|------------
29 RooPlot | regPlot()
30 RooFitResult | regResult()
31 Double_t | regValue()
32 RooTable | regTable()
33 TH1/2/3 | regTH()
34 RooWorkspace | regWS()
35**/
36
37#include "RooUnitTest.h"
38#include "TDirectory.h"
39#include "TClass.h"
40#include "RooHist.h"
41#include "RooMsgService.h"
42#include "RooDouble.h"
43#include "RooTrace.h"
44#include "RooRandom.h"
45#include <cmath>
46
48
49using namespace std;
50
52
53
54////////////////////////////////////////////////////////////////////////////////
55
56RooUnitTest::RooUnitTest(const char* name, TFile* refFile, Bool_t writeRef, Int_t verbose, std::string const& batchMode) : TNamed(name,name),
57 _refFile(refFile), _debug(kFALSE), _write(writeRef), _verb(verbose), _batchMode(batchMode)
58{
59}
60
61
62
63////////////////////////////////////////////////////////////////////////////////
64
66{
67}
68
69
70////////////////////////////////////////////////////////////////////////////////
71
72void RooUnitTest::regPlot(RooPlot* frame, const char* refName)
73{
74 if (_refFile) {
75 string refNameStr(refName) ;
76 frame->SetName(refName) ;
77 _regPlots.push_back(make_pair(frame,refNameStr)) ;
78 } else {
79 delete frame ;
80 }
81}
82
83
84////////////////////////////////////////////////////////////////////////////////
85
86void RooUnitTest::regResult(RooFitResult* r, const char* refName)
87{
88 if (_refFile) {
89 string refNameStr(refName) ;
90 _regResults.push_back(make_pair(r,refNameStr)) ;
91 } else {
92 delete r ;
93 }
94}
95
96
97////////////////////////////////////////////////////////////////////////////////
98
99void RooUnitTest::regValue(Double_t d, const char* refName)
100{
101 if (_refFile) {
102 string refNameStr(refName) ;
103 _regValues.push_back(make_pair(d,refNameStr)) ;
104 }
105}
106
107
108////////////////////////////////////////////////////////////////////////////////
109
110void RooUnitTest::regTable(RooTable* t, const char* refName)
111{
112 if (_refFile) {
113 string refNameStr(refName) ;
114 _regTables.push_back(make_pair(t,refNameStr)) ;
115 } else {
116 delete t ;
117 }
118}
119
120
121////////////////////////////////////////////////////////////////////////////////
122
123void RooUnitTest::regWS(RooWorkspace* ws, const char* refName)
124{
125 if (_refFile) {
126 string refNameStr(refName) ;
127 _regWS.push_back(make_pair(ws,refNameStr)) ;
128 } else {
129 delete ws ;
130 }
131}
132
133
134////////////////////////////////////////////////////////////////////////////////
135
136void RooUnitTest::regTH(TH1* th, const char* refName)
137{
138 if (_refFile) {
139 string refNameStr(refName) ;
140 _regTH.push_back(make_pair(th,refNameStr)) ;
141 } else {
142 delete th ;
143 }
144}
145
146
147////////////////////////////////////////////////////////////////////////////////
148
149RooWorkspace* RooUnitTest::getWS(const char* refName)
150{
151 RooWorkspace* ws = dynamic_cast<RooWorkspace*>(_refFile->Get(refName)) ;
152 if (!ws) {
153 if(_verb >= 0) std::cout << "RooUnitTest ERROR: cannot retrieve RooWorkspace " << refName
154 << " from reference file, skipping " << endl ;
155 return 0 ;
156 }
157
158 return ws ;
159}
160
161
162////////////////////////////////////////////////////////////////////////////////
163
165{
166 if (htest->GetDimension() != href->GetDimension()) {
167 return false ;
168 }
169
170 // Use Kolmogorov distance as metric rather than probability
171 // because we expect histograms to be identical rather
172 // than drawn from the same parent distribution
173 Double_t kmax = htest->KolmogorovTest(href,"M") ;
174
175 if (kmax>htol()) {
176
177 if(_verb >= 0) std::cout << "KS distances = " << kmax << std::endl;
178
179 Int_t ntest = htest->GetNbinsX() +2 ;
180 Int_t nref = href->GetNbinsX() +2 ;
181 if (htest->GetDimension()>1) {
182 ntest *= htest->GetNbinsY() + 2 ;
183 nref *= href->GetNbinsY() + 2 ;
184 }
185 if (htest->GetDimension()>2) {
186 ntest *= htest->GetNbinsZ() + 2 ;
187 nref *= href->GetNbinsZ() + 2 ;
188 }
189
190 if (ntest != nref) {
191 return false ;
192 }
193
194 for (Int_t i=0 ; i<ntest ; i++) {
195 if (fabs(htest->GetBinContent(i)-href->GetBinContent(i))>htol()) {
196 if(_verb >= 0) std::cout << "htest[" << i << "] = " << htest->GetBinContent(i) << " href[" << i << "] = " << href->GetBinContent(i) << endl;
197 }
198 }
199
200 return false ;
201 }
202
203 return true ;
204}
205
206
207
208////////////////////////////////////////////////////////////////////////////////
209
211{
212 Bool_t ret = true ;
213
214 list<pair<RooPlot*, string> >::iterator iter = _regPlots.begin() ;
215 while (iter!=_regPlots.end()) {
216
217 if (!_write) {
218
219 // Comparison mode
220
221 // Retrieve benchmark
222 RooPlot* bmark = dynamic_cast<RooPlot*>(_refFile->Get(iter->second.c_str())) ;
223 if (!bmark) {
224 if(_verb >= 0) std::cout << "RooUnitTest ERROR: cannot retrieve RooPlot " << iter->second
225 << " from reference file, skipping " << std::endl;
226 ret = false ;
227 ++iter ;
228 continue ;
229 }
230
231 if (_verb > 0) {
232 cout << "comparing RooPlot " << iter->first << " to benchmark " << iter->second << " = " << bmark << endl ;
233 cout << "reference: " ; iter->first->Print() ;
234 cout << "benchmark: " ; bmark->Print() ;
235 }
236
237 RooPlot* compPlot = _debug ? iter->first->emptyClone(Form("%s_comparison",iter->first->GetName())) : 0 ;
238 Bool_t anyFail=false ;
239
240 Stat_t nItems = iter->first->numItems() ;
241 for (Stat_t i=0 ; i<nItems ; i++) {
242 // coverity[NULL_RETURNS]
243 TObject* obj = iter->first->getObject((Int_t)i) ;
244
245 // Retrieve corresponding object from reference frame
246 TObject* objRef = bmark->findObject(obj->GetName()) ;
247
248 if (!objRef) {
249 if(_verb >= 0) std::cout << "RooUnitTest ERROR: cannot retrieve reference object " << obj->GetName()
250 << " from benchmark RooPlot " << iter->second << ", skipping" << std::endl;
251 ret = false ;
252 break ;
253 }
254
255 // Histogram comparisons
256 if (obj->IsA()==RooHist::Class()) {
257 RooHist* testHist = static_cast<RooHist*>(obj) ;
258 RooHist* refHist = static_cast<RooHist*>(objRef) ;
259 if (!testHist->isIdentical(*refHist,htol(),_verb >= 0)) {
260 if(_verb >= 0) std::cout << "RooUnitTest ERROR: comparison of object " << obj->IsA()->GetName() << "::" << obj->GetName()
261 << " fails comparison with counterpart in reference RooPlot " << bmark->GetName() << std::endl;
262
263 if (compPlot) {
264 compPlot->addPlotable((RooHist*)testHist->Clone(),"P") ;
265 compPlot->getAttLine()->SetLineColor(kRed) ;
266 compPlot->getAttMarker()->SetMarkerColor(kRed) ;
267 compPlot->getAttLine()->SetLineWidth(1) ;
268
269 compPlot->addPlotable((RooHist*)refHist->Clone(),"P") ;
270 compPlot->getAttLine()->SetLineColor(kBlue) ;
271 compPlot->getAttMarker()->SetMarkerColor(kBlue) ;
272 compPlot->getAttLine()->SetLineWidth(1) ;
273 }
274
275 anyFail=true ;
276 ret = false ;
277 }
278 } else if (obj->IsA()==RooCurve::Class()) {
279 RooCurve* testCurve = static_cast<RooCurve*>(obj) ;
280 RooCurve* refCurve = static_cast<RooCurve*>(objRef) ;
281 if (!testCurve->isIdentical(*refCurve,ctol(),_verb >= 0)) {
282 if(_verb >= 0) std::cout << "RooUnitTest ERROR: comparison of object " << obj->IsA()->GetName() << "::" << obj->GetName()
283 << " fails comparison with counterpart in reference RooPlot " << bmark->GetName() << std::endl;
284
285 if (compPlot) {
286 compPlot->addPlotable((RooCurve*)testCurve->Clone()) ;
287 compPlot->getAttLine()->SetLineColor(kRed) ;
288 compPlot->getAttLine()->SetLineWidth(1) ;
289 compPlot->getAttLine()->SetLineStyle(kSolid) ;
290
291 compPlot->addPlotable((RooCurve*)refCurve->Clone()) ;
292 compPlot->getAttLine()->SetLineColor(kBlue) ;
293 compPlot->getAttLine()->SetLineWidth(1) ;
294 compPlot->getAttLine()->SetLineStyle(kDashed) ;
295 }
296
297 anyFail=true ;
298 ret = false ;
299 }
300
301 }
302
303 }
304
305 if (anyFail && compPlot) {
306 cout << "RooUnitTest INFO: writing comparison plot " << compPlot->GetName() << " of failed test to RooUnitTest_DEBUG.root" << endl ;
307 TFile fdbg("RooUnitTest_DEBUG.root","UPDATE") ;
308 compPlot->Write() ;
309 fdbg.Close() ;
310 } else {
311 delete compPlot ;
312 }
313
314 // Delete RooPlot when comparison is finished to avoid noise in leak checking
315 delete iter->first ;
316
317 } else {
318
319 // Writing mode
320
321 std::cout <<"RooUnitTest: Writing reference RooPlot " << iter->first << " as benchmark " << iter->second << endl ;
322 _refFile->cd() ;
323 iter->first->Write(iter->second.c_str()) ;
324 gMemDir->cd() ;
325 }
326
327 ++iter ;
328 }
329
330
331 list<pair<RooFitResult*, string> >::iterator iter2 = _regResults.begin() ;
332 while (iter2!=_regResults.end()) {
333
334 if (!_write) {
335
336 // Comparison mode
337
338 // Retrieve benchmark
339 RooFitResult* bmark = dynamic_cast<RooFitResult*>(_refFile->Get(iter2->second.c_str())) ;
340 if (!bmark) {
341 if(_verb >= 0) std::cout << "RooUnitTest ERROR: cannot retrieve RooFitResult "
342 << iter2->second << " from reference file, skipping " << std::endl ;
343 ++iter2 ;
344 ret = false ;
345 continue ;
346 }
347
348 if (_verb > 0) {
349 cout << "comparing RooFitResult " << iter2->first << " to benchmark " << iter2->second << " = " << bmark << endl ;
350 }
351
352 if (!iter2->first->isIdentical(*bmark,fptol(),fctol(),_verb >= 0)) {
353 if(_verb >= 0) cout << "RooUnitTest ERROR: comparison of object " << iter2->first->IsA()->GetName() << "::" << iter2->first->GetName()
354 << " from result " << iter2->second
355 << " fails comparison with counterpart in reference RooFitResult " << bmark->GetName() << std::endl;
356 ret = false ;
357 }
358
359 // Delete RooFitResult when comparison is finished to avoid noise in leak checking
360 delete iter2->first ;
361
362
363 } else {
364
365 // Writing mode
366
367 std::cout <<"RooUnitTest: Writing reference RooFitResult " << iter2->first << " as benchmark " << iter2->second << endl ;
368 _refFile->cd() ;
369 iter2->first->Write(iter2->second.c_str()) ;
370 gMemDir->cd() ;
371 }
372
373 ++iter2 ;
374 }
375
376 list<pair<Double_t, string> >::iterator iter3 = _regValues.begin() ;
377 while (iter3!=_regValues.end()) {
378
379 if (!_write) {
380
381 // Comparison mode
382
383 // Retrieve benchmark
384 RooDouble* ref = dynamic_cast<RooDouble*>(_refFile->Get(iter3->second.c_str())) ;
385 if (!ref) {
386 if(_verb >= 0) std::cout << "RooUnitTest ERROR: cannot retrieve RooDouble " << iter3->second << " from reference file, skipping " << std::endl;
387 ++iter3 ;
388 ret = false ;
389 continue ;
390 }
391
392 if (_verb > 0) {
393 cout << "comparing value " << iter3->first << " to benchmark " << iter3->second << " = " << (Double_t)(*ref) << endl ;
394 }
395
396 if (fabs(iter3->first - (Double_t)(*ref))>vtol() ) {
397 if(_verb >= 0) cout << "RooUnitTest ERROR: comparison of value " << iter3->first << " fails comparison with reference " << ref->GetName() << endl ;
398 ret = false ;
399 }
400
401
402 } else {
403
404 // Writing mode
405
406 std::cout <<"RooUnitTest: Writing reference Double_t " << iter3->first << " as benchmark " << iter3->second << endl ;
407 _refFile->cd() ;
408 RooDouble* rd = new RooDouble(iter3->first) ;
409 rd->Write(iter3->second.c_str()) ;
410 gMemDir->cd() ;
411 }
412
413 ++iter3 ;
414 }
415
416
417 list<pair<RooTable*, string> >::iterator iter4 = _regTables.begin() ;
418 while (iter4!=_regTables.end()) {
419
420 if (!_write) {
421
422 // Comparison mode
423
424 // Retrieve benchmark
425 RooTable* bmark = dynamic_cast<RooTable*>(_refFile->Get(iter4->second.c_str())) ;
426 if (!bmark) {
427 if(_verb >= 0) cout << "RooUnitTest ERROR: cannot retrieve RooTable " << iter4->second << " from reference file, skipping " << endl ;
428 ++iter4 ;
429 ret = false ;
430 continue ;
431 }
432
433 if (_verb > 0) {
434 cout << "comparing RooTable " << iter4->first << " to benchmark " << iter4->second << " = " << bmark << endl ;
435 }
436
437 if (!iter4->first->isIdentical(*bmark, _verb >= 0)) {
438 if(_verb >= 0) std::cout << "RooUnitTest ERROR: comparison of object " << iter4->first->IsA()->GetName() << "::" << iter4->first->GetName()
439 << " fails comparison with counterpart in reference RooTable " << bmark->GetName() << endl ;
440 if (_verb > 0) {
441 iter4->first->Print("V");
442 bmark->Print("V");
443 }
444 ret = false;
445 }
446
447 // Delete RooTable when comparison is finished to avoid noise in leak checking
448 delete iter4->first ;
449
450
451 } else {
452
453 // Writing mode
454
455 std::cout <<"RooUnitTest: Writing reference RooTable " << iter4->first << " as benchmark " << iter4->second << endl ;
456 _refFile->cd() ;
457 iter4->first->Write(iter4->second.c_str()) ;
458 gMemDir->cd() ;
459 }
460
461 ++iter4 ;
462 }
463
464
465 list<pair<RooWorkspace*, string> >::iterator iter5 = _regWS.begin() ;
466 while (iter5!=_regWS.end()) {
467
468 if (_write) {
469
470 // Writing mode
471
472 std::cout <<"RooUnitTest: Writing reference RooWorkspace " << iter5->first << " as benchmark " << iter5->second << endl ;
473 _refFile->cd() ;
474 iter5->first->Write(iter5->second.c_str()) ;
475 gMemDir->cd() ;
476 }
477
478 ++iter5 ;
479 }
480
481 /////////////////
482 list<pair<TH1*, string> >::iterator iter6 = _regTH.begin() ;
483 while (iter6!=_regTH.end()) {
484
485 if (!_write) {
486
487 // Comparison mode
488
489 // Retrieve benchmark
490 TH1* bmark = dynamic_cast<TH1*>(_refFile->Get(iter6->second.c_str())) ;
491 if (!bmark) {
492 if(_verb >= 0) cout << "RooUnitTest ERROR: cannot retrieve TH1 " << iter6->second << " from reference file, skipping " << endl ;
493 ++iter6 ;
494 ret = false ;
495 continue ;
496 }
497
498 if (_verb > 0) {
499 cout << "comparing TH1 " << iter6->first << " to benchmark " << iter6->second << " = " << bmark << endl ;
500 }
501
502 if (!areTHidentical(iter6->first,bmark)) {
503 // coverity[NULL_RETURNS]
504 if(_verb >= 0) cout << "RooUnitTest ERROR: comparison of object " << iter6->first->IsA()->GetName() << "::" << iter6->first->GetName()
505 << " fails comparison with counterpart in reference TH1 " << bmark->GetName() << endl ;
506
507
508 if (_debug) {
509 cout << "RooUnitTest INFO: writing THx " << iter6->first->GetName() << " and " << bmark->GetName()
510 << " of failed test to RooUnitTest_DEBUG.root" << endl ;
511 TFile fdbg("RooUnitTest_DEBUG.root","UPDATE") ;
512 iter6->first->SetName(Form("%s_test",iter6->first->GetName())) ;
513 iter6->first->Write() ;
514 bmark->SetName(Form("%s_ref",bmark->GetName())) ;
515 bmark->Write() ;
516 fdbg.Close() ;
517 }
518
519 ret = false ;
520 }
521
522 // Delete TH1 when comparison is finished to avoid noise in leak checking
523 delete iter6->first ;
524
525
526 } else {
527
528 // Writing mode
529
530 std::cout <<"RooUnitTest: Writing reference TH1 " << iter6->first << " as benchmark " << iter6->second << endl ;
531 _refFile->cd() ;
532 iter6->first->Write(iter6->second.c_str()) ;
533 gMemDir->cd() ;
534 }
535
536 ++iter6 ;
537 }
538
539
540 /////////////////
541
542 return ret ;
543}
544
545
546////////////////////////////////////////////////////////////////////////////////
547
549{
551 for (Int_t i=0 ; i<RooMsgService::instance().numStreams() ; i++) {
554 }
555 }
556}
557
558
559////////////////////////////////////////////////////////////////////////////////
560
562{
564 for (Int_t i=0 ; i<RooMsgService::instance().numStreams() ; i++) {
566 }
567}
568
569
570
571////////////////////////////////////////////////////////////////////////////////
572
574{
575 gMemDir->cd() ;
576
577 if (_verb<2) {
578 setSilentMode() ;
579 } else {
580 std::cout << "*** Begin of output of Unit Test at normal verbosity *************" << endl ;
581 }
582
584
585 // Reset random generator seed to make results independent of test ordering
586 gRandom->SetSeed(12345) ;
588
590 if (!testCode()) return false ;
592
593 if (_verb<2) {
595 } else {
596 std::cout << "*** End of output of Unit Test at normal verbosity ***************" << endl ;
597 }
598
599 if (RooMsgService::instance().errorCount()>0) {
600 if(_verb >= 0) std::cout << "RooUnitTest: ERROR messages were logged, failing test" << endl ;
601 return false ;
602 }
603
604 return runCompTests() ;
605}
606
607
608////////////////////////////////////////////////////////////////////////////////
609/// Set gMemDir to memDir
610
612 gMemDir = memDir ;
613}
#define d(i)
Definition: RSha256.hxx:102
const Bool_t kFALSE
Definition: RtypesCore.h:101
double Double_t
Definition: RtypesCore.h:59
#define ClassImp(name)
Definition: Rtypes.h:375
@ kRed
Definition: Rtypes.h:66
@ kBlue
Definition: Rtypes.h:66
@ kDashed
Definition: TAttLine.h:48
@ kSolid
Definition: TAttLine.h:48
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
char name[80]
Definition: TGX11.cxx:110
R__EXTERN TRandom * gRandom
Definition: TRandom.h:62
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Definition: TString.cxx:2447
A RooCurve is a one-dimensional graphical representation of a real-valued function.
Definition: RooCurve.h:32
Bool_t isIdentical(const RooCurve &other, Double_t tol=1e-6, bool verbose=true) const
Return true if curve is identical to other curve allowing for given absolute tolerance on each point ...
Definition: RooCurve.cxx:885
static TClass * Class()
RooDouble is a minimal implementation of a TObject holding a Double_t value.
Definition: RooDouble.h:22
RooFitResult is a container class to hold the input and output of a PDF fit to a dataset.
Definition: RooFitResult.h:40
TClass * IsA() const override
Definition: RooFitResult.h:204
A RooHist is a graphical representation of binned data based on the TGraphAsymmErrors class.
Definition: RooHist.h:27
Bool_t isIdentical(const RooHist &other, Double_t tol=1e-6, bool verbose=true) const
Return kTRUE if contents of this RooHist is identical within given relative tolerance to that of 'oth...
Definition: RooHist.cxx:656
static TClass * Class()
void setStreamStatus(Int_t id, Bool_t active)
(De)Activate stream with given unique ID
static RooMsgService & instance()
Return reference to singleton instance.
void clearErrorCount()
StreamConfig & getStream(Int_t id)
Int_t numStreams() const
void setSilentMode(Bool_t flag)
A RooPlot is a plot frame and a container for graphics objects within that frame.
Definition: RooPlot.h:43
void SetName(const char *name) override
Set the name of the RooPlot to 'name'.
Definition: RooPlot.cxx:1230
TAttMarker * getAttMarker(const char *name=0) const
Return a pointer to the marker attributes of the named object in this plot, or zero if the named obje...
Definition: RooPlot.cxx:872
TAttLine * getAttLine(const char *name=0) const
Return a pointer to the line attributes of the named object in this plot, or zero if the named object...
Definition: RooPlot.cxx:852
void addPlotable(RooPlotable *plotable, Option_t *drawOptions="", Bool_t invisible=kFALSE, Bool_t refreshNorm=kFALSE)
Add the specified plotable object to our plot.
Definition: RooPlot.cxx:561
TObject * findObject(const char *name, const TClass *clas=0) const
Find the named object in our list of items and return a pointer to it.
Definition: RooPlot.cxx:987
void Print(Option_t *options=0) const override
Print TNamed name and title.
Definition: RooPlot.h:135
static TRandom * randomGenerator()
Return a pointer to a singleton random-number generator implementation.
Definition: RooRandom.cxx:51
RooTable is the abstract interface for table objects.
Definition: RooTable.h:23
TClass * IsA() const override
Definition: RooTable.h:38
static void callgrind_zero()
Utility function to trigger zeroing of callgrind counters.
Definition: RooTrace.cxx:296
static void callgrind_dump()
Utility function to trigger dumping of callgrind counters.
Definition: RooTrace.cxx:308
RooUnit test is an abstract base class for unit regression tests for RooFit and RooStats tests perfor...
Definition: RooUnitTest.h:37
std::list< std::pair< TH1 *, std::string > > _regTH
Definition: RooUnitTest.h:85
virtual Double_t fctol()
fit correlation test tolerance
Definition: RooUnitTest.h:66
Bool_t runCompTests()
Bool_t _debug
Definition: RooUnitTest.h:76
void regValue(Double_t value, const char *refName)
Definition: RooUnitTest.cxx:99
virtual Double_t fptol()
fit parameter test tolerance
Definition: RooUnitTest.h:65
Bool_t areTHidentical(TH1 *htest, TH1 *href)
~RooUnitTest() override
Definition: RooUnitTest.cxx:65
Bool_t _write
Definition: RooUnitTest.h:77
void regWS(RooWorkspace *ws, const char *refName)
void regTH(TH1 *h, const char *refName)
RooUnitTest(const char *name, TFile *refFile, Bool_t writeRef, Int_t verbose, std::string const &batchMode="off")
Definition: RooUnitTest.cxx:56
void regResult(RooFitResult *r, const char *refName)
Definition: RooUnitTest.cxx:86
virtual Bool_t testCode()=0
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)
std::list< std::pair< Double_t, std::string > > _regValues
Definition: RooUnitTest.h:82
std::list< std::pair< RooPlot *, std::string > > _regPlots
Definition: RooUnitTest.h:80
void regPlot(RooPlot *frame, const char *refName)
Definition: RooUnitTest.cxx:72
Int_t _verb
Definition: RooUnitTest.h:78
void regTable(RooTable *t, const char *refName)
std::list< std::pair< RooFitResult *, std::string > > _regResults
Definition: RooUnitTest.h:81
Bool_t runTest()
virtual Double_t ctol()
curve test tolerance
Definition: RooUnitTest.h:63
virtual Double_t htol()
histogram test tolerance (KS dist != prob)
Definition: RooUnitTest.h:59
virtual Double_t vtol()
value test tolerance
Definition: RooUnitTest.h:67
std::list< std::pair< RooTable *, std::string > > _regTables
Definition: RooUnitTest.h:83
TFile * _refFile
Definition: RooUnitTest.h:75
void setSilentMode()
static TDirectory * gMemDir
Definition: RooUnitTest.h:73
void clearSilentMode()
The RooWorkspace is a persistable container for RooFit projects.
Definition: RooWorkspace.h:43
virtual void SetLineStyle(Style_t lstyle)
Set the line style.
Definition: TAttLine.h:42
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
Definition: TAttLine.h:43
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Definition: TAttLine.h:40
virtual void SetMarkerColor(Color_t mcolor=1)
Set the marker color.
Definition: TAttMarker.h:38
Bool_t cd(const char *path=nullptr) override
Change current directory to "this" directory.
TObject * Get(const char *namecycle) override
Return pointer to object identified by namecycle.
Describe directory structure in memory.
Definition: TDirectory.h:45
virtual Bool_t cd(const char *path=nullptr)
Change current directory to "this" directory.
Definition: TDirectory.cxx:504
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
Definition: TFile.h:54
void Close(Option_t *option="") override
Close a file.
Definition: TFile.cxx:891
TH1 is the base class of all histogram classes in ROOT.
Definition: TH1.h:58
virtual Int_t GetNbinsY() const
Definition: TH1.h:296
virtual Int_t GetNbinsZ() const
Definition: TH1.h:297
virtual Int_t GetDimension() const
Definition: TH1.h:281
virtual Int_t GetNbinsX() const
Definition: TH1.h:295
void SetName(const char *name) override
Change the name of this histogram.
Definition: TH1.cxx:8835
TClass * IsA() const override
Definition: TH1.h:437
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
Definition: TH1.cxx:5035
virtual Double_t KolmogorovTest(const TH1 *h2, Option_t *option="") const
Statistical test of compatibility in shape between this histogram and h2, using Kolmogorov test.
Definition: TH1.cxx:8095
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
TObject * Clone(const char *newname="") const override
Make a clone of an object using the Streamer facility.
Definition: TNamed.cxx:74
const char * GetName() const override
Returns name of object.
Definition: TNamed.h:47
void Print(Option_t *option="") const override
Print TNamed name and title.
Definition: TNamed.cxx:128
Mother of all ROOT objects.
Definition: TObject.h:37
virtual Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
Definition: TObject.cxx:798
virtual const char * GetName() const
Returns name of object.
Definition: TObject.cxx:359
virtual TClass * IsA() const
Definition: TObject.h:230
virtual void SetSeed(ULong_t seed=0)
Set the random generator seed.
Definition: TRandom.cxx:608
VecExpr< UnaryOp< Fabs< T >, VecExpr< A, T, D >, T >, T, D > fabs(const VecExpr< A, T, D > &rhs)
void ws()
Definition: ws.C:66