ROOT
master
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
12
import
ROOT
13
14
# Create pdf
15
# --------------------
16
17
# Construct gauss(x,m,s)
18
x =
ROOT.RooRealVar
(
"x"
,
"x"
, -10, 10)
19
m =
ROOT.RooRealVar
(
"m"
,
"m"
, 0, -10, 10)
20
s =
ROOT.RooRealVar
(
"s"
,
"s"
, 1, -10, 10)
21
gauss =
ROOT.RooGaussian
(
"g"
,
"g"
, x, m, s)
22
23
# Construct poly(x,p0)
24
p0 =
ROOT.RooRealVar
(
"p0"
,
"p0"
, 0.01, 0.0, 1.0)
25
poly =
ROOT.RooPolynomial
(
"p"
,
"p"
, x, [p0])
26
27
# model = f*gauss(x) + (1-f)*poly(x)
28
f =
ROOT.RooRealVar
(
"f"
,
"f"
, 0.5, 0.0, 1.0)
29
model =
ROOT.RooAddPdf
(
"model"
,
"model"
, [gauss, poly], [f])
30
31
data =
model.generate
({x}, 10)
32
33
# Print configuration of message service
34
# ------------------------------------------
35
36
# Print streams configuration
37
ROOT.RooMsgService.instance
().
Print
()
38
39
# Adding integration topic to existing INFO stream
40
# ---------------------------------------------------
41
42
# Print streams configuration
43
ROOT.RooMsgService.instance
().
Print
()
44
45
# Add Integration topic to existing INFO stream
46
ROOT.RooMsgService.instance
().getStream(1).addTopic(
ROOT.RooFit.Integration
)
47
48
# Construct integral over gauss to demonstrate message stream
49
igauss =
gauss.createIntegral
({x})
50
igauss.Print
()
51
52
# Print streams configuration in verbose, also shows inactive streams
53
ROOT.RooMsgService.instance
().
Print
()
54
55
# Remove stream
56
ROOT.RooMsgService.instance
().getStream(1).removeTopic(
ROOT.RooFit.Integration
)
57
58
# Examples of pdf value tracing
59
# -----------------------------------------------------------------------
60
61
# Show DEBUG level message on function tracing, ROOT.RooGaussian only
62
ROOT.RooMsgService.instance
().addStream(
ROOT.RooFit.DEBUG
, Topic=
ROOT.RooFit.Tracing
, ClassName=
"RooGaussian"
)
63
64
# Perform a fit to generate some tracing messages
65
model.fitTo
(data, Verbose=
True
)
66
67
# Reset message service to default stream configuration
68
ROOT.RooMsgService.instance
().reset()
69
70
# Show DEBUG level message on function tracing on all objects, output to
71
# file
72
ROOT.RooMsgService.instance
().addStream(
ROOT.RooFit.DEBUG
, Topic=
ROOT.RooFit.Tracing
, OutputFile=
"rf506_debug.log"
)
73
74
# Perform a fit to generate some tracing messages
75
model.fitTo
(data, Verbose=
True
)
76
77
# Reset message service to default stream configuration
78
ROOT.RooMsgService.instance
().reset()
79
80
# Example of another debugging stream
81
# ---------------------------------------------------------------------
82
83
# Show DEBUG level messages on client/server link state management
84
ROOT.RooMsgService.instance
().addStream(
ROOT.RooFit.DEBUG
, Topic=
ROOT.RooFit.LinkStateMgmt
)
85
ROOT.RooMsgService.instance
().
Print
(
"v"
)
86
87
# Clone composite pdf g to trigger some link state management activity
88
gprime =
gauss.cloneTree
()
89
gprime.Print
()
90
91
# Reset message service to default stream configuration
92
ROOT.RooMsgService.instance
().reset()
TRangeDynCast
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Definition
TCollection.h:358
Print
void Print(GNN_Data &d, std::string txt="")
Definition
TMVA_SOFIE_GNN_Application.C:59
tutorials
roofit
roofit
rf506_msgservice.py
ROOT master - Reference Guide Generated on Mon Feb 17 2025 15:03:49 (GVA Time) using Doxygen 1.10.0