-
Notifications
You must be signed in to change notification settings - Fork 277
Description
I see a segfault when using a SinglesDigitizer together with ROOT output:
/usr/include/c++/13.2.1/bits/stl_vector.h:1125: std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = GateHitTree*; _Alloc = std::allocator<GateHitTree*>; reference = GateHitTree*&; size_type = long unsigned int]: Assertion '__n < this->size()' failed.
This originates from accessing the first element of m_treesHit in GateToRoot::RecordEndOfAcquisition().
However, m_treesHit is cleared in GateToRoot::RecordEndOfRun(), so the access fails and produces a segfault.
Perhaps clearing m_treesHit at the end of a run is not good in this case:
Gate/source/digits_hits/src/GateToRoot.cc
Line 682 in a1f0a36
| m_treesHit.clear(); |
I am not sure about the sequence of which methods get called when, but I am reckoning that
RecordBeginOfAcquisiton() and RecordEndOfAcquisition()
are called on a greater scope compared to the
RecordBeginOfRun() and RecordEndOfRun()
methods.
This would imply, that when RecordEndOfAcquisition() is called, m_treesHit has been cleared from the last invocation of RecordEndOfRun().
Perhaps it is better to call m_treesHit.clear() right before the container is filled in RecordBeginOfRun().