Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
fit1.py File Reference

Detailed Description

View in nbviewer Open in SWAN
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.GetFrame().SetBorderMode(-1 )
#
# We connect the ROOT file generated in a previous tutorial
#
File = "fillrandom-py.root"
ROOT.Info("fit1.py", File+" does not exist")
exit()
fill = TFile(File)
#
# The function "ls()" lists the directory contents of this file
#
#
# Get object "sqroot" from the file.
#
sqroot = gROOT.FindObject( 'sqroot' )
#
# Now fit histogram h1f with the function sqroot
#
h1f = gROOT.FindObject( 'h1f' )
h1f.Fit( 'sqroot' )
# We now annotate the picture by creating a PaveText object
# and displaying the list of commands in this macro
#
fitlabel = TPaveText( 0.6, 0.3, 0.9, 0.80, 'NDC' )
fitlabel.ReadFile(path.join(str(gROOT.GetTutorialDir()), 'math', 'fit', 'fit1_py.py'))
gBenchmark.Show( 'fit1' )
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t SetFillColor
The Canvas class.
Definition TCanvas.h:23
A ROOT file is an on-disk file, usually with extension .root, that stores objects in a file-system-li...
Definition TFile.h:53
A Pave (see TPave) with text, lines or/and boxes inside.
Definition TPaveText.h:21
c SetBorderSize(2)
Author
Wim Lavrijsen

Definition in file fit1.py.