Message: why are particle energies the same? Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question why are particle energies the same? 

Forum: Particles
Date: 21 May, 2014
From: kunli <kunli>

Hello,

From the input and code, I try to shoot 3 particles into target, with different kinetic energy of 10, 11, 12 keV (in the for loop). While from the results, 3 particles are indeed shot in one event, but with the same initial kinetic energy of 12 keV. 
Could someone tell me what happened?

Thank you
Kun


---------Code--------------
void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent){
for (G4double n=particleEnergy_min; n<=particleEnergy_max; n++) {
    particleEnergy = n/1000*MeV;
    nParticle = 1;
    ....	
    AdjustParticleGun(particleName, particlePosition, particleDirection, particleEnergy); 
    particleGun->GeneratePrimaryVertex(anEvent);
    G4cout<<"--ParticleEnergy--"<<G4BestUnit(particleEnergy,"Energy")<<G4endl;
}
}

void PrimaryGeneratorAction::AdjustParticleGun(G4String particle_name, G4ThreeVector position, G4ThreeVector direction, G4double energy)
{...}
---------Input-----------
$ ./scintillator_01 --beam-energy-min 10 --beam-energy-max 12 --beam-on 1

---------Output---------
--ParticleEnergy--10 keV
--ParticleEnergy--11 keV
--ParticleEnergy--12 keV
1 Events (of 1) with Energy 12 keV simulated. (100%)  Seed = 0
...
//Generate 3 particles, each with same initial energy of 12 keV.

 Add Message Add Message
to: "why are particle energies the same?"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]