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 "TCanvas.h"
00020 #include "TAxis.h"
00021 #include "RooPlot.h"
00022 #include "RooFormulaVar.h"
00023 #include "RooAddition.h"
00024 #include "RooProduct.h"
00025 #include "RooPolyVar.h"
00026 #include "TCanvas.h"
00027 #include "TAxis.h"
00028 #include "TH1.h"
00029
00030 using namespace RooFit ;
00031
00032
00033 void rf302_utilfuncs()
00034 {
00035
00036
00037
00038
00039 RooRealVar x("x","x",-5,5) ;
00040 RooRealVar y("y","y",-5,5) ;
00041
00042
00043 RooRealVar a0("a0","a0",-1.5,-5,5) ;
00044 RooRealVar a1("a1","a1",-0.5,-1,1) ;
00045 RooRealVar sigma("sigma","width of gaussian",0.5) ;
00046
00047
00048
00049
00050
00051
00052 RooFormulaVar fy_1("fy_1","a0-a1*sqrt(10*abs(y))",RooArgSet(y,a0,a1)) ;
00053
00054
00055 RooGaussian model_1("model_1","Gaussian with shifting mean",x,fy_1,sigma) ;
00056
00057
00058
00059
00060
00061
00062
00063 RooPolyVar fy_2("fy_2","fy_2",y,RooArgSet(a0,a1)) ;
00064
00065
00066 RooGaussian model_2("model_2","Gaussian with shifting mean",x,fy_2,sigma) ;
00067
00068
00069
00070
00071
00072
00073
00074 RooAddition fy_3("fy_3","a0+y",RooArgSet(a0,y)) ;
00075
00076
00077 RooGaussian model_3("model_3","Gaussian with shifting mean",x,fy_3,sigma) ;
00078
00079
00080
00081
00082
00083
00084
00085 RooProduct fy_4("fy_4","a1*y",RooArgSet(a1,y)) ;
00086
00087
00088 RooGaussian model_4("model_4","Gaussian with shifting mean",x,fy_4,sigma) ;
00089
00090
00091
00092
00093
00094
00095
00096 TH1* hh_model_1 = model_1.createHistogram("hh_model_1",x,Binning(50),YVar(y,Binning(50))) ;
00097 TH1* hh_model_2 = model_2.createHistogram("hh_model_2",x,Binning(50),YVar(y,Binning(50))) ;
00098 TH1* hh_model_3 = model_3.createHistogram("hh_model_3",x,Binning(50),YVar(y,Binning(50))) ;
00099 TH1* hh_model_4 = model_4.createHistogram("hh_model_4",x,Binning(50),YVar(y,Binning(50))) ;
00100 hh_model_1->SetLineColor(kBlue) ;
00101 hh_model_2->SetLineColor(kBlue) ;
00102 hh_model_3->SetLineColor(kBlue) ;
00103 hh_model_4->SetLineColor(kBlue) ;
00104
00105
00106 TCanvas *c = new TCanvas("rf302_utilfuncs","rf302_utilfuncs",800, 800);
00107 c->Divide(2,2);
00108 c->cd(1) ; gPad->SetLeftMargin(0.20) ; hh_model_1->GetZaxis()->SetTitleOffset(2.5) ; hh_model_1->Draw("surf") ;
00109 c->cd(2) ; gPad->SetLeftMargin(0.20) ; hh_model_2->GetZaxis()->SetTitleOffset(2.5) ; hh_model_2->Draw("surf") ;
00110 c->cd(3) ; gPad->SetLeftMargin(0.20) ; hh_model_3->GetZaxis()->SetTitleOffset(2.5) ; hh_model_3->Draw("surf") ;
00111 c->cd(4) ; gPad->SetLeftMargin(0.20) ; hh_model_4->GetZaxis()->SetTitleOffset(2.5) ; hh_model_4->Draw("surf") ;
00112
00113 }