Message: GetPostStepPoint causes segmentaion fault Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question GetPostStepPoint causes segmentaion fault  

Forum: Event and Track Management
Date: 07 Dec, 2009
From: Gergely Soti <Gergely Soti>

Dear all,

Working on GEANT4.9 on Linux, I wanted to modify the SteppingAction. I want to record the position when a particle (e-) hits a specified volume (AngleSensor):

void SteppingAction::UserSteppingAction(const G4Step* aStep)
{
        G4StepPoint* tpoint = aStep->GetPostStepPoint();
        if(tpoint->GetStepStatus()!=fGeomBoundary)return;

        G4cout << tpoint->GetPhysicalVolume()->GetName() << endl;
        if(tpoint->GetPhysicalVolume()->GetName()!="AngleSensor")return;

        do some stuff...
}

Now, if my particle misses the AngleSensor, and goes to the end or the world volume, I get a segmentation fault, right when I try to access the "GetName" of the volume.

Is this the expected behavior? Am I doing something wrong? I guess I could test if the particle is at the end of the world volume. Anyway I wouldn't expect a segmentation fault...

regards, Gergely

p.s. I looked in the changelogs, I didn't see that this got solved in p01 or p02.

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

1 Feedback: Re: GetPostStepPoint causes segmentaion fault   (Gumplinger Peter - 07 Dec, 2009)
(_ Ok: Re: GetPostStepPoint causes segmentaion fault   (Gergely Soti - 07 Dec, 2009)
 Add Message Add Message
to: "GetPostStepPoint causes segmentaion 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 ]