![]() |
![]() |
------------------------------------------------ Argument list: X,Y,Z,T : current position and time (input only) BTX,BTY,BTZ : direction cosines of the magnetic field vector (returned). B : magnetic field intensity in Tesla (returned) NREG : current region (input only) IDISC : if returned = 1, the particle will be discarded MAGFLD is activated by option MGNFIELD with WHAT(4-6) = 0.0 and is used to return intensity and direction of a magnetic field based on the current position, time, and region. It is called only if the current region has been flagged as having a non-zero magnetic field by option ASSIGNMAt, withWHAT(5)= 1.0. The magnetic field spatial distribution is often read and interpolated from an external field map. Note that in any case the direction cosines MUST be properly normalised in double precision (e.g. BTX = SQRT(ONEONE - BTY**2 - BTZ**2)), even if B = 0.0. Please read carefully the notes on option MGNFIELD. If name-based input is being used, the name corresponding to NREG can be obtained via a call to routine GEOR2N: CALL GEOR2N (NUMREG, NAMREG, IERR) where NUMREG (input variable) is the region number, and NAMREG (returned variable) is the corresponding region name (to be declared as CHARACTER*8). IERR is a returned error code: if = 0, the conversion is successful. See example in the description of BXDRAW below.