16form1 = ROOT.TFormula(
"form1",
"abs(sin(x)/x)")
21sqroot = ROOT.TF1(
"sqroot",
"x*gaus(0) + [3]*form1", rangeMin, rangeMax)
27sqroot.SetParameters(gausScale, gausMean, gausVar, form1Scale)
30h1d = ROOT.TH1D(
"h1d",
"Test random numbers", 200, rangeMin, rangeMax)
33h1d.Fill(np.array([sqroot.GetRandom()
for _
in range(10000)]))
36with ROOT.TFile.Open(
"fillrandom_userfunc_py_uhi.root",
"RECREATE")
as myFile:
37 myFile.WriteObject(form1, form1.GetName())
38 myFile.WriteObject(sqroot, sqroot.GetName())
39 myFile.WriteObject(h1d, h1d.GetName())