ROOT   Reference Guide
rf513_wsfactory_tools.py
Go to the documentation of this file.
1## \file
2## \ingroup tutorial_roofit
3## \notebook -nodraw
4##
5## Organization and simultaneous fits: illustration use of ROOT.RooCustomizer and
6## ROOT.RooSimWSTool interface in factory workspace tool in a complex standalone B physics example
7##
8## \macro_code
9##
10## \date February 2018
11## \authors Clemens Lange, Wouter Verkerke (C++ version)
12
13import ROOT
14
15
16w = ROOT.RooWorkspace("w")
17
18# Build a complex example pdf
19# -----------------------------------------------------------
20
21# Make signal model for CPV: A bmixing decay function in t (convoluted with a triple Gaussian resolution model)
22# times a Gaussian function the reconstructed mass
23w.factory(
24 "PROD::sig( BMixDecay::sig_t( dt[-20,20], mixState[mixed=1,unmix=-1], tagFlav[B0=1,B0bar=-1], "
25 "tau[1.54], dm[0.472], w[0.05], dw[0], "
27 "GaussModel(dt,0,sigmaT[3,10]), "
28 "GaussModel(dt,0,20)},{fracC[0,1],fracT[0,1]}), "
29 "DoubleSided ), "
30 "Gaussian::sig_m( mes[5.20,5.30], mB0[5.20,5.30], sigmB0[0.01,0.05] ))")
31
32# Make background component: A plain decay function in t times an Argus
33# function in the reconstructed mass
34w.factory("PROD::bkg( Decay::bkg_t( dt, tau, gm, DoubleSided), "
35 "ArgusBG::bkg_m( mes, 5.291, k[-100,-10]))")
36
37# Make composite model from the signal and background component
38w.factory("SUM::model( Nsig[5000,0,10000]*sig, NBkg[500,0,10000]*bkg )")
39
40# Example of RooSimWSTool interface
41# ------------------------------------------------------------------
42
43# Introduce a flavour tagging category tagCat as observable with 4 states corresponding
44# to 4 flavour tagging techniques with different performance that require different
45# parameterizations of the fit model
46#
47# ROOT.RooSimWSTool operation:
48# - Make 4 clones of model (for each tagCat) state, will gain an individual
49# copy of parameters w, and biasC. The other parameters remain common
50# - Make a simultaneous p.d.f. of the 4 clones assigning each to the appropriate
51# state of the tagCat index category
52
53# ROOT.RooSimWSTool is interfaced as meta-type SIMCLONE in the factory. The $SplitParam() 54# argument maps to the SplitParam() named argument in the 55# ROOT.RooSimWSTool constructor 56w.factory( 57 "SIMCLONE::model_sim( model,$SplitParam({w,dw,biasC},tagCat[Lep,Kao,NT1,NT2]))")
58
59# Example of RooCustomizer interface
60# -------------------------------------------------------------------
61#
62# Class ROOT.RooCustomizer makes clones of existing p.d.f.s with certain prescribed
63# modifications (branch of leaf node replacements)
64#
65# Here we take our model (the original before ROOT.RooSimWSTool modifications)
66# and request that the parameter w (the mistag rate) is replaced with
67# an expression-based function that calculates w in terms of the Dilution
68# parameter D that is defined D = 1-2*w
69
70# Make a clone model_D of original 'model' replacing 'w' with
71# 'expr('0.5-D/2',D[0,1])'
72w.factory("EDIT::model_D(model, w=expr('0.5-D/2',D[0,1]) )")
73
74# Print workspace contents
75w.Print()
76
77# Make workspace visible on command line