Filling a leaf of a Tree with Random

Hi,

I’ve created a simple tree that has 3 variable leaves: x, y, z.
I am trying to fill each leaf with a different number assortment.
example: leaf x is filled with 1000 events of random Gaussian distribution, y is filled with a uniform distribution, and z is filled with a Landau distribution.
How do I fill each leaf individually?
I cannot access it through:
x->FillRandom(“gaus”,1000)

Thanks!

Fill the tree, not the leaves or branches. Generate three random numbers for every event, assigning to x, y and z, and fill the tree with that event. See examples here for generation or numbers:
https://root.cern.ch/root/html/tutorials/math/testrandom.C.html
Using for instance TRandom3:

...
TRandom *r3 = new TRandom3();
...
for (i=0;i<1000;i++) {
   x = r3->Gaus(0,1);
   y = ...;
   z = ...;
   Tree->Fill();
}
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.