Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
rf513_wsfactory_tools.C
Go to the documentation of this file.
1/// \file
2/// \ingroup tutorial_roofit
3/// \notebook -nodraw
4/// Organization and simultaneous fits: RooCustomizer and RooSimWSTool interface in factory
5/// workspace tool in a complex standalone B physics example
6///
7/// \macro_code
8/// \macro_output
9///
10/// \date July 2009
11/// \author Wouter Verkerke
12
13#include "RooRealVar.h"
14#include "RooDataSet.h"
15#include "RooGaussian.h"
16#include "RooChebychev.h"
17#include "RooAddPdf.h"
18#include "RooWorkspace.h"
19#include "RooPlot.h"
20#include "TCanvas.h"
21#include "TAxis.h"
22using namespace RooFit;
23
25{
26 RooWorkspace *w = new RooWorkspace("w");
27
28 // B u i l d a c o m p l e x e x a m p l e p . d . f .
29 // -----------------------------------------------------------
30
31 // Make signal model for CPV: A bmixing decay function in t (convoluted with a triple Gaussian resolution model)
32 // times a Gaussian function the reconstructed mass
33 w->factory("PROD::sig( BMixDecay::sig_t( dt[-20,20], mixState[mixed=1,unmix=-1], tagFlav[B0=1,B0bar=-1], "
34 "tau[1.54], dm[0.472], w[0.05], dw[0],"
35 "AddModel::gm({GaussModel(dt,biasC[-10,10],sigmaC[0.1,3],dterr[0.01,0.2]),"
36 "GaussModel(dt,0,sigmaT[3,10]),"
37 "GaussModel(dt,0,20)},{fracC[0,1],fracT[0,1]}),"
38 "DoubleSided ),"
39 "Gaussian::sig_m( mes[5.20,5.30], mB0[5.20,5.30], sigmB0[0.01,0.05] ))");
40
41 // Make background component: A plain decay function in t times an Argus function in the reconstructed mass
42 w->factory("PROD::bkg( Decay::bkg_t( dt, tau, gm, DoubleSided),"
43 "ArgusBG::bkg_m( mes, 5.291, k[-100,-10]))");
44
45 // Make composite model from the signal and background component
46 w->factory("SUM::model( Nsig[5000,0,10000]*sig, NBkg[500,0,10000]*bkg )");
47
48 // E x a m p l e o f R o o S i m W S T o o l i n t e r f a c e
49 // ------------------------------------------------------------------
50
51 // Introduce a flavour tagging category tagCat as observable with 4 states corresponding
52 // to 4 flavour tagging techniques with different performance that require different
53 // parameterizations of the fit model
54 //
55 // RooSimWSTool operation:
56 // - Make 4 clones of model (for each tagCat) state, that will gain an individual
57 // copy of parameters w,dw and biasC. The other parameters remain common
58 // - Make a simultaneous pdf of the 4 clones assigning each to the appropriate
59 // state of the tagCat index category
60
61 // RooSimWSTool is interfaced as meta-type SIMCLONE in the factory. The $SplitParam()
62 // argument maps to the SplitParam() named argument in the RooSimWSTool constructor
63 w->factory("SIMCLONE::model_sim( model, $SplitParam({w,dw,biasC},tagCat[Lep,Kao,NT1,NT2]))");
64
65 // E x a m p l e o f R o o C u s t o m i z e r i n t e r f a c e
66 // -------------------------------------------------------------------
67 //
68 // Class RooCustomizer makes clones of existing pdfs with certain prescribed
69 // modifications (branch of leaf node replacements)
70 //
71 // Here we take our model (the original before RooSimWSTool modifications)
72 // and request that the parameter w (the mistag rate) is replaced with
73 // an expression-based function that calculates w in terms of the Dilution
74 // parameter D that is defined as D = 1-2*w
75
76 // Make a clone model_D of original 'model' replacing 'w' with 'expr('0.5-D/2',D[0,1])'
77 w->factory("EDIT::model_D(model, w=expr('0.5-D/2',D[0,1]) )");
78
79 // Print workspace contents
80 w->Print();
81
82 // Make workspace visible on command line
83 gDirectory->Add(w);
84}
#define gDirectory
Definition TDirectory.h:384
Persistable container for RooFit projects.
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
Definition JSONIO.h:26