Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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///
9/// \date July 2008
10/// \author Wouter Verkerke
11
12#include "RooRealVar.h"
13#include "RooDataSet.h"
14#include "RooGaussian.h"
15#include "RooConstVar.h"
16#include "RooPolynomial.h"
17#include "RooAddPdf.h"
18#include "TCanvas.h"
19#include "TAxis.h"
20#include "RooPlot.h"
21#include "RooTrace.h"
22using namespace RooFit;
23
25{
26 // Activate RooFit memory tracing
28
29 // Construct gauss(x,m,s)
30 RooRealVar x("x", "x", -10, 10);
31 RooRealVar m("m", "m", 0, -10, 10);
32 RooRealVar s("s", "s", 1, -10, 10);
33 RooGaussian gauss("g", "g", x, m, s);
34
35 // Show dump of all RooFit object in memory
37
38 // Activate verbose mode
40
41 // Construct poly(x,p0)
42 RooRealVar p0("p0", "p0", 0.01, 0., 1.);
43 RooPolynomial poly("p", "p", x, p0);
44
45 // Put marker in trace list for future reference
47
48 // Construct model = f*gauss(x) + (1-f)*poly(x)
49 RooRealVar f("f", "f", 0.5, 0., 1.);
50 RooAddPdf model("model", "model", RooArgSet(gauss, poly), f);
51
52 // Show object added to memory since marker
54
55 // Since verbose mode is still on, you will see messages
56 // pertaining to destructor calls of all RooFit objects
57 // made in this macro
58 //
59 // A call to RooTrace::dump() at the end of this macro
60 // should show that there a no RooFit object left in memory
61}
#define f(i)
Definition RSha256.hxx:104
const Bool_t kTRUE
Definition RtypesCore.h:91
RooAddPdf is an efficient implementation of a sum of PDFs of the form.
Definition RooAddPdf.h:32
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:29
Plain Gaussian p.d.f.
Definition RooGaussian.h:24
RooPolynomial implements a polynomial p.d.f of the form.
RooRealVar represents a variable that can be changed from the outside.
Definition RooRealVar.h:39
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...
auto * m
Definition textangle.C:8