Fill a 1D histogram with random values using predefined functions
import ROOT
h1d = ROOT.TH1D("h1d", "Test random numbers", nbinsx = 200, xlow = 0.0, xup = 10.0)
h1d.FillRandom("gaus", 10000)
with ROOT.TFile.Open("fillrandom_py.root", "RECREATE") as myfile:
myfile.WriteObject(h1d, h1d.GetName())
- Date
- November 2024
- Author
- Giacomo Parolini
Definition in file hist001_TH1_fillrandom.py.