ROOT
Version master
v6.36
v6.34
v6.32
v6.30
v6.28
v6.26
v6.24
v6.22
v6.20
v6.18
v6.16
v6.14
v6.12
v6.10
v6.08
v6.06
Reference Guide
▼
ROOT
ROOT Reference Documentation
Tutorials
▼
Functional Parts
►
Core ROOT classes
►
std Extension classes
►
Parallelized classes
►
The Geometry Package
►
Graphics
►
Event display with ROOT7
►
GUI
►
Web Widgets
►
Web Display
►
Histogram Library
►
Input/Output Library
►
Math
►
N-D parametric functions
►
VecOps
►
Monte Carlo
►
HTTP server
►
PROOF
►
TMVA
►
RooFit
►
Dataframe
►
RNTuple-related classes
►
ROOT7 classes
►
Tree Library
►
TreePlayer Library
▼
Tutorials
►
Data analysis tutorials
►
Event generation tutorials
►
Experimental API tutorials
►
Geometry tutorials
►
Histograms tutorials
►
HTTP tutorials
►
IO tutorials
►
Machine Learning tutorials
▼
Math tutorials
►
Fast Fourier Transforms tutorials
▼
Fit Tutorials
combinedFit.C
combinedFit.py
ConfidenceIntervals.C
ErrorIntegral.C
exampleFit3D.C
fit1.C
fit1.py
fit2.C
fit2a.C
fit2d.C
fit2dHist.C
fitCircle.C
fitcont.C
fitConvolution.C
fitConvolution.py
fitExclude.C
fithist.C
fitLinear.C
fitLinear2.C
fitLinearRobust.C
fitMultiGraph.C
fitNormSum.C
fitNormSum.py
fitpanel_playback.C
fitslicesy.C
FittingDemo.C
graph2dfit.C
Ifit.C
langaus.C
line3Dfit.C
minuit2FitBench.C
minuit2FitBench2D.C
minuit2GausFit.C
multidimfit.C
multifit.C
multifit.py
myfit.C
TestBinomial.C
TwoHistoFit2D.C
vectorizedFit.C
►
FOAM tutorials
►
Matrix tutorials
►
Probability distributions tutorials
►
Quadratic programming package
►
R tutorials
►
Unuran tutorials
►
VecOps tutorials
ChebyshevPol.C
chi2test.C
exampleFunction.py
exampleFunctor.C
exampleMultiRoot.C
exampleTKDE.C
GammaFun.C
goftest.C
hlquantiles.C
kdTreeBinning.C
Legendre.C
Legendre.py
LegendreAssoc.C
limit.C
mathcoreGenVector.C
mathcoreSpecFunc.C
mathcoreVectorCollection.C
mathcoreVectorFloatIO.C
mathcoreVectorIO.C
mathmoreIntegration.C
mathmoreIntegrationMultidim.C
multidimSampling.C
NumericalMinimization.C
permute.C
principal.C
principal.py
qa2.C
quantiles.C
quasirandom.C
testrandom.C
►
RooFit packages tutorials
►
Visualisation tutorials
►
Legacy tutorials
demos.C
demos.py
demoshelp.C
demoshelp.py
hsimple.C
hsimple.py
rootlogoff.C
rootlogon.C
►
Python interface
►
R Interface for Statistical Computing
►
Namespaces
►
All Classes
►
Files
Release Notes
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Modules
Pages
Loading...
Searching...
No Matches
Namespaces
fit1.py File Reference
Tutorials
»
Math tutorials
»
Fit Tutorials
Detailed Description
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
().
SetFillColor
( 21 )
c1.GetFrame
().SetBorderMode(-1 )
c1.GetFrame
().
SetBorderSize
( 5 )
gBenchmark.Start
(
'fit1'
)
#
# We connect the ROOT file generated in a previous tutorial
#
File =
"fillrandom-py.root"
if
(
ROOT.gSystem.AccessPathName
(File)) :
ROOT.Info
(
"fit1.py"
, File+
" does not exist"
)
exit
()
fill =
TFile
(File)
#
# The function "ls()" lists the directory contents of this file
#
fill.ls
()
#
# Get object "sqroot" from the file.
#
sqroot =
gROOT.FindObject
(
'sqroot'
)
sqroot.Print
()
#
# Now fit histogram h1f with the function sqroot
#
h1f =
gROOT.FindObject
(
'h1f'
)
h1f.SetFillColor
( 45 )
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.SetTextAlign
( 12 )
fitlabel.SetFillColor
( 42 )
fitlabel.ReadFile
(
path.join
(str(
gROOT.GetTutorialDir
()),
'math'
,
'fit'
,
'fit1_py.py'
))
fitlabel.Draw
()
c1.Update
()
gBenchmark.Show
(
'fit1'
)
TRangeDynCast
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Definition
TCollection.h:358
SetFillColor
Option_t Option_t SetFillColor
Definition
TGWin32VirtualXProxy.cxx:50
ROOT::Detail::TRangeCast
Definition
TCollection.h:311
TCanvas
The Canvas class.
Definition
TCanvas.h:23
TFile
A ROOT file is an on-disk file, usually with extension .root, that stores objects in a file-system-li...
Definition
TFile.h:131
TPaveText
A Pave (see TPave) with text, lines or/and boxes inside.
Definition
TPaveText.h:21
SetBorderSize
c SetBorderSize(2)
Author
Wim Lavrijsen
Definition in file
fit1.py
.
tutorials
math
fit
fit1.py
ROOT master - Reference Guide Generated on Mon Apr 21 2025 15:41:44 (GVA Time) using Doxygen 1.10.0