rf507_debugtools.C

Go to the documentation of this file.
00001 //////////////////////////////////////////////////////////////////////////
00002 //
00003 // 'ORGANIZATION AND SIMULTANEOUS FITS' RooFit tutorial macro #507
00004 // 
00005 //   RooFit memory tracing debug tool
00006 //
00007 //
00008 //
00009 // 07/2008 - Wouter Verkerke 
00010 // 
00011 /////////////////////////////////////////////////////////////////////////
00012 
00013 #ifndef __CINT__
00014 #include "RooGlobalFunc.h"
00015 #endif
00016 #include "RooRealVar.h"
00017 #include "RooDataSet.h"
00018 #include "RooGaussian.h"
00019 #include "RooConstVar.h"
00020 #include "RooPolynomial.h"
00021 #include "RooAddPdf.h"
00022 #include "TCanvas.h"
00023 #include "TAxis.h"
00024 #include "RooPlot.h"
00025 #include "RooTrace.h"
00026 using namespace RooFit ;
00027 
00028 
00029 void rf507_debugtools()
00030 {
00031   // Activate RooFit memory tracing
00032   RooTrace::active(kTRUE) ;
00033 
00034   // Construct gauss(x,m,s)
00035   RooRealVar x("x","x",-10,10) ;
00036   RooRealVar m("m","m",0,-10,10) ;
00037   RooRealVar s("s","s",1,-10,10) ;
00038   RooGaussian gauss("g","g",x,m,s) ;
00039 
00040   // Show dump of all RooFit object in memory
00041   RooTrace::dump() ;
00042 
00043   // Activate verbose mode
00044   RooTrace::verbose(kTRUE) ;
00045 
00046   // Construct poly(x,p0)
00047   RooRealVar p0("p0","p0",0.01,0.,1.) ;
00048   RooPolynomial poly("p","p",x,p0) ;             
00049 
00050   // Put marker in trace list for future reference
00051   RooTrace::mark() ;
00052 
00053   // Construct model = f*gauss(x) + (1-f)*poly(x)
00054   RooRealVar f("f","f",0.5,0.,1.) ;
00055   RooAddPdf model("model","model",RooArgSet(gauss,poly),f) ;
00056 
00057   // Show object added to memory since marker
00058   RooTrace::dump(cout,kTRUE) ;
00059 
00060   // Since verbose mode is still on, you will see messages
00061   // pertaining to destructor calls of all RooFit objects
00062   // made in this macro
00063   //
00064   // A call to RooTrace::dump() at the end of this macro
00065   // should show that there a no RooFit object left in memory
00066 }

Generated on Tue Jul 5 15:45:08 2011 for ROOT_528-00b_version by  doxygen 1.5.1