Dear ROOT users,
I would like to ask a question about the GetRandom3 method. The situation is as follows: I would like to generate particles with angles theta, phi and energy E. The direction and energy of the particles come from a text file, but I read the file and store the quantities into several histograms
Th1 theta
Th1 phi
Th2 thetaPhi
Th2 thetaEnergy
Th1 energy
If I use the method “GetRandom” in the TH1 to generate a variable according to its distribution it works fast and nice. The problem is that there are correlations between the variables, and I thought that a GetRandom3 from the 3d histogram (theta, phi, E) would provide a better generation of events…but it is quite slow and the computational time is very high. What I was thinking is that maybe this could be possible:
- Generate a theta from its th1 histogram with GetRandom()
- With this theta, go to the th2 (theta, phi) and get a phi (somehow…)
- With this theta go to the th2 (theta, energy) and get an Energy.
Maybe this could make the trick. The question is how could I do 2 and 3. Should I project, work with profiles…?
Thank you very much for your time.