Back to home page

EIC code displayed by LXR

 
 

    


Warning, /geant4/examples/extended/field/field01/README is written in an unsupported language. File is not indexed.

0001 -------------------------------------------------------------------
0002 
0003      =========================================================
0004      Geant4 - an Object-Oriented Toolkit for Simulation in HEP
0005      =========================================================
0006 
0007                             field01
0008                             -------
0009 
0010     Example that enables investigation of the accuracy and performance of the
0011     tracking in a magnetic field.
0012 
0013     The key Geant4 capabilities demonstrated in this example are:
0014       - creating a uniform magnetic field interactively using the field
0015         messenger,
0016       - choosing the type of Runge Kutta stepper used for integration of the
0017         motion of charged particles in the magnetic field,
0018       - controlling the thresholds that determine which looping particles are
0019         killed by G4Transporation.
0020 
0021       Some of these capabilities are available via interactive commands,
0022       implemented in F01FieldMessenger.
0023 
0024     A. The magnetic field is defined in the ConstructSDandField() method 
0025        in the F01DetectorConstruction class using the G4FieldBuilder class.
0026 
0027        The interactive commands, under the /field directory, are created with
0028        the instantiation of G4FieldBuilder in the F03DetectorConstruction constructor,
0029 
0030     B. Choosing the type of stepper -
0031 
0032      The basic capabilities of choosing the stepper type are demonstrated in the
0033      field.in macro file:
0034 
0035        /field/stepperType  TsitourasRK45   ##  Choose a stepper type   ( Tsitouras )
0036 
0037        /field/stepperType  RK547FEq1       ##  Choose an FSAL stepper  ( FEqRK1 )
0038 
0039        /field/setMinimumStep 0.1 mm        ##  Smaller steps always succeed
0040 
0041        /field/update                       ##  Initialise using parameters above
0042                                            ##  if they were changed after initialization
0043 
0044      In addition it is possible to choose to use a new type of stepper, known
0045      as 'First Same as Last' or FSAL, which in each step obtains the field value
0046      at the step endpoint and evaluates the 'right hand size' of the equation
0047      for the next integration step.  This reduces the number of calls to the field
0048      evaluation, which can be one the most computationally expensive methods,
0049      while providing similar accuracy.
0050 
0051      There are several potential choices of the stepper type. Here are some
0052      suggestions:
0053      ===========================================================================
0054      Number  Name of Stepper      Comments
0055      ===========================================================================
0056      Recommended - default since Geant4 10.4:
0057 
0058        DormandPrince745 : Uses a pair 4th & 5th order formulae (like other 4/5
0059                                  well-known and very efficient embedded method
0060                                  methods); their difference is the error estimate.
0061                                  Highly recommended in literature, including
0062                                  Hairer & Wanner, & Numerical Recipes
0063                                  Used in several established RK code (e.g. DOPRI5)
0064      ===========================================================================
0065      Good choices for reasonably smooth fields:
0066 
0067        BogackiShampine45       : more efficient embedded 4/5 pair
0068                                  Used in many applications, including
0069                                  RKSUITE suite.
0070 
0071        TsitourasRK45           : potentially the most efficient embedded 4/5
0072                                  pair - found in expanded search of parameter
0073                                  space.
0074 
0075        DormandPrinceRK56       : higher order embedded method from authors of DoPri5.
0076                                   Uses a pair 5th & 6th order formulae.
0077 
0078        DormandPrinceRK78       : higher order embedded method from authors of DoPri5.
0079                                   Uses a pair 7th & 8th order formulae.
0080 
0081        NystromRK4              : a specialised Nystrom method for magnetic fields.
0082                                  Reuses the field value at the mid-point of the step,
0083                                  and also provides an analytical estimation of the
0084                                  integration error based on numerical evaluation of
0085                                  fourth order variation in the equation for
0086                                  magnetic field.
0087      ===========================================================================
0088      The new 'First Same as Last' (FSAL) steppers can be chosen in addition:
0089         RKFEq1                 : FSAL stepper with improved equilibrium properties.
0090                                  When kinks or other anomalies are encountered,
0091                                  and at the start of integration when the best
0092                                  step size is not known, this type of stepper
0093                                  converges faster and more smoothly to good
0094                                  step sizes.
0095      ===========================================================================
0096      The old default and old first alternative -
0097 
0098         ClassicalRK4           : original Runge-Kutta method, very robust but slower )
0099                                ( obtains error estimate by doing 2 half steps )
0100                                  Good baseline for comparison - long experience of use.
0101                                  May be good alternative for less smooth fields.
0102 
0103         CashKarpRKF45          : The oldest 'embedded' RK method in Geant4 -
0104                                  also fairly robust.
0105                                  Faster than  ClassicalRK4 for smoother fields,
0106                                  as it does not need two half steps to estimate error.
0107                                  Available since Geant4 1.0
0108 
0109      ===========================================================================
0110      Other potential choices for non-smooth fields (with kinks, abrupt changes):
0111 
0112         SimpleHeum             : low   order, with error obtained from half-steps
0113         BogackiShampine23      : lower order embedded method  (new in 10.3-beta)
0114      ===========================================================================
0115 
0116 
0117 
0118     C. Controlling the killing of looping particles
0119 
0120 
0121        Occasionally tracks 'looping' in a strong magnetic field, making little
0122        progress even over hundreds of integration steps.  This is due to a
0123        combination of a strong magnetic field and a thin material (gas or vacuum)
0124        in which the size of a physics step is substantially larger than the radius
0125        of curvature of the track.
0126 
0127        Since the amount of CPU time which can be consumed by one or few such tracks
0128        is very large, it is important to limit the number of integration steps
0129        spent on these tracks.  The module for propagation in field in Geant4
0130        flags tracks which take more than a certain number (default 1,000) integration
0131        steps without reaching the requested end of the step size, which was
0132        determined by the physics and geometry.
0133 
0134        The Geant4 G4Transportation and G4CoupledTransportation processes are tasked
0135        to select which of the looping tracks are killed and which survive. To
0136        balance the potential significant cost of integrating looping particles,
0137        three thresholds exist
0138 
0139         The 'Warning' Energy: a track with energy below this value that is found to
0140                               loop is killed silently (no warning.)
0141 
0142         Above the 'Warning Energy', if a track is selected for killing a warning is
0143         generated.
0144 
0145         The 'Important' Energy: the threshold energy above which a track will survive
0146         for multiple steps if found looping.
0147 
0148           number of 'tracking' steps.  They will be only be killed only if they still
0149        loop after than
0150         The number of 'trials': the number of steps that 'important' tracks survive.
0151 
0152         Note that currently only stable particles are killed. ( Refinements to enable
0153         toggling whether unstable particles can be killed are in development. )
0154 
0155        This example demonstrate choosing different values for these parametes
0156        in the main() method of field01.cc using one of two techniques.
0157 
0158        The first method is new in Geant4 release 10.5, and uses the G4PhysicsListHelper
0159        which has methods to choose a pre-selected set of parameter values. The choices
0160        are between a set each of low and high thresholds.  Either one can be enabled
0161        by calling correspondingly
0162            - G4PhysicsListHelper::GetPhysicsListHelper()->UseLowLooperThresholds();
0163           or
0164            - G4PhysicsListHelper::GetPhysicsListHelper()->UseHighLooperThresholds();
0165        These methods must be called before the physics is constructed - i.e. typically
0166        before RunManager's Initialise() method is called.
0167        This works only if either
0168            - a modular physics lists is used, or if
0169            - the G4ModularPhysicsList and its AddTransporation method are used
0170            to create and register a common transportation process for all particles
0171            (one for each thread).
0172 
0173        ii) Fine grained control (available in Geant4 versions since 7.0)
0174 
0175        Fine grained control of the Transportation's parameters for looping particles
0176        is also possible.
0177 
0178        This is demonstrated in the F01RunAction's ChangeLooperParameters method,
0179        which is called by the BeginOfRunAction.  There the appropriate
0180        Transportation object for the electron is obtained, and its parameters
0181        (if valid) are used to overwrite the thresholds in the G4Transportation class.
0182 
0183        For example, to ensure that only looping particles with energy 10 keV are
0184        killed silently we change the value of the 'Warning' Energy:
0185 
0186          runAction->SetWarningEnergy(   10.0 * CLHEP::keV );
0187 
0188        [ This is passed along to the registered G4Transportation or
0189        G4CoupledTransportation object by the F01RunAction's ChangeLooperParameters.]
0190 
0191        As a result the killing of any (stable) looping track with energy over 10 keV
0192        will generate a warning.
0193 
0194        A second configurable energy threshold enables tracks above it to survive a
0195        chosen number of 'tracking' steps.  They will be only be killed only if they
0196        still loop after than number of tracking steps.  F01RunAction's methods are
0197        used to configure these parameters:
0198 
0199          runAction->SetImportantEnergy( 0.1  * CLHEP::MeV );
0200          runAction->SetNumberOfTrials( 30 );
0201 
0202        which the run action passes to the G4Transportation or
0203        G4CoupledTransportation object registered for the electron.
0204 
0205        Note that for all pre-configured and modular physics lists share a single
0206        Transportation process for all types of particles.  So the parameters for
0207        killing loopers will be shared by all particle types in this case.
0208 
0209 
0210 Background Information
0211 
0212  1- GEOMETRY DEFINITION
0213 
0214         The "Absorber" is a solid made of a given material.
0215 
0216         Three parameters define the absorber :
0217         - the material of the absorber,
0218         - the thickness of an absorber,
0219         - the transverse size of the absorber (the input face is a square).
0220 
0221         The volume "World" contains the "Absorber".
0222         In this test the parameters of the "World" can be changed , too.
0223 
0224         In addition a transverse uniform magnetic field can be applied.
0225 
0226         The default geometry is constructed in F01DetectorConstruction class,
0227         but all the parameters can be changed via
0228         the commands defined in the F01DetectorMessenger class.
0229 
0230  2- AN EVENT : THE PRIMARY GENERATOR
0231 
0232         The primary kinematic consists of a single particle (electron, Ekin = 0.5 GeV)
0233         which hits the
0234         absorber perpendicular to the input face. The type of the particle
0235         and its energy are set in the F01PrimaryGeneratorAction class, and can
0236         be changed via the G4 build-in commands of G4ParticleGun class (see
0237         the macros provided with this example).
0238 
0239     It is also possible to change the position of the primary particle vertex
0240     or activate its randomization via the commands defined in  the
0241     F01PrimaryGeneratorMessenger class.
0242 
0243         A RUN is a set of events.
0244 
0245  3- DETECTOR RESPONSE
0246 
0247     The spatial distribution of charged particles transported in magnetic
0248         field is envistigated.
0249         A HIT is a record, event per event , of all the
0250         informations needed to simulate and analyse the detector response.
0251 
0252         In this example a F01CalorHit is defined as a set of 2 informations:
0253         - the total energy deposit in the absorber,
0254         - the total tracklength of all charged particles in the absorber,
0255 
0256         Therefore  the absorber is declared
0257         'sensitive detector' (SD), see F01CalorimeterSD, which means they can contribute to the hit.
0258 
0259  4- PHYSICS LIST
0260 
0261      The particle's type and the physic processes which will be available
0262      in this example are set in the FTFP_BERT physics list. This physics list
0263      requires data files for electromagnetic and hadronic processes.
0264      See more on installation of the datasets in Geant4 Installation Guide,
0265 
0266  5- HOW TO START ?
0267 
0268         - Execute field01 in 'batch' mode from macro file e.g.
0269                 % ./field01 field01.in
0270 
0271         - Execute field01 in 'interactive' mode with visualization e.g.
0272                 % ./field01
0273                 ....
0274                 Idle> /run/beamOn 1
0275                 ....
0276 
0277 
0278