![]() |
![]() |
-------------------------------------------------- Argument list: IJ : particle type EKSCO : particle kinetic energy (GeV) PLA : particle momentum (GeV/c) WEE : particle weight MREG : previous region number NEWREG : current region number XX, YY, ZZ : particle position TXX, TYY, TZZ : particle direction Subroutine USRMED is activated by option MAT-PROP withSDUM= USERDIRE, for one or more materials indicated by the user. It is called every time a particle is going to be transported in one of the user-flagged materials. Two cases are possible: 1) MREG = NEWREG: the particle is going to move from a point inside the medium. The user is allowed to change only the particle weight. Typical application: simulating attenuation of optical photons in an absorbing medium by reducing the photon weight. 2) MREG not = NEWREG: the particle is going to move from a point on a boundary between two different regions. The user may change any of the following: particle weight, current region number, direction cosines. Typical applications: - simulating refraction, by changing the direction cosines so that the particle is still inside the same region. To do this, one generally needs the direction cosines of the normal to the surface: TXNOR(NPFLKA), TYNOR(NPFLKA), TZNOR(NPFLKA) (COMMON FLKSTK must be included). - simulating reflection (albedo) at a boundary. The direction cosines must be modified according to some reflection law or albedo angular distribution, and NEWREG must be set = MREG. In both cases the weight can also be reduced to account for surface reflectivity or similar (if the particle is an optical photon, the FRGHNS user function can be called to establish a surface roughness). Also, setting the weight WEE to zero is a way to kill the particle. If name-based input is being used, the names corresponding to MREG and NEWREG 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 above.