TRef Array and Process ID

Hi,

I’m having a problem using TRefArray that i’m hoping one of you may have some suggestion on how to resolve.

I’m storing in an ntuple class TRefArray to object in another class
(eg TRefArray of tracks from a vertex or TRefArrays of mother/daughters of a MC particle).

When making the nutple, after ~7200 evts, i’m getting the error from TRefArray saying:
Error in TRefArray::AddAtAndExpand: The object at 0x… is not registered in the process the TRefArray point to …

I’ve called
m_tree -> BranchRef();
and before filling the tree:
Int_t ObjectNumber = TProcessID::GetObjectCount();
TProcessID::SetObjectCount(ObjectNumber);

I’m not so sure what causes this since it’s running the same job and the processID has not changed when filling the ntuple.

From what i can tell running over the output ntuple, the problem seems to be only for the TRefArray in the Vertex class and not the TRefArray in the MC class.
The ntuple is rather big, 2.4Gb (i initially had the ntuple files splitted after ~1Gb, no difference either way as expected) and an event can have lots of tracks.
I’m using ROOT 5.22.00d.

Any ideas how to resolve this ?

Cheers
-a

Hi Anyes,

you need to call Int_t ObjectNumber = TProcessID::GetObjectCount(); at the beginning of the event loop, before setting any of the TRefs, and TProcessID::SetObjectCount(ObjectNumber); after they have all been set. If you already do that then we’ll need a running example demonstrating the issue to be able to investigate where the problem comes from.

Cheers, Axel.