The randomness of GPS and energy spectrum

Hi all,
I use the G4GeneralParticleSource class and UI comands to define a particle source with energy spectrum. Let’s denote the spectrum p_i, and i is the index of bins related to energy. In a run (sampling) N particles are simulated. If we focus on a perticular bin i, then this bin should have N*p_i particles . But the number N*p_i is its expectation value, not the real number of particles in the bin i, and the real number in bin i is not same in each run. Since it’s a binomial distribution with probability p_i and N times expriments, its real number generated in bin i should have variance var=N*p_i(1-p_i)

My question is that can geant4 handle this randomness automaticly or it only generate N*p_i particles in the bin i? I don’t know that if I defined a energy spectrum using UI command /gps/hist/point energy probability do I need some commands to deal with the randomness of its distribution.

if you configure it that way, gps randomly generates the energy according to the probability distribution. the variance for each bin is a result of that random process, and i think can(&needs) not (to) be configured.

yeah, you are right. I have checked it by repeated simulations. It has variance in each bin.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.