Problem with GeneralParticleSource user defined histogram

Hi everyone.
I have a strange problem with the GPS user defined histogram. It seems like at some point there is division by zero somewhere during the run. I tried changing the energies to lower values and suddenly at some point I stopped getting the error.

Any ideas how I can fix this?

Terminal error log:
ZMxpvInfiniteVector thrown:
ZMxpvInfiniteVector: Attempt to divide vector by 0 – will produce infinities and/or NANs
at line 299 in file /root/Downloads/2.4.4.0/CLHEP/Vector/src/ThreeVector.cc
terminate called after throwing an instance of ‘ZMxpvInfiniteVector’
what(): ZMxpvInfiniteVector: Attempt to divide vector by 0 – will produce infinities and/or NANs
Abort (core dumped)

Run file:

Change the default number of workers (in multi-threading mode)

/run/numberOfThreads 4

Initialize kernel

/run/initialize

/gps/ene/type User
/gps/hist/type energy
/gps/hist/point 2212.38938053096 0.415246215397869
/gps/hist/point 210176.991150443 0.415246215397869
/gps/hist/point 418141.592920354 0.275016223772348
/gps/hist/point 626106.194690266 0.0789319898472974
/gps/hist/point 834070.796460178 0.0310448734222262
/gps/hist/point 1042035.39823009 0.0265197142861716
/gps/hist/point 1250000 0.039559705636263
/gps/hist/point 1457964.60176991 0.0420309146381671
/gps/hist/point 1665929.20353982 0.0292983858775098
/gps/hist/point 1873893.80530974 0.0189140797158606
/gps/hist/point 2081858.40707965 0.0114152905380548
/gps/hist/point 2289823.00884956 0.00683177812085869
/gps/hist/point 2497787.61061947 0.00700646029735413
/gps/hist/point 2705752.21238938 0.00677452394797838
/gps/hist/point 2913716.81415929 0.00430041493335176
/gps/hist/point 3121681.41592921 0.00336911790123036
/gps/hist/point 3329646.01769912 0.00205056213886734
/gps/hist/point 3537610.61946903 0.000961447481121346
/gps/hist/point 3745575.22123894 0.000728302047469481

/tracking/verbose 0
/gps/particle mu1-
/gps/direction 0 0 1
/gps/position 0 0 -1000
/vis/viewer/zoom 1

/run/beamOn 1000

Not sure, may be something related to the position or the direction vector you defined. I suggest simplifying your example and rule out the options one by one. Use monoenergetic distribution, then isotropic etc. Similarly then simplifying your /hist/point spectra. Also, one trick you may want to do is save the spectra in a separate file and call it in your mac. This will make your mac tidy; see here.

Also, what if you define the particle type, position, biasing in the same sequence as here? Does that change anything. There are examples in Book For Application Developers.

Hi, Thanks for the reply.
The trick with the spectra is great, looks way better now. I tried changing the direction, and it seems that as soon as the particles begin interacting with the detector, the problems begin. Changing the energy didn’t changing anything. I’ll try changing some more parameters and see if perhaps that helps.