I’ve written a muon source file that samples angles and energies from two spectra. This works fine. What I’d like to do is target a particular region of interest (ROI) in order to increase statistical yield. I treat the muons as straight trajectories and check a few parametric equations to determine if the muon will in fact intersect the ROI. The function I’ve written works if called in a standalone f90 file, but not in the simulation. The only error I get is: executable returned RC=136. I’ll attach the source file, the input file, and the spectra for sampling. I’d appreciate anyone explaining why this doesn’t work.

Extra details:

Running the latest FLUKA on MacOS with gcc version 10.4.0

You are using the sample_spectrum function (which is now available as the built in function sample_spectrum_momentum_energy), where you only ony one energy value, but your files has a minimum and maximum energy value, thus the appropriate sampling function is sample_histogram_momentum_energy.

These sampling function can handle only one file at the moment, so you need to duplicate them with a different name, to be able to use for the energy and direction sampling separately.

For the direction sampling you need to use GeV instead of MeV to avoid the unit conversion

Finally, the line

azimuth = acos(cos_x/sin(zenith))

creates an arithmetic error, probably because the cos_x, cos_y, and cos_z values are independently sampled and are not normalized.

Cheers,
David

P.S.: You can find the traceback of the error in the fluka_<nnnnn>/<inputfile>001.log file.