Message: user stepping action seg faults Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None user stepping action seg faults 

Keywords: user stepping action seg faults
Forum: Event and Track Management
Date: 18 Dec, 2006
From: Ken Teh <teh@anl.gov>

My user stepping action shown below seg faults.

void SteppingAction::UserSteppingAction(const G4Step *s)
{
    G4StepPoint *spre, *spost;

    if (s == 0) return;
    spre = s->GetPreStepPoint();
    spost = s->GetPostStepPoint();
    if (spre && spost && spre->GetPhysicalVolume()->GetName() ==
            spost->GetPhysicalVolume()->GetName()) return;
    G4cout << "post step volume=" << spost->GetPhysicalVolume()->GetName()
        << G4endl;
    if (spost->GetTouchable() == 0) return;
    G4cout << "touchable name, repl #, copy # = "
        << spost->GetTouchable()->GetVolume()->GetName() << ", "
        << spost->GetTouchable()->GetReplicaNumber() << ", "
        << spost->GetTouchable()->GetCopyNumber() << G4endl;
}

If I don't add the user stepping action to the run manager, then the simulation runs. The problem is reproducible. It always happens on the second event. I show the output when /tracking/verbose is on. The first is without the user stepping action:

--no user stepping action ---------------------------------------------
  185    -9.21     5.45      391   0.00471   0.0241 0.000237       801       strip hLowEIoni
  186    -9.21     5.45      391         0  0.00471  0.00017       801       strip hLowEIoni
EventAction::EndOfEventAction()
RunAction::EndOfRunAction() 0
Idle> /run/beamOn 1
RunAction::BeginOfRunAction() 1
EventAction::BeginOfEventAction()

*********************************************************************************************************
* G4Track Information:   Particle = proton,   Track ID = 1,   Parent ID = 0
*********************************************************************************************************

Step#    X(mm)    Y(mm)    Z(mm) KinE(MeV)  dE(MeV) StepLeng TrackLeng  NextVolume ProcName
    0        0        0        0         5        0        0         0    solenoid initStep
    1    -63.4     14.5 1.08e+03         5        0 1.53e+03  1.53e+03        hall Transportation
    2      365       73  1.5e+03         5        0      606  2.14e+03  OutOfWorld Transportation
EventAction::EndOfEventAction()
RunAction::EndOfRunAction() 1

--user stepping action ---------------------------------------------------
  185    -9.21     5.45      391   0.00471   0.0241 0.000237       801       strip hLowEIoni
  186    -9.21     5.45      391         0  0.00471  0.00017       801       strip hLowEIoni
EventAction::EndOfEventAction()
RunAction::EndOfRunAction() 0
Idle> /run/beamOn 1
RunAction::BeginOfRunAction() 1
EventAction::BeginOfEventAction()

*********************************************************************************************************
* G4Track Information:   Particle = proton,   Track ID = 1,   Parent ID = 0
*********************************************************************************************************

Step#    X(mm)    Y(mm)    Z(mm) KinE(MeV)  dE(MeV) StepLeng TrackLeng  NextVolume ProcName
    0        0        0        0         5        0        0         0    solenoid initStep
    1    -63.4     14.5 1.08e+03         5        0 1.53e+03  1.53e+03        hall Transportation
post step volume=hall
touchable name, repl #, copy # = hall, 0, 0
    2      365       73  1.5e+03         5        0      606  2.14e+03  OutOfWorld Transportation
Segmentation fault

---------------------------------------------------------------------

I'm guessing the problem is not in the user stepping function but elsewhere and it has something to do with the particle having left the solenoid and has entered the experimental hall. The hall and solenoid are filled with the geant galactic vacuum. The only physics process I use is low energy ionisation for protons.

The paradox is, of course, that the simulation runs if I don't add the user stepping action to the run manager.

Any ideas?

Ken

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

1 None: Re: user stepping action seg faults   (Ken Teh - 18 Dec, 2006)
(_ Warning: Re: user stepping action seg faults   (Peter Gumplinger - 04 Jan, 2007)
 Add Message Add Message
to: "user stepping action seg faults"

 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 ]