Please fill out the following information to help in answering your question, and also see tips for posting code snippets. If you don’t provide this information it will take more time to help with your problem!
Geant4 Version: Geant4v11
Operating System: macOS 15.7.3
Compiler/Version:
CMake Version:
Hi all,
I modified example hadr04 to try to modify neutron moderation. My use case requires generating neutrons with an arbitrary pointwise distribution. The application seems to work for monoenergetic neutrons; however, when I try with the arbitrary distribution, the neutrons are produced with the default value of 1 MeV and not as per the histogram.
Any thoughts on what the issue could be here?
Here are the relevant macro files that I’m using.
- moderation.mac
#
# Macro file for "Hadr04.cc"
#
# neutron 2 MeV; all processes
#
/control/verbose 2
/run/verbose 2
#
/testhadr/det/setMat HeavyWater
#/testhadr/det/setSize 20 cm
#
/testhadr/phys/thermalScattering true
#
/run/initialize
#
# Set the GPS source
/control/execute set_gps.mac
#
/analysis/setFileName Moderation_D20
/analysis/h1/set 1 100 0. 200. none #nb colli >1eV
/analysis/h1/set 2 100 0. 5. m #track len >1eV
/analysis/h1/set 3 100 0. 50. us #time of flight >1eV
/analysis/h1/set 4 100 0. 10000. none #nb colli <1eV
/analysis/h1/set 5 100 0. 100. m #track len <1eV
/analysis/h1/set 6 100 0. 100. ms #time of flight <1eV
/analysis/h1/set 7 100 0. 3 MeV #energy dist
#
/run/printProgress 200
/run/beamOn 500
- set_gps.mac
/control/execute vis.mac
# Use General Particle Source
/gps/particle neutron
#/gps/energy 2 MeV
/gps/position 0 0 0 cm
/gps/pos/type Point
# User defined
/gps/ene/type Arb
/gps/hist/type arb
/gps/hist/point 0.5 0.2
/gps/hist/point 1.0 0.2
/gps/hist/point 1.5 0.2
/gps/hist/point 2 0.8
/gps/hist/inter Lin
# Direction
/gps/ang/type iso
/gps/ang/mintheta 150 deg
/gps/ang/maxtheta 180 deg