Message: Re: Sigmentation fault Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Feedback Re: Sigmentation fault  

Keywords: Segmentation fault
Forum: Hadronic Processes
Re: Question Sigmentation fault (Alexey Lubashevskiy)
Date: 25 Oct, 2006
From: John Apostolakis <John Apostolakis>

I suggest that you check the value of the volume pointer that you get, to check that it is not null (ie zero).

Changing your code to read something like

  G4VPhysicalVolume  *pvol= aTrack->GetVolume();
  G4String vol_name = (pvol!=0) pvol->GetName() ? "Null";  

should allow you to take care of this case.

Generally it makes sense to protect your use of volumes (and other pointers) to make sure that they are not null. There are several reasons that a volume pointer could be null:

  - the track has arrived at the boundary of the world volume
  - the process that created it wanted to create a secondary outside
      the current volume
  - the process that created it simply did not set it (actually it 
        did not set the touchable which is the stack of volumes)

I hope that this helps to make clear the likely/potential problem, and allows you to solve it.

Best regards, John Apostolakis

P.S. Could you please add your affiliation to your HyperNews posting and mention your application area.

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

 Add Message Add Message
to: "Re: Sigmentation 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 ]