Hello,
I’m getting a segmentation fault in TRef that I don’t quite understand…
TRef::operator= (this=0x1753820, obj=<optimized out>) at root-6.06.08/core/base/src/TRef.cxx:301
301 SetUniqueID(uid);
(gdb) info locals
uid = 1
I used to have the same code working before I made some changes. I now have an abstract base class Event and a derived class SimEvent.
class Event: public TObject {
// ...
ClassDef(Event, 1);
}
class SimEvent: public Event{
// ...
TClonesArray* ecalSimHits;
TClonesArray* trackerSimHits;
TClonesArray* simParticles;
ClassDef(SimEvent, 1);
}
The SimEvent class is basically just a container for a set of TClonesArray.
For instance, one of my output classes has a single TRef to another class object like …
class SimTrackerHit: public TObject {
// ....
TRef simParticle{nullptr};
}
It seems to work fine to add the objects to the event and persist it so long as the TRef is not set. But when I try to set a TRef on one of the output objects in my test, it immediately crashes.
Can anyone suggest how I might go about debugging this to see why TRef is crashing here when the unique ID is being set? Is a unique ID of 1 valid in this case? (In case it matters, I’m testing the output by adding 3 objects to the event.)
All I can think of is that ROOT is for some reason seeing the base Event class instead of SimEvent so the unique ID is not valid, but I don’t have enough understanding of the internals to say why that would be.
Thanks.
–Jeremy