Region of particle cannot be determined in extreme position

Hello FLUKA experts,

I am trying to create a muon source with the source_newgen.f template. These muons are to have a zenith angle distribution and an energy distribution. I have an error, and a few questions:

  1. The error:
    Region of particle in position -1.136407157E+27 -2.886724341E+26 3.000000000E+03 cannot be determined, error count: 1

    I believe the issue is related to my use of the sample_annular_distribution subroutine. The muon beam I’m trying to define must have particles coming from various positions uniformly distributed on a disk of radius 50 m. With a lower max radius, the simulation seems to run fine. However, above a certain threshold, the annular subroutine could be failing point. This point is so far out of the geometry which otherwise has no error.

  2. I’d like to use the sample_histogram_momentum_energy subroutine. Are there any peculiarities for making a histogram.txt file for this function? Must the probabilities be normalized?

  3. How can I sample the zenith angles in the same way as I’m doing it for the energy? Can I repurpose the sample_histogram_momentum_energy subroutine?

Thank you for your helpful advice.

Regan

nEXO-mu-n.inp (19.1 KB)
source_muon.f (19.3 KB)

Dear Regan,

  1. There is two issues with the annular sampling:
  • There is a bug, which requires setting the x and y coordinates in the source routine as well.
  • You need to use the double precision notation (like 5.0D0) when you set the minimum and maximum radius of the sampling.
  1. There is no need to manually normalize the probabilities, it is done automatically.

  2. Currently only one histogram can be specified. If you want to sample from more than one, you need to duplicate the the function using a different name.

  3. You probably want to look at the spectrum sampling routine posted here: Questions about source_newgen.f - #8 by mayank.rse This may be more suitable for sampling angles.

Cheers,
David