# rf209_anaconv¶

Addition and convolution: decay function pdfs with optional B physics effects (mixing and CP violation) that can be analytically convolved with e.g. Gaussian resolution functions

pdf1 = decay(t,tau) (x) delta(t)
pdf2 = decay(t,tau) (x) gauss(t,m,s)
pdf3 = decay(t,tau) (x) (f*gauss1(t,m1,s1) + (1-f)*gauss2(t,m1,s1))

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 Wednesday, November 30, 2022 at 11:22 AM.

In [1]:
import ROOT

Welcome to JupyROOT 6.27/01


## B-physics pdf with truth resolution¶

Variables of decay pdf

In [2]:
dt = ROOT.RooRealVar("dt", "dt", -10, 10)
tau = ROOT.RooRealVar("tau", "tau", 1.548)


Build a truth resolution model (delta function)

In [3]:
tm = ROOT.RooTruthModel("tm", "truth model", dt)


Construct decay(t) (x) delta(t)

In [4]:
decay_tm = ROOT.RooDecay("decay_tm", "decay", dt, tau, tm, type="DoubleSided")


Plot pdf (dashed)

In [5]:
frame = dt.frame(Title="Bdecay (x) resolution")
decay_tm.plotOn(frame, LineStyle="--")

Out[5]:
<cppyy.gbl.RooPlot object at 0x8c64720>

## B-physics pdf with Gaussian resolution¶

Build a gaussian resolution model

In [6]:
bias1 = ROOT.RooRealVar("bias1", "bias1", 0)
sigma1 = ROOT.RooRealVar("sigma1", "sigma1", 1)
gm1 = ROOT.RooGaussModel("gm1", "gauss model 1", dt, bias1, sigma1)


Construct decay(t) (x) gauss1(t)

In [7]:
decay_gm1 = ROOT.RooDecay("decay_gm1", "decay", dt, tau, gm1, type="DoubleSided")


Plot pdf

In [8]:
decay_gm1.plotOn(frame)

Out[8]:
<cppyy.gbl.RooPlot object at 0x8c64720>

## B-physics pdf with double Gaussian resolution¶

Build another gaussian resolution model

In [9]:
bias2 = ROOT.RooRealVar("bias2", "bias2", 0)
sigma2 = ROOT.RooRealVar("sigma2", "sigma2", 5)
gm2 = ROOT.RooGaussModel("gm2", "gauss model 2", dt, bias2, sigma2)


Build a composite resolution model fgm1+(1-f)gm2

In [10]:
gm1frac = ROOT.RooRealVar("gm1frac", "fraction of gm1", 0.5)
gmsum = ROOT.RooAddModel("gmsum", "sum of gm1 and gm2", [gm1, gm2], [gm1frac])


Construct decay(t) (x) (fgm1 + (1-f)gm2)

In [11]:
decay_gmsum = ROOT.RooDecay("decay_gmsum", "decay", dt, tau, gmsum, ROOT.RooDecay.DoubleSided)


Plot pdf (red)

In [12]:
decay_gmsum.plotOn(frame, LineColor="r")

Out[12]:
<cppyy.gbl.RooPlot object at 0x8c64720>

Draw all frames on canvas

In [13]:
c = ROOT.TCanvas("rf209_anaconv", "rf209_anaconv", 600, 600)
frame.GetYaxis().SetTitleOffset(1.6)
frame.Draw()

c.SaveAs("rf209_anaconv.png")

Info in <TCanvas::Print>: png file rf209_anaconv.png has been created


Draw all canvases

In [14]:
from ROOT import gROOT
gROOT.GetListOfCanvases().Draw()