Hello,
is there a way to fill a histogram with the FillRandom method if the function involved is not as simple as in the example below? I am thinking of something like :
def func(x, y, p1, p2 , p3 …, pn):
return z = …
where func is given to a TF2 object
xy = TF2( ‘xy’, ‘func’, x0, x1, y0, y1)
Do you have any suggestions?
Example of working code used above in the text:
# Upper and lower bounds of the 2D histogram and the 2D function:
x0 = 0.
x1 = 100.
y0 = 0.
y1 = 100.
# Simple 2D function to fill the histogram :
xy = TF2( ‘xy’, ‘(x*y)’, x0, x1, y0, y1)
# Create and fill histogram :
bin_no = 11
h3 = TH2D(“h3”, “fill the boxes”, bin_no, x0, x1, bin_no, y0, y1)
n_entries = 1000
h3.FillRandom(“xy”, n_entries)