-
Notifications
You must be signed in to change notification settings - Fork 4
Segmentation fault during tracking #92
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
base: tracking_no_excavation
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -281,6 +281,15 @@ class MuonReco(ROOT.FairTask): | |
|
|
||
| def Init(self): | ||
| """Initialize the task.""" | ||
| ROOT.gInterpreter.Declare(r""" | ||
| #include "TClonesArray.h" | ||
| #include "sndRecoTrack.h" | ||
|
|
||
| // Construct a *copy* of src inside arr at index i (placement new). | ||
| sndRecoTrack* EmplaceSndRecoTrack(TClonesArray* arr, int i, const sndRecoTrack& src) { | ||
| return new((*arr)[i]) sndRecoTrack(src); | ||
| } | ||
| """) | ||
| self.logger = ROOT.FairLogger.GetLogger() | ||
| if self.logger.IsLogNeeded(ROOT.fair.Severity.info): | ||
| print("Initializing muon reconstruction task!") | ||
|
|
@@ -583,7 +592,7 @@ def SetStandalone(self): | |
| def Exec(self, opt): | ||
| """Core part of teh task.""" | ||
| self.kalman_tracks.Clear("C") | ||
|
|
||
| nStored = 0 | ||
| # Set scaling in case task is run seperately from other tracking tasks | ||
| if self.scale > 1 and self.standalone: | ||
| if ROOT.gRandom.Rndm() > 1.0 / self.scale: | ||
|
|
@@ -1123,7 +1132,9 @@ def Exec(self, opt): | |
| this_track.setRawMeasTimes(pointTimes) | ||
| 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. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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. |
||
| ROOT.EmplaceSndRecoTrack(self.kalman_tracks, int(nStored), this_track) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we don't want to define our own function, |
||
| nStored += 1 | ||
| # Delete the Kalman track object | ||
| theTrack.Delete() | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.