Message: Re: simulation efficiency Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Idea Re: simulation efficiency 

Forum: Event and Track Management
Re: Question simulation efficiency (Sean Turnbull)
Date: 11 Jul, 2011
From: Zach Hartwig <Zach Hartwig>

Hi Sean,

If you are interested in easily counting particles that are *created* during a run, you should derive your own G4UserStackingAction class and use the G4UserStackingAction::ClassifyNewTrack method, which is called during the tracking process when new particles need to be added to the stack for tracking. You can increment your created particle hits in your G4UserRunAction class (after passing the G4UserRunAction pointer to your G4UserStackingAction class, just as you are presently doing with your G4UserSteppingAction class).

Because G4UserSteppingAction::UserSteppingAction is called at every step, you should make every effort to minimize code in this function especially for CPU intensive simulation. Putting the code in G4UserStackingAction::ClassifyNewTrack ensures highly efficient accumulation of the data you want and only *once* for each particle when it is newly created. It appears that the code you now have will "count" the same neutron/Au198 each time it takes a step, which will result in many more neutrons/Au198 being tallied at the end of the run than there should be.

You can find an example in $G4INSTALL/examples/extended/electromagnetic/TestEm5/src/ See also the G4 user manual:

Hope this helps.


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

1 Ok: Re: simulation efficiency   (Joel Long - 11 Jul, 2011)
(_ Agree: Re: simulation efficiency   (Zach Hartwig - 11 Jul, 2011)
 Add Message Add Message
to: "Re: simulation efficiency"

 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 ]