60 _refFile(refFile), _debug(
kFALSE), _write(writeRef), _verb(verbose)
78 string refNameStr(refName) ;
80 _regPlots.push_back(make_pair(frame,refNameStr)) ;
92 string refNameStr(refName) ;
105 string refNameStr(refName) ;
106 _regValues.push_back(make_pair(d,refNameStr)) ;
116 string refNameStr(refName) ;
117 _regTables.push_back(make_pair(t,refNameStr)) ;
129 string refNameStr(refName) ;
130 _regWS.push_back(make_pair(ws,refNameStr)) ;
142 string refNameStr(refName) ;
143 _regTH.push_back(make_pair(th,refNameStr)) ;
156 cout <<
"RooUnitTest ERROR: cannot retrieve RooWorkspace " << refName
157 <<
" from reference file, skipping " << endl ;
180 cout <<
"KS distances = " << kmax << endl ;
197 for (
Int_t i=0 ; i<ntest ; i++) {
217 list<pair<RooPlot*, string> >::iterator iter =
_regPlots.begin() ;
227 cout <<
"RooUnitTest ERROR: cannot retrieve RooPlot " << iter->second <<
" from reference file, skipping " << endl ;
234 cout <<
"comparing RooPlot " << iter->first <<
" to benchmark " << iter->second <<
" = " << bmark << endl ;
235 cout <<
"reference: " ; iter->first->Print() ;
236 cout <<
"benchmark: " ; bmark->
Print() ;
239 RooPlot* compPlot =
_debug ? iter->first->emptyClone(
Form(
"%s_comparison",iter->first->GetName())) : 0 ;
242 Stat_t nItems = iter->first->numItems() ;
243 for (
Stat_t i=0 ; i<nItems ; i++) {
251 cout <<
"RooUnitTest ERROR: cannot retrieve object " << obj->
GetName() <<
" from reference RooPlot " << iter->second <<
", skipping" << endl ;
261 cout <<
"RooUnitTest ERROR: comparison of object " << obj->IsA()->
GetName() <<
"::" << obj->
GetName()
262 <<
" fails comparison with counterpart in reference RooPlot " << bmark->
GetName() << endl ;
283 cout <<
"RooUnitTest ERROR: comparison of object " << obj->IsA()->
GetName() <<
"::" << obj->
GetName()
284 <<
" fails comparison with counterpart in reference RooPlot " << bmark->
GetName() << endl ;
306 if (anyFail && compPlot) {
307 cout <<
"RooUnitTest INFO: writing comparison plot " << compPlot->
GetName() <<
" of failed test to RooUnitTest_DEBUG.root" << endl ;
308 TFile fdbg(
"RooUnitTest_DEBUG.root",
"UPDATE") ;
322 cout <<
"RooUnitTest: Writing reference RooPlot " << iter->first <<
" as benchmark " << iter->second << endl ;
324 iter->first->Write(iter->second.c_str()) ;
332 list<pair<RooFitResult*, string> >::iterator iter2 =
_regResults.begin() ;
342 cout <<
"RooUnitTest ERROR: cannot retrieve RooFitResult " << iter2->second <<
" from reference file, skipping " << endl ;
349 cout <<
"comparing RooFitResult " << iter2->first <<
" to benchmark " << iter2->second <<
" = " << bmark << endl ;
352 if (!iter2->first->isIdentical(*bmark,
fptol(),
fctol())) {
353 cout <<
"RooUnitTest ERROR: comparison of object " << iter2->first->IsA()->GetName() <<
"::" << iter2->first->GetName()
354 <<
" fails comparison with counterpart in reference RooFitResult " << bmark->
GetName() << endl ;
359 delete iter2->first ;
366 cout <<
"RooUnitTest: Writing reference RooFitResult " << iter2->first <<
" as benchmark " << iter2->second << endl ;
368 iter2->first->Write(iter2->second.c_str()) ;
375 list<pair<Double_t, string> >::iterator iter3 =
_regValues.begin() ;
385 cout <<
"RooUnitTest ERROR: cannot retrieve RooDouble " << iter3->second <<
" from reference file, skipping " << endl ;
392 cout <<
"comparing value " << iter3->first <<
" to benchmark " << iter3->second <<
" = " << (
Double_t)(*ref) << endl ;
396 cout <<
"RooUnitTest ERROR: comparison of value " << iter3->first <<
" fails comparison with reference " << ref->
GetName() << endl ;
405 cout <<
"RooUnitTest: Writing reference Double_t " << iter3->first <<
" as benchmark " << iter3->second << endl ;
408 rd->
Write(iter3->second.c_str()) ;
416 list<pair<RooTable*, string> >::iterator iter4 =
_regTables.begin() ;
426 cout <<
"RooUnitTest ERROR: cannot retrieve RooTable " << iter4->second <<
" from reference file, skipping " << endl ;
433 cout <<
"comparing RooTable " << iter4->first <<
" to benchmark " << iter4->second <<
" = " << bmark << endl ;
436 if (!iter4->first->isIdentical(*bmark)) {
437 cout <<
"RooUnitTest ERROR: comparison of object " << iter4->first->IsA()->GetName() <<
"::" << iter4->first->GetName()
438 <<
" fails comparison with counterpart in reference RooTable " << bmark->
GetName() << endl ;
443 delete iter4->first ;
450 cout <<
"RooUnitTest: Writing reference RooTable " << iter4->first <<
" as benchmark " << iter4->second << endl ;
452 iter4->first->Write(iter4->second.c_str()) ;
460 list<pair<RooWorkspace*, string> >::iterator iter5 =
_regWS.begin() ;
461 while (iter5!=
_regWS.end()) {
467 cout <<
"RooUnitTest: Writing reference RooWorkspace " << iter5->first <<
" as benchmark " << iter5->second << endl ;
469 iter5->first->Write(iter5->second.c_str()) ;
477 list<pair<TH1*, string> >::iterator iter6 =
_regTH.begin() ;
478 while (iter6!=
_regTH.end()) {
485 TH1* bmark =
dynamic_cast<TH1*
>(
_refFile->Get(iter6->second.c_str())) ;
487 cout <<
"RooUnitTest ERROR: cannot retrieve TH1 " << iter6->second <<
" from reference file, skipping " << endl ;
494 cout <<
"comparing TH1 " << iter6->first <<
" to benchmark " << iter6->second <<
" = " << bmark << endl ;
499 cout <<
"RooUnitTest ERROR: comparison of object " << iter6->first->IsA()->GetName() <<
"::" << iter6->first->GetName()
500 <<
" fails comparison with counterpart in reference TH1 " << bmark->
GetName() << endl ;
504 cout <<
"RooUnitTest INFO: writing THx " << iter6->first->GetName() <<
" and " << bmark->
GetName()
505 <<
" of failed test to RooUnitTest_DEBUG.root" << endl ;
506 TFile fdbg(
"RooUnitTest_DEBUG.root",
"UPDATE") ;
507 iter6->first->SetName(
Form(
"%s_test",iter6->first->GetName())) ;
508 iter6->first->Write() ;
518 delete iter6->first ;
525 cout <<
"RooUnitTest: Writing reference TH1 " << iter6->first <<
" as benchmark " << iter6->second << endl ;
527 iter6->first->Write(iter6->second.c_str()) ;
575 cout <<
"*** Begin of output of Unit Test at normal verbosity *************" << endl ;
591 cout <<
"*** End of output of Unit Test at normal verbosity ***************" << endl ;
595 cout <<
"RooUnitTest: ERROR messages were logged, failing test" << endl ;
RooFit::MsgLevel minLevel
virtual const char * GetName() const
Returns name of object.
virtual Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
A RooCurve is a one-dimensional graphical representation of a real-valued function.
void SetName(const char *name)
Set the name of the RooPlot to 'name'.
virtual void Print(Option_t *options=0) const
Print TNamed name and title.
void regWS(RooWorkspace *ws, const char *refName)
static void callgrind_zero()
Utility function to trigger zeroing of callgrind counters.
std::list< std::pair< RooFitResult *, std::string > > _regResults
std::list< std::pair< RooWorkspace *, std::string > > _regWS
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
void addPlotable(RooPlotable *plotable, Option_t *drawOptions="", Bool_t invisible=kFALSE, Bool_t refreshNorm=kFALSE)
Add the specified plotable object to our plot.
Bool_t areTHidentical(TH1 *htest, TH1 *href)
virtual Int_t GetNbinsZ() const
StreamConfig & getStream(Int_t id)
static RooMsgService & instance()
Return reference to singleton instance.
RooUnit test is an abstract base class for unit regression tests for RooFit and RooStats tests perfor...
RooDouble is a minimal implementation of a TObject holding a Double_t value.
void setStreamStatus(Int_t id, Bool_t active)
(De)Activate stream with given unique ID
virtual Int_t GetDimension() const
A RooHist is a graphical representation of binned data based on the TGraphAsymmErrors class...
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...
The TNamed class is the base class for all named ROOT classes.
virtual void SetSeed(ULong_t seed=0)
Set the random generator seed.
virtual void SetMarkerColor(Color_t mcolor=1)
Set the marker color.
RooUnitTest(const char *name, TFile *refFile, Bool_t writeRef, Int_t verbose)
static TRandom * randomGenerator()
Return a pointer to a singleton random-number generator implementation.
static TDirectory * gMemDir
RooWorkspace * getWS(const char *refName)
static void setMemDir(TDirectory *memDir)
Set gMemDir to memDir.
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...
virtual void SetLineColor(Color_t lcolor)
Set the line color.
VecExpr< UnaryOp< Fabs< T >, VecExpr< A, T, D >, T >, T, D > fabs(const VecExpr< A, T, D > &rhs)
std::list< std::pair< TH1 *, std::string > > _regTH
void regValue(Double_t value, const char *refName)
char * Form(const char *fmt,...)
void setSilentMode(Bool_t flag)
R__EXTERN TRandom * gRandom
virtual Bool_t testCode()=0
A RooPlot is a plot frame and a container for graphics objects within that frame. ...
void regPlot(RooPlot *frame, const char *refName)
std::list< std::pair< RooTable *, std::string > > _regTables
virtual void SetName(const char *name)
Change the name of this histogram.
void regTable(RooTable *t, const char *refName)
Describe directory structure in memory.
std::list< std::pair< Double_t, std::string > > _regValues
Bool_t isIdentical(const RooHist &other, Double_t tol=1e-6) const
Return kTRUE if contents of this RooHist is identical within given relative tolerance to that of 'oth...
Bool_t isIdentical(const RooCurve &other, Double_t tol=1e-6) const
Return true if curve is identical to other curve allowing for given absolute tolerance on each point ...
virtual void SetLineStyle(Style_t lstyle)
Set the line style.
virtual TObject * Clone(const char *newname="") const
Make a clone of an object using the Streamer facility.
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...
Mother of all ROOT objects.
std::list< std::pair< RooPlot *, std::string > > _regPlots
virtual Bool_t cd(const char *path=0)
Change current directory to "this" directory.
RooTable is the abstract interface for table objects.
static void callgrind_dump()
Utility function to trigger dumping of callgrind counters.
virtual Int_t GetNbinsX() const
virtual const char * GetName() const
Returns name of object.
void regTH(TH1 *h, const char *refName)
The RooWorkspace is a persistable container for RooFit projects.
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.
virtual Int_t GetNbinsY() const
void regResult(RooFitResult *r, const char *refName)