00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef __CINT__
00017 #include "RooGlobalFunc.h"
00018 #endif
00019 #include "RooRealVar.h"
00020 #include "RooDataSet.h"
00021 #include "RooGaussian.h"
00022 #include "RooExponential.h"
00023 #include "TCanvas.h"
00024 #include "RooPlot.h"
00025 #include "RooFitResult.h"
00026
00027 using namespace RooFit ;
00028
00029
00030 class TestBasic314 : public RooFitTestUnit
00031 {
00032 public:
00033 TestBasic314(TFile* refFile, Bool_t writeRef, Int_t verbose) : RooFitTestUnit("Fit with non-rectangular observable boundaries",refFile,writeRef,verbose) {} ;
00034 Bool_t testCode() {
00035
00036
00037
00038
00039
00040 RooRealVar t("t","t",0,5) ;
00041 RooRealVar tmin("tmin","tmin",0,0,5) ;
00042
00043
00044 t.setRange(tmin,RooConst(t.getMax())) ;
00045
00046
00047 RooRealVar tau("tau","tau",-1.54,-10,-0.1) ;
00048 RooExponential model("model","model",t,tau) ;
00049
00050
00051
00052
00053
00054
00055
00056 RooDataSet* dall = model.generate(t,10000) ;
00057
00058
00059 RooDataSet* tmp = RooGaussian("gmin","gmin",tmin,RooConst(0),RooConst(0.5)).generate(tmin,5000) ;
00060
00061
00062 RooDataSet* dacc = model.generate(t,ProtoData(*tmp)) ;
00063
00064
00065
00066
00067
00068
00069 RooFitResult* r = model.fitTo(*dacc,Save()) ;
00070
00071
00072
00073
00074
00075
00076
00077 RooPlot* frame = t.frame(Title("Fit to data with per-event acceptance")) ;
00078 dall->plotOn(frame,MarkerColor(kRed),LineColor(kRed)) ;
00079 model.plotOn(frame) ;
00080 dacc->plotOn(frame,Name("dacc")) ;
00081
00082
00083 regResult(r,"rf314_fit") ;
00084 regPlot(frame,"rf314_plot1") ;
00085
00086 delete tmp ;
00087 delete dacc ;
00088 delete dall ;
00089
00090 return kTRUE;
00091 }
00092 } ;