Logo ROOT   6.07/09
Reference Guide
rf507_debugtools.C
Go to the documentation of this file.
1 /// \file
2 /// \ingroup tutorial_roofit
3 /// \notebook -nodraw
4 /// 'ORGANIZATION AND SIMULTANEOUS FITS' RooFit tutorial macro #507
5 ///
6 /// RooFit memory tracing debug tool
7 ///
8 /// \macro_output
9 /// \macro_code
10 /// \author 07/2008 - Wouter Verkerke
11 
12 
13 #include "RooRealVar.h"
14 #include "RooDataSet.h"
15 #include "RooGaussian.h"
16 #include "RooConstVar.h"
17 #include "RooPolynomial.h"
18 #include "RooAddPdf.h"
19 #include "TCanvas.h"
20 #include "TAxis.h"
21 #include "RooPlot.h"
22 #include "RooTrace.h"
23 using namespace RooFit ;
24 
25 
26 void rf507_debugtools()
27 {
28  // Activate RooFit memory tracing
30 
31  // Construct gauss(x,m,s)
32  RooRealVar x("x","x",-10,10) ;
33  RooRealVar m("m","m",0,-10,10) ;
34  RooRealVar s("s","s",1,-10,10) ;
35  RooGaussian gauss("g","g",x,m,s) ;
36 
37  // Show dump of all RooFit object in memory
38  RooTrace::dump() ;
39 
40  // Activate verbose mode
42 
43  // Construct poly(x,p0)
44  RooRealVar p0("p0","p0",0.01,0.,1.) ;
45  RooPolynomial poly("p","p",x,p0) ;
46 
47  // Put marker in trace list for future reference
48  RooTrace::mark() ;
49 
50  // Construct model = f*gauss(x) + (1-f)*poly(x)
51  RooRealVar f("f","f",0.5,0.,1.) ;
52  RooAddPdf model("model","model",RooArgSet(gauss,poly),f) ;
53 
54  // Show object added to memory since marker
56 
57  // Since verbose mode is still on, you will see messages
58  // pertaining to destructor calls of all RooFit objects
59  // made in this macro
60  //
61  // A call to RooTrace::dump() at the end of this macro
62  // should show that there a no RooFit object left in memory
63 }
RooAddPdf is an efficient implementation of a sum of PDFs of the form.
Definition: RooAddPdf.h:29
static void active(Bool_t flag)
If flag is true, memory tracing is activated.
Definition: RooTrace.cxx:133
Double_t x[n]
Definition: legend1.C:17
Plain Gaussian p.d.f.
Definition: RooGaussian.h:25
RooRealVar represents a fundamental (non-derived) real valued object.
Definition: RooRealVar.h:37
static void mark()
Put marker in object list, that allows to dump contents of list relative to this marker.
Definition: RooTrace.cxx:206
TMarker * m
Definition: textangle.C:8
static void verbose(Bool_t flag)
If flag is true, a message will be printed at each object creation or deletion.
Definition: RooTrace.cxx:143
double f(double x)
static void printObjectCounts()
Definition: RooTrace.cxx:264
static void dump()
Dump contents of object registry to stdout.
Definition: RooTrace.cxx:227
RooPolynomial implements a polynomial p.d.f of the form By default coefficient a_0 is chosen to be 1...
Definition: RooPolynomial.h:28
const Bool_t kTRUE
Definition: Rtypes.h:91