Fit example.
import ROOT
from os import path
from ROOT import TCanvas, TFile, TPaveText
from ROOT import gROOT, gBenchmark
c1 =
TCanvas(
'c1',
'The Fit Canvas', 200, 10, 700, 500 )
c1.SetGridx()
c1.SetGridy()
c1.GetFrame().SetBorderMode(-1 )
gBenchmark.Start( 'fit1' )
File = "fillrandom-py.root"
if (ROOT.gSystem.AccessPathName(File)) :
ROOT.Info("fit1.py", File+" does not exist")
exit()
fill.ls()
sqroot = gROOT.FindObject( 'sqroot' )
sqroot.Print()
h1f = gROOT.FindObject( 'h1f' )
h1f.SetFillColor( 45 )
h1f.Fit( 'sqroot' )
fitlabel =
TPaveText( 0.6, 0.3, 0.9, 0.80,
'NDC' )
fitlabel.SetTextAlign( 12 )
fitlabel.SetFillColor( 42 )
fitlabel.ReadFile(path.join(str(gROOT.GetTutorialDir()), 'math', 'fit', 'fit1_py.py'))
fitlabel.Draw()
c1.Update()
gBenchmark.Show( 'fit1' )
A file, usually with extension .root, that stores data and code in the form of serialized objects in ...
- Author
- Wim Lavrijsen
Definition in file fit1.py.