Question on tutorial example

Hi all,

I have a question on random filling of histograms. I have been trying to modify the tutorial example /tutorials/hist/fillrandom.C

The example file (/tutorials/hist/fillrandom.C) fails to work when you move it to /tutorials/hist/fillrandom.3.C. I’m confused how changing the name makes the tutorial example fail. It gives the error:

root [2] .X /Applications/root/tutorials/hist/fillrandom.3.C
Error: non class,struct,union object fillrandom used with . or -> :0:
*** Interpreter error recovered ***

I was curious if anyone could explain to me how this part of the tutorial example works.


When doing

root > .x myscript.C this executes by default the function named “myscript” in myscript.C.
If your file contains one or more functions with names name1, name2, etc,
you can execute any of these functions by doing

root > .L myscript.C root > name1()
See the very first chapters of the Users Guide for mode details.


Thanks Rene!