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 "RooPlot.h"
00021 #include "RooFormulaVar.h"
00022 #include "RooAddition.h"
00023 #include "RooProduct.h"
00024 #include "RooPolyVar.h"
00025 #include "TCanvas.h"
00026 #include "TH1.h"
00027
00028 using namespace RooFit ;
00029
00030
00031 class TestBasic302 : public RooFitTestUnit
00032 {
00033 public:
00034 TestBasic302(TFile* refFile, Bool_t writeRef, Int_t verbose) : RooFitTestUnit("Sum and product utility functions",refFile,writeRef,verbose) {} ;
00035 Bool_t testCode() {
00036
00037
00038
00039
00040
00041 RooRealVar x("x","x",-5,5) ;
00042 RooRealVar y("y","y",-5,5) ;
00043
00044
00045 RooRealVar a0("a0","a0",-1.5,-5,5) ;
00046 RooRealVar a1("a1","a1",-0.5,-1,1) ;
00047 RooRealVar sigma("sigma","width of gaussian",0.5) ;
00048
00049
00050
00051
00052
00053
00054 RooFormulaVar fy_1("fy_1","a0-a1*sqrt(10*abs(y))",RooArgSet(y,a0,a1)) ;
00055
00056
00057 RooGaussian model_1("model_1","Gaussian with shifting mean",x,fy_1,sigma) ;
00058
00059
00060
00061
00062
00063
00064
00065 RooPolyVar fy_2("fy_2","fy_2",y,RooArgSet(a0,a1)) ;
00066
00067
00068 RooGaussian model_2("model_2","Gaussian with shifting mean",x,fy_2,sigma) ;
00069
00070
00071
00072
00073
00074
00075
00076 RooAddition fy_3("fy_3","a0+y",RooArgSet(a0,y)) ;
00077
00078
00079 RooGaussian model_3("model_3","Gaussian with shifting mean",x,fy_3,sigma) ;
00080
00081
00082
00083
00084
00085
00086
00087 RooProduct fy_4("fy_4","a1*y",RooArgSet(a1,y)) ;
00088
00089
00090 RooGaussian model_4("model_4","Gaussian with shifting mean",x,fy_4,sigma) ;
00091
00092
00093
00094
00095
00096
00097
00098 TH1* hh_model_1 = model_1.createHistogram("hh_model_1",x,Binning(50),YVar(y,Binning(50))) ;
00099 TH1* hh_model_2 = model_2.createHistogram("hh_model_2",x,Binning(50),YVar(y,Binning(50))) ;
00100 TH1* hh_model_3 = model_3.createHistogram("hh_model_3",x,Binning(50),YVar(y,Binning(50))) ;
00101 TH1* hh_model_4 = model_4.createHistogram("hh_model_4",x,Binning(50),YVar(y,Binning(50))) ;
00102 hh_model_1->SetLineColor(kBlue) ;
00103 hh_model_2->SetLineColor(kBlue) ;
00104 hh_model_3->SetLineColor(kBlue) ;
00105 hh_model_4->SetLineColor(kBlue) ;
00106
00107 regTH(hh_model_1,"rf202_model2d_1") ;
00108 regTH(hh_model_2,"rf202_model2d_2") ;
00109 regTH(hh_model_3,"rf202_model2d_3") ;
00110 regTH(hh_model_4,"rf202_model2d_4") ;
00111
00112 return kTRUE ;
00113 }
00114 } ;