Skip to content

segmentation fault when using SinglesDigitizer and ROOT output #647

@bl0x

Description

@bl0x

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:

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().

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions