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