Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

segmentation fault when using SinglesDigitizer and ROOT output #647

Open
bl0x opened this issue Nov 29, 2023 · 1 comment
Open

segmentation fault when using SinglesDigitizer and ROOT output #647

bl0x opened this issue Nov 29, 2023 · 1 comment

Comments

@bl0x
Copy link

bl0x commented Nov 29, 2023

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

@kochebina
Copy link
Contributor

Dear Bastien,

Indeed I need to fix it! Could you, please, share your macros that I could reproduce the seg fault? (possible by email : kochebina at gmail dot com)

For the sequence it is:
RecordBeginOfAcquisiton()
RecordBeginOfRun()
RecordBeginOfEvent()
RecordBeginOfEvent()
RecordEndOfRun()
RecordEndOfAcquisition()

I started to clear m_treesHit in RecordEndOfRun() for the case when one wants to simulate several runs un the same aquisition. I'll check what to do with that

Cheers,
Olga

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants