#include #include "TH1.h" #include "TFile.h" #include "RooRealVar.h" #include "RooFormulaVar.h" #include "RooDataHist.h" #include "RooPlot.h" #include "RooGenericPdf.h" #include "RooGaussian.h" #include "RooProdPdf.h" #include "RooFFTConvPdf.h" #include "RooNumConvPdf.h" #include "RooNLLVar.h" #include "RooMinuit.h" #include "RooFitResult.h" #include "TCanvas.h" #include "TROOT.h" #include "RooAddPdf.h" #include "RooChi2Var.h" #include "RooArgSet.h" #include #include using namespace RooFit; void fit_work() { TFile file("fitFile"); RooRealVar obs("obs","obs",-30.,30.); RooRealVar testsig("testsig","testsig",3.0); RooRealVar testsig2("testsig2","testsig2",4.0); RooRealVar testsig3("testsig3","testsig3",5.0); RooRealVar c1("c1","c1",0.); RooGaussian gt1("gt1","gt1",obs,c1,testsig); RooGaussian gt2("gt2","gt2",obs,c1,testsig2); RooGaussian gt3("gt3","gt3",obs,c1,testsig3); obs.setBins(10000,"fft"); RooFFTConvPdf conv("conv","conv",obs,gt1,gt2); RooRealVar one("one","one",1.); RooRealVar mOne("mOne","mOne",-1.); RooAddPdf diff("diff","diff",RooArgList(gt3,conv),RooArgList(one,mOne)); RooPlot* obsframe = obs.frame(); conv.plotOn(obsframe,LineColor(kGreen)); gt3.plotOn(obsframe,LineColor(kMagenta)); diff.plotOn(obsframe,LineColor(kRed)); obsframe->Draw(); }