Message: Re: How to transport and stack secondaries first before transporting the primaries again Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Re: How to transport and stack secondaries first before transporting the primaries again  

Forum: Event and Track Management
Re: None How to transport and stack secondaries first before transporting the primaries again (Brent van der Heyden)
Date: Apr 24, 06:17
From: Makoto Asai <Makoto Asai>

Hi,

Sorry for this belated reply. You do not need to implement anything for UserStackingAction, but in your UserSteppingAction, you need to have the following lines of code.

YourUserSteppingAction::UserSteppingAction(const G4Step* theStep)
{
  if(theStep->GetNumberOfSecondariesInCurrentStep > 0) // secondaries are generated
  {
   G4Track * theTrack = theStep->GetTrack();
   theTrack->SetTrackStatus(fSuspend);
  }
}

Then, the primary track and all the secondaries generated at this step are sent to the track stack, and the primary track is pushed to the stack followed by secondary tracks. Given the stack is last-in-first-out, the next track that is posed out from the stack is a secondary.

If you are using Geant4 version 10.4-patch01 or earlier, you also need to comment-out G4_USESMARTSTACK option defined in CMakeList.txt in source/event directory and re-compile Geant4 installation. If you are using Geant4 version 10.4-patch02 or later, you don't need this.

Hope this helps,
Makoto

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

1 Note: Re: How to transport and stack secondaries first before transporting the primaries again   (Brent van der Heyden - May 01, 04:06) new
 Add Message Add Message
to: "Re: How to transport and stack secondaries first before transporting the primaries again "

 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 ]