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