48 :fParticleGun(fPtclGun),fShootIon(false)
53 gunDirectory->
SetGuidance(
"Particle Gun control commands.");
60 particleCmd->
SetGuidance(
"Set particle to be generated.");
62 particleCmd->
SetGuidance(
" (ion can be specified for shooting ions)");
67 for(
G4int i=0;i<nPtcl;i++)
76 candidateList +=
"ion ";
80 directionCmd->
SetGuidance(
"Set momentum direction.");
81 directionCmd->
SetGuidance(
"Direction needs not to be a unit vector.");
83 directionCmd->
SetRange(
"ex != 0 || ey != 0 || ez != 0");
93 momCmd->
SetGuidance(
"Set momentum. This command is equivalent to two commands /gun/direction and /gun/momentumAmp");
95 momCmd->
SetRange(
"px != 0 || py != 0 || pz != 0");
99 momAmpCmd->
SetGuidance(
"Set absolute value of momentum.");
100 momAmpCmd->
SetGuidance(
"Direction should be set by /gun/direction command.");
101 momAmpCmd->
SetGuidance(
"This command should be used alternatively with /gun/energy.");
106 positionCmd->
SetGuidance(
"Set starting position of the particle.");
113 timeCmd->
SetGuidance(
"Set initial time of the particle.");
122 polCmd->
SetRange(
"Px>=-1.&&Px<=1.&&Py>=-1.&&Py<=1.&&Pz>=-1.&&Pz<=1.");
125 numberCmd->
SetGuidance(
"Set number of particles to be generated.");
130 ionCmd->
SetGuidance(
"Set properties of ion to be generated.");
134 ionCmd->
SetGuidance(
" Q:(int) Charge of Ion (in unit of e)");
135 ionCmd->
SetGuidance(
" E:(double) Excitation energy (in keV)");
177 if( command==listCmd )
179 else if( command==particleCmd )
181 if (newValues ==
"ion") {
190 else if( command==directionCmd )
192 else if( command==energyCmd )
194 else if( command==momCmd )
196 else if( command==momAmpCmd )
198 else if( command==positionCmd )
200 else if( command==timeCmd )
202 else if( command==polCmd )
204 else if( command==numberCmd )
206 else if( command==ionCmd )
207 { IonCommand(newValues); }
214 if( command==directionCmd )
216 else if( command==particleCmd )
218 else if( command==energyCmd )
222 {
G4cerr <<
" G4ParticleGun: was defined in terms of momentum." <<
G4endl; }
226 else if( command==momCmd || command==momAmpCmd )
230 {
G4cerr <<
" G4ParticleGun: was defined in terms of kinetic energy." <<
G4endl; }
233 if( command==momCmd )
239 else if( command==positionCmd )
241 else if( command==timeCmd )
243 else if( command==polCmd )
245 else if( command==numberCmd )
247 else if( command==ionCmd )
250 cv =
ItoS(fAtomicNumber) +
" " +
ItoS(fAtomicMass) +
" ";
251 cv +=
ItoS(fIonCharge);
259 void G4ParticleGunMessenger::IonCommand(
G4String newValues)
264 fAtomicNumber =
StoI(next());
265 fAtomicMass =
StoI(next());
268 fIonCharge = fAtomicNumber;
270 fIonCharge =
StoI(sQ);
273 fIonExciteEnergy = 0.0;
275 fIonExciteEnergy =
StoD(sQ) *
keV;
280 ion = particleTable->
GetIon( fAtomicNumber, fAtomicMass, fIonExciteEnergy);
282 G4cout <<
"Ion with Z=" << fAtomicNumber;
283 G4cout <<
" A=" << fAtomicMass <<
"is not be defined" <<
G4endl;
289 G4cout <<
"Set /gun/particle to ion before using /gun/ion command";