using namespace RooFit ; void ex6() { // Make model // A workspace is a container class for RooFit data modeling objects // (variables, functions, probability density functions etc...) // Here we make an empty workspace RooWorkspace w("w") ; // Now we use the 'factory' to fill the workspace with the definition // of three variables (x,mean and sigma) and the definition of a Gaussian // probability density function 'g' in terms of (x,mean,sigma)s w.factory("Exponential::decay(t[0,20],expr::alpha('-1/tau',tau[1.54,0.1,20]))") ; RooDataSet* data = w.pdf("decay")->generate(*w.var("t"),100) ; RooFitResult* r = w.pdf("decay")->fitTo(*data,Save()) ; RooPlot* frame = w.var("t")->frame() ; data->plotOn(frame) ; w.pdf("decay")->plotOn(frame) ; frame->Draw() ; // BLOCK 1 for (Int_t i=0 ; inumEntries() ; i++){ Double_t t = data->get(i)->getRealValue("t") ; cout << "t[" << i << "] = " << t << endl ; } }