How many particles i am throwing when i give command /run/beamOn 1?

Hello Experts,
Can you please tell me when i switch on the GPS then give command /run/beamOn 1 then how many particles are incident on the object in this case or if i run it for more events then how can i calculate number of particles ?
in case of GPS, number of events is equal to number of beams from different angles, did i understood correctly ?
Can anyone please correct me if i am wrong.
Thanks in advance!
Priyanshu

The /run/beamOn command specifies the number of events you want to generate. Each event consists of a single call to your G4PrimaryGeneratorAction, followed by tracking of whatever primaries were specified.

You specify the number of primaries in your generator configuration. With G4ParticleGun, for example, the /gun/number command lets you specify how many primaries you want, and similarly with /gps/number for G4GeneralParticleSource.

1 Like

Okay. Thank you so much for the reply.
priyanshu

sorry, one more question that is if i do /run/beamOn 1 then it calls one time primary class and in this i specify in my generator configuration /gps/number 20 means in one event it will throw 20 particles from the same direction.
but now my question is, will all 20 particles be the same energy or these 20 particles will be 20 different energies that will be according to my primary.mac file.
since in my primary.mac file i am having /gps/hist/point 200MeV to 10000MeV (almost 1000 points of different energies between these energy values) then /gps/number 20 will incident 20 particles with which energy ?
Thanks
Priyanshu

I just checked: particles have the same origin/direction but different energies.

Test with /gps/number 2:

G4WT2 > * G4Track Information:   Particle = gamma,   Track ID = 2,   Parent ID = 0
G4WT2 > *********************************************************************************************************
G4WT2 > 
G4WT2 > Step#    X(mm)    Y(mm)    Z(mm) KinE(MeV)  dE(MeV) StepLeng TrackLeng  NextVolume ProcName
G4WT2 >     0      296     18.3 5.16e+03     >>>0.279<<<        0        0         0       World initStep
G4WT2 >     1      302    -73.1      161     0.279        0    5e+03     5e+03     mesh007 CoupledTransportation
...

G4WT2 > *********************************************************************************************************
G4WT2 > * G4Track Information:   Particle = gamma,   Track ID = 1,   Parent ID = 0
G4WT2 > *********************************************************************************************************
G4WT2 > 
G4WT2 > Step#    X(mm)    Y(mm)    Z(mm) KinE(MeV)  dE(MeV) StepLeng TrackLeng  NextVolume ProcName
G4WT2 >     0      296     18.3 5.16e+03      >>>4.67<<<        0        0         0       World initStep
G4WT2 >     1      302    -73.1      161      4.67        0    5e+03     5e+03     mesh007 CoupledTransportation
...

if for some reason you want to also have distinguishable locations for the generated primaries:

void myPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent) {
    for(G4int i = 0; i < desiredNumberOfParticles; i++) {
        fGeneralParticleSource->GeneratePrimaryVertex(anEvent);
    }
}

Thank you @weller for you reply!
means these are taking energy values from primary.mac file where we have specified the GCR spectra using the /gps/hist/point , right ?

and if i do /gps/number 2 then it will take two different values from the starting two points
similarly, /gps/number 5 , will take different energies starting from first point to fifth point of the GCR spectra, if i am correct ?

So for the space application, it (/gps/number )should be equal to the points of GCR spectra for one event, is it so ?

then for this space application, how many events should i run for good accuracy, can you please give an idea!

and one more last question, how you print this tracking information.
since, i am working in Extended/gdml/G01 example , then how can i do this?
Thank you again!
priyanshu

correct

not correct. with your histogram points, you define the spectrum which is the basis for your energy distribution. the energy of each primary will be random, and in large numbers resemble the same histogram as your input.

I don’t think it has anything to do with this…

no idea, sorry… as a first step, I would look at the statistics of your output quantities when performing a few runs with a certain number of primaries.

/tracking/verbose 1, but be careful with /run/beamOn N afterwards, this will extremely slow down performance, as it produces a lot of text!

1 Like

Thank you very much @weller @mkelsey .
really it helped me a lot in understanding all the silly questions coming in my mind.
Thank you again!
priyanshu