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 "RooGaussian.h"
00019 #include "RooGaussModel.h"
00020 #include "RooDecay.h"
00021 #include "RooLandau.h"
00022 #include "RooPlot.h"
00023 #include "TCanvas.h"
00024 #include "TH2D.h"
00025 using namespace RooFit ;
00026
00027
00028
00029 class TestBasic306 : public RooFitTestUnit
00030 {
00031 public:
00032 TestBasic306(TFile* refFile, Bool_t writeRef, Int_t verbose) : RooFitTestUnit("Conditional use of per-event error p.d.f. F(t|dt)",refFile,writeRef,verbose) {} ;
00033 Bool_t testCode() {
00034
00035
00036
00037
00038
00039 RooRealVar dt("dt","dt",-10,10) ;
00040 RooRealVar dterr("dterr","per-event error on dt",0.01,10) ;
00041
00042
00043 RooRealVar bias("bias","bias",0,-10,10) ;
00044 RooRealVar sigma("sigma","per-event error scale factor",1,0.1,10) ;
00045 RooGaussModel gm("gm1","gauss model scaled bt per-event error",dt,bias,sigma,dterr) ;
00046
00047
00048 RooRealVar tau("tau","tau",1.548) ;
00049 RooDecay decay_gm("decay_gm","decay",dt,tau,gm,RooDecay::DoubleSided) ;
00050
00051
00052
00053
00054
00055
00056
00057 RooLandau pdfDtErr("pdfDtErr","pdfDtErr",dterr,RooConst(1),RooConst(0.25)) ;
00058 RooDataSet* expDataDterr = pdfDtErr.generate(dterr,10000) ;
00059
00060
00061
00062
00063
00064
00065
00066 RooDataSet* data = decay_gm.generate(dt,ProtoData(*expDataDterr)) ;
00067
00068
00069
00070
00071
00072
00073
00074 decay_gm.fitTo(*data,ConditionalObservables(dterr)) ;
00075
00076
00077
00078
00079
00080
00081
00082
00083 TH1* hh_decay = decay_gm.createHistogram("hh_decay",dt,Binning(50),YVar(dterr,Binning(50))) ;
00084 hh_decay->SetLineColor(kBlue) ;
00085
00086
00087
00088 RooPlot* frame = dt.frame(Title("Slices of decay(dt|dterr) at various dterr")) ;
00089 for (Int_t ibin=0 ; ibin<100 ; ibin+=20) {
00090 dterr.setBin(ibin) ;
00091 decay_gm.plotOn(frame,Normalization(5.),Name(Form("curve_slice_%d",ibin))) ;
00092 }
00093
00094
00095
00096 RooPlot* frame2 = dt.frame(Title("Projection of decay(dt|dterr) on dt")) ;
00097 data->plotOn(frame2) ;
00098
00099
00100
00101
00102
00103
00104 decay_gm.plotOn(frame2,ProjWData(*expDataDterr,kTRUE)) ;
00105
00106
00107 regTH(hh_decay,"rf306_model2d") ;
00108 regPlot(frame,"rf306_plot1") ;
00109 regPlot(frame2,"rf306_plot2") ;
00110
00111 delete expDataDterr ;
00112 delete data ;
00113
00114 return kTRUE ;
00115 }
00116 } ;
00117