Logo ROOT   6.10/09
Reference Guide
rf708_bphysics.C
Go to the documentation of this file.
1 /// \file
2 /// \ingroup tutorial_roofit
3 /// \notebook -js
4 /// 'SPECIAL PDFS' RooFit tutorial macro #708
5 ///
6 /// Special decay pdf for B physics with mixing and/or CP violation
7 ///
8 /// \macro_image
9 /// \macro_output
10 /// \macro_code
11 /// \author 07/2008 - Wouter Verkerke
12 
13 
14 #include "RooRealVar.h"
15 #include "RooDataSet.h"
16 #include "RooGaussian.h"
17 #include "RooConstVar.h"
18 #include "RooCategory.h"
19 #include "RooBMixDecay.h"
20 #include "RooBCPEffDecay.h"
21 #include "RooBDecay.h"
22 #include "RooFormulaVar.h"
23 #include "RooTruthModel.h"
24 #include "TCanvas.h"
25 #include "TAxis.h"
26 #include "RooPlot.h"
27 using namespace RooFit ;
28 
29 void rf708_bphysics()
30 {
31  // -------------------------------------
32  // B - D e c a y w i t h m i x i n g
33  // =====================================
34 
35  // C o n s t r u c t p d f
36  // -------------------------
37 
38  // Observable
39  RooRealVar dt("dt","dt",-10,10) ;
40  dt.setBins(40) ;
41 
42  // Parameters
43  RooRealVar dm("dm","delta m(B0)",0.472) ;
44  RooRealVar tau("tau","tau (B0)",1.547) ;
45  RooRealVar w("w","flavour mistag rate",0.1) ;
46  RooRealVar dw("dw","delta mistag rate for B0/B0bar",0.1) ;
47 
48  RooCategory mixState("mixState","B0/B0bar mixing state") ;
49  mixState.defineType("mixed",-1) ;
50  mixState.defineType("unmixed",1) ;
51 
52  RooCategory tagFlav("tagFlav","Flavour of the tagged B0") ;
53  tagFlav.defineType("B0",1) ;
54  tagFlav.defineType("B0bar",-1) ;
55 
56  // Use delta function resolution model
57  RooTruthModel truthModel("tm","truth model",dt) ;
58 
59  // Construct Bdecay with mixing
60  RooBMixDecay bmix("bmix","decay",dt,mixState,tagFlav,tau,dm,w,dw,truthModel,RooBMixDecay::DoubleSided) ;
61 
62 
63 
64  // P l o t p d f i n v a r i o u s s l i c e s
65  // ---------------------------------------------------
66 
67  // Generate some data
68  RooDataSet* data = bmix.generate(RooArgSet(dt,mixState,tagFlav),10000) ;
69 
70  // Plot B0 and B0bar tagged data separately
71  // For all plots below B0 and B0 tagged data will look somewhat differently
72  // if the flavor tagging mistag rate for B0 and B0 is different (i.e. dw!=0)
73  RooPlot* frame1 = dt.frame(Title("B decay distribution with mixing (B0/B0bar)")) ;
74 
75  data->plotOn(frame1,Cut("tagFlav==tagFlav::B0")) ;
76  bmix.plotOn(frame1,Slice(tagFlav,"B0")) ;
77 
78  data->plotOn(frame1,Cut("tagFlav==tagFlav::B0bar"),MarkerColor(kCyan)) ;
79  bmix.plotOn(frame1,Slice(tagFlav,"B0bar"),LineColor(kCyan)) ;
80 
81 
82  // Plot mixed slice for B0 and B0bar tagged data separately
83  RooPlot* frame2 = dt.frame(Title("B decay distribution of mixed events (B0/B0bar)")) ;
84 
85  data->plotOn(frame2,Cut("mixState==mixState::mixed&&tagFlav==tagFlav::B0")) ;
86  bmix.plotOn(frame2,Slice(tagFlav,"B0"),Slice(mixState,"mixed")) ;
87 
88  data->plotOn(frame2,Cut("mixState==mixState::mixed&&tagFlav==tagFlav::B0bar"),MarkerColor(kCyan)) ;
89  bmix.plotOn(frame2,Slice(tagFlav,"B0bar"),Slice(mixState,"mixed"),LineColor(kCyan)) ;
90 
91 
92  // Plot unmixed slice for B0 and B0bar tagged data separately
93  RooPlot* frame3 = dt.frame(Title("B decay distribution of unmixed events (B0/B0bar)")) ;
94 
95  data->plotOn(frame3,Cut("mixState==mixState::unmixed&&tagFlav==tagFlav::B0")) ;
96  bmix.plotOn(frame3,Slice(tagFlav,"B0"),Slice(mixState,"unmixed")) ;
97 
98  data->plotOn(frame3,Cut("mixState==mixState::unmixed&&tagFlav==tagFlav::B0bar"),MarkerColor(kCyan)) ;
99  bmix.plotOn(frame3,Slice(tagFlav,"B0bar"),Slice(mixState,"unmixed"),LineColor(kCyan)) ;
100 
101 
102 
103 
104 
105  // -------------------------------------------------
106  // B - D e c a y w i t h C P v i o l a t i o n
107  // =================================================
108 
109  // C o n s t r u c t p d f
110  // -------------------------
111 
112  // Additional parameters needed for B decay with CPV
113  RooRealVar CPeigen("CPeigen","CP eigen value",-1) ;
114  RooRealVar absLambda("absLambda","|lambda|",1,0,2) ;
115  RooRealVar argLambda("absLambda","|lambda|",0.7,-1,1) ;
116  RooRealVar effR("effR","B0/B0bar reco efficiency ratio",1) ;
117 
118  // Construct Bdecay with CP violation
119  RooBCPEffDecay bcp("bcp","bcp", dt, tagFlav, tau, dm, w, CPeigen, absLambda, argLambda, effR, dw, truthModel, RooBCPEffDecay::DoubleSided) ;
120 
121 
122 
123  // P l o t s c e n a r i o 1 - s i n ( 2 b ) = 0 . 7 , | l | = 1
124  // ---------------------------------------------------------------------------
125 
126  // Generate some data
127  RooDataSet* data2 = bcp.generate(RooArgSet(dt,tagFlav),10000) ;
128 
129  // Plot B0 and B0bar tagged data separately
130  RooPlot* frame4 = dt.frame(Title("B decay distribution with CPV(|l|=1,Im(l)=0.7) (B0/B0bar)")) ;
131 
132  data2->plotOn(frame4,Cut("tagFlav==tagFlav::B0")) ;
133  bcp.plotOn(frame4,Slice(tagFlav,"B0")) ;
134 
135  data2->plotOn(frame4,Cut("tagFlav==tagFlav::B0bar"),MarkerColor(kCyan)) ;
136  bcp.plotOn(frame4,Slice(tagFlav,"B0bar"),LineColor(kCyan)) ;
137 
138 
139 
140  // P l o t s c e n a r i o 2 - s i n ( 2 b ) = 0 . 7 , | l | = 0 . 7
141  // -------------------------------------------------------------------------------
142 
143  absLambda=0.7 ;
144 
145  // Generate some data
146  RooDataSet* data3 = bcp.generate(RooArgSet(dt,tagFlav),10000) ;
147 
148  // Plot B0 and B0bar tagged data separately (sin2b = 0.7 plus direct CPV |l|=0.5)
149  RooPlot* frame5 = dt.frame(Title("B decay distribution with CPV(|l|=0.7,Im(l)=0.7) (B0/B0bar)")) ;
150 
151  data3->plotOn(frame5,Cut("tagFlav==tagFlav::B0")) ;
152  bcp.plotOn(frame5,Slice(tagFlav,"B0")) ;
153 
154  data3->plotOn(frame5,Cut("tagFlav==tagFlav::B0bar"),MarkerColor(kCyan)) ;
155  bcp.plotOn(frame5,Slice(tagFlav,"B0bar"),LineColor(kCyan)) ;
156 
157 
158 
159  // ---------------------------------------------------------------------------
160  // G e n e r i c B d e c a y w i t h u s e r c o e f f i c i e n t s
161  // ===========================================================================
162 
163  // C o n s t r u c t p d f
164  // -------------------------
165 
166  // Model parameters
167  RooRealVar DGbG("DGbG","DGamma/GammaAvg",0.5,-1,1);
168  RooRealVar Adir("Adir","-[1-abs(l)**2]/[1+abs(l)**2]",0);
169  RooRealVar Amix("Amix","2Im(l)/[1+abs(l)**2]",0.7);
170  RooRealVar Adel("Adel","2Re(l)/[1+abs(l)**2]",0.7);
171 
172  // Derived input parameters for pdf
173  RooFormulaVar DG("DG","Delta Gamma","@1/@0",RooArgList(tau,DGbG));
174 
175  // Construct coefficient functions for sin,cos,sinh modulations of decay distribution
176  RooFormulaVar fsin("fsin","fsin","@0*@1*(1-2*@2)",RooArgList(Amix,tagFlav,w));
177  RooFormulaVar fcos("fcos","fcos","@0*@1*(1-2*@2)",RooArgList(Adir,tagFlav,w));
178  RooFormulaVar fsinh("fsinh","fsinh","@0",RooArgList(Adel));
179 
180  // Construct generic B decay pdf using above user coefficients
181  RooBDecay bcpg("bcpg","bcpg",dt,tau,DG,RooConst(1),fsinh,fcos,fsin,dm,truthModel,RooBDecay::DoubleSided);
182 
183 
184 
185  // P l o t - I m ( l ) = 0 . 7 , R e ( l ) = 0 . 7 | l | = 1, d G / G = 0 . 5
186  // -------------------------------------------------------------------------------------
187 
188  // Generate some data
189  RooDataSet* data4 = bcpg.generate(RooArgSet(dt,tagFlav),10000) ;
190 
191  // Plot B0 and B0bar tagged data separately
192  RooPlot* frame6 = dt.frame(Title("B decay distribution with CPV(Im(l)=0.7,Re(l)=0.7,|l|=1,dG/G=0.5) (B0/B0bar)")) ;
193 
194  data4->plotOn(frame6,Cut("tagFlav==tagFlav::B0")) ;
195  bcpg.plotOn(frame6,Slice(tagFlav,"B0")) ;
196 
197  data4->plotOn(frame6,Cut("tagFlav==tagFlav::B0bar"),MarkerColor(kCyan)) ;
198  bcpg.plotOn(frame6,Slice(tagFlav,"B0bar"),LineColor(kCyan)) ;
199 
200 
201 
202 
203  TCanvas* c = new TCanvas("rf708_bphysics","rf708_bphysics",1200,800) ;
204  c->Divide(3,2) ;
205  c->cd(1) ; gPad->SetLeftMargin(0.15) ; frame1->GetYaxis()->SetTitleOffset(1.6) ; frame1->Draw() ;
206  c->cd(2) ; gPad->SetLeftMargin(0.15) ; frame2->GetYaxis()->SetTitleOffset(1.6) ; frame2->Draw() ;
207  c->cd(3) ; gPad->SetLeftMargin(0.15) ; frame3->GetYaxis()->SetTitleOffset(1.6) ; frame3->Draw() ;
208  c->cd(4) ; gPad->SetLeftMargin(0.15) ; frame4->GetYaxis()->SetTitleOffset(1.6) ; frame4->Draw() ;
209  c->cd(5) ; gPad->SetLeftMargin(0.15) ; frame5->GetYaxis()->SetTitleOffset(1.6) ; frame5->Draw() ;
210  c->cd(6) ; gPad->SetLeftMargin(0.15) ; frame6->GetYaxis()->SetTitleOffset(1.6) ; frame6->Draw() ;
211 
212 }
virtual void SetTitleOffset(Float_t offset=1)
Set distance between the axis and the axis title Offset is a correction factor with respect to the "s...
Definition: TAttAxis.cxx:262
RooTruthModel is an implementation of RooResolution model that provides a delta-function resolution m...
Definition: RooTruthModel.h:21
TAxis * GetYaxis() const
Definition: RooPlot.cxx:1118
virtual RooPlot * plotOn(RooPlot *frame, const RooCmdArg &arg1=RooCmdArg::none(), const RooCmdArg &arg2=RooCmdArg::none(), const RooCmdArg &arg3=RooCmdArg::none(), const RooCmdArg &arg4=RooCmdArg::none(), const RooCmdArg &arg5=RooCmdArg::none(), const RooCmdArg &arg6=RooCmdArg::none(), const RooCmdArg &arg7=RooCmdArg::none(), const RooCmdArg &arg8=RooCmdArg::none()) const
Plot dataset on specified frame.
Definition: RooAbsData.cxx:552
RooCmdArg Cut(const char *cutSpec)
RooCmdArg LineColor(Color_t color)
TVirtualPad * cd(Int_t subpadnumber=0)
Set current canvas & pad.
Definition: TCanvas.cxx:679
PDF describing decay time distribution of B meson including effects of standard model CP violation...
RooCmdArg Title(const char *name)
Most general description of B decay time distribution with effects of CP violation, mixing and life time differences.
Definition: RooBDecay.h:24
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t tau
Definition: TRolke.cxx:630
Class RooBMixDecay is a RooAbsAnaConvPdf implementation that describes the decay of B mesons with the...
Definition: RooBMixDecay.h:23
RooRealVar represents a fundamental (non-derived) real valued object.
Definition: RooRealVar.h:36
RooDataSet is a container class to hold unbinned data.
Definition: RooDataSet.h:29
RooCategory represents a fundamental (non-derived) discrete value object.
Definition: RooCategory.h:24
A RooPlot is a plot frame and a container for graphics objects within that frame. ...
Definition: RooPlot.h:41
The Canvas class.
Definition: TCanvas.h:31
Definition: Rtypes.h:56
RooConstVar & RooConst(Double_t val)
virtual void Divide(Int_t nx=1, Int_t ny=1, Float_t xmargin=0.01, Float_t ymargin=0.01, Int_t color=0)
Automatic pad generation by division.
Definition: TPad.cxx:1135
#define gPad
Definition: TVirtualPad.h:284
RooCmdArg MarkerColor(Color_t color)
RooCmdArg Slice(const RooArgSet &sliceSet)
virtual void Draw(Option_t *options=0)
Draw this plot and all of the elements it contains.
Definition: RooPlot.cxx:559