expo() { gSystem->Load("libRooFit"); using namespace RooFit; RooRealVar pid("pid","pid",-600,600) ; RooRealVar dectime("dectime","dectime",0,15) ; // Build Gaussian PDF RooRealVar x("x","x",0,15) ; RooRealVar tau("tau","",-0.714286,-1,-0.5) ; RooExponential expo("expo","expo PDF",x,tau) ; // Generate a toy MC set // RooDataSet* data = expo.generate(x,500) ; RooDataSet* data = RooDataSet::read("piddectime.txt",RooArgList(pid,dectime)); // Fit pdf to toy tau.setConstant(kFALSE) ; expo.fitTo(*data,Range(0.1,8),Minos(false)) ; // Plot PDF and toy data overlaid RooPlot* xframe2 = dectime.frame() ; data->plotOn(xframe2) ; expo.plotOn(xframe2) ; xframe2->Draw() ; // Print final value of parameters tau.Print() ; }