00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef __CINT__
00014 #include "RooGlobalFunc.h"
00015 #endif
00016 #include "RooRealVar.h"
00017 #include "RooDataSet.h"
00018 #include "RooGaussModel.h"
00019 #include "RooDecay.h"
00020 #include "RooBMixDecay.h"
00021 #include "RooCategory.h"
00022 #include "TCanvas.h"
00023 #include "RooPlot.h"
00024 using namespace RooFit ;
00025
00026
00027 class TestBasic310 : public RooFitTestUnit
00028 {
00029 public:
00030 TestBasic310(TFile* refFile, Bool_t writeRef, Int_t verbose) : RooFitTestUnit("Data and p.d.f projection in category slice",refFile,writeRef,verbose) {} ;
00031 Bool_t testCode() {
00032
00033
00034
00035
00036
00037 RooRealVar dt("dt","dt",-20,20) ;
00038
00039
00040 RooCategory mixState("mixState","B0/B0bar mixing state") ;
00041 RooCategory tagFlav("tagFlav","Flavour of the tagged B0") ;
00042
00043
00044 mixState.defineType("mixed",-1) ;
00045 mixState.defineType("unmixed",1) ;
00046 tagFlav.defineType("B0",1) ;
00047 tagFlav.defineType("B0bar",-1) ;
00048
00049
00050 RooRealVar dm("dm","delta m(B)",0.472,0.,1.0) ;
00051 RooRealVar tau("tau","B0 decay time",1.547,1.0,2.0) ;
00052 RooRealVar w("w","Flavor Mistag rate",0.03,0.0,1.0) ;
00053 RooRealVar dw("dw","Flavor Mistag rate difference between B0 and B0bar",0.01) ;
00054
00055
00056 RooRealVar bias1("bias1","bias1",0) ;
00057 RooRealVar sigma1("sigma1","sigma1",0.01) ;
00058 RooGaussModel gm1("gm1","gauss model 1",dt,bias1,sigma1) ;
00059
00060
00061 RooBMixDecay bmix_gm1("bmix","decay",dt,mixState,tagFlav,tau,dm,w,dw,gm1,RooBMixDecay::DoubleSided) ;
00062
00063
00064 RooDataSet *data = bmix_gm1.generate(RooArgSet(dt,tagFlav,mixState),20000) ;
00065
00066
00067
00068
00069
00070
00071
00072 RooPlot* frame = dt.frame(Title("Inclusive decay distribution")) ;
00073 data->plotOn(frame) ;
00074 bmix_gm1.plotOn(frame) ;
00075
00076
00077
00078
00079
00080
00081
00082 RooPlot* frame2 = dt.frame(Title("Decay distribution of mixed events")) ;
00083 data->plotOn(frame2,Cut("mixState==mixState::mixed")) ;
00084
00085
00086 bmix_gm1.plotOn(frame2,Slice(mixState,"mixed")) ;
00087
00088
00089 RooPlot* frame3 = dt.frame(Title("Decay distribution of unmixed events")) ;
00090 data->plotOn(frame3,Cut("mixState==mixState::unmixed")) ;
00091
00092
00093 bmix_gm1.plotOn(frame3,Slice(mixState,"unmixed")) ;
00094
00095
00096 regPlot(frame,"rf310_plot1") ;
00097 regPlot(frame2,"rf310_plot2") ;
00098 regPlot(frame3,"rf310_plot3") ;
00099
00100 delete data ;
00101
00102 return kTRUE ;
00103 }
00104 } ;