Re: [ROOT] TF1 & GetRandom

From: Daniel De Marco (ddm@GE.INFN.IT)
Date: Wed Mar 05 2003 - 18:51:21 MET


* Rene Brun <Rene.Brun@cern.ch> [05/03/2003 17:44]:
> You do not need any special calls for this. Just do:
>   gRandom = new TRandom3;  for example

Yes, I know that. And meanwhile I'm using this approach.
But I have a MC with some TF1 used to generate random numbers. I want these
random number sequences to evolve independently and it will be much more
straightforward to set the generator in the beginning for each TF1 than to
do:
gRandom = random1;
foo = distrib->GetRandom();
gRandom = savedgRandom;
for each call.
Besides if I want to use the same distribution in various subroutines I
should pass them not only the TF1, but also the TRandom.

Anyway I implemented the suggestion I mentioned. I added a TRandom *fRandom
to TF1, modified the constructors adding fRandom=gRandom, added the method
void SetRandomGenerator(TRandom *rg) { fRandom=rg; } and modified the
GetRandom methods to use fRandom instead of gRandom. I'm compilig it right
now. Tomorrow I will run some test and if you changed your mind I can send
you the diff.

Ciao, Daniel.

--ddm



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:09 MET