TRandom3 Gaus segmentation violation

Hi

I’m trying to run a code, using a TRandom3 object to get a Gaus random distribution.

I’m using a TSelector to tun over Tuples and I’m using a class that need a TRandom3. When i require one of the mothod of this class it systematically crashes when the class use this TRandom3 object (any method Gaus, Uniform…)

To test it, i’ve commented the use of this class and declared a TRandom3 *Rand; as a member of the selector.
In the constructor, i initialize the Rand with
Rand = new TRandom3();

and just two lines in my selector
cout<<"rand value "<<endl;
cout<Gaus(0,1)<<endl;

Any configuration i’ve tried it gives

===========================================================
There was a crash.
This is the entire stack trace of all threads:
===========================================================
#0  0x00002b087288a115 in waitpid () from /lib64/libc.so.6
#1  0x00002b087282c481 in do_system () from /lib64/libc.so.6
#2  0x00002b086ce13f0c in TUnixSystem::StackTrace() ()
   from /lal/root/5.28.00b/lib64/libCore.so.5.28
#3  0x00002b086ce116e1 in TUnixSystem::DispatchSignals(ESignals) ()
   from /lal/root/5.28.00b/lib64/libCore.so.5.28
#4  <signal handler called>
#5  0x000000000040c6f1 in Ana::Process (this=0x7fffe299e870, 
    entry=<value optimized out>) at src/Ana.C:132
#6  0x00002b08717292af in TTreePlayer::Process(TSelector*, char const*, long long, long long) () from /lal/root/5.28.00b/lib64/libTreePlayer.so.5.28
#7  0x0000000000431cf7 in main (argc=<value optimized out>, 
    argv=<value optimized out>) at src/main.cpp:146
===========================================================


The lines below might hint at the cause of the crash.
If they do not help you then please submit a bug report at
http://root.cern.ch/bugs. Please post the ENTIRE stack trace
from above as an attachment in addition to anything else
that might help us fixing this issue.
===========================================================
#5  0x000000000040c6f1 in Ana::Process (this=0x7fffe299e870, 
    entry=<value optimized out>) at src/Ana.C:132
#6  0x00002b08717292af in TTreePlayer::Process(TSelector*, char const*, long long, long long) () from /lal/root/5.28.00b/lib64/libTreePlayer.so.5.28
#7  0x0000000000431cf7 in main (argc=<value optimized out>, 
    argv=<value optimized out>) at src/main.cpp:146
===========================================================

I’ve tried to change ROOT version (5.26.00 and 5.28.00B) and the random obejct (TRandom1, TRandom3)
but it always seg fault.

any idea ?

thanks in advance

Hi,

Most likely Rand is not really initialized when you use it (maybe you did not initialize it in all the constructors). For quick check try:cout<<"rand value "<<endl; cout << (void*)Rand << endl; Rand = new TRandom3(); cout<<Rand->Gaus(0,1)<<endl;Cheers,
Philippe.