Import Geant4 11.0.0 source tree
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
|
||||
///\file "field/.README.txt"
|
||||
///\brief Examples field README page
|
||||
|
||||
/*! \page Examples_field Category "field"
|
||||
|
||||
Examples in this directory demonstrate specific simulation setups
|
||||
in magnetic field.
|
||||
|
||||
\link Examplefield01 field01 \endlink
|
||||
|
||||
Example enabling investigation of tracking in a magnetic field.
|
||||
|
||||
\link Examplefield02 field02 \endlink
|
||||
|
||||
Test for investigation of tracking in electric field and field dependent
|
||||
electromagnetic processes.
|
||||
|
||||
\link Examplefield03 field03 \endlink
|
||||
|
||||
Example of tracking in magnetic field where field associated
|
||||
to selected logical volumes varies.
|
||||
|
||||
\link Examplefield04 field04 \endlink
|
||||
|
||||
This example shows how to define/use OVERLAPPING field elements
|
||||
in Geant4. Fields might be either magnetic, electric or both.
|
||||
|
||||
\link Examplefield05 field05 \endlink
|
||||
|
||||
This example demonstrates so-called "spin-frozen" condition.
|
||||
|
||||
\link Examplefield06 field06 \endlink
|
||||
|
||||
This example exercises the capability of tracking massive
|
||||
particles in a gravity field.
|
||||
|
||||
\link ExampleBlineTracer BlineTracer \endlink
|
||||
|
||||
The BlineTracer module allows to trace and visualise magnetic field
|
||||
lines in a Geant4 application where particle are tracked through the
|
||||
magnetic field (in future, these functionalities may be integrated in
|
||||
the Geant4 kernel).
|
||||
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,184 @@
|
||||
|
||||
///\file "field/BlineTracer/.README.txt"
|
||||
///\brief Example BlineTracer README page
|
||||
|
||||
/*! \page ExampleBlineTracer Example BlineTracer
|
||||
|
||||
\author Laurent Desorgher (desorgher@phim.unibe.ch) - 04/10/2003
|
||||
|
||||
The BlineTracer module allows to trace and visualise magnetic field
|
||||
lines in a Geant4 application where particle are tracked through the
|
||||
magnetic field (in future, these functionalities may be integrated in
|
||||
the Geant4 kernel).
|
||||
|
||||
To use the tracer, the user should copy the classes provided here in
|
||||
his/her own application/example and create somewhere in his/her code
|
||||
an instance of a G4BlineTracer object.
|
||||
It can be anywhere (for example in the main code or in the user class
|
||||
defining the magnetic field):
|
||||
|
||||
\verbatim
|
||||
#include "G4BlineTracer.hh"
|
||||
G4BlineTracer* theBlineTool = new G4BlineTracer();
|
||||
\endverbatim
|
||||
|
||||
\section ExampleBlineTracer_s1 Design principles
|
||||
|
||||
The core of the tool is the method G4BlineTracer::ComputeBlines() of G4BlineTracer class.
|
||||
In this method a bline is computed by tracking a ChargedGeantino in the user
|
||||
defined magnetic field and by using a Bline equation of motion (class
|
||||
G4BlineEquation, motion along the field) instead of a Lorentz equation.
|
||||
|
||||
During the execution of this method :
|
||||
|
||||
- The user defined equations of motion associated to the different
|
||||
global and local fields are replaced by instances of G4BlineEquation
|
||||
associated to the same fields.
|
||||
The G4BlineEquation class defines the differential equation of a
|
||||
magnetic field line.
|
||||
|
||||
- User defined ChordFinders are replaced by new ChordFinders
|
||||
associated to the G4BlineEquation object.
|
||||
|
||||
- The user primary generator action, run action, event action and
|
||||
stepping action are replaced by instances of the classes
|
||||
G4BlinePrimaryGeneratorAction, G4BlineTracer, G4BlineEventAction
|
||||
and G4BlineSteppingAction respectively. Other actions are set to
|
||||
a NULL pointer.
|
||||
|
||||
After the execution of the method, the original user defined actions, equation
|
||||
of motions and chord-finders are restored.
|
||||
|
||||
In other words, the deafult run-action is temporarly replaced by a
|
||||
G4BlineTracer run-action using the same Geometry, physics and magnetic fields
|
||||
but with a different equation of motion and user actions.
|
||||
|
||||
The G4BlinePrimaryGeneratorAction::GeneratePrimaries() method of the G4BlinePrimaryGeneratorAction class
|
||||
call the GeneratePrimaries() method of the user defined PrimaryGeneratorAction
|
||||
for defining the start position and start time of tracking.
|
||||
Start position for user application and for Bline tracking are therefore
|
||||
controlled by the same UI commands.
|
||||
The type of particles to be tracked when tracing Blines is always set
|
||||
to Charged-Geantino. This allows to switch off the effect of electromagnetic
|
||||
and hadronics physics when tracing field lines.
|
||||
|
||||
|
||||
The G4BlineEventAction class is responsible to store computed magnetic field
|
||||
lines as a vector of Polylines and Polymarkers for later visualisation.
|
||||
These vectors can be drawn and reset at any time.
|
||||
|
||||
The stepping action does nothing in this implementation but it can be used
|
||||
in future versions to limit field line tracing to physical volumes defined
|
||||
by the user. For this purpose a G4BlineStackingAction could also be
|
||||
implemented.
|
||||
|
||||
\section ExampleBlineTracer_s2 User Manual
|
||||
|
||||
\subsection ExampleBlineTracer_subs21 General description
|
||||
|
||||
The BlineTracer is controlled by the UI commands contained in the directory
|
||||
/vis/blineTracer. By calling the command 'computeBline', several magnetic field
|
||||
lines passing through user defined start positions are computed.
|
||||
Start positions are generated by the user primary generator action.
|
||||
By doing so, the definition of start positions is the same for usual particles
|
||||
tracking and magnetic field line tracking.
|
||||
|
||||
A magnetic field line is computed as a track of a charged geantino that moves
|
||||
along the field line. The user can define the maximum length of a tracking step
|
||||
(only valid for Bline tracing purposes) by the use of the 'setMaxStepLength'
|
||||
command.
|
||||
|
||||
By using small enough maximum step length, smooth magnetic field lines are
|
||||
obtained. By using the command 'stockLines' and 'stockPoints' the user
|
||||
can decide to store the series of tracking step positions defining
|
||||
a magnetic field line as a Polyline object and/or a PolyMarker object
|
||||
(circles) respectively.
|
||||
|
||||
These objects are stored in vectors of PolyLines and PolyMarkers.
|
||||
By using the command 'draw', these vectors are added to the scene
|
||||
of the visualisation manager, provided that a scene handler and
|
||||
visualisation driver have been properly created.
|
||||
|
||||
The scene is visualised by invoking the vis command '/vis/show'.
|
||||
Polyline objects are visualised as line segments joining the different
|
||||
step positions defining a line, while for a Polymarker object markers
|
||||
(here circles), are drawn at each step positions.
|
||||
|
||||
By using the 'setColour' the user defines the visualisation colour
|
||||
that will be associated to the next computed magnetic field lines.
|
||||
By calling 'setPointSize' the user defines the size of visualisation markers
|
||||
that will be associated to the next computed magnetic field lines.
|
||||
The user can remove the vector of Polymarker and Polyline from the memory
|
||||
by invoking 'resetMaterialToBeDrawn'.
|
||||
|
||||
When using small max step size and polymarkers for visualisation purposes, the
|
||||
thickness of a smooth magnetic field line is obtained. It is controlled by the
|
||||
Marker size parameter ('setPointSize')
|
||||
|
||||
\subsection ExampleBlineTracer_subs22 Command description
|
||||
|
||||
\verbatim
|
||||
/vis/blineTracer/computeBline nb_of_lines
|
||||
\endverbatim
|
||||
- Parameters: integer nb_of_lines
|
||||
- Description: Compute nb_of_lines different magnetic field lines
|
||||
|
||||
\verbatim
|
||||
/vis/blineTracer/setMaxStepLength max_step_length
|
||||
\endverbatim
|
||||
- Parameters: double max_step_length
|
||||
- Description: Set the maximum tracking step length for computing
|
||||
magnetic field lines
|
||||
|
||||
\verbatim
|
||||
/vis/blineTracer/setColour red green blue
|
||||
\endverbatim
|
||||
- Parameters: double red, green, blue
|
||||
- Description: Define the colour for visualisation of the
|
||||
next computed magnetic field lines. The color is
|
||||
defined by a RGB code (red,green,blue) with all
|
||||
parameters smaller than 1.
|
||||
|
||||
\verbatim
|
||||
/vis/blineTracer/stockLines aBool
|
||||
\endverbatim
|
||||
- Parameters: boolean aBool
|
||||
- Description: If true the next computed field lines are stored
|
||||
as Polylines for further visualisation
|
||||
|
||||
\verbatim
|
||||
/vis/blineTracer/stockLines aBool
|
||||
\endverbatim
|
||||
- Parameters: boolean aBool
|
||||
- Description: If true the next computed field lines are stored
|
||||
as Polymarkers for further visualisation
|
||||
|
||||
\verbatim
|
||||
/vis/blineTracer/setPointSize point_size
|
||||
\endverbatim
|
||||
- Parameters: double point_size
|
||||
- Description: set the size of the visualisation markers
|
||||
that will be associated with the next computed
|
||||
magnetic field lines
|
||||
|
||||
\verbatim
|
||||
/vis/blineTracer/resetMaterialToBeDrawn
|
||||
\endverbatim
|
||||
- Parameters: none
|
||||
- Description: The vector of Polyline and Polymarker representing
|
||||
magnetic field lines to be visualised are removed
|
||||
from memory
|
||||
|
||||
\verbatim
|
||||
/tracking/storeTrajectory 1
|
||||
\endverbatim
|
||||
- If the storeTrajectory parameter is not set no field lines are
|
||||
stored.
|
||||
|
||||
\section ExampleBlineTracer_s3 Current limitations & known problems
|
||||
|
||||
The tool is working properly only for detectors parts where magnetic
|
||||
field are defined. It is planned in the future to stop the tracking of
|
||||
field lines in regions where no fields are existing.
|
||||
|
||||
*/
|
||||
@@ -0,0 +1,155 @@
|
||||
README file for the Geant4 BlineTracer module
|
||||
|
||||
Author : Laurent Desorgher (desorgher@phim.unibe.ch) - 04/10/2003
|
||||
|
||||
-------------------------------------------------
|
||||
|
||||
The BlineTracer module allows to trace and visualise magnetic field
|
||||
lines in a Geant4 application where particle are tracked through the
|
||||
magnetic field (in future, these functionalities may be integrated in
|
||||
the Geant4 kernel).
|
||||
To use the tracer, the user should copy the classes provided here in
|
||||
his/her own application/example and create somewhere in his/her code
|
||||
an instance of a G4BlineTracer object.
|
||||
It can be anywhere (for example in the main code or in the user class
|
||||
defining the magnetic field):
|
||||
|
||||
#include "G4BlineTracer.hh"
|
||||
G4BlineTracer* theBlineTool = new G4BlineTracer();
|
||||
|
||||
|
||||
Design principles:
|
||||
|
||||
The core of the tool is the method ComputeBlines() of G4BlineTracer class.
|
||||
In this method a bline is computed by tracking a ChargedGeantino in the user
|
||||
defined magnetic field and by using a Bline equation of motion (class
|
||||
G4BlineEquation, motion along the field) instead of a Lorentz equation.
|
||||
|
||||
During the execution of this method :
|
||||
|
||||
-The user defined equations of motion associated to the different
|
||||
global and local fields are replaced by instances of G4BlineEquation
|
||||
associated to the same fields.
|
||||
The G4BlineEquation class defines the differential equation of a
|
||||
magnetic field line.
|
||||
|
||||
-User defined ChordFinders are replaced by new ChordFinders
|
||||
associated to the G4BlineEquation object.
|
||||
|
||||
-The user primary generator action, run action, event action and
|
||||
stepping action are replaced by instances of the classes
|
||||
G4BlinePrimaryGeneratorAction, G4BlineTracer, G4BlineEventAction
|
||||
and G4BlineSteppingAction respectively. Other actions are set to
|
||||
a NULL pointer.
|
||||
|
||||
After the execution of the method, the original user defined actions, equation
|
||||
of motions and chord-finders are restored.
|
||||
|
||||
In other words, the deafult run-action is temporarly replaced by a
|
||||
G4BlineTracer run-action using the same Geometry, physics and magnetic fields
|
||||
but with a different equation of motion and user actions.
|
||||
|
||||
The GeneratePrimaries() method of the G4BlinePrimaryGeneratorAction class
|
||||
call the GeneratePrimaries() method of the user defined PrimaryGeneratorAction
|
||||
for defining the start position and start time of tracking.
|
||||
Start position for user application and for Bline tracking are therefore
|
||||
controlled by the same UI commands.
|
||||
The type of particles to be tracked when tracing Blines is always set
|
||||
to Charged-Geantino. This allows to switch off the effect of electromagnetic
|
||||
and hadronics physics when tracing field lines.
|
||||
|
||||
|
||||
The G4BlineEventAction class is responsible to store computed magnetic field
|
||||
lines as a vector of Polylines and Polymarkers for later visualisation.
|
||||
These vectors can be drawn and reset at any time.
|
||||
|
||||
The stepping action does nothing in this implementation but it can be used
|
||||
in future versions to limit field line tracing to physical volumes defined
|
||||
by the user. For this purpose a G4BlineStackingAction could also be
|
||||
implemented.
|
||||
|
||||
User Manual:
|
||||
|
||||
General description:
|
||||
|
||||
The BlineTracer is controlled by the UI commands contained in the directory
|
||||
/vis/blineTracer. By calling the command 'computeBline', several magnetic field
|
||||
lines passing through user defined start positions are computed.
|
||||
Start positions are generated by the user primary generator action.
|
||||
By doing so, the definition of start positions is the same for usual particles
|
||||
tracking and magnetic field line tracking.
|
||||
|
||||
A magnetic field line is computed as a track of a charged geantino that moves
|
||||
along the field line. The user can define the maximum length of a tracking step
|
||||
(only valid for Bline tracing purposes) by the use of the 'setMaxStepLength'
|
||||
command.
|
||||
By using small enough maximum step length, smooth magnetic field lines are
|
||||
obtained. By using the command 'stockLines' and 'stockPoints' the user
|
||||
can decide to store the series of tracking step positions defining
|
||||
a magnetic field line as a Polyline object and/or a PolyMarker object
|
||||
(circles) respectively.
|
||||
These objects are stored in vectors of PolyLines and PolyMarkers.
|
||||
By using the command 'draw', these vectors are added to the scene
|
||||
of the visualisation manager, provided that a scene handler and
|
||||
visualisation driver have been properly created.
|
||||
The scene is visualised by invoking the vis command '/vis/show'.
|
||||
Polyline objects are visualised as line segments joining the different
|
||||
step positions defining a line, while for a Polymarker object markers
|
||||
(here circles), are drawn at each step positions.
|
||||
By using the 'setColour' the user defines the visualisation colour
|
||||
that will be associated to the next computed magnetic field lines.
|
||||
By calling 'setPointSize' the user defines the size of visualisation markers
|
||||
that will be associated to the next computed magnetic field lines.
|
||||
The user can remove the vector of Polymarker and Polyline from the memory
|
||||
by invoking 'resetMaterialToBeDrawn'.
|
||||
When using small max step size and polymarkers for visualisation purposes, the
|
||||
thickness of a smooth magnetic field line is obtained. It is controlled by the
|
||||
Marker size parameter ('setPointSize')
|
||||
|
||||
Command description:
|
||||
/vis/blineTracer/computeBline nb_of_lines :
|
||||
Parameters: integer nb_of_lines
|
||||
Description: Compute nb_of_lines different magnetic field lines
|
||||
|
||||
/vis/blineTracer/setMaxStepLength max_step_length :
|
||||
Parameters: double max_step_length
|
||||
Description: Set the maximum tracking step length for computing
|
||||
magnetic field lines
|
||||
|
||||
/vis/blineTracer/setColour red green blue
|
||||
Parameters: double red, green, blue
|
||||
Description: Define the colour for visualisation of the
|
||||
next computed magnetic field lines. The color is
|
||||
defined by a RGB code (red,green,blue) with all
|
||||
parameters smaller than 1.
|
||||
|
||||
/vis/blineTracer/stockLines aBool
|
||||
Parameters: boolean aBool
|
||||
Description: If true the next computed field lines are stored
|
||||
as Polylines for further visualisation
|
||||
/vis/blineTracer/stockLines aBool
|
||||
Parameters: boolean aBool
|
||||
Description: If true the next computed field lines are stored
|
||||
as Polymarkers for further visualisation
|
||||
|
||||
/vis/blineTracer/setPointSize point_size
|
||||
Parameters: double point_size
|
||||
DEscription: set the size of the visualisation markers
|
||||
that will be associated with the next computed
|
||||
magnetic field lines
|
||||
|
||||
/vis/blineTracer/resetMaterialToBeDrawn
|
||||
Parameters: none
|
||||
Description: The vector of Polyline and Polymarker representing
|
||||
magnetic field lines to be visualised are removed
|
||||
from memory
|
||||
|
||||
/tracking/storeTrajectory 1 :
|
||||
If the storeTrajectory parameter is not set no field lines are
|
||||
stored.
|
||||
|
||||
Current limitations & known problems:
|
||||
|
||||
The tool is working properly only for detectors parts where magnetic
|
||||
field are defined. It is planned in the future to stop the tracking of
|
||||
field lines in regions where no fields are existing.
|
||||
@@ -0,0 +1,41 @@
|
||||
|
||||
Geant4 extended examples - field
|
||||
----------------------------------
|
||||
|
||||
Examples in this directory demonstrate specific simulation setups
|
||||
in magnetic field.
|
||||
|
||||
field01
|
||||
--------
|
||||
Example enabling investigation of tracking in a magnetic field.
|
||||
|
||||
field02
|
||||
--------
|
||||
Test for investigation of tracking in electric field and field dependent
|
||||
electromagnetic processes.
|
||||
|
||||
field03
|
||||
--------
|
||||
Example of tracking in magnetic field where field associated
|
||||
to selected logical volumes varies.
|
||||
|
||||
field04
|
||||
--------
|
||||
This example shows how to define/use OVERLAPPING field elements
|
||||
in Geant4. Fields might be either magnetic, electric or both.
|
||||
|
||||
field05
|
||||
--------
|
||||
This example demonstrates so-called "spin-frozen" condition.
|
||||
|
||||
field06
|
||||
--------
|
||||
This example exercises the new (in 9.5) capability of tracking massive
|
||||
particles in a gravity field.
|
||||
|
||||
BlineTracer
|
||||
------------
|
||||
The BlineTracer module allows to trace and visualise magnetic field
|
||||
lines in a Geant4 application where particle are tracked through the
|
||||
magnetic field (in future, these functionalities may be integrated in
|
||||
the Geant4 kernel).
|
||||
@@ -0,0 +1,275 @@
|
||||
|
||||
///\file "field/field01/.README.txt"
|
||||
///\brief Example field01 README page
|
||||
|
||||
/*! \page Examplefield01 Example field01
|
||||
|
||||
Example that enables investigation of the accuracy and performance of the
|
||||
tracking in a magnetic field.
|
||||
|
||||
The key Geant4 capabilities demonstrated in this example are:
|
||||
- creating a uniform magnetic field interactively using the field
|
||||
messenger,
|
||||
- choosing the type of Runge Kutta stepper used for integration of the
|
||||
motion of charged particles in the magnetic field,
|
||||
- controlling the thresholds that determine which looping particles are
|
||||
killed by G4Transporation.
|
||||
|
||||
Some of these capabilities are available via interactive commands,
|
||||
implemented in F01FieldMessenger.
|
||||
|
||||
The magnetic field is defined in the F01FieldSetup class which object
|
||||
is created in the ConstructSDandField() function in the F01DetectorConstruction
|
||||
class. The interactive commands are implemented in F01FieldMessenger.
|
||||
|
||||
The magnetic field is defined in F01FieldSetup, which is created in
|
||||
the ConstructSDandField() method in the F01DetectorConstruction class.
|
||||
|
||||
\section field01_s01 Choosing the type of stepper
|
||||
|
||||
The basic capabilities of choosing the stepper type are demonstrated in the
|
||||
field.in macro file:
|
||||
|
||||
\verbatim
|
||||
/field/setStepperType 145 ## Choose a stepper type ( Tsito
|
||||
/field/setStepperType 101 ## Choose an FSAL stepper ( FE
|
||||
/field/setMinStep 0.1 mm ## Smaller steps always s
|
||||
/field/update ## Initialise using parameters above
|
||||
\endverbatim
|
||||
|
||||
In addition it is possible to choose to use a new type of stepper, known
|
||||
as 'First Same as Last' or FSAL, which in each step obtains the field value
|
||||
at the step endpoint and evaluates the 'right hand size' of the equation
|
||||
for the next integration step. This reduces the number of calls to the field
|
||||
evaluation, which can be one the most computationally expensive methods,
|
||||
while providing similar accuracy.
|
||||
|
||||
There are several potential choices of the stepper type. Here are some suggestions:
|
||||
\verbatim
|
||||
===========================================================================
|
||||
Number Name of Stepper Comments
|
||||
===========================================================================
|
||||
Recommended - default since Geant4 10.4:
|
||||
|
||||
15 - 'DoPri5' or
|
||||
Dormand Prince 745 : Uses a pair 4th & 5th order formulae (like other 4/5
|
||||
well-known and very efficient embedded method
|
||||
methods); their difference is the error estimate.
|
||||
Highly recommended in literature, including
|
||||
Hairer & Wanner, & Numerical Recipes
|
||||
Used in several established RK code (e.g. DOPRI5)
|
||||
===========================================================================
|
||||
Good choices for reasonably smooth fields:
|
||||
|
||||
45 - BogackiShampine45 : more efficient embedded 4/5 pair
|
||||
Used in many applications, including
|
||||
RKSUITE suite.
|
||||
|
||||
145 - Tsitouras45 : potentially the most efficient embedded 4/5
|
||||
pair - found in expanded search of parameter
|
||||
space.
|
||||
|
||||
56 - Dormand Prince RK56 : higher order embedded method from authors of DoPri5.
|
||||
Uses a pair 5th & 6th order formulae.
|
||||
|
||||
78 - Dormand Prince RK78 : higher order embedded method from authors of DoPri5.
|
||||
Uses a pair 7th & 8th order formulae.
|
||||
|
||||
9 - NystromRK4 : a specialised Nystrom method for magnetic fields.
|
||||
Reuses the field value at the mid-point of the step,
|
||||
and also provides an analytical estimation of the
|
||||
integration error based on numerical evaluation of
|
||||
fourth order variation in the equation for
|
||||
magnetic field.
|
||||
===========================================================================
|
||||
The new 'First Same as Last' (FSAL) steppers can be chosen in addition:
|
||||
1 - RKFEq1 : FSAL stepper with improved equilibrium properties.
|
||||
When kinks or other anomalies are encountered,
|
||||
and at the start of integration when the best
|
||||
step size is not known, this type of stepper
|
||||
converges faster and more smoothly to good
|
||||
step sizes.
|
||||
===========================================================================
|
||||
The old default and old first alternative -
|
||||
|
||||
4 - ClassicalRK4 : original Runge-Kutta method, very robust but slower )
|
||||
( obtains error estimate by doing 2 half steps )
|
||||
Good baseline for comparison - long experience of use.
|
||||
May be good alternative for less smooth fields.
|
||||
|
||||
8 - Cash Karp RKF 45 : The oldest 'embedded' RK method in Geant4 -
|
||||
also fairly robust.
|
||||
Faster than ClassicalRK4 for smoother fields,
|
||||
as it does not need two half steps to estimate error.
|
||||
Available since Geant4 1.0
|
||||
|
||||
===========================================================================
|
||||
Other potential choices for non-smooth fields (with kinks, abrupt changes):
|
||||
|
||||
3 - SimpleHeum : low order, with error obtained from half-steps
|
||||
23 - BogackiShampine23 : lower order embedded method (new in 10.3-beta)
|
||||
===========================================================================
|
||||
\endverbatim
|
||||
|
||||
\section field01_s02 Controlling the killing of looping particles
|
||||
|
||||
Occasionally tracks 'looping' in a strong magnetic field, making little
|
||||
progress even over hundreds of integration steps. This is due to a
|
||||
combination of a strong magnetic field and a thin material (gas or vacuum)
|
||||
in which the size of a physics step is substantially larger than the radius
|
||||
of curvature of the track.
|
||||
|
||||
Since the amount of CPU time which can be consumed by one or few such tracks
|
||||
is very large, it is important to limit the number of integration steps
|
||||
spent on these tracks. The module for propagation in field in Geant4
|
||||
flags tracks which take more than a certain number (default 1,000) integration
|
||||
steps without reaching the requested end of the step size, which was
|
||||
determined by the physics and geometry.
|
||||
|
||||
The Geant4 G4Transportation and G4CoupledTransportation processes are tasked
|
||||
to select which of the looping tracks are killed and which survive. To
|
||||
balance the potential significant cost of integrating looping particles,
|
||||
three thresholds exist
|
||||
|
||||
- **The 'Warning' Energy**: a track with energy below this value that is found to
|
||||
loop is killed silently (no warning.)
|
||||
Above the 'Warning Energy', if a track is selected for killing a warning is
|
||||
generated.
|
||||
|
||||
- **The 'Important' Energy**: the threshold energy above which a track will survive
|
||||
for multiple steps if found looping.
|
||||
|
||||
- Number of 'tracking' steps. They will be only be killed only if they still
|
||||
loop after than.
|
||||
**The number of 'trials'**: the number of steps that 'important' tracks survive.
|
||||
|
||||
Note that currently only stable particles are killed. ( Refinements to enable
|
||||
toggling whether unstable particles can be killed are in development. )
|
||||
|
||||
This example demonstrate choosing different values for these parametes
|
||||
in the main () method of field01.cc using one of two techniques.
|
||||
|
||||
\subsection field01_s02_sub1 i) Using G4PhysicsListHelper
|
||||
|
||||
The first method is new in Geant4 release 10.5, and uses the G4PhysicsListHelper
|
||||
which has methods to choose a pre-selected set of parameter values. The choices
|
||||
are between a set each of low and high thresholds. Either one can be enabled
|
||||
by calling correspondingly
|
||||
- G4PhysicsListHelper::GetPhysicsListHelper()->UseLowLooperThresholds();
|
||||
or
|
||||
- G4PhysicsListHelper::GetPhysicsListHelper()->UseHighLooperThresholds();
|
||||
|
||||
These methods must be called before the physics is constructed - i.e. typically
|
||||
before RunManager's Initialise() method is called.
|
||||
This works only if either
|
||||
- a modular physics lists is used, or if
|
||||
- the G4ModularPhysicsList and its AddTransporation method are used to create and register a common transportation process for all particles (one for each thread).
|
||||
|
||||
\subsection field01_s02_sub2 ii) Fine grained control (available in Geant4 versions since 7.0)
|
||||
|
||||
Fine grained control of the Transportation's parameters for looping particles
|
||||
is also possible.
|
||||
|
||||
This is demonstrated in the F01RunAction::ChangeLooperParameters() method,
|
||||
which is called by the BeginOfRunAction. There the appropriate
|
||||
Transportation object for the electron is obtained, and its parameters
|
||||
(if valid) are used to overwrite the thresholds in the G4Transportation class.
|
||||
|
||||
For example, to ensure that only looping particles with energy 10 keV are
|
||||
killed silently we change the value of the 'Warning' Energy:
|
||||
\code{.cpp}
|
||||
runAction->SetWarningEnergy( 10.0 * CLHEP::keV );
|
||||
\endcode
|
||||
[ This is passed along to the registered G4Transportation or
|
||||
G4CoupledTransportation object by the F01RunAction's ChangeLooperParameters.]
|
||||
|
||||
As a result the killing of any (stable) looping track with energy over 10 keV
|
||||
will generate a warning.
|
||||
|
||||
A second configurable energy threshold enables tracks above it to survive a
|
||||
chosen number of 'tracking' steps. They will be only be killed only if they
|
||||
still loop after than number of tracking steps. F01RunAction's methods are
|
||||
used to configure these parameters:
|
||||
\code{.cpp}
|
||||
runAction->SetImportantEnergy( 0.1 * CLHEP::MeV );
|
||||
runAction->SetNumberOfTrials( 30 );
|
||||
\endcode
|
||||
which the run action passes to the G4Transportation or
|
||||
G4CoupledTransportation object registered for the electron.
|
||||
|
||||
Note that for all pre-configured and modular physics lists share a single
|
||||
Transportation process for all types of particles. So the parameters for
|
||||
killing loopers will be shared by all particle types in this case.
|
||||
|
||||
\section field01_s1 Background Information
|
||||
|
||||
\subsection field01_s1_sub1 GEOMETRY DEFINITION
|
||||
|
||||
The "Absorber" is a solid made of a given material.
|
||||
|
||||
Three parameters define the absorber :
|
||||
- the material of the absorber,
|
||||
- the thickness of an absorber,
|
||||
- the transverse size of the absorber (the input face is a square).
|
||||
|
||||
The volume "World" contains the "Absorber".
|
||||
In this test the parameters of the "World" can be changed , too.
|
||||
|
||||
In addition a transverse uniform magnetic field can be applied.
|
||||
|
||||
The default geometry is constructed in F01DetectorConstruction class,
|
||||
but all the parameters can be changed via
|
||||
the commands defined in the F01DetectorMessenger class.
|
||||
|
||||
\subsection field01_s1_sub2 AN EVENT : THE PRIMARY GENERATOR
|
||||
|
||||
The primary kinematic consists of a single particle (electron, Ekin = 0.5 GeV)
|
||||
which hits the
|
||||
absorber perpendicular to the input face. The type of the particle
|
||||
and its energy are set in the F01PrimaryGeneratorAction class, and can
|
||||
be changed via the G4 build-in commands of G4ParticleGun class (see
|
||||
the macros provided with this example).
|
||||
|
||||
It is also possible to change the position of the primary particle vertex
|
||||
or activate its randomization via the commands defined in the
|
||||
F01PrimaryGeneratorMessenger class.
|
||||
|
||||
A RUN is a set of events.
|
||||
|
||||
\subsection field01_s1_sub3 DETECTOR RESPONSE
|
||||
|
||||
The spatial distribution of charged particles transported in magnetic
|
||||
field is envistigated.
|
||||
A HIT is a record, event per event , of all the
|
||||
informations needed to simulate and analyse the detector response.
|
||||
|
||||
In this example a F01CalorHit is defined as a set of 2 informations:
|
||||
- the total energy deposit in the absorber,
|
||||
- the total tracklength of all charged particles in the absorber,
|
||||
|
||||
Therefore the absorber is declared
|
||||
'sensitive detector' (SD), see F01CalorimeterSD, which means they can contribute to the hit.
|
||||
|
||||
\subsection field01_s1_sub4 PHYSICS LIST
|
||||
|
||||
The particle's type and the physic processes which will be available
|
||||
in this example are set in the FTFP_BERT physics list. This physics list
|
||||
requires data files for electromagnetic and hadronic processes.
|
||||
See more on installation of the datasets in Geant4 Installation Guide,
|
||||
|
||||
\subsection field01_s1_sub5 HOW TO START ?
|
||||
|
||||
- Execute field01 in 'batch' mode from macro file e.g.
|
||||
\verbatim
|
||||
% ./field01 field01.in
|
||||
\endverbatim
|
||||
|
||||
- Execute field01 in 'interactive' mode with visualization e.g.
|
||||
\verbatim
|
||||
% ./field01
|
||||
....
|
||||
Idle> /run/beamOn 1
|
||||
....
|
||||
\endverbatim
|
||||
|
||||
*/
|
||||
@@ -0,0 +1,276 @@
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
|
||||
=========================================================
|
||||
|
||||
field01
|
||||
-------
|
||||
|
||||
Example that enables investigation of the accuracy and performance of the
|
||||
tracking in a magnetic field.
|
||||
|
||||
The key Geant4 capabilities demonstrated in this example are:
|
||||
- creating a uniform magnetic field interactively using the field
|
||||
messenger,
|
||||
- choosing the type of Runge Kutta stepper used for integration of the
|
||||
motion of charged particles in the magnetic field,
|
||||
- controlling the thresholds that determine which looping particles are
|
||||
killed by G4Transporation.
|
||||
|
||||
Some of these capabilities are available via interactive commands,
|
||||
implemented in F01FieldMessenger.
|
||||
|
||||
A. The magnetic field is defined in F01FieldSetup, which is created in
|
||||
the ConstructSDandField() method in the F01DetectorConstruction
|
||||
class.
|
||||
|
||||
B. Choosing the type of stepper -
|
||||
|
||||
The basic capabilities of choosing the stepper type are demonstrated in the
|
||||
field.in macro file:
|
||||
|
||||
/field/setStepperType 145 ## Choose a stepper type ( Tsitouras )
|
||||
|
||||
/field/setStepperType 101 ## Choose an FSAL stepper ( FEqRK1 )
|
||||
|
||||
/field/setMinStep 0.1 mm ## Smaller steps always succeed
|
||||
|
||||
/field/update ## Initialise using parameters above
|
||||
|
||||
In addition it is possible to choose to use a new type of stepper, known
|
||||
as 'First Same as Last' or FSAL, which in each step obtains the field value
|
||||
at the step endpoint and evaluates the 'right hand size' of the equation
|
||||
for the next integration step. This reduces the number of calls to the field
|
||||
evaluation, which can be one the most computationally expensive methods,
|
||||
while providing similar accuracy.
|
||||
|
||||
There are several potential choices of the stepper type. Here are some
|
||||
suggestions:
|
||||
===========================================================================
|
||||
Number Name of Stepper Comments
|
||||
===========================================================================
|
||||
Recommended - default since Geant4 10.4:
|
||||
|
||||
15 - 'DoPri5' or
|
||||
Dormand Prince 745 : Uses a pair 4th & 5th order formulae (like other 4/5
|
||||
well-known and very efficient embedded method
|
||||
methods); their difference is the error estimate.
|
||||
Highly recommended in literature, including
|
||||
Hairer & Wanner, & Numerical Recipes
|
||||
Used in several established RK code (e.g. DOPRI5)
|
||||
===========================================================================
|
||||
Good choices for reasonably smooth fields:
|
||||
|
||||
45 - BogackiShampine45 : more efficient embedded 4/5 pair
|
||||
Used in many applications, including
|
||||
RKSUITE suite.
|
||||
|
||||
145 - Tsitouras45 : potentially the most efficient embedded 4/5
|
||||
pair - found in expanded search of parameter
|
||||
space.
|
||||
|
||||
56 - Dormand Prince RK56 : higher order embedded method from authors of DoPri5.
|
||||
Uses a pair 5th & 6th order formulae.
|
||||
|
||||
78 - Dormand Prince RK78 : higher order embedded method from authors of DoPri5.
|
||||
Uses a pair 7th & 8th order formulae.
|
||||
|
||||
9 - NystromRK4 : a specialised Nystrom method for magnetic fields.
|
||||
Reuses the field value at the mid-point of the step,
|
||||
and also provides an analytical estimation of the
|
||||
integration error based on numerical evaluation of
|
||||
fourth order variation in the equation for
|
||||
magnetic field.
|
||||
===========================================================================
|
||||
The new 'First Same as Last' (FSAL) steppers can be chosen in addition:
|
||||
1 - RKFEq1 : FSAL stepper with improved equilibrium properties.
|
||||
When kinks or other anomalies are encountered,
|
||||
and at the start of integration when the best
|
||||
step size is not known, this type of stepper
|
||||
converges faster and more smoothly to good
|
||||
step sizes.
|
||||
===========================================================================
|
||||
The old default and old first alternative -
|
||||
|
||||
4 - ClassicalRK4 : original Runge-Kutta method, very robust but slower )
|
||||
( obtains error estimate by doing 2 half steps )
|
||||
Good baseline for comparison - long experience of use.
|
||||
May be good alternative for less smooth fields.
|
||||
|
||||
8 - Cash Karp RKF 45 : The oldest 'embedded' RK method in Geant4 -
|
||||
also fairly robust.
|
||||
Faster than ClassicalRK4 for smoother fields,
|
||||
as it does not need two half steps to estimate error.
|
||||
Available since Geant4 1.0
|
||||
|
||||
===========================================================================
|
||||
Other potential choices for non-smooth fields (with kinks, abrupt changes):
|
||||
|
||||
3 - SimpleHeum : low order, with error obtained from half-steps
|
||||
23 - BogackiShampine23 : lower order embedded method (new in 10.3-beta)
|
||||
===========================================================================
|
||||
|
||||
|
||||
|
||||
C. Controlling the killing of looping particles
|
||||
|
||||
|
||||
Occasionally tracks 'looping' in a strong magnetic field, making little
|
||||
progress even over hundreds of integration steps. This is due to a
|
||||
combination of a strong magnetic field and a thin material (gas or vacuum)
|
||||
in which the size of a physics step is substantially larger than the radius
|
||||
of curvature of the track.
|
||||
|
||||
Since the amount of CPU time which can be consumed by one or few such tracks
|
||||
is very large, it is important to limit the number of integration steps
|
||||
spent on these tracks. The module for propagation in field in Geant4
|
||||
flags tracks which take more than a certain number (default 1,000) integration
|
||||
steps without reaching the requested end of the step size, which was
|
||||
determined by the physics and geometry.
|
||||
|
||||
The Geant4 G4Transportation and G4CoupledTransportation processes are tasked
|
||||
to select which of the looping tracks are killed and which survive. To
|
||||
balance the potential significant cost of integrating looping particles,
|
||||
three thresholds exist
|
||||
|
||||
The 'Warning' Energy: a track with energy below this value that is found to
|
||||
loop is killed silently (no warning.)
|
||||
|
||||
Above the 'Warning Energy', if a track is selected for killing a warning is
|
||||
generated.
|
||||
|
||||
The 'Important' Energy: the threshold energy above which a track will survive
|
||||
for multiple steps if found looping.
|
||||
|
||||
number of 'tracking' steps. They will be only be killed only if they still
|
||||
loop after than
|
||||
The number of 'trials': the number of steps that 'important' tracks survive.
|
||||
|
||||
Note that currently only stable particles are killed. ( Refinements to enable
|
||||
toggling whether unstable particles can be killed are in development. )
|
||||
|
||||
This example demonstrate choosing different values for these parametes
|
||||
in the main() method of field01.cc using one of two techniques.
|
||||
|
||||
The first method is new in Geant4 release 10.5, and uses the G4PhysicsListHelper
|
||||
which has methods to choose a pre-selected set of parameter values. The choices
|
||||
are between a set each of low and high thresholds. Either one can be enabled
|
||||
by calling correspondingly
|
||||
- G4PhysicsListHelper::GetPhysicsListHelper()->UseLowLooperThresholds();
|
||||
or
|
||||
- G4PhysicsListHelper::GetPhysicsListHelper()->UseHighLooperThresholds();
|
||||
These methods must be called before the physics is constructed - i.e. typically
|
||||
before RunManager's Initialise() method is called.
|
||||
This works only if either
|
||||
- a modular physics lists is used, or if
|
||||
- the G4ModularPhysicsList and its AddTransporation method are used
|
||||
to create and register a common transportation process for all particles
|
||||
(one for each thread).
|
||||
|
||||
ii) Fine grained control (available in Geant4 versions since 7.0)
|
||||
|
||||
Fine grained control of the Transportation's parameters for looping particles
|
||||
is also possible.
|
||||
|
||||
This is demonstrated in the F01RunAction's ChangeLooperParameters method,
|
||||
which is called by the BeginOfRunAction. There the appropriate
|
||||
Transportation object for the electron is obtained, and its parameters
|
||||
(if valid) are used to overwrite the thresholds in the G4Transportation class.
|
||||
|
||||
For example, to ensure that only looping particles with energy 10 keV are
|
||||
killed silently we change the value of the 'Warning' Energy:
|
||||
|
||||
runAction->SetWarningEnergy( 10.0 * CLHEP::keV );
|
||||
|
||||
[ This is passed along to the registered G4Transportation or
|
||||
G4CoupledTransportation object by the F01RunAction's ChangeLooperParameters.]
|
||||
|
||||
As a result the killing of any (stable) looping track with energy over 10 keV
|
||||
will generate a warning.
|
||||
|
||||
A second configurable energy threshold enables tracks above it to survive a
|
||||
chosen number of 'tracking' steps. They will be only be killed only if they
|
||||
still loop after than number of tracking steps. F01RunAction's methods are
|
||||
used to configure these parameters:
|
||||
|
||||
runAction->SetImportantEnergy( 0.1 * CLHEP::MeV );
|
||||
runAction->SetNumberOfTrials( 30 );
|
||||
|
||||
which the run action passes to the G4Transportation or
|
||||
G4CoupledTransportation object registered for the electron.
|
||||
|
||||
Note that for all pre-configured and modular physics lists share a single
|
||||
Transportation process for all types of particles. So the parameters for
|
||||
killing loopers will be shared by all particle types in this case.
|
||||
|
||||
|
||||
Background Information
|
||||
|
||||
1- GEOMETRY DEFINITION
|
||||
|
||||
The "Absorber" is a solid made of a given material.
|
||||
|
||||
Three parameters define the absorber :
|
||||
- the material of the absorber,
|
||||
- the thickness of an absorber,
|
||||
- the transverse size of the absorber (the input face is a square).
|
||||
|
||||
The volume "World" contains the "Absorber".
|
||||
In this test the parameters of the "World" can be changed , too.
|
||||
|
||||
In addition a transverse uniform magnetic field can be applied.
|
||||
|
||||
The default geometry is constructed in F01DetectorConstruction class,
|
||||
but all the parameters can be changed via
|
||||
the commands defined in the F01DetectorMessenger class.
|
||||
|
||||
2- AN EVENT : THE PRIMARY GENERATOR
|
||||
|
||||
The primary kinematic consists of a single particle (electron, Ekin = 0.5 GeV)
|
||||
which hits the
|
||||
absorber perpendicular to the input face. The type of the particle
|
||||
and its energy are set in the F01PrimaryGeneratorAction class, and can
|
||||
be changed via the G4 build-in commands of G4ParticleGun class (see
|
||||
the macros provided with this example).
|
||||
|
||||
It is also possible to change the position of the primary particle vertex
|
||||
or activate its randomization via the commands defined in the
|
||||
F01PrimaryGeneratorMessenger class.
|
||||
|
||||
A RUN is a set of events.
|
||||
|
||||
3- DETECTOR RESPONSE
|
||||
|
||||
The spatial distribution of charged particles transported in magnetic
|
||||
field is envistigated.
|
||||
A HIT is a record, event per event , of all the
|
||||
informations needed to simulate and analyse the detector response.
|
||||
|
||||
In this example a F01CalorHit is defined as a set of 2 informations:
|
||||
- the total energy deposit in the absorber,
|
||||
- the total tracklength of all charged particles in the absorber,
|
||||
|
||||
Therefore the absorber is declared
|
||||
'sensitive detector' (SD), see F01CalorimeterSD, which means they can contribute to the hit.
|
||||
|
||||
4- PHYSICS LIST
|
||||
|
||||
The particle's type and the physic processes which will be available
|
||||
in this example are set in the FTFP_BERT physics list. This physics list
|
||||
requires data files for electromagnetic and hadronic processes.
|
||||
See more on installation of the datasets in Geant4 Installation Guide,
|
||||
|
||||
5- HOW TO START ?
|
||||
|
||||
- Execute field01 in 'batch' mode from macro file e.g.
|
||||
% ./field01 field01.in
|
||||
|
||||
- Execute field01 in 'interactive' mode with visualization e.g.
|
||||
% ./field01
|
||||
....
|
||||
Idle> /run/beamOn 1
|
||||
....
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
|
||||
///\file "field/field02/.README.txt"
|
||||
///\brief Example field02 README page
|
||||
|
||||
/*! \page Examplefield02 Example field02
|
||||
|
||||
Test for investigation of tracking in electric field
|
||||
and field dependent electromagnetic processes.
|
||||
|
||||
\section field02_s0 FIELD DEFINITION
|
||||
The field is a constant electric field.
|
||||
|
||||
Technical note: in order to use any electric field, it is
|
||||
necessary to create the objects for its equation of motion,
|
||||
the stepper and driver for the integration, and the
|
||||
chord finder.
|
||||
|
||||
The class that does these is F02ElectricFieldSetup. Its object
|
||||
is created in the ConstructSDandField() function in the F02DetectorConstruction
|
||||
class. The interactive commands are implemented in F02FieldMessenger.
|
||||
|
||||
\section field02_s1 GEOMETRY DEFINITION
|
||||
|
||||
The "Absorber" is a solid made of a given material.
|
||||
|
||||
Three parameters define the absorber :
|
||||
- the material of the absorber,
|
||||
- the thickness of an absorber,
|
||||
- the transverse size of the absorber (the input face is a square).
|
||||
|
||||
The volume "World" contains the "Absorber".
|
||||
In this test the parameters of the "World" can be changed , too.
|
||||
|
||||
In addition a transverse uniform electric field can be applied.
|
||||
|
||||
The default geometry is constructed in F02DetectorConstruction class,
|
||||
but all the parameters can be changed via
|
||||
the commands defined in the F02DetectorMessenger class.
|
||||
|
||||
\section field02_s2 AN EVENT : THE PRIMARY GENERATOR
|
||||
|
||||
The primary kinematic consists of a single particle which hits the
|
||||
absorber perpendicular to the input face. The type of the particle
|
||||
and its energy are set in the F02PrimaryGeneratorAction class, and can
|
||||
be changed via the G4 build-in commands of G4ParticleGun class (see
|
||||
the macros provided with this example).
|
||||
|
||||
It is also possible to change the position of the primary particle vertex
|
||||
or activate its randomization via the commands defined in the
|
||||
F01PrimaryGeneratorMessenger class.
|
||||
|
||||
A RUN is a set of events.
|
||||
|
||||
\section field02_s3 DETECTOR RESPONSE
|
||||
|
||||
|
||||
A HIT is a record, event per event , of all the
|
||||
informations needed to simulate and analyse the detector response.
|
||||
|
||||
In this example a F02CalorHit is defined as a set of 2 informations:
|
||||
- the total energy deposit in the absorber,
|
||||
- the total tracklength of all charged particles in the absorber,
|
||||
|
||||
Therefore the absorber is declared
|
||||
'sensitive detector' (SD), see F02CalorimeterSD, which means they can contribute to the hit.
|
||||
|
||||
\section field02_s4 PHYSICS LIST
|
||||
|
||||
The particle's type and the physic processes which will be available
|
||||
in this example are set in the FTFP_BERT physics list. This physics list
|
||||
requires data files for electromagnetic and hadronic processes.
|
||||
See more on installation of the datasets in Geant4 Installation Guide,
|
||||
|
||||
\section field02_s5 HOW TO START ?
|
||||
|
||||
- Execute field02 in 'batch' mode from macro file e.g.
|
||||
\verbatim
|
||||
% ./field02 field02.in
|
||||
\endverbatim
|
||||
|
||||
- Execute field02 in 'interactive' mode with visualization e.g.
|
||||
\verbatim
|
||||
% ./field02
|
||||
....
|
||||
Idle> /run/beamOn 1
|
||||
....
|
||||
\endverbatim
|
||||
*/
|
||||
@@ -0,0 +1,86 @@
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
|
||||
=========================================================
|
||||
|
||||
field02
|
||||
-------
|
||||
|
||||
Test for investigation of tracking in electric field
|
||||
and field dependent electromagnetic processes.
|
||||
|
||||
1- FIELD DEFINITION
|
||||
The field is a constant electric field.
|
||||
|
||||
Technical note: in order to use any electric field, it is
|
||||
necessary to create the objects for its equation of motion,
|
||||
the stepper and driver for the integration, and the
|
||||
chord finder.
|
||||
|
||||
The class that does these is F02ElectricFieldSetup. Its object
|
||||
is created in the ConstructSDandField() function in the F02DetectorConstruction
|
||||
class. The interactive commands are implemented in F02FieldMessenger.
|
||||
|
||||
1- GEOMETRY DEFINITION
|
||||
|
||||
The "Absorber" is a solid made of a given material.
|
||||
|
||||
Three parameters define the absorber :
|
||||
- the material of the absorber,
|
||||
- the thickness of an absorber,
|
||||
- the transverse size of the absorber (the input face is a square).
|
||||
|
||||
The volume "World" contains the "Absorber".
|
||||
In this test the parameters of the "World" can be changed , too.
|
||||
|
||||
In addition a transverse uniform electric field can be applied.
|
||||
|
||||
The default geometry is constructed in F02DetectorConstruction class,
|
||||
but all the parameters can be changed via
|
||||
the commands defined in the F02DetectorMessenger class.
|
||||
|
||||
2- AN EVENT : THE PRIMARY GENERATOR
|
||||
|
||||
The primary kinematic consists of a single particle which hits the
|
||||
absorber perpendicular to the input face. The type of the particle
|
||||
and its energy are set in the F02PrimaryGeneratorAction class, and can
|
||||
be changed via the G4 build-in commands of G4ParticleGun class (see
|
||||
the macros provided with this example).
|
||||
|
||||
It is also possible to change the position of the primary particle vertex
|
||||
or activate its randomization via the commands defined in the
|
||||
F01PrimaryGeneratorMessenger class.
|
||||
|
||||
A RUN is a set of events.
|
||||
|
||||
3- DETECTOR RESPONSE
|
||||
|
||||
|
||||
A HIT is a record, event per event , of all the
|
||||
informations needed to simulate and analyse the detector response.
|
||||
|
||||
In this example a F02CalorHit is defined as a set of 2 informations:
|
||||
- the total energy deposit in the absorber,
|
||||
- the total tracklength of all charged particles in the absorber,
|
||||
|
||||
Therefore the absorber is declared
|
||||
'sensitive detector' (SD), see F02CalorimeterSD, which means they can contribute to the hit.
|
||||
|
||||
4- PHYSICS LIST
|
||||
|
||||
The particle's type and the physic processes which will be available
|
||||
in this example are set in the FTFP_BERT physics list. This physics list
|
||||
requires data files for electromagnetic and hadronic processes.
|
||||
See more on installation of the datasets in Geant4 Installation Guide,
|
||||
|
||||
5- HOW TO START ?
|
||||
|
||||
- Execute field02 in 'batch' mode from macro file e.g.
|
||||
% ./field02 field02.in
|
||||
|
||||
- Execute field02 in 'interactive' mode with visualization e.g.
|
||||
% ./field02
|
||||
....
|
||||
Idle> /run/beamOn 1
|
||||
....
|
||||
@@ -0,0 +1,85 @@
|
||||
|
||||
///\file "field/field03/.README.txt"
|
||||
///\brief Example field03 README page
|
||||
|
||||
/*! \page Examplefield03 Example field03
|
||||
|
||||
Example of tracking in magnetic field where field associated
|
||||
to selected logical volumes varies.
|
||||
|
||||
A global and a local magnetic field are defined in the F03FieldSetup class, which object
|
||||
is created in the ConstructSDandField() function in the F03DetectorConstruction
|
||||
class. The local magnetic field is set to the "Radiator" volume.
|
||||
The interactive commands are implemented in F03FieldMessenger.
|
||||
|
||||
\section field03_s1 GEOMETRY DEFINITION
|
||||
|
||||
The "Absorber" is a solid made of a given material.
|
||||
|
||||
Three parameters define the absorber :
|
||||
- the material of the absorber,
|
||||
- the thickness of an absorber,
|
||||
- the transverse size of the absorber (the input face is a square).
|
||||
|
||||
The volume "World" contains the "Absorber".
|
||||
In this test the parameters of the "World" can be changed , too.
|
||||
|
||||
A transverse global uniform magnetic field can be applied.
|
||||
In addition, the "Radiator" volume, which is placed in geometry next
|
||||
to the absorber, has a local magnetic field.
|
||||
|
||||
The default geometry is constructed in F03DetectorConstruction class,
|
||||
but all the parameters can be changed via
|
||||
the commands defined in the F03DetectorMessenger class.
|
||||
|
||||
\section field03_s2 AN EVENT : THE PRIMARY GENERATOR
|
||||
|
||||
The primary kinematic consists of a single particle which hits the
|
||||
absorber perpendicular to the input face. The type of the particle
|
||||
and its energy are set in the F03PrimaryGeneratorAction class, and can
|
||||
be changed via the G4 build-in commands of G4ParticleGun class (see
|
||||
the macros provided with this example).
|
||||
|
||||
It is also possible to change the position of the primary particle vertex
|
||||
or activate its randomization via the commands defined in the
|
||||
F01PrimaryGeneratorMessenger class.
|
||||
|
||||
A RUN is a set of events.
|
||||
|
||||
\section field03_s3 DETECTOR RESPONSE
|
||||
|
||||
|
||||
A HIT is a record, event per event , of all the
|
||||
informations needed to simulate and analyse the detector response.
|
||||
|
||||
In this example a F03CalorHit is defined as a set of 2 informations:
|
||||
- the total energy deposit in the absorber,
|
||||
- the total tracklength of all charged particles in the absorber,
|
||||
|
||||
Therefore the absorber is declared
|
||||
'sensitive detector' (SD), see F03CalorimeterSD, which means they can contribute to the hit.
|
||||
|
||||
|
||||
\subsection field01_s4 PHYSICS LIST
|
||||
|
||||
The particle's type and the physic processes which will be available
|
||||
in this example are set in the FTFP_BERT physics list. This physics list
|
||||
requires data files for electromagnetic and hadronic processes.
|
||||
See more on installation of the datasets in Geant4 Installation Guide,
|
||||
|
||||
\section field03_s5 HOW TO START ?
|
||||
|
||||
- Execute field03 in 'batch' mode from macro files e.g.
|
||||
\verbatim
|
||||
% ./field03 field03.in
|
||||
\endverbatim
|
||||
|
||||
- Execute field03 in 'interactive' mode with visualization e.g.
|
||||
\verbatim
|
||||
% ./field03
|
||||
....
|
||||
Idle> /run/beamOn 1
|
||||
....
|
||||
\endverbatim
|
||||
|
||||
*/
|
||||
@@ -0,0 +1,81 @@
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
|
||||
=========================================================
|
||||
|
||||
field03
|
||||
-------
|
||||
|
||||
Example of tracking in magnetic field where field associated
|
||||
to selected logical volumes varies.
|
||||
|
||||
A global and a local magnetic field are defined in the F03FieldSetup class, which object
|
||||
is created in the ConstructSDandField() function in the F03DetectorConstruction
|
||||
class. The local magnetic field is set to the "Radiator" volume.
|
||||
The interactive commands are implemented in F03FieldMessenger.
|
||||
|
||||
|
||||
1- GEOMETRY DEFINITION
|
||||
|
||||
The "Absorber" is a solid made of a given material.
|
||||
|
||||
Three parameters define the absorber :
|
||||
- the material of the absorber,
|
||||
- the thickness of an absorber,
|
||||
- the transverse size of the absorber (the input face is a square).
|
||||
|
||||
The volume "World" contains the "Absorber".
|
||||
In this test the parameters of the "World" can be changed , too.
|
||||
|
||||
A transverse global uniform magnetic field can be applied.
|
||||
In addition, the "Radiator" volume, which is placed in geometry next
|
||||
to the absorber, has a local magnetic field.
|
||||
|
||||
The default geometry is constructed in F03DetectorConstruction class,
|
||||
but all the parameters can be changed via
|
||||
the commands defined in the F03DetectorMessenger class.
|
||||
|
||||
2- AN EVENT : THE PRIMARY GENERATOR
|
||||
|
||||
The primary kinematic consists of a single particle which hits the
|
||||
absorber perpendicular to the input face. The type of the particle
|
||||
and its energy are set in the F03PrimaryGeneratorAction class, and can
|
||||
be changed via the G4 build-in commands of G4ParticleGun class (see
|
||||
the macros provided with this example).
|
||||
|
||||
It is also possible to change the position of the primary particle vertex
|
||||
or activate its randomization via the commands defined in the
|
||||
F01PrimaryGeneratorMessenger class.
|
||||
|
||||
A RUN is a set of events.
|
||||
|
||||
3- DETECTOR RESPONSE
|
||||
|
||||
A HIT is a record, event per event , of all the
|
||||
informations needed to simulate and analyse the detector response.
|
||||
|
||||
In this example a F03CalorHit is defined as a set of 2 informations:
|
||||
- the total energy deposit in the absorber,
|
||||
- the total tracklength of all charged particles in the absorber,
|
||||
|
||||
Therefore the absorber is declared
|
||||
'sensitive detector' (SD), see F03CalorimeterSD, which means they can contribute to the hit.
|
||||
|
||||
4- PHYSICS LIST
|
||||
|
||||
The particle's type and the physic processes which will be available
|
||||
in this example are set in the FTFP_BERT physics list. This physics list
|
||||
requires data files for electromagnetic and hadronic processes.
|
||||
See more on installation of the datasets in Geant4 Installation Guide,
|
||||
|
||||
5- HOW TO START ?
|
||||
|
||||
- Execute field03 in 'batch' mode from macro files e.g.
|
||||
% ./field03 field03.in
|
||||
|
||||
- Execute field03 in 'interactive' mode with visualization e.g.
|
||||
% ./field03
|
||||
....
|
||||
Idle> /run/beamOn 1
|
||||
....
|
||||
@@ -0,0 +1,397 @@
|
||||
|
||||
///\file "field/field04/.README.txt"
|
||||
///\brief Example field04 README page
|
||||
|
||||
/*! \page Examplefield04 Example field04
|
||||
|
||||
|
||||
This example shows how to define/use OVERLAPPING field elements
|
||||
in Geant4. Fields might be either magnetic, electric or both.
|
||||
|
||||
Credit goes to Tom Roberts and Muons Inc. since much of the code
|
||||
and ideas were taken at liberty from the (GNU GPL) source of
|
||||
G4BEAMLINE release 1.12.
|
||||
|
||||
http://g4beamline.muonsinc.com
|
||||
|
||||
\section field04_s1 Classes
|
||||
|
||||
\subsection field04_sub_s11 main ()
|
||||
|
||||
See field04.cc.
|
||||
|
||||
The example can be run with the following optional arguments:
|
||||
|
||||
\verbatim
|
||||
% field04 [-m macro ] [-p physicsList] [-r randomSeed] [-s preinit|idle]
|
||||
\endverbatim
|
||||
|
||||
If a macro is provided with the option "-m", the program runs in a batch mode,
|
||||
otherwise the program open the interactive session after executing the
|
||||
default initialization macro init_vis.mac. The option "-s preinit" can be used
|
||||
to start the program without initialization in PreInit phase.
|
||||
|
||||
For example:
|
||||
to assign the F04PhysicsList:
|
||||
\verbatim
|
||||
% field04 -p QGSP_BERT
|
||||
\endverbatim
|
||||
|
||||
an initial random number seed with:
|
||||
\verbatim
|
||||
% field04 field04.in -r 12345
|
||||
\endverbatim
|
||||
|
||||
to start with a macro file and an initial seed:
|
||||
\verbatim
|
||||
% field04 -m field04.in -r 12345
|
||||
\endverbatim
|
||||
|
||||
\subsection field04_sub_s12 F04DetectorConstruction
|
||||
|
||||
The geometry consists of two solenoidal magnets: a "CaptureMgnt"
|
||||
followed by a (blue-colored "TransferMgnt". By definition, the
|
||||
axis and center of the "CaptureMgnt" coincide with the "World". The
|
||||
position of the "TransferMgnt" relative to the downstream end of the
|
||||
"CaptureMgnt", as well as its axis angle, both may vary. A cylindrical
|
||||
"Target" is positioned inside the "CaptureMgnt". Its axis can vary
|
||||
from 0 to 180 deg, and hence also the direction of the incoming
|
||||
proton beam wrt the "CaptureMgnt"'s axis. A "Degrader" is located
|
||||
inside the "TransferMgnt", its default position being at the
|
||||
upstream end of the "TransferMgnt". Finally, also a "TestPlane" is
|
||||
located inside the "TransferMgnt", by default at its downstream end.
|
||||
|
||||
The "World" consists of a solid cylinder made of a given material.
|
||||
(It is the responsibility of the user to make the world
|
||||
large enough to contain the rest of the geometry!)
|
||||
|
||||
Three parameters define the world :
|
||||
- the material of the world,
|
||||
- the world radius,
|
||||
- the world length.
|
||||
|
||||
Example (default values):
|
||||
\verbatim
|
||||
/field04/SetWorldMat G4_AIR
|
||||
/field04/SetWorldR 5.0 m
|
||||
/field04/SetWorldZ 50.0 m
|
||||
\endverbatim
|
||||
|
||||
The "Target" is a solid cylinder made of a given material.
|
||||
Five parameters define the target:
|
||||
- the material of the target,
|
||||
- the target radius,
|
||||
- the target thickness,
|
||||
- the target position inside the "CaptureMgnt",
|
||||
- the target axis angle relative to that of the "CaptureMgnt".
|
||||
|
||||
Example (default values):
|
||||
\verbatim
|
||||
/field04/SetTgtMat G4_W
|
||||
/field04/SetTgtRad 0.4 cm
|
||||
/field04/SetTgtThick 16.0 cm
|
||||
/field04/SetTgtPos 0.0 cm
|
||||
/field04/SetTgtAng 170
|
||||
\endverbatim
|
||||
|
||||
The "Degrader" is a solid cylinder made of a given material.
|
||||
|
||||
Four parameters define the degrader:
|
||||
- the material of the degrader,
|
||||
- the degrader radius,
|
||||
- the degrader thickness,
|
||||
- the degrader position relative to the "TransferMgnt" center.
|
||||
|
||||
Example (default values):
|
||||
\verbatim
|
||||
/field04/SetDgrMat G4_Pb
|
||||
/field04/SetDgrRad 30.0 cm
|
||||
/field04/SetDgrThick 0.1 cm
|
||||
#/field04/SetDgrPos -7.4 m
|
||||
\endverbatim
|
||||
|
||||
The "CaptureMgnt" is a solenoid (vacuum cylinder). It is either
|
||||
a two-sided or a one-sided magnetic bottle with the B field
|
||||
varying linearly from the center value B1 to the edge value B2.
|
||||
The one-sided F04FocusSolenoid has the open end at +z and focuses
|
||||
on the z < 0 side.
|
||||
|
||||
Four parameters define the "CaptureMgnt":
|
||||
- the magnet radius,
|
||||
- the magnet length,
|
||||
- the weaker magnetic field at the center B1
|
||||
- the stronger magnetic field at the edge B2
|
||||
|
||||
Example (default values):
|
||||
\verbatim
|
||||
/field04/SetCaptureR 0.6 m
|
||||
/field04/SetCaptureZ 4.0 m
|
||||
/field/SetCaptureB1 2.5 tesla
|
||||
/field/SetCaptureB2 5.0 tesla
|
||||
\endverbatim
|
||||
|
||||
The "TransferMgnt" is a solenoid (vacuum cylinder) with a
|
||||
constant B-field. When the "TransferMgnt" follows immediately
|
||||
the "CaptureMgnt", its relative position is at 0 cm.
|
||||
|
||||
Four parameters define the "TransferMgnt":
|
||||
- the magnet radius,
|
||||
- the magnet length,
|
||||
- the magnet field,
|
||||
- the magnet relative position
|
||||
(its upstream face wrt the downstream face of the "CaptureMgnt".)
|
||||
|
||||
Example (default values):
|
||||
\verbatim
|
||||
/field04/SetTransferR 0.3 m
|
||||
/field04/SetTransferZ 15.0 m
|
||||
/field/SetTransferB 5.0 tesla
|
||||
/field04/SetTransferP 0.0 m
|
||||
\endverbatim
|
||||
The default geometry is constructed in F04DetectorConstruction class,
|
||||
but all the parameters can be changed via the commands defined in
|
||||
the F04DetectorMessenger class.
|
||||
|
||||
\subsection field04_sub_s13 F04Materials
|
||||
|
||||
Material definitions are done through the singleton class F04Materials
|
||||
which keeps a pointer to the G4NistManager. It has a method
|
||||
GetMaterial by name (G4String) which in turn invokes the
|
||||
G4NistManager::FindOrBuildMaterial, and/or G4Material::GetMaterial
|
||||
methods. It has also a method CreateMaterials which, for materials
|
||||
absent from the NIST data base, shows how to create them using the
|
||||
G4NistManager::ConstructNewMaterial method.
|
||||
|
||||
|
||||
\subsection field04_sub_s14 F04PrimaryGeneratorAction
|
||||
|
||||
The primary kinematic consists of a single particle which hits the
|
||||
target perpendicular to its upstream face. The type of the particle
|
||||
and its energy are set in the F04PrimaryGeneratorAction class, and can
|
||||
be changed via the G4 build-in commands of the G4ParticleGun class.
|
||||
In addition, there is a fRndmFlag, which once set allows the beam to
|
||||
explore randomly the whole cross section of the target. The default
|
||||
beam consists of 500 MeV protons, starting at the upstream face of
|
||||
the target, directed along dx = dy = 0, dz = 1 wrt the target frame.
|
||||
The default direction should NOT be changed! The arguments of the
|
||||
x/y/zvertex commands are relative to the target center.
|
||||
|
||||
Example:
|
||||
\verbatim
|
||||
/gun/random on
|
||||
#/gun/xvertex 0 mm
|
||||
#/gun/yvertex 0 mm
|
||||
#/gun/zvertex -100 mm
|
||||
\endverbatim
|
||||
|
||||
\subsection field04_sub_s15 DETECTOR RESPONSE in F04SteppingAction
|
||||
|
||||
Information is extracted from the program via F04SteppingAction
|
||||
at the TestPlane.
|
||||
|
||||
\subsection field04_sub_s16 F04PhysicsList
|
||||
|
||||
The F04PhysicsList extends a selected Geant4 physics list.
|
||||
The base physics list name is provided by its name in the F04PhysicsList
|
||||
constructor.
|
||||
|
||||
In addition to processes defined in the base Geant4 physics list,
|
||||
there is added the F04StepMax process and the decay of pions can be assigned
|
||||
via dedicated commands in F04PhysicsListMessenger.
|
||||
|
||||
The command to define maximum step:
|
||||
\verbatim
|
||||
/exp/phys/stepMax value unit
|
||||
\endverbatim
|
||||
|
||||
The decay of pions can be assigned via (pi -> e nu, pi -> mu nu):
|
||||
\verbatim
|
||||
/decay/pienu
|
||||
/decay/pimunu
|
||||
\endverbatim
|
||||
|
||||
The pienu assignment includes a small fraction of radiative decay:
|
||||
e nu gamma (G4PionRadiativeDecayChannel).
|
||||
|
||||
The standard/default muon decay chain is modified to be 98.6%
|
||||
G4MuonDecayChannelWithSpin and 1.4% G4MuonRadiativeDecayChannelWithSpin
|
||||
in ConstructParticle().
|
||||
|
||||
The pion decay process G4PolDecay inherits from G4Decay and implements
|
||||
the virtual method - empty in the base class - DaughterPolarization
|
||||
|
||||
The muon decay process is G4DecayWithSpin
|
||||
|
||||
Furthermore, the following commands are also available, but
|
||||
may only be used AFTER /run/initialize
|
||||
|
||||
\verbatim
|
||||
/process/inactivate msc
|
||||
/process/activate msc
|
||||
\endverbatim
|
||||
|
||||
\subsection field04_sub_s17 Overlapping Fields
|
||||
|
||||
The F04GlobalField (a singleton) is instantiated in
|
||||
F04DetectorConstruction() and assigned to the global field manager
|
||||
in UpdateField():
|
||||
\verbatim
|
||||
fFieldManager = GetGlobalFieldManager();
|
||||
fFieldManager->SetDetectorField(this);
|
||||
\endverbatim
|
||||
The F04GlobalField has a std::vector<ElementField*> FieldList
|
||||
|
||||
The field from each individual beamline element is given by a
|
||||
F04ElementField object. Any number of overlapping F04ElementField
|
||||
objects can be added to the F04GlobalField. Any element that
|
||||
represents an element with an EM field must add the appropriate
|
||||
F04ElementField to the global F04GlobalField object.
|
||||
|
||||
Of course, the F04GlobalField has the method GetFieldValue implemented.
|
||||
|
||||
Before /run/initialize in the macro file or command, the update
|
||||
field command must have been issued if any of the other following
|
||||
field commands was employed:
|
||||
\verbatim
|
||||
/field/update
|
||||
\endverbatim
|
||||
|
||||
Other options are:
|
||||
\verbatim
|
||||
/field/setStepperType 4
|
||||
/field/setMinStep 10 mm
|
||||
/field/setDeltaChord 3.0 mm
|
||||
/field/setDeltaOneStep 0.01 mm
|
||||
/field/setDeltaIntersection 0.1 mm
|
||||
/field/setEpsMin 2.5e-7 mm
|
||||
/field/setEpsMax 0.05 mm
|
||||
\endverbatim
|
||||
Each field element has a rectilinear bounding box in global
|
||||
coordinate space which is checked before a point is verified to
|
||||
actually be inside the F04ElementField (IsWithin and IsOutside).
|
||||
SetGlobalPoint is called 8 times for the corners of the local
|
||||
bounding box, after a local->global coordinate transform.
|
||||
|
||||
The F04ElementField is the interface class used by F04GlobalField to
|
||||
compute the field value at a given point[].
|
||||
|
||||
A beamline element, for example the F04SimpleSolenoid, will derive
|
||||
from F04ElementField and implement the computation for the element.
|
||||
\verbatim
|
||||
simpleSolenoid
|
||||
= new F04SimpleSolenoid(B, l, logicTransferMgnt,TransferMgntCenter);
|
||||
\endverbatim
|
||||
Besides the magnetic field and the length of the simple solenoid,
|
||||
the constructor needs the knowledge of the G4LogicalVolume for
|
||||
the beamline element and where its center is located in the
|
||||
'World'.
|
||||
|
||||
The F04ElementField has a G4AffineTransform "fGlobal2local" which
|
||||
allows the quick computation of coordinate transformations. It can
|
||||
only be determined by knowing the element's coordinate origin in
|
||||
the global frame and after all of the geometry has been defined.
|
||||
For this reason, the object is prepared in two stages, through the
|
||||
constructor providing it with the coordinate center and a pointer
|
||||
to the G4LogicalVolume. Later the Construct() method is called to
|
||||
calculate the fGlobal2local and the bounding box. This can be done
|
||||
from the F04RunAction::BeginOfRunAction method, for only then are we
|
||||
certain that the geometry has been completely built:
|
||||
\verbatim
|
||||
FieldList* fields = F04GlobalField::GetObject()->GetFields();
|
||||
|
||||
if (fields) {
|
||||
if (fields->size()>0) {
|
||||
FieldList::iterator i;
|
||||
for (i=fields->begin(); i!=fields->end(); ++i)(*i)->Construct();
|
||||
}
|
||||
}
|
||||
\endverbatim
|
||||
The F04ElementField constructor will also add the derived object into
|
||||
F04GlobalField. Finally, its AddFieldValue() will add the field value
|
||||
for this element to field[].
|
||||
|
||||
\subsection field04_sub_s18 User Action Classes
|
||||
|
||||
- F04RunActionMessenger:
|
||||
\verbatim
|
||||
/rndm/save freq - to save rndm status in external files
|
||||
0 not saved
|
||||
>0 saved on: beginOfRun.rndm
|
||||
1 saved on: endOfRun.rndm
|
||||
2 saved on: endOfEvent.rndm
|
||||
/rndm/read random/run0evt8268.rndm
|
||||
\endverbatim
|
||||
|
||||
- F04RunAction: \n
|
||||
BeginOfRunAction: Deal with random number storage,
|
||||
initialization etc. Call the Construct() method of
|
||||
F04ElementFields in the FieldList of F04GlobalField object.
|
||||
EndOfRunAction: random number storage/status printing.
|
||||
|
||||
- F04EventActionMessenger: \n
|
||||
\verbatim
|
||||
/event/setverbose
|
||||
\endverbatim
|
||||
|
||||
- F04EventAction(F04RunAction* RA): \n
|
||||
Customized BeginOfEvent printing
|
||||
EndofEvent:
|
||||
saveEngingStatus and showEngineStatus according to flag
|
||||
in F04RunAction
|
||||
|
||||
- F04TrackingAction: \n
|
||||
PreUserTrackingAction: Instantiate F04UserTrackInformation
|
||||
and set the application TrackStatus.
|
||||
PostUserTrackingAction: Retreive F04UserTrackInformation
|
||||
and decide to save random number status accordingly.
|
||||
|
||||
- F04SteppingActionMessenger: \n
|
||||
|
||||
- F04SteppingAction: \n
|
||||
UserSteppingAction: Kill primary if/when outside Target
|
||||
volume. Diagnostic/histogram filling for particles at a
|
||||
TestPlane. Find decay position and when particle
|
||||
FIRST reverses z-momentum component via using a
|
||||
F04UserTrackInformation object.
|
||||
|
||||
- F04StackingAction: \n
|
||||
Track only primaries, pi+ or mu+
|
||||
|
||||
- F04UserTrackInformation: \n
|
||||
Keep an application F04TrackStatus for the track: \n
|
||||
undefined, left, right, reverse
|
||||
|
||||
- F04SteppingVerbose: \n
|
||||
Only print track header and step information for
|
||||
pi+ and mu+.
|
||||
Note: the information for primary protons is not printed.
|
||||
|
||||
- F04Trajectory, F04TrajectoryPoint: \n
|
||||
Example of application specific implementations
|
||||
|
||||
\section field04_s2 HOW TO START ?
|
||||
|
||||
- Execute field04 in 'batch' mode from macro files e.g.
|
||||
\verbatim
|
||||
% field04 -m field04.in
|
||||
\endverbatim
|
||||
|
||||
- Execute field04 in 'interactive' mode with visualization
|
||||
\verbatim
|
||||
% field04
|
||||
....
|
||||
Idle> type your commands
|
||||
....
|
||||
\endverbatim
|
||||
|
||||
- Execute field04 in 'interactive' mode without initialization
|
||||
\verbatim
|
||||
% field04 -s preinit
|
||||
....
|
||||
Idle> type your commands, then
|
||||
Idle> /run/initialize
|
||||
Idle> /control/execute vis.mac
|
||||
....
|
||||
\endverbatim
|
||||
|
||||
*/
|
||||
@@ -0,0 +1,377 @@
|
||||
|
||||
=========================================================
|
||||
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
|
||||
=========================================================
|
||||
|
||||
|
||||
|
||||
field04 Example
|
||||
---------------
|
||||
|
||||
This example shows how to define/use OVERLAPPING field elements
|
||||
in Geant4. Fields might be either magnetic, electric or both.
|
||||
|
||||
Credit goes to Tom Roberts and Muons Inc. since much of the code
|
||||
and ideas were taken at liberty from the (GNU GPL) source of
|
||||
G4BEAMLINE release 1.12.
|
||||
|
||||
http://g4beamline.muonsinc.com
|
||||
|
||||
**************
|
||||
*Classes Used*
|
||||
**************
|
||||
|
||||
1 - main()
|
||||
|
||||
See field04.cc.
|
||||
|
||||
The example can be run with the following optional arguments:
|
||||
|
||||
% field04 [-m macro ] [-p physicsList] [-r randomSeed] [-s preinit|idle]
|
||||
|
||||
If a macro is provided with the option "-m", the program runs in a batch mode,
|
||||
otherwise the program open the interactive session after executing the
|
||||
default initialization macro init_vis.mac. The option "-s preinit" can be used
|
||||
to start the program without initialization in PreInit phase.
|
||||
|
||||
For example:
|
||||
to assign the F04PhysicsList:
|
||||
% field04 -p QGSP_BERT
|
||||
|
||||
an initial random number seed with:
|
||||
% field04 field04.in -r 12345
|
||||
|
||||
to start with a macro file and an initial seed:
|
||||
% field04 -m field04.in -r 12345
|
||||
|
||||
|
||||
2- GEOMETRY DEFINITION
|
||||
|
||||
The geometry consists of two solenoidal magnets: a "CaptureMgnt"
|
||||
followed by a (blue-colored "TransferMgnt". By definition, the
|
||||
axis and center of the "CaptureMgnt" coincide with the "World". The
|
||||
position of the "TransferMgnt" relative to the downstream end of the
|
||||
"CaptureMgnt", as well as its axis angle, both may vary. A cylindrical
|
||||
"Target" is positioned inside the "CaptureMgnt". Its axis can vary
|
||||
from 0 to 180 deg, and hence also the direction of the incoming
|
||||
proton beam wrt the "CaptureMgnt"'s axis. A "Degrader" is located
|
||||
inside the "TransferMgnt", its default position being at the
|
||||
upstream end of the "TransferMgnt". Finally, also a "TestPlane" is
|
||||
located inside the "TransferMgnt", by default at its downstream end.
|
||||
|
||||
|
||||
The "World" consists of a solid cylinder made of a given material.
|
||||
(It is the responsibility of the user to make the world
|
||||
large enough to contain the rest of the geometry!)
|
||||
|
||||
Three parameters define the world :
|
||||
- the material of the world,
|
||||
- the world radius,
|
||||
- the world length.
|
||||
|
||||
Example (default values):
|
||||
/field04/SetWorldMat G4_AIR
|
||||
/field04/SetWorldR 5.0 m
|
||||
/field04/SetWorldZ 50.0 m
|
||||
|
||||
|
||||
The "Target" is a solid cylinder made of a given material.
|
||||
|
||||
Five parameters define the target:
|
||||
- the material of the target,
|
||||
- the target radius,
|
||||
- the target thickness,
|
||||
- the target position inside the "CaptureMgnt",
|
||||
- the target axis angle relative to that of the "CaptureMgnt".
|
||||
|
||||
Example (default values):
|
||||
/field04/SetTgtMat G4_W
|
||||
/field04/SetTgtRad 0.4 cm
|
||||
/field04/SetTgtThick 16.0 cm
|
||||
/field04/SetTgtPos 0.0 cm
|
||||
/field04/SetTgtAng 170
|
||||
|
||||
|
||||
The "Degrader" is a solid cylinder made of a given material.
|
||||
|
||||
Four parameters define the degrader:
|
||||
- the material of the degrader,
|
||||
- the degrader radius,
|
||||
- the degrader thickness,
|
||||
- the degrader position relative to the "TransferMgnt" center.
|
||||
|
||||
Example (default values):
|
||||
/field04/SetDgrMat G4_Pb
|
||||
/field04/SetDgrRad 30.0 cm
|
||||
/field04/SetDgrThick 0.1 cm
|
||||
#/field04/SetDgrPos -7.4 m
|
||||
|
||||
|
||||
The "CaptureMgnt" is a solenoid (vacuum cylinder). It is either
|
||||
a two-sided or a one-sided magnetic bottle with the B field
|
||||
varying linearly from the center value B1 to the edge value B2.
|
||||
The one-sided F04FocusSolenoid has the open end at +z and focuses
|
||||
on the z < 0 side.
|
||||
|
||||
Four parameters define the "CaptureMgnt":
|
||||
- the magnet radius,
|
||||
- the magnet length,
|
||||
- the weaker magnetic field at the center B1
|
||||
- the stronger magnetic field at the edge B2
|
||||
|
||||
Example (default values):
|
||||
/field04/SetCaptureR 0.6 m
|
||||
/field04/SetCaptureZ 4.0 m
|
||||
/field/SetCaptureB1 2.5 tesla
|
||||
/field/SetCaptureB2 5.0 tesla
|
||||
|
||||
|
||||
The "TransferMgnt" is a solenoid (vacuum cylinder) with a
|
||||
constant B-field. When the "TransferMgnt" follows immediately
|
||||
the "CaptureMgnt", its relative position is at 0 cm.
|
||||
|
||||
Four parameters define the "TransferMgnt":
|
||||
- the magnet radius,
|
||||
- the magnet length,
|
||||
- the magnet field,
|
||||
- the magnet relative position
|
||||
(its upstream face wrt the downstream face of the "CaptureMgnt".)
|
||||
|
||||
Example (default values):
|
||||
/field04/SetTransferR 0.3 m
|
||||
/field04/SetTransferZ 15.0 m
|
||||
/field/SetTransferB 5.0 tesla
|
||||
/field04/SetTransferP 0.0 m
|
||||
|
||||
The default geometry is constructed in F04DetectorConstruction class,
|
||||
but all the parameters can be changed via the commands defined in
|
||||
the F04DetectorMessenger class.
|
||||
|
||||
|
||||
3- MATERIAL DEFINITION
|
||||
|
||||
Material definitions are done through the singleton class F04Materials
|
||||
which keeps a pointer to the G4NistManager. It has a method
|
||||
GetMaterial by name (G4String) which in turn invokes the
|
||||
G4NistManager::FindOrBuildMaterial, and/or G4Material::GetMaterial
|
||||
methods. It has also a method CreateMaterials which, for materials
|
||||
absent from the NIST data base, shows how to create them using the
|
||||
G4NistManager::ConstructNewMaterial method.
|
||||
|
||||
|
||||
4- AN EVENT: THE PRIMARY GENERATOR
|
||||
|
||||
The primary kinematic consists of a single particle which hits the
|
||||
target perpendicular to its upstream face. The type of the particle
|
||||
and its energy are set in the F04PrimaryGeneratorAction class, and can
|
||||
be changed via the G4 build-in commands of the G4ParticleGun class.
|
||||
In addition, there is a fRndmFlag, which once set allows the beam to
|
||||
explore randomly the whole cross section of the target. The default
|
||||
beam consists of 500 MeV protons, starting at the upstream face of
|
||||
the target, directed along dx = dy = 0, dz = 1 wrt the target frame.
|
||||
The default direction should NOT be changed! The arguments of the
|
||||
x/y/zvertex commands are relative to the target center.
|
||||
|
||||
Example:
|
||||
/gun/random on
|
||||
#/gun/xvertex 0 mm
|
||||
#/gun/yvertex 0 mm
|
||||
#/gun/zvertex -100 mm
|
||||
|
||||
|
||||
5- DETECTOR RESPONSE
|
||||
|
||||
Information is extracted from the program via F04SteppingAction
|
||||
at the TestPlane.
|
||||
|
||||
|
||||
6- PHYSICS
|
||||
|
||||
The F04PhysicsList extends a selected Geant4 physics list.
|
||||
The base physics list name is provided by its name in the F04PhysicsList
|
||||
constructor.
|
||||
|
||||
In addition to processes defined in the base Geant4 physics list,
|
||||
there is added the F04StepMax process and the decay of pions can be assigned
|
||||
via dedicated commands in F04PhysicsListMessenger.
|
||||
|
||||
The command to define maximum step:
|
||||
/exp/phys/stepMax value unit
|
||||
|
||||
The decay of pions can be assigned via (pi -> e nu, pi -> mu nu):
|
||||
|
||||
/decay/pienu
|
||||
/decay/pimunu
|
||||
|
||||
The pienu assignment includes a small fraction of radiative decay:
|
||||
e nu gamma (G4PionRadiativeDecayChannel).
|
||||
|
||||
The standard/default muon decay chain is modified to be 98.6%
|
||||
G4MuonDecayChannelWithSpin and 1.4% G4MuonRadiativeDecayChannelWithSpin
|
||||
in ConstructParticle().
|
||||
|
||||
The pion decay process G4PolDecay inherits from G4Decay and implements
|
||||
the virtual method - empty in the base class - DaughterPolarization
|
||||
|
||||
The muon decay process is G4DecayWithSpin
|
||||
|
||||
Furthermore, the following commands are also available, but
|
||||
may only be used AFTER /run/initialize
|
||||
|
||||
/process/inactivate msc
|
||||
/process/activate msc
|
||||
|
||||
7- Overlapping Fields
|
||||
|
||||
The F04GlobalField (a singleton) is instantiated in
|
||||
F04DetectorConstruction() and assigned to the global field manager
|
||||
in UpdateField():
|
||||
|
||||
fFieldManager = GetGlobalFieldManager();
|
||||
fFieldManager->SetDetectorField(this);
|
||||
|
||||
The F04GlobalField has a std::vector<ElementField*> FieldList
|
||||
|
||||
The field from each individual beamline element is given by a
|
||||
F04ElementField object. Any number of overlapping F04ElementField
|
||||
objects can be added to the F04GlobalField. Any element that
|
||||
represents an element with an EM field must add the appropriate
|
||||
F04ElementField to the global F04GlobalField object.
|
||||
|
||||
Of course, the F04GlobalField has the method GetFieldValue implemented.
|
||||
|
||||
Before /run/initialize in the macro file or command, the update
|
||||
field command must have been issued if any of the other following
|
||||
field commands was employed:
|
||||
|
||||
/field/update
|
||||
|
||||
Other options are:
|
||||
|
||||
/field/setStepperType 4
|
||||
/field/setMinStep 10 mm
|
||||
/field/setDeltaChord 3.0 mm
|
||||
/field/setDeltaOneStep 0.01 mm
|
||||
/field/setDeltaIntersection 0.1 mm
|
||||
/field/setEpsMin 2.5e-7 mm
|
||||
/field/setEpsMax 0.05 mm
|
||||
|
||||
Each field element has a rectilinear bounding box in global
|
||||
coordinate space which is checked before a point is verified to
|
||||
actually be inside the F04ElementField (IsWithin and IsOutside).
|
||||
SetGlobalPoint is called 8 times for the corners of the local
|
||||
bounding box, after a local->global coordinate transform.
|
||||
|
||||
The F04ElementField is the interface class used by F04GlobalField to
|
||||
compute the field value at a given point[].
|
||||
|
||||
A beamline element, for example the F04SimpleSolenoid, will derive
|
||||
from F04ElementField and implement the computation for the element.
|
||||
|
||||
simpleSolenoid
|
||||
= new F04SimpleSolenoid(B, l, logicTransferMgnt,TransferMgntCenter);
|
||||
|
||||
Besides the magnetic field and the length of the simple solenoid,
|
||||
the constructor needs the knowledge of the G4LogicalVolume for
|
||||
the beamline element and where its center is located in the
|
||||
'World'.
|
||||
|
||||
The F04ElementField has a G4AffineTransform "fGlobal2local" which
|
||||
allows the quick computation of coordinate transformations. It can
|
||||
only be determined by knowing the element's coordinate origin in
|
||||
the global frame and after all of the geometry has been defined.
|
||||
For this reason, the object is prepared in two stages, through the
|
||||
constructor providing it with the coordinate center and a pointer
|
||||
to the G4LogicalVolume. Later the Construct() method is called to
|
||||
calculate the fGlobal2local and the bounding box. This can be done
|
||||
from the F04RunAction::BeginOfRunAction method, for only then are we
|
||||
certain that the geometry has been completely built:
|
||||
|
||||
FieldList* fields = F04GlobalField::GetObject()->GetFields();
|
||||
|
||||
if (fields) {
|
||||
if (fields->size()>0) {
|
||||
FieldList::iterator i;
|
||||
for (i=fields->begin(); i!=fields->end(); ++i)(*i)->Construct();
|
||||
}
|
||||
}
|
||||
|
||||
The F04ElementField constructor will also add the derived object into
|
||||
F04GlobalField. Finally, its AddFieldValue() will add the field value
|
||||
for this element to field[].
|
||||
|
||||
|
||||
8- User Action Classes
|
||||
|
||||
F04RunActionMessenger:
|
||||
|
||||
/rndm/save freq - to save rndm status in external files
|
||||
0 not saved
|
||||
>0 saved on: beginOfRun.rndm
|
||||
1 saved on: endOfRun.rndm
|
||||
2 saved on: endOfEvent.rndm
|
||||
/rndm/read random/run0evt8268.rndm
|
||||
|
||||
F04RunAction:
|
||||
BeginOfRunAction: Deal with random number storage,
|
||||
initialization etc. Call the Construct() method of
|
||||
F04ElementFields in the FieldList of F04GlobalField object.
|
||||
EndOfRunAction: random number storage/status printing.
|
||||
|
||||
F04EventActionMessenger:
|
||||
/event/setverbose
|
||||
|
||||
F04EventAction(RunAction* RA):
|
||||
Customized BeginOfEvent printing
|
||||
EndofEvent:
|
||||
saveEngingStatus and showEngineStatus according to flag
|
||||
in F04RunAction
|
||||
|
||||
F04TrackingAction:
|
||||
PreUserTrackingAction: Instantiate F04UserTrackInformation
|
||||
and set the application TrackStatus.
|
||||
PostUserTrackingAction: Retreive F04UserTrackInformation
|
||||
and decide to save random number status accordingly.
|
||||
|
||||
F04SteppingActionMessenger:
|
||||
|
||||
F04SteppingAction:
|
||||
UserSteppingAction: Kill primary if/when outside Target
|
||||
volume. Diagnostic/histogram filling for particles at a
|
||||
TestPlane. Find decay position and when particle
|
||||
FIRST reverses z-momentum component via using a
|
||||
F04UserTrackInformation object.
|
||||
|
||||
F04StackingAction:
|
||||
Track only primaries, pi+ or mu+
|
||||
|
||||
F04UserTrackInformation:
|
||||
Keep an application F04TrackStatus for the track:
|
||||
undefined, left, right, reverse
|
||||
|
||||
F04SteppingVerbose:
|
||||
Only print track header and step information for
|
||||
pi+ and mu+.
|
||||
Note: the information for primary protons is not printed.
|
||||
|
||||
F04Trajectory, TrajectoryPoint:
|
||||
Example of application specific implementations
|
||||
|
||||
9- HOW TO START ?
|
||||
|
||||
- Execute field04 in 'batch' mode from macro files e.g.
|
||||
% field04 -m field04.in
|
||||
|
||||
- Execute field04 in 'interactive' mode with visualization
|
||||
% field04
|
||||
....
|
||||
Idle> type your commands
|
||||
....
|
||||
|
||||
- Execute field04 in 'interactive' mode without initialization
|
||||
% field04 -s preinit
|
||||
....
|
||||
Idle> type your commands, then
|
||||
Idle> /run/initialize
|
||||
Idle> /control/execute vis.mac
|
||||
....
|
||||
@@ -0,0 +1,2 @@
|
||||
Directory including files generated during run for
|
||||
storing seeds.
|
||||
@@ -0,0 +1,84 @@
|
||||
|
||||
///\file "field/field05/.README.txt"
|
||||
///\brief Example field05 README page
|
||||
|
||||
/*! \page Examplefield05 Example field05
|
||||
|
||||
This example checks so-called "spin-frozen" condition
|
||||
There is a good example article hep-ph/0012087v1.
|
||||
This article discusses about how to cancel the muon g-2 precession by
|
||||
applying an electric field.
|
||||
|
||||
- 1) beta is muon velocity,
|
||||
- 2) B is an uniform magnetic field and vec{beta}.vec{B}=0,
|
||||
"." means scalar product,
|
||||
- 3) Radial electric field (E) in the lab frame and vec{beta}.vec{E}=0,
|
||||
- 4) a=(g-2)/2 is muon anomalous magnetic moment.
|
||||
|
||||
The required electric field to cancel the g-2 precession is,
|
||||
\verbatim
|
||||
E=a*B*light_c*gamma**2*beta.
|
||||
\endverbatim
|
||||
|
||||
In case of gamma=5 and B=0.24 Tesla, the required electric field is
|
||||
\verbatim
|
||||
E=2 MV/m.
|
||||
\endverbatim
|
||||
|
||||
"Spin-frozen" happens when spin rotation cycle and muon rotation cycle
|
||||
are same. In this case, both cycles should be 149.5 nsec.
|
||||
|
||||
See also:
|
||||
http://research.kek.jp/people/hiromi/MyHomePage/G-2_work_files/SpinStudyinEMfieldByGeant4.pdf
|
||||
|
||||
Credit goes to Hiromi Iinuma from KEK.
|
||||
|
||||
Classes Used
|
||||
|
||||
\section field05_s1 main ()
|
||||
|
||||
See field05.cc.
|
||||
|
||||
\section field05_s2 GEOMETRY DEFINITION
|
||||
|
||||
as simple world G4Box with a G4ElectroMagneticField \n
|
||||
propagating both spin and momentum (G4EqEMFieldWithSpin) \n
|
||||
with G4ClassicalRK4(fEquation,12) and \n
|
||||
Bz = 0.24*tesla; \n
|
||||
Er = 2.113987E+6*volt/m;
|
||||
|
||||
\section field05_s3 AN EVENT: THE PRIMARY GENERATOR
|
||||
|
||||
use mu+ G4ParticleGun with Pmu = 517.6*MeV/c \n
|
||||
and aligned spin and momentum direction
|
||||
|
||||
\section field05_s4 PHYSICS
|
||||
\verbatim
|
||||
RegisterPhysics(new G4SpinDecayPhysics());
|
||||
RegisterPhysics(new G4StepLimiterPhysics());
|
||||
|
||||
G4SpinDecayPhysics defines muon decay modes with spin,
|
||||
G4StepLimiterPhysics defines G4StepLimiter and G4UserSpecialCuts.
|
||||
|
||||
\section field05_s5 User Action Classes
|
||||
|
||||
SteppingAction: \n
|
||||
G4Exception when the cosine of the angle between
|
||||
the spin and the momentum is < (1.-1.E-7)
|
||||
|
||||
\section field05_s6 HOW TO START ?
|
||||
|
||||
- Execute field05 in 'batch' mode from macro files e.g.
|
||||
\verbatim
|
||||
% field05 field05.in > field.out &
|
||||
\endverbatim
|
||||
|
||||
- Execute field05 in 'interactive' mode with visualization e.g.
|
||||
\verbatim
|
||||
% field05
|
||||
....
|
||||
Idle> type your commands, for example:
|
||||
Idle> run/beamOn 1
|
||||
....
|
||||
\endverbatim
|
||||
*/
|
||||
@@ -0,0 +1,82 @@
|
||||
|
||||
=========================================================
|
||||
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
|
||||
=========================================================
|
||||
|
||||
|
||||
|
||||
field05 Example
|
||||
---------------
|
||||
|
||||
This example checks so-called "spin-frozen" condition
|
||||
There is a good example article hep-ph/0012087v1.
|
||||
This article discusses about how to cancel the muon g-2 precession by
|
||||
applying an electric field.
|
||||
|
||||
1) beta is muon velocity,
|
||||
2) B is an uniform magnetic field and \vec{beta}.\vec{B}=0,
|
||||
"." means scalar product,
|
||||
3) Radial electric field (E) in the lab frame and \vec{beta}.\vec{E}=0,
|
||||
4) a=(g-2)/2 is muon anomalous magnetic moment.
|
||||
|
||||
The required electric field to cancel the g-2 precession is,
|
||||
E=a*B*light_c*gamma**2*beta.
|
||||
|
||||
In case of gamma=5 and B=0.24 Tesla, the required electric field is
|
||||
E=2 MV/m.
|
||||
|
||||
"Spin-frozen" happens when spin rotation cycle and muon rotation cycle
|
||||
are same. In this case, both cycles should be 149.5 nsec.
|
||||
|
||||
See also:
|
||||
http://research.kek.jp/people/hiromi/MyHomePage/G-2_work_files/SpinStudyinEMfieldByGeant4.pdf
|
||||
|
||||
|
||||
Credit goes to Hiromi Iinuma from KEK.
|
||||
|
||||
**************
|
||||
*Classes Used*
|
||||
**************
|
||||
|
||||
1 - main()
|
||||
|
||||
See field05.cc.
|
||||
|
||||
2- GEOMETRY DEFINITION
|
||||
|
||||
as simple world G4Box with a G4ElectroMagneticField
|
||||
propagating both spin and momentum (G4EqEMFieldWithSpin)
|
||||
with G4ClassicalRK4(fEquation,12) and
|
||||
Bz = 0.24*tesla;
|
||||
Er = 2.113987E+6*volt/m;
|
||||
|
||||
3- AN EVENT: THE PRIMARY GENERATOR
|
||||
|
||||
use mu+ G4ParticleGun with Pmu = 517.6*MeV/c
|
||||
and aligned spin and momentum direction
|
||||
|
||||
4- PHYSICS
|
||||
|
||||
RegisterPhysics(new G4SpinDecayPhysics());
|
||||
RegisterPhysics(new G4StepLimiterPhysics());
|
||||
|
||||
G4SpinDecayPhysics defines muon decay modes with spin,
|
||||
G4StepLimiterPhysics defines G4StepLimiter and G4UserSpecialCuts.
|
||||
|
||||
5- User Action Classes
|
||||
|
||||
SteppingAction:
|
||||
G4Exception when the cosine of the angle between
|
||||
the spin and the momentum is < (1.-1.E-7)
|
||||
|
||||
6- HOW TO START ?
|
||||
|
||||
- Execute field05 in 'batch' mode from macro files e.g.
|
||||
% field05 field05.in > field.out &
|
||||
|
||||
- Execute field05 in 'interactive' mode with visualization e.g.
|
||||
% field05
|
||||
....
|
||||
Idle> type your commands, for example:
|
||||
Idle> run/beamOn 1
|
||||
....
|
||||
@@ -0,0 +1,68 @@
|
||||
|
||||
///\file "field/field06/.README.txt"
|
||||
///\brief Example field06 README page
|
||||
|
||||
/*! \page Examplefield06 Example field06
|
||||
|
||||
This example exercises the capability of tracking massive
|
||||
particles in a gravity field.
|
||||
|
||||
Credit goes to Erik Miller (Univ. of Northern British Columbia) and
|
||||
Garry Yan (Univ. of Toronto)
|
||||
|
||||
Classes Used
|
||||
|
||||
\section field06_s1 main()
|
||||
|
||||
See field06.cc.
|
||||
|
||||
\section field06_s2 GEOMETRY DEFINITION
|
||||
|
||||
As simple world G4Box with a G4UniformGravityField propagating momentum
|
||||
(G4EqGravityField) with G4ClassicalRK4(fEquation,8). The example uses the
|
||||
default gravity field on the earth's surface: gy = -9.81*m/s/s/c_light.
|
||||
|
||||
\section field06_s3 AN EVENT: THE PRIMARY GENERATOR
|
||||
|
||||
Uses an Ultra Cold Neutron (UCN) and G4ParticleGun with: \n
|
||||
particleEnergy = G4UniformRand()*1e-7*eV
|
||||
|
||||
UCN are launched from (0,0,0) uniform into 4pi
|
||||
|
||||
\section field06_s4 PHYSICS
|
||||
|
||||
The simulation knows of only six particles: G4Neutron, G4Proton,
|
||||
G4Electron, G4AntiNeutrinoE, G4MuonPlus and G4MuonMinus
|
||||
\verbatim
|
||||
RegisterPhysics(new G4StepLimiterPhysics());
|
||||
\endverbatim
|
||||
G4StepLimiterPhysics defines G4StepLimiter and G4UserSpecialCuts
|
||||
|
||||
\section field06_s5 HOW TO START ?
|
||||
|
||||
This example handles the program arguments in a new way.
|
||||
It can be run with the following optional arguments:
|
||||
\verbatim
|
||||
% field06 [-m macro ] [-u UIsession] [-t nThreads] [-r randomSeed]
|
||||
\endverbatim
|
||||
|
||||
The -t option is available only in multi-threading mode
|
||||
and it allows the user to override the Geant4 default number of
|
||||
threads. The number of threads can be also set via G4FORCENUMBEROFTHREADS
|
||||
environment variable which has the top priority.
|
||||
|
||||
- Execute field06 in 'batch' mode from macro files e.g.
|
||||
\verbatim
|
||||
% field06 -m field06.in > field06.out &
|
||||
\endverbatim
|
||||
|
||||
- Execute field06 in 'interactive' mode with visualization e.g.
|
||||
\verbatim
|
||||
% field06
|
||||
....
|
||||
Idle> type your commands, for example:
|
||||
Idle> run/beamOn 1
|
||||
....
|
||||
\endverbatim
|
||||
|
||||
*/
|
||||
@@ -0,0 +1,67 @@
|
||||
|
||||
=========================================================
|
||||
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
|
||||
=========================================================
|
||||
|
||||
|
||||
|
||||
field06 Example
|
||||
---------------
|
||||
|
||||
This example exercises the capability of tracking massive
|
||||
particles in a gravity field.
|
||||
|
||||
Credit goes to Erik Miller (Univ. of Northern British Columbia) and
|
||||
Garry Yan (Univ. of Toronto)
|
||||
|
||||
**************
|
||||
*Classes Used*
|
||||
**************
|
||||
|
||||
1 - main()
|
||||
|
||||
See field06.cc.
|
||||
|
||||
|
||||
2- GEOMETRY DEFINITION
|
||||
|
||||
As simple world G4Box with a G4UniformGravityField propagating momentum
|
||||
(G4EqGravityField) with G4ClassicalRK4(fEquation,8). The example uses the
|
||||
default gravity field on the earth's surface: gy = -9.81*m/s/s/c_light.
|
||||
|
||||
3- AN EVENT: THE PRIMARY GENERATOR
|
||||
|
||||
Uses an Ultra Cold Neutron (UCN) and G4ParticleGun with:
|
||||
particleEnergy = G4UniformRand()*1e-7*eV
|
||||
|
||||
UCN are launched from (0,0,0) uniform into 4pi
|
||||
|
||||
4- PHYSICS
|
||||
|
||||
The simulation knows of only six particles: G4Neutron, G4Proton,
|
||||
G4Electron, G4AntiNeutrinoE, G4MuonPlus and G4MuonMinus
|
||||
|
||||
RegisterPhysics(new G4StepLimiterPhysics());
|
||||
|
||||
G4StepLimiterPhysics defines G4StepLimiter and G4UserSpecialCuts
|
||||
|
||||
5- HOW TO START ?
|
||||
|
||||
This example handles the program arguments in a new way.
|
||||
It can be run with the following optional arguments:
|
||||
% field06 [-m macro ] [-u UIsession] [-t nThreads] [-r randomSeed]
|
||||
|
||||
The -t option is available only in multi-threading mode
|
||||
and it allows the user to override the Geant4 default number of
|
||||
threads. The number of threads can be also set via G4FORCENUMBEROFTHREADS
|
||||
environment variable which has the top priority.
|
||||
|
||||
- Execute field06 in 'batch' mode from macro files e.g.
|
||||
% field06 -m field06.in > field06.out &
|
||||
|
||||
- Execute field06 in 'interactive' mode with visualization e.g.
|
||||
% field06
|
||||
....
|
||||
Idle> type your commands, for example:
|
||||
Idle> run/beamOn 1
|
||||
....
|
||||
Reference in New Issue
Block a user