ROOT
Version v6.34
master
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
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Modules
Pages
Loading...
Searching...
No Matches
fitConvolution.py
Go to the documentation of this file.
1
## \file
2
## \ingroup tutorial_fit
3
## \notebook
4
## Tutorial for convolution of two functions
5
##
6
## \macro_image
7
## \macro_output
8
## \macro_code
9
##
10
## \author Jonas Rembser, Aurelie Flandi (C++ version)
11
12
import
ROOT
13
14
# Construction of histogram to fit.
15
h_ExpGauss =
ROOT.TH1F
(
"h_ExpGauss"
,
"Exponential convoluted by Gaussian"
, 100, 0.0, 5.0)
16
for
i
in
range
(1000000):
17
# Gives a alpha of -0.3 in the exp.
18
x =
ROOT.gRandom.Exp
(1.0 / 0.3)
19
x +=
ROOT.gRandom.Gaus
(0.0, 3.0)
20
# Probability density function of the addition of two variables is the
21
# convolution of two density functions.
22
h_ExpGauss.Fill
(x)
23
24
f_conv =
ROOT.TF1Convolution
(
"expo"
,
"gaus"
, -1, 6,
True
)
25
f_conv.SetRange
(-1.0, 6.0)
26
f_conv.SetNofPointsFFT
(1000)
27
f =
ROOT.TF1
(
"f"
, f_conv, 0.0, 5.0,
f_conv.GetNpar
())
28
f.SetParameters
(1.0, -0.3, 0.0, 1.0)
29
30
c1 =
ROOT.TCanvas
(
"c1"
,
"c1"
, 800, 1000)
31
32
# Fit and draw result of the fit
33
h_ExpGauss.Fit
(
"f"
)
34
35
c1.SaveAs
(
"fitConvolution.png"
)
TRangeDynCast
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Definition
TCollection.h:358
ROOT::Detail::TRangeCast
Definition
TCollection.h:311
tutorials
fit
fitConvolution.py
ROOT tags/6-34-04 - Reference Guide Generated on Wed Mar 19 2025 04:35:06 (GVA Time) using Doxygen 1.10.0