62 _refFile(refFile), _debug(
kFALSE), _write(writeRef), _verb(verbose)
80 string refNameStr(refName) ;
82 _regPlots.push_back(make_pair(frame,refNameStr)) ;
94 string refNameStr(refName) ;
107 string refNameStr(refName) ;
108 _regValues.push_back(make_pair(d,refNameStr)) ;
118 string refNameStr(refName) ;
119 _regTables.push_back(make_pair(t,refNameStr)) ;
131 string refNameStr(refName) ;
132 _regWS.push_back(make_pair(ws,refNameStr)) ;
144 string refNameStr(refName) ;
145 _regTH.push_back(make_pair(th,refNameStr)) ;
158 cout <<
"RooUnitTest ERROR: cannot retrieve RooWorkspace " << refName
159 <<
" from reference file, skipping " << endl ;
182 cout <<
"KS distances = " << kmax << endl ;
199 for (
Int_t i=0 ; i<ntest ; i++) {
219 list<pair<RooPlot*, string> >::iterator
iter =
_regPlots.begin() ;
229 cout <<
"RooUnitTest ERROR: cannot retrieve RooPlot " << iter->second <<
" from reference file, skipping " << endl ;
236 cout <<
"comparing RooPlot " << iter->first <<
" to benchmark " << iter->second <<
" = " << bmark << endl ;
237 cout <<
"reference: " ; iter->first->Print() ;
238 cout <<
"benchmark: " ; bmark->
Print() ;
241 RooPlot* compPlot =
_debug ? iter->first->emptyClone(
Form(
"%s_comparison",iter->first->GetName())) : 0 ;
244 Stat_t nItems = iter->first->numItems() ;
245 for (
Stat_t i=0 ; i<nItems ; i++) {
253 cout <<
"RooUnitTest ERROR: cannot retrieve object " << obj->
GetName() <<
" from reference RooPlot " << iter->second <<
", skipping" << endl ;
263 cout <<
"RooUnitTest ERROR: comparison of object " << obj->IsA()->
GetName() <<
"::" << obj->
GetName()
264 <<
" fails comparison with counterpart in reference RooPlot " << bmark->
GetName() << endl ;
285 cout <<
"RooUnitTest ERROR: comparison of object " << obj->IsA()->
GetName() <<
"::" << obj->
GetName()
286 <<
" fails comparison with counterpart in reference RooPlot " << bmark->
GetName() << endl ;
308 if (anyFail && compPlot) {
309 cout <<
"RooUnitTest INFO: writing comparison plot " << compPlot->
GetName() <<
" of failed test to RooUnitTest_DEBUG.root" << endl ;
310 TFile fdbg(
"RooUnitTest_DEBUG.root",
"UPDATE") ;
324 cout <<
"RooUnitTest: Writing reference RooPlot " << iter->first <<
" as benchmark " << iter->second << endl ;
326 iter->first->Write(iter->second.c_str()) ;
334 list<pair<RooFitResult*, string> >::iterator iter2 =
_regResults.begin() ;
344 cout <<
"RooUnitTest ERROR: cannot retrieve RooFitResult " << iter2->second <<
" from reference file, skipping " << endl ;
351 cout <<
"comparing RooFitResult " << iter2->first <<
" to benchmark " << iter2->second <<
" = " << bmark << endl ;
354 if (!iter2->first->isIdentical(*bmark,
fptol(),
fctol())) {
355 cout <<
"RooUnitTest ERROR: comparison of object " << iter2->first->IsA()->GetName() <<
"::" << iter2->first->GetName()
356 <<
" fails comparison with counterpart in reference RooFitResult " << bmark->
GetName() << endl ;
361 delete iter2->first ;
368 cout <<
"RooUnitTest: Writing reference RooFitResult " << iter2->first <<
" as benchmark " << iter2->second << endl ;
370 iter2->first->Write(iter2->second.c_str()) ;
377 list<pair<Double_t, string> >::iterator iter3 =
_regValues.begin() ;
387 cout <<
"RooUnitTest ERROR: cannot retrieve RooDouble " << iter3->second <<
" from reference file, skipping " << endl ;
394 cout <<
"comparing value " << iter3->first <<
" to benchmark " << iter3->second <<
" = " << (
Double_t)(*ref) << endl ;
398 cout <<
"RooUnitTest ERROR: comparison of value " << iter3->first <<
" fails comparison with reference " << ref->
GetName() << endl ;
407 cout <<
"RooUnitTest: Writing reference Double_t " << iter3->first <<
" as benchmark " << iter3->second << endl ;
410 rd->
Write(iter3->second.c_str()) ;
418 list<pair<RooTable*, string> >::iterator iter4 =
_regTables.begin() ;
428 cout <<
"RooUnitTest ERROR: cannot retrieve RooTable " << iter4->second <<
" from reference file, skipping " << endl ;
435 cout <<
"comparing RooTable " << iter4->first <<
" to benchmark " << iter4->second <<
" = " << bmark << endl ;
438 if (!iter4->first->isIdentical(*bmark)) {
439 cout <<
"RooUnitTest ERROR: comparison of object " << iter4->first->IsA()->GetName() <<
"::" << iter4->first->GetName()
440 <<
" fails comparison with counterpart in reference RooTable " << bmark->
GetName() << endl ;
445 delete iter4->first ;
452 cout <<
"RooUnitTest: Writing reference RooTable " << iter4->first <<
" as benchmark " << iter4->second << endl ;
454 iter4->first->Write(iter4->second.c_str()) ;
462 list<pair<RooWorkspace*, string> >::iterator iter5 =
_regWS.begin() ;
463 while (iter5!=
_regWS.end()) {
469 cout <<
"RooUnitTest: Writing reference RooWorkspace " << iter5->first <<
" as benchmark " << iter5->second << endl ;
471 iter5->first->Write(iter5->second.c_str()) ;
479 list<pair<TH1*, string> >::iterator iter6 =
_regTH.begin() ;
480 while (iter6!=
_regTH.end()) {
489 cout <<
"RooUnitTest ERROR: cannot retrieve TH1 " << iter6->second <<
" from reference file, skipping " << endl ;
496 cout <<
"comparing TH1 " << iter6->first <<
" to benchmark " << iter6->second <<
" = " << bmark << endl ;
501 cout <<
"RooUnitTest ERROR: comparison of object " << iter6->first->IsA()->GetName() <<
"::" << iter6->first->GetName()
502 <<
" fails comparison with counterpart in reference TH1 " << bmark->
GetName() << endl ;
506 cout <<
"RooUnitTest INFO: writing THx " << iter6->first->GetName() <<
" and " << bmark->
GetName()
507 <<
" of failed test to RooUnitTest_DEBUG.root" << endl ;
508 TFile fdbg(
"RooUnitTest_DEBUG.root",
"UPDATE") ;
509 iter6->first->SetName(
Form(
"%s_test",iter6->first->GetName())) ;
510 iter6->first->Write() ;
520 delete iter6->first ;
527 cout <<
"RooUnitTest: Writing reference TH1 " << iter6->first <<
" as benchmark " << iter6->second << endl ;
529 iter6->first->Write(iter6->second.c_str()) ;
577 cout <<
"*** Begin of output of Unit Test at normal verbosity *************" << endl ;
593 cout <<
"*** End of output of Unit Test at normal verbosity ***************" << endl ;
597 cout <<
"RooUnitTest: ERROR messages were logged, failing test" << endl ;
virtual Bool_t cd(const char *path=0)
Change current directory to "this" directory.
RooFit::MsgLevel minLevel
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)
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 Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
void SetName(const char *name)
Set the name of the RooPlot to 'name'.
void regWS(RooWorkspace *ws, const char *refName)
static void callgrind_zero()
Utility function to trigger zeroing of callgrind counters.
virtual Int_t GetDimension() const
std::list< std::pair< RooFitResult *, std::string > > _regResults
std::list< std::pair< RooWorkspace *, std::string > > _regWS
void addPlotable(RooPlotable *plotable, Option_t *drawOptions="", Bool_t invisible=kFALSE, Bool_t refreshNorm=kFALSE)
Add the specified plotable object to our plot.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
Bool_t areTHidentical(TH1 *htest, TH1 *href)
virtual TObject * Get(const char *namecycle)
Return pointer to object identified by namecycle.
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...
StreamConfig & getStream(Int_t id)
virtual Int_t GetNbinsX() const
static RooMsgService & instance()
Return reference to singleton instance.
virtual void SetSeed(UInt_t seed=0)
Set the random generator seed.
void setStreamStatus(Int_t id, Bool_t active)
(De)Activate stream with given unique ID
The TNamed class is the base class for all named ROOT classes.
std::map< std::string, std::string >::const_iterator iter
virtual void SetMarkerColor(Color_t mcolor=1)
if on multiple lines(like in C++).**The" * configuration fragment. * * The "import myobject continue
Parses the configuration file.
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.
virtual TObject * Clone(const char *newname="") const
Make a clone of an object using the Streamer facility.
static TDirectory * gMemDir
RooWorkspace * getWS(const char *refName)
static void setMemDir(TDirectory *memDir)
Set gMemDir to memDir.
virtual void SetLineColor(Color_t lcolor)
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
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...
void regValue(Double_t value, const char *refName)
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...
char * Form(const char *fmt,...)
virtual void Print(Option_t *options=0) const
Print TNamed name and title.
virtual Int_t GetNbinsZ() const
virtual const char * GetName() const
Returns name of object.
void setSilentMode(Bool_t flag)
R__EXTERN TRandom * gRandom
virtual Bool_t testCode()=0
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)
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 const char * GetName() const
Returns name of object.
Describe directory structure in memory.
std::list< std::pair< Double_t, std::string > > _regValues
virtual void SetLineStyle(Style_t lstyle)
Mother of all ROOT objects.
virtual Int_t GetNbinsY() const
std::list< std::pair< RooPlot *, std::string > > _regPlots
virtual Bool_t cd(const char *path=0)
Change current directory to "this" directory.
static void callgrind_dump()
Utility function to trigger dumping of callgrind counters.
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...
void regTH(TH1 *h, const char *refName)
virtual void Close(Option_t *option="")
Close a file.
void regResult(RooFitResult *r, const char *refName)