Message: Re: GetCreatorProcess gives segmentation fault Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Idea Re: GetCreatorProcess gives segmentation fault 

Forum: Event and Track Management
Re: None GetCreatorProcess gives segmentation fault (Marion Bug)
Date: 17 Mar, 2010
From: Zach Hartwig <Zach Hartwig>

Hi Marion,

Before trying to access:

 aStep->GetTrack()->GetCreatorProcess()->GetProcessName()

you need to ensure that the current tracking particle has a creator process object. Primary events (launched from G4ParticleGun or G4GeneralParticleSource) do not have a creator process object since they are primary particles, and thus, when you try to get the process name from your sensitive detector class for primary particles, you create a segmentation fault since there is no creator process in memory to access from the step object.

Test for the creator process, then grab the creator process name. Something like:

 G4String CPName;
 if(aStep->GetTrack()->GetCreatorProcess()!=0)
    CPName = aStep->GetTrack()->GetCreatorProcess()->GetProcessName();

Hope that helps.

~Zach

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 None: Re: GetCreatorProcess gives segmentation fault   (Marion Bug - 18 Mar, 2010)
 Add Message Add Message
to: "Re: GetCreatorProcess gives segmentation fault"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]