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 "RooCategory.h"
00018 #include "RooDataSet.h"
00019 #include "RooGaussian.h"
00020 #include "RooConstVar.h"
00021 #include "RooPolynomial.h"
00022 #include "RooSimultaneous.h"
00023 #include "RooAddPdf.h"
00024 #include "RooWorkspace.h"
00025 #include "RooSimWSTool.h"
00026 #include "RooPlot.h"
00027 #include "TCanvas.h"
00028 #include "TAxis.h"
00029 #include "TFile.h"
00030 #include "TH1.h"
00031 using namespace RooFit ;
00032
00033
00034 void rf504_simwstool()
00035 {
00036
00037
00038
00039
00040 RooRealVar x("x","x",-10,10) ;
00041 RooRealVar m("m","m",0,-10,10) ;
00042 RooRealVar s("s","s",1,-10,10) ;
00043 RooGaussian gauss("g","g",x,m,s) ;
00044
00045
00046 RooRealVar p0("p0","p0",0.01,0.,1.) ;
00047 RooPolynomial poly("p","p",x,p0) ;
00048
00049
00050 RooRealVar f("f","f",0.5,0.,1.) ;
00051 RooAddPdf model("model","model",RooArgSet(gauss,poly),f) ;
00052
00053
00054
00055
00056
00057
00058
00059 RooCategory c("c","c") ;
00060 c.defineType("run1") ;
00061 c.defineType("run2") ;
00062
00063 RooCategory d("d","d") ;
00064 d.defineType("foo") ;
00065 d.defineType("bar") ;
00066
00067
00068
00069
00070
00071
00072
00073 RooWorkspace w("w","w") ;
00074 w.import(RooArgSet(model,c,d)) ;
00075
00076
00077 RooSimWSTool sct(w) ;
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091 RooSimultaneous* model_sim = sct.build("model_sim","model",SplitParam("m","c")) ;
00092
00093
00094 model_sim->Print("t") ;
00095
00096
00097 w.var("m_run1")->setVal(-3) ;
00098 w.var("m_run2")->setVal(+3) ;
00099
00100
00101 w.Print("v") ;
00102
00103
00104
00105
00106
00107
00108
00109 RooSimultaneous* model_sim2 = sct.build("model_sim2","model",SplitParam("p0","c,d")) ;
00110
00111
00112 model_sim2->Print("t") ;
00113
00114 }