Problem 1773 - Segmentation Fault from GetOriginTouchable
Summary: Segmentation Fault from GetOriginTouchable
Status: RESOLVED FIXED
Alias: None
Product: Geant4
Classification: Unclassified
Component: event (show other problems)
Version: 10.1
Hardware: PC Linux
: P5 trivial
Assignee: Andrea Dotti
URL:
Depends on:
Blocks:
 
Reported: 2015-08-07 16:28 CEST by Steve Quillin
Modified: 2016-01-28 00:29 CET (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this problem.
Description Steve Quillin 2015-08-07 16:28:49 CEST
Accessing information from a touchable obtained from track->GetOriginTouchable() gives a segmentation fault if the track is a source (primary) particle.

Examples from steppingaction :-

G4Track* aTrack = theStep->GetTrack();
const G4VTouchable * t1= aTrack->GetOriginTouchable()  ;  // ok
G4VPhysicalVolume *p1  = t1->GetVolume()               ;  //  Instant segfault if aTrack->GetParentID()==0

But:-

if(aTrack->GetParentID()>0) G4cout<<t1->GetVolume()->GetName() << G4endl;  // ok



It's a trivial issue to work around I know. I just thought I'd report it as it caught me out for a while and may do so others also.

Please request further information if required.


Thanks 

Steve Quillin
Comment 1 kurasige 2015-08-09 07:32:52 CEST
OriginTouchable is set in G4EventManager::StackTracks.
It seems that  the OriginTouchable is set to primary tracks as well as secondary tracks. I have no idea on this problem.
Comment 2 asai 2016-01-28 00:29:15 CET
Sorry for the belated response.
Fix will be included in the next patch release.
Kind regards,
Makoto Asai