Message: Segmentation violation when accessing secondary tracks from SteppingAction Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question Segmentation violation when accessing secondary tracks from SteppingAction 

Keywords: Tracking Secondaries Segmentation violation
Forum: Event and Track Management
Date: 18 Nov, 2007
From: Michael Gericke <Michael Gericke>

Hi,

I am simulating cold neutron capture on some materials. I am trying to get track information out of the secondaries vector, in the function UserSteppingAction, as shown below. The problem is that for some events (very few) the simulation crashes (see further down for messages), not allowing me to access any information.

Two remarks:

1) the problem does not occur with 4.8.2, but does with 4.9.0.p01

2) if I remove the code shown below, the problem goes away

Has anyone encountered this problem:

  for(G4int i = GetTrackVectorSize()-nSecTotal; i < GetTrackVectorSize(); i++){

    G4VUserTrackInformation *test = ((*fSecondary)[i]->GetUserInformation()); <--- crashes here
    //     infoNew = (N3HeSimTrackInformation*)test;
    //     infoNew  = (*fSecondary)[i]->GetUserInformation();

    if(test == 0){//(*fSecondary)[i]->GetUserInformation()==0){

      infoNew = new N3HeSimTrackInformation();

      infoNew->StoreParentTrackID(theTrack->GetTrackID());
      infoNew->StoreParentEnergy(theTrack->GetKineticEnergy());
      infoNew->StoreEventNumber(myUserInfo->GetPrimaryEventNumber());
      infoNew->SetNewFlag(true);
      (*fSecondary)[i]->SetUserInformation(infoNew);
    }
    else{
      infoNew = (N3HeSimTrackInformation*)test;
      //       infoNew = (N3HeSimTrackInformation*)((*fSecondary)[i]->GetUserInformation());
      infoNew->StoreParentTrackID(theTrack->GetTrackID());
      infoNew->StoreParentEnergy(theTrack->GetKineticEnergy());
    }

    etc ...

Note: 

       GetTrackVectorSize() just return (*fSecondary).size()

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

1 None: Re: Segmentation violation when accessing secondary tracks from SteppingAction   (Michael Gericke - 18 Nov, 2007)
3 Idea: Re: Segmentation violation when accessing secondary tracks from SteppingAction   (Peter Gumplinger - 19 Nov, 2007)
 Add Message Add Message
to: "Segmentation violation when accessing secondary tracks from SteppingAction"

 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 ]