00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef __CINT__
00015 #include "RooGlobalFunc.h"
00016 #endif
00017 #include "RooRealVar.h"
00018 #include "RooDataSet.h"
00019 #include "RooGaussian.h"
00020 #include "TCanvas.h"
00021 #include "TAxis.h"
00022 #include "RooPlot.h"
00023 using namespace RooFit ;
00024
00025
00026 void rf111_derivatives()
00027 {
00028
00029
00030
00031
00032 RooRealVar x("x","x",-10,10) ;
00033 RooRealVar mean("mean","mean of gaussian",1,-10,10) ;
00034 RooRealVar sigma("sigma","width of gaussian",1,0.1,10) ;
00035
00036
00037 RooGaussian gauss("gauss","gaussian PDF",x,mean,sigma) ;
00038
00039
00040
00041
00042
00043
00044 RooAbsReal* dgdx = gauss.derivative(x,1) ;
00045
00046
00047 RooAbsReal* d2gdx2 = gauss.derivative(x,2) ;
00048 RooAbsReal* d3gdx3 = gauss.derivative(x,3) ;
00049
00050
00051 RooPlot* xframe = x.frame(Title("d(Gauss)/dx")) ;
00052
00053
00054 gauss.plotOn(xframe) ;
00055
00056
00057 dgdx->plotOn(xframe,LineColor(kMagenta)) ;
00058 d2gdx2->plotOn(xframe,LineColor(kRed)) ;
00059 d3gdx3->plotOn(xframe,LineColor(kOrange)) ;
00060
00061
00062
00063
00064
00065
00066 RooAbsReal* dgds = gauss.derivative(sigma,1) ;
00067
00068
00069 RooAbsReal* d2gds2 = gauss.derivative(sigma,2) ;
00070 RooAbsReal* d3gds3 = gauss.derivative(sigma,3) ;
00071
00072
00073 RooPlot* sframe = sigma.frame(Title("d(Gauss)/d(sigma)"),Range(0.,2.)) ;
00074
00075
00076 gauss.plotOn(sframe) ;
00077
00078
00079 dgds->plotOn(sframe,LineColor(kMagenta)) ;
00080 d2gds2->plotOn(sframe,LineColor(kRed)) ;
00081 d3gds3->plotOn(sframe,LineColor(kOrange)) ;
00082
00083
00084
00085
00086 TCanvas* c = new TCanvas("rf111_derivatives","rf111_derivatives",800,400) ;
00087 c->Divide(2) ;
00088 c->cd(1) ; gPad->SetLeftMargin(0.15) ; xframe->GetYaxis()->SetTitleOffset(1.6) ; xframe->Draw() ;
00089 c->cd(2) ; gPad->SetLeftMargin(0.15) ; sframe->GetYaxis()->SetTitleOffset(1.6) ; sframe->Draw() ;
00090
00091
00092 }