{ TFile *fin = new TFile("example_data.root"); TNtupleD *nt = (TNtupleD *)fin->Get("nt"); TH1D *hist2 = new TH1D("hist2","Binned data",100,0.,2.); nt->Project("hist2","mass","","",nt->GetEntries()/100); hist2->SetFillColor(kRed-9); hist2->SetStats(false); hist2->GetXaxis()->SetTitle("Mass"); TF1 *f1 = new TF1("f1","[0]+[1]*x+[2]*gaus(2)"); f1->SetParameters(2.,-0.5,3.,1.,0.05); hist2->Fit("f1"); }