Hi,
Here my macro
#include <vector>
#ifndef __CINT__
#include "RooGlobalFunc.h"
#endif
#include "RooRealVar.h"
#include "RooDataSet.h"
#include "RooGaussian.h"
#include "RooPolynomial.h"
#include "RooAddPdf.h"
#include "RooFitResult.h"
#include "RooFFTConvPdf.h"
#include "TCanvas.h"
#include "RooPlot.h"
#include "TAxis.h"
#include "TH1.h"
void roo_nsig_cut4_A007() {
using namespace RooFit ;
gROOT->Reset();
f = new TFile("path/to/root/file/histo.root");
Int_t grp = 6;
Double_t xmin = 0.85;
Double_t xmax = 1.1;
RooRealVar x("x", "", xmin, xmax);
TH1F *hnew1 = 0;
gDirectory->GetObject("cut4_AND_0.07", hnew1);
hnew1->Rebin(grp);
hnew1->GetXaxis()->SetRangeUser(xmin, xmax);
hnew1->SetMarkerStyle(20);
hnew1->SetMarkerSize(0.7);
RooDataHist dh("dh","dh", x, Import(*hnew1));
//Fit parameters
RooRealVar mean("mean","mean",[i]value,min,max[/i]);
RooRealVar sigma("sigma","sigma",0.006,0.001,0.009);
RooGaussian sig("sig","signal p.d.f.",x,mean,sigma);
RooRealVar c0("c0","coefficient #0", -0.2, -1.,3.);
RooRealVar c1("c1","coefficient #1", 0.01,-1.,1.);
RooRealVar c2("c2","coefficient #2",-0.003,-1.,1.);
RooChebychev bkg("bkg","background p.d.f.",x,RooArgList(c0,c1,c2)) ;
RooRealVar nsig("nsig","signal fraction",6000,0.,100000.);
RooRealVar nbkg("nbkg","background fraction",30000,0.,1000000.);
// model(x) = fsig*sig(x) + (1-fsig)*bkg(x)
RooAddPdf model("model","model",RooArgList(sig,bkg),RooArgList(nsig,nbkg)) ;
model.fitTo(dh);
RooPlot* xframe =x.frame(Title("W/SS_OR_No_d0_And007"));
dh.plotOn(xframe);
model.plotOn(xframe);
model.plotOn(xframe,Components("bkg"),LineStyle(kDashed));
//ShowConstant(1);
model.paramOn(xframe, Layout(0.55,0.99,0.4));
//dh.statOn(xframe, Layout(0.75, 0.99, 0.8));
xframe->Draw();
cout << "chi^2 = " << xframe->chiSquare() << endl;
}
I cannot show the output of this macro, because it never stops, the minuit function that runs during fit keeps on running to get the best fit, but it nevers stops. This same macro worked when i ran it in ubuntu. You would need some more information?