207{
209 if (command==listCmd)
210 {
212 }
213 else if (command==particleCmd)
214 {
215 if (newValues =="ion")
216 {
217 fShootIon = true;
218 }
219 else
220 {
221 fShootIon = false;
223 if(pd != nullptr)
224 {
226 }
227 else
228 {
229 ed << "Particle [" << newValues << "] is not found.";
231 }
232 }
233
234 } else if( command==directionCmd )
236 else if( command==energyCmd )
238 else if( command==momCmd )
240 else if( command==momAmpCmd )
242 else if( command==positionCmd )
244 else if( command==timeCmd )
246 else if( command==polCmd )
248 else if( command==numberCmd )
250 else if( command==ionCmd )
251 {
252 if (fShootIon)
253 {
254 IonCommand(newValues);
255 }
256 else
257 {
258 ed << "Set /gun/particle to ion before using /gun/ion command";
260 }
261 }
262 else if( command==ionLvlCmd )
263 {
265 depWarn << "\nCommand /gun/ionL is deprecated and will be removed in future releases.\n"
266 << "Use /gun/ion instead.\n";
267 G4Exception(
"G4ParticleGunMessenger::SetNewValue",
"IonLWarn",
269
270 if (fShootIon)
271 {
272 IonLevelCommand(newValues);
273 }
274 else
275 {
276 ed << "Set /gun/particle to ion before using /gun/ion command";
278 }
279 }
280}
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)