Rf 5 0 7_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 Monday, January 17, 2022 at 10:05 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"
In [2]:
%%cpp -d
// This is a workaround to make sure the namespace is used inside functions
using namespace RooFit;

Activate roofit memory tracing

In [3]:
RooTrace::active(kTRUE);
RooFit v3.60 -- Developed by Wouter Verkerke and David Kirkby 
                Copyright (C) 2000-2013 NIKHEF, University of California & Stanford University
                All rights reserved, please read http://roofit.sourceforge.net/license.txt

Construct gauss(x,m,s)

In [4]:
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 [5]:
RooTrace::dump();
List of RooFit objects allocated while trace active:

Activate verbose mode

In [6]:
RooTrace::verbose(kTRUE);

Construct poly(x,p0)

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

Put marker in trace list for future reference

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

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

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

Show object added to memory since marker

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