ImportFromFile() function

Hi All. I am just starting with Roofit and my first task is to fit a mass distribution. I create a model to fit the mass distribution (basically -> exponential + gaussian) and I also generate a toy data set and I did the fitting following the instructions in the tutorials and it works great. Now I want to use a root file which contains data organized in several trees and several branches and what I want to do is import the data from that root file to a RooDataSet. I used

RooDataSet ds(“ds”,“ds”,RooArgSet(m,type,mkk,prob,fls3d),ImportFromFile(const char* data.root, const char* events),Cut(“prob>0.5”));

to import the data but I get a error messages: (I know these are common errors and I tried common solutions with no success)

Error: Invalid type ‘const’ in declaration of ‘char’ expgaus.C:56:
Error: Symbol const char is not defined in current scope expgaus.C:56:
Error: Symbol data is not defined in current scope expgaus.C:56:
Error: Failed to evaluate data.root
Error: Invalid type ‘const’ in declaration of ‘char’ expgaus.C:56:
Error: Symbol const char is not defined in current scope expgaus.C:56:
Error: Symbol events is not defined in current scope expgaus.C:56:
*** Interpreter error recovered ***

This is the code I have

#ifndef CINT
#include “RooGlobalFunc.h”
#endif
{
#include “RooDataHist.h”
#include “RooCategory.h”
#include “RooConstVar.h”
#include “TH1.h”
#include “TTree.h”
#include “TRandom.h”
#include “RooRealVar.h”
#include “RooDataSet.h”
#include “RooGaussian.h”
#include “TCanvas.h”
#include “RooPlot.h”
#include “TAxis.h”
#include "RooCmdConfig.h"
using namespace RooFit ;
//gSystem->Load(“libRooFit”) ;

// — Observable —
//RooRealVar x(“x”,“gauss PDF”,-10,10) ;
RooRealVar x(“x”,“gauss PDF”,4.8,6) ;

// — Parameters —
//RooRealVar mean(“mean”,“sigma”,0,-1,1) ;
//RooRealVar width(“width”,“width”,1,0,5) ;
RooRealVar mean(“mean”,“sigma”,5.3,5.2,5.4) ;
RooRealVar width(“width”,“width”,0.05,0,.2) ;

// — Build Gaussian PDF —
RooGaussian signal(“signal”,“signal PDF”,x,mean,width) ;

// — Build exponential background PDF —
RooRealVar alpha(“alpha”,“alpha”,-5,-50.,0.);
RooExponential background(“expo”,“exponential PDF”,x,alpha);

// — Construct signal+background PDF —
RooRealVar nsig(“nsig”,"#signal events",100,0.,10000) ;
RooRealVar nbkg(“nbkg”,"#background events",100,0.,10000) ;
RooAddPdf model(“model”,“gauss+expo PDF”,RooArgList(signal,background),RooArgList(nsig,nbkg)) ;

// — Generate a toyMC sample from composite PDF —
//RooDataSet *data = model.generate(x,2000) ;
//////////////////////////////////////////////////////////////////

RooRealVar m(“m”,“m”,4.8,6);
RooRealVar type(“type”,“type”,300531,300532) ;
RooRealVar mkk(“mkk”,“mkk”,1.01,1.03) ;
RooRealVar prob(“prob”,“prob”,0,1) ;
RooRealVar fls3d(“fls3d”,“fls3d”,0,100);

RooDataSet ds(“ds”,“ds”,RooArgSet(m,type,mkk,prob,fls3d),ImportFromFile(const char* data.root, const char* events),Cut(“prob>0.5”));

// — Perform extended ML fit of composite PDF to toy data —
//model.fitTo(*data) ;

// — Plot toy data and composite PDF overlaid —
RooPlot* xframe = x.frame() ;

//data->plotOn(xframe) ;
model.plotOn(xframe) ;
model.plotOn(xframe,Components(background),LineStyle(kDashed)) ;

xframe->Draw() ;

}

any suggestion is very welcome… Thanks

Please post in the general “ROOT Support” forum, as this problem is not Python/PyROOT related and I don’t even have time for PyROOT atm, let alone to help with general ROOT.