rf507_debugtools

Organization and simultaneous fits: RooFit memory tracing debug tool

Author: Wouter Verkerke
This notebook tutorial was automatically generated with ROOTBOOK-izer from the macro found in the ROOT repository on Wednesday, November 30, 2022 at 11:23 AM.

In [1]:
%%cpp -d
#include "RooRealVar.h"
#include "RooDataSet.h"
#include "RooGaussian.h"
#include "RooPolynomial.h"
#include "RooAddPdf.h"
#include "TCanvas.h"
#include "TAxis.h"
#include "RooPlot.h"
#include "RooTrace.h"
using namespace RooFit;

Activate RooFit memory tracing

In [2]:
RooTrace::active(true);

Construct gauss(x,m,s)

In [3]:
RooRealVar x("x", "x", -10, 10);
RooRealVar m("m", "m", 0, -10, 10);
RooRealVar s("s", "s", 1, -10, 10);
RooGaussian gauss("g", "g", x, m, s);
[#0] WARNING:InputArguments -- The parameter 's' with range [-10, 10] of the RooGaussian 'g' exceeds the safe range of (0, inf). Advise to limit its range.

Show dump of all RooFit object in memory

In [4]:
RooTrace::dump();
List of RooFit objects allocated while trace active:

Activate verbose mode

In [5]:
RooTrace::verbose(true);

Construct poly(x,p0)

In [6]:
RooRealVar p0("p0", "p0", 0.01, 0., 1.);
RooPolynomial poly("p", "p", x, p0);

Put marker in trace list for future reference

In [7]:
RooTrace::mark();

Construct model = fgauss(x) + (1-f)poly(x)

In [8]:
RooRealVar f("f", "f", 0.5, 0., 1.);
RooAddPdf model("model", "model", RooArgSet(gauss, poly), f);

Show object added to memory since marker

In [9]:
RooTrace::printObjectCounts();
 class RooSharedProperties count = 1 sizeof = 56 total memory =  0.00 Mb
Grand total memory =  0.00 Mb