rf209_anaconv.cxx

Go to the documentation of this file.
00001 /////////////////////////////////////////////////////////////////////////
00002 //
00003 // 'ADDITION AND CONVOLUTION' RooFit tutorial macro #209
00004 // 
00005 // Decay function p.d.fs with optional B physics 
00006 // effects (mixing and CP violation) that can be
00007 // analytically convolved with e.g. Gaussian resolution 
00008 // functions
00009 // 
00010 // pdf1 = decay(t,tau) (x) delta(t)
00011 // pdf2 = decay(t,tau) (x) gauss(t,m,s)
00012 // pdf3 = decay(t,tau) (x) (f*gauss1(t,m1,s1) + (1-f)*gauss2(t,m1,s1))
00013 // 
00014 // 07/2008 - Wouter Verkerke 
00015 //
00016 /////////////////////////////////////////////////////////////////////////
00017 
00018 #ifndef __CINT__
00019 #include "RooGlobalFunc.h"
00020 #endif
00021 #include "RooRealVar.h"
00022 #include "RooDataSet.h"
00023 #include "RooGaussModel.h"
00024 #include "RooAddModel.h"
00025 #include "RooTruthModel.h"
00026 #include "RooDecay.h"
00027 #include "RooPlot.h"
00028 #include "TCanvas.h"
00029 #include "TH1.h"
00030 using namespace RooFit ;
00031 
00032 
00033 
00034 class TestBasic209 : public RooFitTestUnit
00035 {
00036 public: 
00037   TestBasic209(TFile* refFile, Bool_t writeRef, Int_t verbose) : RooFitTestUnit("Analytical convolution operator",refFile,writeRef,verbose) {} ;
00038   Bool_t testCode() {
00039     
00040     // B - p h y s i c s   p d f   w i t h   t r u t h   r e s o l u t i o n
00041     // ---------------------------------------------------------------------
00042     
00043     // Variables of decay p.d.f.
00044     RooRealVar dt("dt","dt",-10,10) ;
00045     RooRealVar tau("tau","tau",1.548) ;
00046     
00047     // Build a truth resolution model (delta function)
00048     RooTruthModel tm("tm","truth model",dt) ;
00049     
00050     // Construct decay(t) (x) delta(t)
00051     RooDecay decay_tm("decay_tm","decay",dt,tau,tm,RooDecay::DoubleSided) ;
00052     
00053     // Plot p.d.f. (dashed)
00054     RooPlot* frame = dt.frame(Title("Bdecay (x) resolution")) ;
00055     decay_tm.plotOn(frame,LineStyle(kDashed)) ;
00056     
00057     
00058     // B - p h y s i c s   p d f   w i t h   G a u s s i a n   r e s o l u t i o n
00059     // ----------------------------------------------------------------------------
00060     
00061     // Build a gaussian resolution model
00062     RooRealVar bias1("bias1","bias1",0) ;
00063     RooRealVar sigma1("sigma1","sigma1",1) ;
00064     RooGaussModel gm1("gm1","gauss model 1",dt,bias1,sigma1) ;
00065     
00066     // Construct decay(t) (x) gauss1(t)
00067     RooDecay decay_gm1("decay_gm1","decay",dt,tau,gm1,RooDecay::DoubleSided) ;
00068     
00069     // Plot p.d.f. 
00070     decay_gm1.plotOn(frame) ;
00071     
00072     
00073     // B - p h y s i c s   p d f   w i t h   d o u b l e   G a u s s i a n   r e s o l u t i o n
00074     // ------------------------------------------------------------------------------------------
00075     
00076     // Build another gaussian resolution model
00077     RooRealVar bias2("bias2","bias2",0) ;
00078     RooRealVar sigma2("sigma2","sigma2",5) ;
00079     RooGaussModel gm2("gm2","gauss model 2",dt,bias2,sigma2) ;
00080     
00081     // Build a composite resolution model f*gm1+(1-f)*gm2
00082     RooRealVar gm1frac("gm1frac","fraction of gm1",0.5) ;
00083     RooAddModel gmsum("gmsum","sum of gm1 and gm2",RooArgList(gm1,gm2),gm1frac) ;
00084     
00085     // Construct decay(t) (x) (f*gm1 + (1-f)*gm2)
00086     RooDecay decay_gmsum("decay_gmsum","decay",dt,tau,gmsum,RooDecay::DoubleSided) ;
00087     
00088     // Plot p.d.f. (red)
00089     decay_gmsum.plotOn(frame,LineColor(kRed)) ;
00090     
00091     regPlot(frame,"rf209_plot1") ;
00092 
00093     return kTRUE ;
00094 
00095   } 
00096 } ;

Generated on Tue Jul 5 15:07:46 2011 for ROOT_528-00b_version by  doxygen 1.5.1