Re: [fluka-discuss]: About user routine:how to define the energy distribution of part icles in source.f

From: Alberto Fasso' <fasso_at_slac.stanford.edu>
Date: Wed, 13 May 2015 07:14:57 -0700 (PDT)

The function FLNRRN returns a Gaussian distributed random number, not an
energy in GeV!
More precisely: it returns a random number normally distributed between
minus infinity and plus infinity, centered at zero, and with a standard
deviation equal to 1.

Therefore, if your Gaussian distribution is centered at ECENTR (in GeV!)
and has a standard deviation of ESIGMA (also in GeV), you must multiply the
sampled number by ESIGMA, and add it to ECENTR.

        DATA ECENTR / value in GeV /, ESIGMA / value in GeV /
        ...........................................................

        CALL FLNRRN (RGAUSS)
        ENSAMP = RGAUSS * ESIGMA + ECENTR
        TKEFLK (NPFLKA) = ENSAMP
        PMOFLK (NPFLKA) = SQRT (ENSAMP * (ENSAMP + TWOTWO * AM(IJBEAM)))

Note also that I have removed your line REAL RGAUSS=0.0, which has no
meaning. And remember, when programming user routines, that you can declare
LOGICAL or CHARACTER variables, but MUST NOT declare any variable as REAL or
INTEGER. In FLUKA, all variables with name beginning with I,J,K,L,M,N (if not
LOGICAL or CHARACTER) are INTEGER. All the others are DOUBLE PRECISION
(not REAL!)

Again, I repeat here what I have written today to another user: if you are a
beginner, or if you are not familiar with the Fluka programming rules, please
avoid writing user routines.

Alberto



On Wed, 13 May 2015, 2013200577 wrote:

> Hi ,everyone !
> Here is my question: I define the energy distribution of particles by
> sampling from a Gaussian distrbution,but there seems to be some error,who can
> help me find it?Thank you very much.
>
>
>
>
>
> REAL RGAUSS=0.0
> CALL FLNRRN (RGAUSS)
> ENSAMP=RGAUSS
> TKEFLK (NPFLKA) = ENSAMP
> PMOFLK (NPFLKA) = SQRT (ENSAMP * (ENSAMP + TWOTWO * AM(IJBEAM)))

__________________________________________________________________________
You can manage unsubscription from this mailing list at https://www.fluka.org/fluka.php?id=acc_info
Received on Wed May 13 2015 - 17:40:03 CEST

This archive was generated by hypermail 2.3.0 : Wed May 13 2015 - 17:40:11 CEST