Rf 5 0 6_Msgservice

Organization and simultaneous fits: tuning and customizing the ROOT.RooFit message logging facility

Author: Clemens Lange, Wouter Verkerke (C++ version)
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 [ ]:
import ROOT

Create pdf

Construct gauss(x,m,s)

In [ ]:
x = ROOT.RooRealVar("x", "x", -10, 10)
m = ROOT.RooRealVar("m", "m", 0, -10, 10)
s = ROOT.RooRealVar("s", "s", 1, -10, 10)
gauss = ROOT.RooGaussian("g", "g", x, m, s)

Construct poly(x,p0)

In [ ]:
p0 = ROOT.RooRealVar("p0", "p0", 0.01, 0.0, 1.0)
poly = ROOT.RooPolynomial("p", "p", x, [p0])

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

In [ ]:
f = ROOT.RooRealVar("f", "f", 0.5, 0.0, 1.0)
model = ROOT.RooAddPdf("model", "model", [gauss, poly], [f])

data = model.generate({x}, 10)

Print streams configuration

In [ ]:
ROOT.RooMsgService.instance().Print()

Adding integration topic to existing INFO stream

Print streams configuration

In [ ]:
ROOT.RooMsgService.instance().Print()

Add Integration topic to existing INFO stream

In [ ]:
ROOT.RooMsgService.instance().getStream(1).addTopic(ROOT.RooFit.Integration)

Construct integral over gauss to demonstrate message stream

In [ ]:
igauss = gauss.createIntegral({x})
igauss.Print()

Print streams configuration in verbose, also shows inactive streams

In [ ]:
ROOT.RooMsgService.instance().Print()

Remove stream

In [ ]:
ROOT.RooMsgService.instance().getStream(1).removeTopic(ROOT.RooFit.Integration)

Examples of pdf value tracing

Show DEBUG level message on function tracing, ROOT.RooGaussian only

In [ ]:
ROOT.RooMsgService.instance().addStream(ROOT.RooFit.DEBUG, Topic=ROOT.RooFit.Tracing, ClassName="RooGaussian")

Perform a fit to generate some tracing messages

In [ ]:
model.fitTo(data, Verbose=True)

Reset message service to default stream configuration

In [ ]:
ROOT.RooMsgService.instance().reset()

Show DEBUG level message on function tracing on all objects, output to file

In [ ]:
ROOT.RooMsgService.instance().addStream(ROOT.RooFit.DEBUG, Topic=ROOT.RooFit.Tracing, OutputFile="rf506_debug.log")

Perform a fit to generate some tracing messages

In [ ]:
model.fitTo(data, Verbose=True)

Reset message service to default stream configuration

In [ ]:
ROOT.RooMsgService.instance().reset()

Example of another debugging stream

Show DEBUG level messages on client/server link state management

In [ ]:
ROOT.RooMsgService.instance().addStream(ROOT.RooFit.DEBUG, Topic=ROOT.RooFit.LinkStateMgmt)
ROOT.RooMsgService.instance().Print("v")

Clone composite pdf g to trigger some link state management activity

In [ ]:
gprime = gauss.cloneTree()
gprime.Print()

Reset message service to default stream configuration

In [ ]:
ROOT.RooMsgService.instance().reset()