From: Chris Theis (Christian.Theis@cern.ch)
Date: Wed Jun 27 2007 - 18:25:50 CEST
Hello Laurent,
>
> I try to sample a synchrotron source for Fluka calculations and i use
> for that source.f . I perform an uniform sampling over my energy range
> [1:500] keV and this sampling is very efficient (I manage to sample
all
> the energies).
Actually your sampling is efficient only at the first glance because you
have the same chance to sample parts of your spectrum which are not very
important (=low weight), as you have sampling the important ones (=high
weight). Depending on your spectrum and the respective weights this
approach might work, but I'd recommend a different way to elude the
problems you're running into.
> 2) If an uniform sampling is not desirable for this type of spectra
> (because of the huge weight interval), do you recommends a better
> function that 1/N(E) to biase the spectra ?
Instead of sampling the energy interval uniformly and tampering with the
weights of the particles you could do it the other way round. Namely,
you sample the important parts of your spectrum (those with the high
weights) with a higher probability than those that have a lower
contribution to the result. This way you do not need to change the
weight and introduce large weight fluctuations.
There are a number of ways that you could to this:
*) Inversion method: You calculate the the integral of your spectrum
iteratively over all bins. In the end you'll end up with a table of N
bins, like your original spectrum, and each bin X contains the integral
from the start-bin up to bin index X. After normalization this will give
you the tabulated cumulative distribution function of your spectrum. Now
you can sample this function uniformly and mapping the result back to
the original spectrum you can determine the energy of the particle that
should be started.
*) Rejection sampling for your spectrum either with a uniform function
as a delimiter or a biased function. However, these things are a little
trickier to implement and the efficiency strongly depends on the
delimiting function.
*) Transformation method, if your spectrum can be described by an
analytical function that is bijective and integrable.
Cheers
Chris
------------------------------------------------------------------------
-- Chris Theis CERN/SC-RP - European Organization for Nuclear Research 1211 Geneva 23, Switzerland Phone: +41 22 767 8069 Office: 892-2A-015 e-mail: Christian.Theis@cern.ch www: http://www.cern.ch/theis ------------------------------------------------------------------------ --
This archive was generated by hypermail 2.1.6 : Thu Jun 28 2007 - 00:38:55 CEST