5.3.18. User-defined source

An original source function can be used by editing usrsors.f and setting s-type = 100. If the following parameters are set, these values have priority over the user-defined data. Parameters with (D=***) are optional.

Table 5.3.199 x0

value

explanation

Minimum x coordinate [cm].

Table 5.3.200 x1

value

explanation

Maximum x coordinate [cm].

Table 5.3.201 y0

value

explanation

Minimum y coordinate [cm].

Table 5.3.202 y1

value

explanation

Maximum y coordinate [cm].

Table 5.3.203 z0

value

explanation

Minimum z coordinate [cm].

Table 5.3.204 z1

value

explanation

Maximum z coordinate [cm].

Table 5.3.205 sx

value

explanation

(D=0)

x component of spin.

Table 5.3.206 sy

value

explanation

(D=0)

y component of spin.

Table 5.3.207 sz

value

explanation

(D=0)

z component of spin.

Table 5.3.208 dir

value

explanation

Direction cosine of the projectile relative to the z-axis.

all

Isotropic source.

data

An a-type subsection is required.

Table 5.3.209 phi

value

explanation

(D=all)

Azimuthal angle [degree].

all

Randomly selected in the range from 0 to 360 degrees.

Table 5.3.210 dom

value

explanation

(D=0.0)

Solid angle spread [degree].

-1

\(\cos^2\) bias distribution.

Table 5.3.211 e0

value

explanation

For mono-energy source, specify the projectile energy [MeV/n]. For an energy spectrum, use e-type = instead.

Table 5.3.212 e-type

value

explanation

mono-energy source

Give the source energy [MeV/n] directly by e0.

energy spectrum

Specify the source energy distribution by e-type.

Table 5.3.213 wgt

value

explanation

(D=1.0)

Weight of source particles.

Table 5.3.214 factor

value

explanation

(D=1.0)

Normalization factor of the source particle.

Table 5.3.215 reg

value

explanation

(D=all)

Region restriction.

Table 5.3.216 ntmax

value

explanation

(D=1000)

Maximum number of retries when reg is specified.

Table 5.3.217 trcl

value

explanation

(D=none)

Transform number, or the definition of transform.

User-defined variables c1-c99 set by set can be used in usrsors.f as cval(1-99). Note that the last setting of set is used if the same variable is defined several times.

A sample program of usrsors.f is shown below. In the first comment part, there is a list of the variables necessary to define the source. Next, there is a list of kf-codes specifying the source particle. In the last part of the comment, the random number functions are shown, one for a uniform random number and the other for a Gaussian random number. The first part of the program is an example of the initialization, which describes the opening and closing of the data file. The remaining part shows a list of the variables the user should define in this subroutine.

Listing 5.3.2 usrsors.f
   1:   ************************************************************************
   2:         subroutine usrsors(x,y,z,u,v,w,e,wt,time,name,kf,nc1,nc2,nc3,
   3:        &                   sx,sy,sz)
   4:   *        sample subroutine for user defined source.                    *
   5:   *        variables :                                                   *
   6:   *           x, y, z : position of the source.                          *
   7:   *           u, v, w : unit vector of the particle direction.           *
   8:   *           e       : kinetic energy of particle (MeV).                *
   9:   *           wt      : weight of particle.                              *
  10:   *           time    : initial time of particle. (ns)                   *
  11:   *           name    : usually = 1, for Coulmb spread.                  *
  12:   *           kf      : kf code of the particle.                         *
  13:   *           nc1     : initial value of counter 1                       *
  14:   *           nc2     : initial value of counter 2                       *
  15:   *           nc3     : initial value of counter 3                       *
  16:   *           sx,sy,sz : spin components                                 *
  17:   *----------------------------------------------------------------------*
  18:   *        kf code table                                                 *
  19:   *           kf-code: ityp :  description                               *
  20:   *             2212 :   1  :  proton                                    *
  21:   *             2112 :   2  :  neutron                                   *
  22:   *              211 :   3  :  pion (+)                                  *
  23:   *              111 :   4  :  pion (0)                                  *
  24:   *             -211 :   5  :  pion (-)                                  *
  25:   *              -13 :   6  :  muon (+)                                  *
  26:   *               13 :   7  :  muon (-)                                  *
  27:   *              321 :   8  :  kaon (+)                                  *
  28:   *              311 :   9  :  kaon (0)                                  *
  29:   *             -321 :  10  :  kaon (-)                                  *
  30:   *           kf-code of the other transport particles                   *
  31:   *               12 :         nu_e                                      *
  32:   *               14 :         nu_mu                                     *
  33:   *              221 :         eta                                       *
  34:   *              331 :         eta'                                      *
  35:   *             -311 :         k0bar                                     *
  36:   *            -2112 :         nbar                                      *
  37:   *            -2212 :         pbar                                      *
  38:   *             3122 :         Lanmda0                                   *
  39:   *             3222 :         Sigma+                                    *
  40:   *             3212 :         Sigma0                                    *
  41:   *             3112 :         Sigma-                                    *
  42:   *             3322 :         Xi0                                       *
  43:   *             3312 :         Xi-                                       *
  44:   *             3334 :         Omega-                                    *
  45:   *----------------------------------------------------------------------*
  46:   *        available function for random number                          *
  47:   *           unirn(dummy) : uniform random number from 0 to 1           *
  48:   *           gaurn(dummy) : gaussian random number                      *
  49:   *                          for exp( - x**2 / 2 / sig**2 ) : sig = 1.0  *
  50:   ************************************************************************
  51:         implicit real*8 (a-h,o-z)
  52:   *-----------------------------------------------------------------------
  53:         parameter ( pi  = 3.141592653589793d0 )
  54:         data ifirst / 0 /
  55:         save ifirst
  56:         character filenm*50
  57:   *-----------------------------------------------------------------------
  58:   *        example of initialization
  59:   *-----------------------------------------------------------------------
  60:            if( ifirst .eq. 0 ) then
  61:   c              filenm = 'input.dat'
  62:   c              inquire( file = filenm, exist = exex )
  63:   c              if( exex .eqv. .false. ) then
  64:   c                 write(*,*) 'file does not exist =>  ', filenm
  65:   c                 call parastop( 887 )
  66:   c                 end if
  67:   c              open(71, file = file(i), status = 'old' )
  68:
  69:   c              close(71)
  70:                  ifirst = 1
  71:            end if
  72:   *-----------------------------------------------------------------------
  73:   *        example for 3 GeV proton with z-direction
  74:   *-----------------------------------------------------------------------
  75:               x = 0.0
  76:               y = 0.0
  77:               z = 0.0
  78:               u = 0.0
  79:               v = 0.0
  80:               w = 1.0
  81:               e = 3000.0
  82:              wt = 1.0
  83:            time = 0.0
  84:            name = 1
  85:              kf = 2212
  86:             nc1 = 0
  87:             nc2 = 0
  88:             nc3 = 0
  89:              sx = 0.d0
  90:              sy = 0.d0
  91:              sz = 0.d0
  92:   *-----------------------------------------------------------------------
  93:         return
  94:         end