208{
210 if (command==listCmd)
211 {
213 }
214 else if (command==particleCmd)
215 {
216 if (newValues =="ion")
217 {
218 fShootIon = true;
219 }
220 else
221 {
222 fShootIon = false;
224 if(pd != nullptr)
225 {
227 }
228 else
229 {
230 ed << "Particle [" << newValues << "] is not found.";
232 }
233 }
234
235 } else if( command==directionCmd )
237 else if( command==energyCmd )
239 else if( command==momCmd )
241 else if( command==momAmpCmd )
243 else if( command==positionCmd )
245 else if( command==timeCmd )
247 else if( command==polCmd )
249 else if( command==numberCmd )
251 else if( command==ionCmd )
252 {
253 if (fShootIon)
254 {
255 IonCommand(newValues);
256 }
257 else
258 {
259 ed << "Set /gun/particle to ion before using /gun/ion command";
261 }
262 }
263 else if( command==ionLvlCmd )
264 {
266 depWarn << "\nCommand /gun/ionL is deprecated and will be removed in future releases.\n"
267 << "Use /gun/ion instead.\n";
268 G4Exception(
"G4ParticleGunMessenger::SetNewValue",
"IonLWarn",
270
271 if (fShootIon)
272 {
273 IonLevelCommand(newValues);
274 }
275 else
276 {
277 ed << "Set /gun/particle to ion before using /gun/ion command";
279 }
280 }
281}
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
void SetNumberOfParticles(G4int i)
void SetParticlePolarization(G4ThreeVector aVal)
void SetParticleMomentum(G4double aMomentum)
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
void DumpTable(const G4String &particle_name="ALL")
static G4ThreeVector GetNew3VectorValue(const char *paramString)
static G4ThreeVector GetNew3VectorValue(const char *paramString)
static G4double GetNewDoubleValue(const char *paramString)
static G4int GetNewIntValue(const char *paramString)
void CommandFailed(G4int errCode, G4ExceptionDescription &ed)