Logo ROOT   6.18/05
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 memory tracing debug tool
5///
6/// \macro_output
7/// \macro_code
8/// \author 07/2008 - Wouter Verkerke
9
10#include "RooRealVar.h"
11#include "RooDataSet.h"
12#include "RooGaussian.h"
13#include "RooConstVar.h"
14#include "RooPolynomial.h"
15#include "RooAddPdf.h"
16#include "TCanvas.h"
17#include "TAxis.h"
18#include "RooPlot.h"
19#include "RooTrace.h"
20using namespace RooFit;
21
23{
24 // Activate RooFit memory tracing
26
27 // Construct gauss(x,m,s)
28 RooRealVar x("x", "x", -10, 10);
29 RooRealVar m("m", "m", 0, -10, 10);
30 RooRealVar s("s", "s", 1, -10, 10);
31 RooGaussian gauss("g", "g", x, m, s);
32
33 // Show dump of all RooFit object in memory
35
36 // Activate verbose mode
38
39 // Construct poly(x,p0)
40 RooRealVar p0("p0", "p0", 0.01, 0., 1.);
41 RooPolynomial poly("p", "p", x, p0);
42
43 // Put marker in trace list for future reference
45
46 // Construct model = f*gauss(x) + (1-f)*poly(x)
47 RooRealVar f("f", "f", 0.5, 0., 1.);
48 RooAddPdf model("model", "model", RooArgSet(gauss, poly), f);
49
50 // Show object added to memory since marker
52
53 // Since verbose mode is still on, you will see messages
54 // pertaining to destructor calls of all RooFit objects
55 // made in this macro
56 //
57 // A call to RooTrace::dump() at the end of this macro
58 // should show that there a no RooFit object left in memory
59}
#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
Template specialisation used in RooAbsArg:
static constexpr double s
static constexpr double gauss
auto * m
Definition: textangle.C:8