ROOT
Version master
v6.34
v6.32
v6.30
v6.28
v6.26
v6.24
v6.22
v6.20
v6.18
v6.16
v6.14
v6.12
v6.10
v6.08
v6.06
Reference Guide
►
ROOT
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Modules
Pages
Loading...
Searching...
No Matches
rf209_anaconv.py
Go to the documentation of this file.
1
## \file
2
## \ingroup tutorial_roofit_main
3
## \notebook
4
## Addition and convolution: decay function pdfs with optional B physics effects (mixing
5
## and CP violation) that can be analytically convolved with e.g. Gaussian resolution functions
6
##
7
## ```
8
## pdf1 = decay(t,tau) (x) delta(t)
9
## pdf2 = decay(t,tau) (x) gauss(t,m,s)
10
## pdf3 = decay(t,tau) (x) (f*gauss1(t,m1,s1) + (1-f)*gauss2(t,m1,s1))
11
## ```
12
##
13
## \macro_image
14
## \macro_code
15
## \macro_output
16
##
17
## \date February 2018
18
## \authors Clemens Lange, Wouter Verkerke (C++ version)
19
20
import
ROOT
21
22
# B-physics pdf with truth resolution
23
# ---------------------------------------------------------------------
24
25
# Variables of decay pdf
26
dt =
ROOT.RooRealVar
(
"dt"
,
"dt"
, -10, 10)
27
tau =
ROOT.RooRealVar
(
"tau"
,
"tau"
, 1.548)
28
29
# Build a truth resolution model (delta function)
30
tm =
ROOT.RooTruthModel
(
"tm"
,
"truth model"
, dt)
31
32
# Construct decay(t) (x) delta(t)
33
decay_tm =
ROOT.RooDecay
(
"decay_tm"
,
"decay"
, dt, tau, tm, type=
"DoubleSided"
)
34
35
# Plot pdf (dashed)
36
frame =
dt.frame
(Title=
"Bdecay (x) resolution"
)
37
decay_tm.plotOn
(frame, LineStyle=
"--"
)
38
39
# B-physics pdf with Gaussian resolution
40
# ----------------------------------------------------------------------------
41
42
# Build a gaussian resolution model
43
bias1 =
ROOT.RooRealVar
(
"bias1"
,
"bias1"
, 0)
44
sigma1 =
ROOT.RooRealVar
(
"sigma1"
,
"sigma1"
, 1)
45
gm1 =
ROOT.RooGaussModel
(
"gm1"
,
"gauss model 1"
, dt, bias1, sigma1)
46
47
# Construct decay(t) (x) gauss1(t)
48
decay_gm1 =
ROOT.RooDecay
(
"decay_gm1"
,
"decay"
, dt, tau, gm1, type=
"DoubleSided"
)
49
50
# Plot pdf
51
decay_gm1.plotOn
(frame)
52
53
# B-physics pdf with double Gaussian resolution
54
# ------------------------------------------------------------------------------------------
55
56
# Build another gaussian resolution model
57
bias2 =
ROOT.RooRealVar
(
"bias2"
,
"bias2"
, 0)
58
sigma2 =
ROOT.RooRealVar
(
"sigma2"
,
"sigma2"
, 5)
59
gm2 =
ROOT.RooGaussModel
(
"gm2"
,
"gauss model 2"
, dt, bias2, sigma2)
60
61
# Build a composite resolution model f*gm1+(1-f)*gm2
62
gm1frac =
ROOT.RooRealVar
(
"gm1frac"
,
"fraction of gm1"
, 0.5)
63
gmsum =
ROOT.RooAddModel
(
"gmsum"
,
"sum of gm1 and gm2"
, [gm1, gm2], [gm1frac])
64
65
# Construct decay(t) (x) (f*gm1 + (1-f)*gm2)
66
decay_gmsum =
ROOT.RooDecay
(
"decay_gmsum"
,
"decay"
, dt, tau, gmsum,
ROOT.RooDecay.DoubleSided
)
67
68
# Plot pdf (red)
69
decay_gmsum.plotOn
(frame, LineColor=
"r"
)
70
71
# Draw all frames on canvas
72
c =
ROOT.TCanvas
(
"rf209_anaconv"
,
"rf209_anaconv"
, 600, 600)
73
ROOT.gPad.SetLeftMargin
(0.15)
74
frame.GetYaxis
().SetTitleOffset(1.6)
75
frame.Draw
()
76
77
c.SaveAs
(
"rf209_anaconv.png"
)
TRangeDynCast
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Definition
TCollection.h:358
tutorials
roofit
roofit
rf209_anaconv.py
ROOT master - Reference Guide Generated on Mon Apr 7 2025 06:27:36 (GVA Time) using Doxygen 1.10.0