00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef __CINT__
00016 #include "RooGlobalFunc.h"
00017 #endif
00018 #include "RooRealVar.h"
00019 #include "RooDataSet.h"
00020 #include "RooGaussian.h"
00021 #include "RooLandau.h"
00022 #include "RooFFTConvPdf.h"
00023 #include "RooPlot.h"
00024 #include "TCanvas.h"
00025 #include "TH1.h"
00026 #include "TPluginManager.h"
00027 #include "TROOT.h"
00028
00029 using namespace RooFit ;
00030
00031
00032
00033 class TestBasic208 : public RooFitTestUnit
00034 {
00035 public:
00036 TestBasic208(TFile* refFile, Bool_t writeRef, Int_t verbose) : RooFitTestUnit("FFT Convolution operator p.d.f.",refFile,writeRef,verbose) {} ;
00037
00038 Bool_t isTestAvailable() {
00039
00040 TPluginHandler *h;
00041 if ((h = gROOT->GetPluginManager()->FindHandler("TVirtualFFT"))) {
00042 if (h->LoadPlugin() == -1) {
00043 return kFALSE;
00044 } else {
00045 return kTRUE ;
00046 }
00047 }
00048 return kFALSE ;
00049 }
00050
00051 Double_t ctol() { return 5e-3 ; }
00052
00053 Bool_t testCode() {
00054
00055
00056
00057
00058
00059 RooRealVar t("t","t",-10,30) ;
00060
00061
00062 RooRealVar ml("ml","mean landau",5.,-20,20) ;
00063 RooRealVar sl("sl","sigma landau",1,0.1,10) ;
00064 RooLandau landau("lx","lx",t,ml,sl) ;
00065
00066
00067 RooRealVar mg("mg","mg",0) ;
00068 RooRealVar sg("sg","sg",2,0.1,10) ;
00069 RooGaussian gauss("gauss","gauss",t,mg,sg) ;
00070
00071
00072
00073
00074
00075
00076 t.setBins(10000,"cache") ;
00077
00078
00079 RooFFTConvPdf lxg("lxg","landau (X) gauss",t,landau,gauss) ;
00080
00081
00082
00083
00084
00085
00086 RooDataSet* data = lxg.generate(t,10000) ;
00087
00088
00089 lxg.fitTo(*data) ;
00090
00091
00092 RooPlot* frame = t.frame(Title("landau (x) gauss convolution")) ;
00093 data->plotOn(frame) ;
00094 lxg.plotOn(frame) ;
00095 landau.plotOn(frame,LineStyle(kDashed)) ;
00096
00097 regPlot(frame,"rf208_plot1") ;
00098
00099 delete data ;
00100 return kTRUE ;
00101
00102 }
00103 } ;
00104
00105
00106