Issue with GPS energy spectrum interpolation

Hello everyone,
in my application I simulate primary neutrons using GPS with a point-wise energy spectrum. I use
/gps/ene/type Arb
/gps/hist/type arb
and then define many energy histogram points via /gps/hist/point.
In between the given points, the spectrum is interpolated.
Now, I see a strange behavior when choosing Spline interpolation (via /gps/hist/inter Spline). When creating a histogram of the primary particles’ energy, it seems like some energies are simulated too often, leading to small spikes in the spectrum. This problem doesn’t seem to occur when choosing Linear interpolation (/gps/hist/inter Lin). I attached the spectra to demonstrate the effect. On the left side of the image, one can see the results for Spline interpolation, on the right side for Linear interpolation.

When doing a cubic spline interpolation of the spectrum outside Geant4 (with scipy.interpolate), this effect does not occur.

I use Geant4 version 10.7.0.

Did anyone notice similar issues with the Spline interpolation? Thanks in advance!

Can you please tell me that how you invoked GPS in your application ?
Actually, i am changing particle gun to General particle source (GPS). can you please help me with this ?
Thanks in advance !

If you change G4ParticleGun to G4GeneralParticleSource in your application, then when you run it, you will automatically get all of the /gps/... macro commands defined. You can then use those commands to set up your source.

Thank you for your reply!
Yes, i changed G4ParticleGun to G4GeneralParticleSource but when i run this i get these errors ?
should i also include primary.mac file ?

You’re setting a class data member to the new G4GeneralParticleSource pointer. Did you change the type of that data member in the .hh file?

Then, you’re calling member functions of G4ParticleGun to initialize the generator. Did you confirm (by looking at G4GeneralParticleSource.hh) that those member functions have the same names for GPS? (2.5 KB)
G01ActionInitialization.hh (2.2 KB)
G01DetectorConstruction.hh (2.3 KB) (3.1 KB)
G01PrimaryGeneratorAction.hh (2.3 KB)

These are the files(src and header) that i have in the application where i am working on. and in this i am trying to invoke GPS in place of particle gun but i am facing so many errors.
In this application there is no header file of G4GeneralParticleSource.hh, it just call this header file.
so can you please point me out that where i am doing wrong. it will be very helpful.
Thank you very much.