Logo ROOT   6.16/01
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"
23using namespace RooFit ;
24
25
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
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
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}
#define f(i)
Definition: RSha256.hxx:104
const Bool_t kTRUE
Definition: RtypesCore.h:87
RooAddPdf is an efficient implementation of a sum of PDFs of the form.
Definition: RooAddPdf.h:29
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:28
Plain Gaussian p.d.f.
Definition: RooGaussian.h:25
RooPolynomial implements a polynomial p.d.f of the form.
Definition: RooPolynomial.h:28
RooRealVar represents a fundamental (non-derived) real valued object.
Definition: RooRealVar.h:36
static void active(Bool_t flag)
If flag is true, memory tracing is activated.
Definition: RooTrace.cxx:133
static void dump()
Dump contents of object registry to stdout.
Definition: RooTrace.cxx:227
static void printObjectCounts()
Definition: RooTrace.cxx:264
static void mark()
Put marker in object list, that allows to dump contents of list relative to this marker.
Definition: RooTrace.cxx:206
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_t x[n]
Definition: legend1.C:17
static constexpr double s
static constexpr double gauss
auto * m
Definition: textangle.C:8