ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
rf507_debugtools.C
Go to the documentation of this file.
1 /// \file
2 /// \ingroup tutorial_roofit
3 /// 'ORGANIZATION AND SIMULTANEOUS FITS' RooFit tutorial macro #507
4 ///
5 /// RooFit memory tracing debug tool
6 ///
7 ///
8 ///
9 /// \macro_code
10 /// \author 07/2008 - Wouter Verkerke
11 
12 
13 #ifndef __CINT__
14 #include "RooGlobalFunc.h"
15 #endif
16 #include "RooRealVar.h"
17 #include "RooDataSet.h"
18 #include "RooGaussian.h"
19 #include "RooConstVar.h"
20 #include "RooPolynomial.h"
21 #include "RooAddPdf.h"
22 #include "TCanvas.h"
23 #include "TAxis.h"
24 #include "RooPlot.h"
25 #include "RooTrace.h"
26 using namespace RooFit ;
27 
28 
29 void rf507_debugtools()
30 {
31  // Activate RooFit memory tracing
33 
34  // Construct gauss(x,m,s)
35  RooRealVar x("x","x",-10,10) ;
36  RooRealVar m("m","m",0,-10,10) ;
37  RooRealVar s("s","s",1,-10,10) ;
38  RooGaussian gauss("g","g",x,m,s) ;
39 
40  // Show dump of all RooFit object in memory
41  RooTrace::dump() ;
42 
43  // Activate verbose mode
45 
46  // Construct poly(x,p0)
47  RooRealVar p0("p0","p0",0.01,0.,1.) ;
48  RooPolynomial poly("p","p",x,p0) ;
49 
50  // Put marker in trace list for future reference
51  RooTrace::mark() ;
52 
53  // Construct model = f*gauss(x) + (1-f)*poly(x)
54  RooRealVar f("f","f",0.5,0.,1.) ;
55  RooAddPdf model("model","model",RooArgSet(gauss,poly),f) ;
56 
57  // Show object added to memory since marker
59 
60  // Since verbose mode is still on, you will see messages
61  // pertaining to destructor calls of all RooFit objects
62  // made in this macro
63  //
64  // A call to RooTrace::dump() at the end of this macro
65  // should show that there a no RooFit object left in memory
66 }
TFile * f
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
friend class RooArgSet
Definition: RooAbsArg.h:469
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
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