Logo ROOT  
Reference Guide
rf507_debugtools.C
Go to the documentation of this file.
1/// \file
2/// \ingroup tutorial_roofit
3/// \notebook -nodraw
4///
5/// Organization and simultaneous fits: RooFit memory tracing debug tool
6///
7/// \macro_output
8/// \macro_code
9///
10/// \date 07/2008
11/// \author Wouter Verkerke
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
26{
27 // Activate RooFit memory tracing
29
30 // Construct gauss(x,m,s)
31 RooRealVar x("x", "x", -10, 10);
32 RooRealVar m("m", "m", 0, -10, 10);
33 RooRealVar s("s", "s", 1, -10, 10);
34 RooGaussian gauss("g", "g", x, m, s);
35
36 // Show dump of all RooFit object in memory
38
39 // Activate verbose mode
41
42 // Construct poly(x,p0)
43 RooRealVar p0("p0", "p0", 0.01, 0., 1.);
44 RooPolynomial poly("p", "p", x, p0);
45
46 // Put marker in trace list for future reference
48
49 // Construct model = f*gauss(x) + (1-f)*poly(x)
50 RooRealVar f("f", "f", 0.5, 0., 1.);
51 RooAddPdf model("model", "model", RooArgSet(gauss, poly), f);
52
53 // Show object added to memory since marker
55
56 // Since verbose mode is still on, you will see messages
57 // pertaining to destructor calls of all RooFit objects
58 // made in this macro
59 //
60 // A call to RooTrace::dump() at the end of this macro
61 // should show that there a no RooFit object left in memory
62}
#define f(i)
Definition: RSha256.hxx:104
const Bool_t kTRUE
Definition: RtypesCore.h:89
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 variable that can be changed from the outside.
Definition: RooRealVar.h:35
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
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
static constexpr double s
static constexpr double gauss
auto * m
Definition: textangle.C:8