/*! @page Useraction The User Action Classes
Previous: @ref Mandatory
Up: @ref Main
Next: @ref howg4
\anchor useraction_intro
- @ref useractintro
- @ref runaction
- @ref eventaction
- @ref trackingaction
- @ref stackingaction
- @ref steppingaction
\section useractintro Introduction
The user action classes are very useful monitoring features of \gf. Thanks to these classes, it is possible to operate actions at different stages of the simulation.
The user is completely free in the implementation of the actions to take, and therefore the possibilities offered by this feature are innumerable, from interactivity to histogramming, debugging, visualization or even direct optimization of the simulation parameters etc.
In the following pages, we describe the use of those classes for the \lemu simulation.
\section runaction User Run Action
The user run action class operates actions at the beginning and at the end of each run. In LEMuSRRunAction.cc, one can see that it is only used to initialize and update the visualization manager.
An interesting thing to notice is that some commands can be sent directly to the user interaction manager without going through the terminal. This can be of special utility when running the simulation in batch mode.
\section eventaction User Event Action
The user event action class operates actions at the beginnig and at the end of each event of a given run. Initially used for the hits collection, we left its implementation open.
The two main classes are BeginOfEventAction and EndOfEventAction. For the implementation refer to the LEMuSREventAction.cc file.
\section trackingaction User Tracking Action
The tracking action class is implemented in the LEMuSRTrackingAction.cc file. The two main methods are PreUserTrackingAction and PostUserTrackingAction. In \lemu simulation, we first used the tracking action to get the gyromagnetic parameters of the tracked particle. They can be accessed by any other class via a pointer to the tracking action instance.
This is very useful in particular for spin precession calculations. Indeed, \gf do not handle yet different gyromagnetic ratios or precession of neutral particles. The muonium data can be highly biased by this.
However, this procedure is not very "nice" because the tracking action should remain an optional class i.e. should not be necessary to run the simulation. Now the code uses the G4TrackingManager class from geant4, which is a top executive class together with the G4RunManager, G4EventManager and G4SteppingManager classes.
Here is a short overview on the hierarchy organisation of thoses classes.
\section stackingaction User Stacking Action
The user action class can be implemented to select the tracks to consider or not in order to gain calculation time. One can also use it for statistics or to take actions on the tracks to be simulated.
\section steppingaction User Stepping Action
The most important user action class of the \lemu simulation is the stepping action. Five different stepping action classes were implemented:
- AsymCheck: for tests of the asymmetry.
- FieldCheck: for tests of electromagnetic fields.
- FocalLengthTest: for tests of the focal length.
- TDCheck: for tests of the trigger detector.
- LEMuSRSteppingAction for a usual run.
The stepping action has to be set in the LEMuSR.cc file. Only one stepping action can be enabled at once. Therefore, we defined environement variables in order to select under which form the code should be compiled.
After important modification of the code it is useful to go through all the tests in order to verify that everything still runs correctly.
In the following, we describe the actions of those different stepping actions.
*/