A simple fitting example

A simple fitting example

//
// To see the output of this macro, click  here 
// Here we create a Canvas named "c1" with all default parameters
//
gROOT.Reset(c1)
TCanvas c1(c1,"The Fit Canvas")
c1.SetGridx
c1.SetGridy
//
// We connect the ROOT file generated in a previous tutorial
// see  Filling histograms with random numbers from a function 
//
TFile fill(fillrandom.root)
//
// The following command ".ls" list the directory contents of this file
//
.ls
sqroot.Print

//
// Now fit histogram h1f with the function sqroot
//
h1f.Fit(sqroot)

// We now annotate the picture by creating a PaveText object
// and displaying the list of commands in this macro
//
TPaveText fitlabel(6.5,50,10.5,300)
fitlabel.SetTextAlign(12)
fitlabel.SetFillColor(25)
fitlabel.ReadFile(fit1.commands.mac)
fitlabel.Draw

//----------------------------------------------------------------------
// The log file from this macro is shown below
//




[ROOT page] [Class index] [Top of the page]


This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.