Segmentation fault during tracking#92
Open
eduard322 wants to merge 3 commits intoSND-LHC:tracking_no_excavationfrom
Open
Segmentation fault during tracking#92eduard322 wants to merge 3 commits intoSND-LHC:tracking_no_excavationfrom
eduard322 wants to merge 3 commits intoSND-LHC:tracking_no_excavationfrom
Conversation
olantwin
reviewed
Jan 23, 2026
| this_track.setTrackType(self.track_type) | ||
| # Save the track in sndRecoTrack format | ||
| self.kalman_tracks[i_muon] = this_track | ||
| self.kalman_tracks.ExpandCreate(nStored + 1) |
Contributor
There was a problem hiding this comment.
This should be avoided, as this might involve copying the entire array. It's probably better to only expand the array by a growth factor whenever we reach its capacity.
olantwin
reviewed
Jan 23, 2026
| # Save the track in sndRecoTrack format | ||
| self.kalman_tracks[i_muon] = this_track | ||
| self.kalman_tracks.ExpandCreate(nStored + 1) | ||
| ROOT.EmplaceSndRecoTrack(self.kalman_tracks, int(nStored), this_track) |
Contributor
There was a problem hiding this comment.
If we don't want to define our own function, TClonesArray::ConstructedAt() followed by std::swap() can be used.
olantwin
reviewed
Jan 23, 2026
| #include "sndRecoTrack.h" | ||
|
|
||
| // Construct a *copy* of src inside arr at index i (placement new). | ||
| sndRecoTrack* EmplaceSndRecoTrack(TClonesArray* arr, int i, const sndRecoTrack& src) { |
Contributor
There was a problem hiding this comment.
Since we're stuck with many TCAs, it might be worth making this a template function for any object inheriting from TObject and declare it somewhere centrally.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixed the segmentation fault during the tracking that appeared at some point during processing of the neutrino events in the SND upgrade. Apparently, this kind of issue has never appeared neither in the previous studies of the advsnd, nor in the relevant sndsw. The issue was caused by
TClonesArrayand the python assignment for them (self.kalman_tracks[i_muon] = this_track). See the changed code. I replaced the assigment to the cpp one, which gave the positive results. I have tested the tracks and compared them with the ones stored in genfit_track format (worked without problems, but is disabled by default). Event display and with the fitted track:Hope we can get rid of
TClonesArrayand use STL vectors, but so far here is the workaround. Maybe also useful for the sndsw, because it can happen any time due to the incorrect memory assignment.