How to understand the SetZStop(G4double zValue) function in the phase space file

I’m recently learning to use phase space files, but I have some questions about the SetZStop(G4double zValue) function.

I added the relevant file to my B1 program, and then called the SetZStop(G4double zValue) function in BeginOfRunAction.

The official manual describes this function as follows: it defines a new scoring plane at z = zValue. This method must be called at least once before the Geant4 run starts.

At first I set this parameter to 10cm, in this case I can only launch one particle, if I launch more than one particle the program will quit. If I set this parameter to 90cm, then I can launch more particles.

I never quite understand this question and would like to ask you how this function should be used if I want to generate my own phase space file.

Thank you all for your replies

1 Like

Dear Jodie,

Could you please provide more details regarding the class of that method, phase-space format, what the “relevant file” is, etc.?



hi mcortes:

Thank you for your reply, I am sorry I did not describe it clearly, the relevant documents refer to the following documents.

• iaea_config.h
• iaea_header.h and
• iaea_phsp.h and
• iaea_record.h and
• utilities.h and

These files are some dependency files and changes to the B1 program only appear in RunAction, Event Action, Stepping Action.Here is my program

void RunAction::BeginOfRunAction(const G4Run*aRun)
  // inform the runManager to save random number seed

  // reset accumulables to their initial values
  G4AccumulableManager* accumulableManager = G4AccumulableManager::Instance();

  G4IAEAphspWriter*IAEAWriter = G4IAEAphspWriter::GetInstance();


void RunAction::EndOfRunAction(const G4Run* aRun)

void EventAction::BeginOfEventAction(const G4Event*aEvent)
  fEdep = 0.;

void SteppingAction::UserSteppingAction(const G4Step* aStep)

Thanks for your reply.