Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
rf506_msgservice.py
2## \ingroup tutorial_roofit_main
3## \notebook -nodraw
4## Organization and simultaneous fits: tuning and customizing the ROOT.RooFit message logging facility
5##
6## \macro_code
7## \macro_output
8##
9## \date February 2018
10## \authors Clemens Lange, Wouter Verkerke (C++ version)
11
12import ROOT
13
14# Create pdf
15# --------------------
16
17# Construct gauss(x,m,s)
18x = ROOT.RooRealVar("x", "x", -10, 10)
19m = ROOT.RooRealVar("m", "m", 0, -10, 10)
20s = ROOT.RooRealVar("s", "s", 1, -10, 10)
21gauss = ROOT.RooGaussian("g", "g", x, m, s)
22
23# Construct poly(x,p0)
24p0 = ROOT.RooRealVar("p0", "p0", 0.01, 0.0, 1.0)
25poly = ROOT.RooPolynomial("p", "p", x, [p0])
26
27# model = f*gauss(x) + (1-f)*poly(x)
28f = ROOT.RooRealVar("f", "f", 0.5, 0.0, 1.0)
29model = ROOT.RooAddPdf("model", "model", [gauss, poly], [f])
30
31data = model.generate({x}, 10)
32
33# Print configuration of message service
34# ------------------------------------------
35
36# Print streams configuration
38
39# Adding integration topic to existing INFO stream
40# ---------------------------------------------------
41
42# Print streams configuration
44
45# Add Integration topic to existing INFO stream
47
48# Construct integral over gauss to demonstrate message stream
49igauss = gauss.createIntegral({x})
51
52# Print streams configuration in verbose, also shows inactive streams
54
55# Remove stream
57
58# Examples of pdf value tracing
59# -----------------------------------------------------------------------
60
61# Show DEBUG level message on function tracing, ROOT.RooGaussian only
62ROOT.RooMsgService.instance().addStream(ROOT.RooFit.DEBUG, Topic=ROOT.RooFit.Tracing, ClassName="RooGaussian")
63
64# Perform a fit to generate some tracing messages
65model.fitTo(data, Verbose=True)
66
67# Reset message service to default stream configuration
69
70# Show DEBUG level message on function tracing on all objects, output to
71# file
72ROOT.RooMsgService.instance().addStream(ROOT.RooFit.DEBUG, Topic=ROOT.RooFit.Tracing, OutputFile="rf506_debug.log")
73
74# Perform a fit to generate some tracing messages
75model.fitTo(data, Verbose=True)
76
77# Reset message service to default stream configuration
79
80# Example of another debugging stream
81# ---------------------------------------------------------------------
82
83# Show DEBUG level messages on client/server link state management
86
87# Clone composite pdf g to trigger some link state management activity
88gprime = gauss.cloneTree()
90
91# Reset message service to default stream configuration
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
void Print(GNN_Data &d, std::string txt="")