Bug #1761

TRefArray can not be used in multithread mode

Added by Karadzhov, Yordan over 8 years ago. Updated over 8 years ago.

Target version:
Start date:
28 September 2015
Due date:
% Done:


Estimated time:
New Issue


Apparently TRefArray does nasty things when allocating memory and in the multithread mode we get random segfaults. This is actually explained very well in the comments at the beginning of the source file:

- All elements of a TRefArray must be set in the same process,
In particular, one cannot modify some elements of the array in
a different process.

TRefArray can not switch to new TProcessID if they already contain objects.

If you want to keep the data structure as it is, there will be no way to run the reconstruction in multithread mode.

However it seems to me that there is a solution, suggested again in the comments of the source file

Use an array of TRef when one of the above restrictions is met.

It will be even better if we use std::vector<TRef>


Updated by Karadzhov, Yordan over 8 years ago

  • Category set to Tracker

Updated by Dobbs, Adam over 8 years ago

Moving to a std::vector<TRef> seems like a good idea. I would ideally like to make a wrapper class, MAUS::CrossLink or something, to wrap it in case we decide to change the implementation again. I will get to it when I can, hopefully soon...


Updated by Karadzhov, Yordan over 8 years ago

Just to keep the record.
Replacing TReffArray with std::vector<TRef> doesn't solve the problem. However I found here:

that in ROOT one have to call the "magical" static function


in order to enable the thread support. This seems to solve my problem entirely.


Updated by Karadzhov, Yordan over 8 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

Also available in: Atom PDF