Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/event/src/G4GeneralParticleSourceMessenger.cc

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /event/src/G4GeneralParticleSourceMessenger.cc (Version 11.3.0) and /event/src/G4GeneralParticleSourceMessenger.cc (Version 10.7.p4)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
 26 // G4GeneralParticleSourceMessenger class impl     26 // G4GeneralParticleSourceMessenger class implementation
 27 //                                                 27 //
 28 // Author: Fan Lei, QinetiQ ltd.                   28 // Author: Fan Lei, QinetiQ ltd.
 29 // Customer: ESA/ESTEC                             29 // Customer: ESA/ESTEC
 30 // Revisions: Andrew Green, Andrea Dotti           30 // Revisions: Andrew Green, Andrea Dotti
 31 // -------------------------------------------     31 // --------------------------------------------------------------------
 32                                                    32 
 33 #include "G4GeneralParticleSourceMessenger.hh"     33 #include "G4GeneralParticleSourceMessenger.hh"
 34                                                    34 
 35 #include "G4PhysicalConstants.hh"                  35 #include "G4PhysicalConstants.hh"
 36 #include "G4SystemOfUnits.hh"                      36 #include "G4SystemOfUnits.hh"
 37 #include "G4Geantino.hh"                           37 #include "G4Geantino.hh"
 38 #include "G4ThreeVector.hh"                        38 #include "G4ThreeVector.hh"
 39 #include "G4ParticleTable.hh"                      39 #include "G4ParticleTable.hh"
 40 #include "G4IonTable.hh"                           40 #include "G4IonTable.hh"
 41 #include "G4UIdirectory.hh"                        41 #include "G4UIdirectory.hh"
 42 #include "G4UIcmdWithoutParameter.hh"              42 #include "G4UIcmdWithoutParameter.hh"
 43 #include "G4UIcmdWithAString.hh"                   43 #include "G4UIcmdWithAString.hh"
 44 #include "G4UIcmdWithADoubleAndUnit.hh"            44 #include "G4UIcmdWithADoubleAndUnit.hh"
 45 #include "G4UIcmdWith3Vector.hh"                   45 #include "G4UIcmdWith3Vector.hh"
 46 #include "G4UIcmdWith3VectorAndUnit.hh"            46 #include "G4UIcmdWith3VectorAndUnit.hh"
 47 #include "G4UIcmdWithAnInteger.hh"                 47 #include "G4UIcmdWithAnInteger.hh"
 48 #include "G4UIcmdWithADouble.hh"                   48 #include "G4UIcmdWithADouble.hh"
 49 #include "G4UIcmdWithABool.hh"                     49 #include "G4UIcmdWithABool.hh"
 50 #include "G4ios.hh"                                50 #include "G4ios.hh"
 51                                                    51 
 52 #include "G4Tokenizer.hh"                          52 #include "G4Tokenizer.hh"
 53 #include "G4SingleParticleSource.hh"               53 #include "G4SingleParticleSource.hh"
 54 #include "G4GeneralParticleSource.hh"              54 #include "G4GeneralParticleSource.hh"
 55                                                    55 
 56 #include "G4AutoLock.hh"                           56 #include "G4AutoLock.hh"
 57                                                    57 
 58 namespace                                          58 namespace
 59 {                                                  59 {
 60   G4Mutex creationM = G4MUTEX_INITIALIZER;         60   G4Mutex creationM = G4MUTEX_INITIALIZER;
 61   G4GeneralParticleSourceMessenger* theInstanc     61   G4GeneralParticleSourceMessenger* theInstance = nullptr;
 62 }                                                  62 }
 63                                                    63 
 64 G4GeneralParticleSourceMessenger*                  64 G4GeneralParticleSourceMessenger*
 65 G4GeneralParticleSourceMessenger::GetInstance(     65 G4GeneralParticleSourceMessenger::GetInstance(G4GeneralParticleSource* psc)
 66 {                                                  66 {
 67   G4AutoLock l(&creationM);                        67   G4AutoLock l(&creationM);
 68   if ( theInstance == nullptr )                    68   if ( theInstance == nullptr )
 69     theInstance = new G4GeneralParticleSourceM     69     theInstance = new G4GeneralParticleSourceMessenger(psc);
 70   return theInstance;                              70   return theInstance;
 71 }                                                  71 }
 72                                                    72 
 73 void G4GeneralParticleSourceMessenger::Destroy     73 void G4GeneralParticleSourceMessenger::Destroy()
 74 {                                                  74 {
 75   G4AutoLock l(&creationM);                        75   G4AutoLock l(&creationM);
 76   if ( theInstance != nullptr )                    76   if ( theInstance != nullptr )
 77   {                                                77   {
 78     delete theInstance;                            78     delete theInstance;
 79     theInstance = nullptr;                         79     theInstance = nullptr;
 80   }                                                80   }
 81 }                                                  81 }
 82                                                    82 
 83 // -------------------------------------------     83 // --------------------------------------------------------------------
 84 //                                                 84 //
 85 G4GeneralParticleSourceMessenger::                 85 G4GeneralParticleSourceMessenger::
 86 G4GeneralParticleSourceMessenger(G4GeneralPart     86 G4GeneralParticleSourceMessenger(G4GeneralParticleSource* fPtclGun) 
 87   : fGPS(fPtclGun)                                 87   : fGPS(fPtclGun)
 88 {                                                  88 {
 89   // A.Dotti - 10th October 2014                   89   // A.Dotti - 10th October 2014
 90   // This messenger is special: it is instanti     90   // This messenger is special: it is instantiated in a user action but (e.g.
 91   // in a thread).                                 91   // in a thread).
 92   // The UI commands it defines should be exec     92   // The UI commands it defines should be executed by the *master* thread
 93   // because they operate on shared resources      93   // because they operate on shared resources and we want the UI commands to
 94   // take effect BEFORE the threads do some wo     94   // take effect BEFORE the threads do some work (so all data are properly
 95   // initialized).                                 95   // initialized).
 96   // To achieve this behavior we set to true a     96   // To achieve this behavior we set to true a base class protected
 97   // data member. Since it makes no sense to h     97   // data member. Since it makes no sense to have more than one instance
 98   // of the messenger, we check that we actual     98   // of the messenger, we check that we actually have only one.
 99   // Note that the logic of implementing, in a     99   // Note that the logic of implementing, in a given worker thread only one
100   // messenger is deleted/fated to the creator    100   // messenger is deleted/fated to the creator
101                                                   101 
102   commandsShouldBeInMaster = true;                102   commandsShouldBeInMaster = true;
103                                                   103 
104   particleTable = G4ParticleTable::GetParticle    104   particleTable = G4ParticleTable::GetParticleTable();
105   histtype = "biasx";                             105   histtype = "biasx";
106                                                   106 
107   // UI Commands only for master                  107   // UI Commands only for master
108   //                                              108   //
109   G4bool broadcast = false;                       109   G4bool broadcast = false;
110   gpsDirectory = new G4UIdirectory("/gps/",bro    110   gpsDirectory = new G4UIdirectory("/gps/",broadcast);
111                                                   111     
112   gpsDirectory->SetGuidance("General Particle     112   gpsDirectory->SetGuidance("General Particle Source control commands.");
113                                                   113 
114   // Now the commands for multiple sources        114   // Now the commands for multiple sources
115   //                                              115   //
116   sourceDirectory = new G4UIdirectory("/gps/so    116   sourceDirectory = new G4UIdirectory("/gps/source/");
117   sourceDirectory->SetGuidance("Multiple sourc    117   sourceDirectory->SetGuidance("Multiple source control sub-directory");
118                                                   118 
119   addsourceCmd = new G4UIcmdWithADouble("/gps/    119   addsourceCmd = new G4UIcmdWithADouble("/gps/source/add",this);
120   addsourceCmd->SetGuidance("Add a new source     120   addsourceCmd->SetGuidance("Add a new source definition to the particle gun");
121   addsourceCmd->SetGuidance(" with the specifi    121   addsourceCmd->SetGuidance(" with the specified intensity");
122   addsourceCmd->SetParameterName("addsource",f    122   addsourceCmd->SetParameterName("addsource",false,false);
123   addsourceCmd->SetRange("addsource > 0.");       123   addsourceCmd->SetRange("addsource > 0.");
124                                                   124 
125   listsourceCmd = new G4UIcmdWithoutParameter(    125   listsourceCmd = new G4UIcmdWithoutParameter("/gps/source/list",this);
126   listsourceCmd->SetGuidance("List the defined    126   listsourceCmd->SetGuidance("List the defined particle sources");
127                                                   127 
128   clearsourceCmd = new G4UIcmdWithoutParameter    128   clearsourceCmd = new G4UIcmdWithoutParameter("/gps/source/clear",this);
129   clearsourceCmd->SetGuidance("Remove all the     129   clearsourceCmd->SetGuidance("Remove all the defined particle sources");
130                                                   130 
131   getsourceCmd = new G4UIcmdWithoutParameter("    131   getsourceCmd = new G4UIcmdWithoutParameter("/gps/source/show",this);
132   getsourceCmd->SetGuidance("Show the current     132   getsourceCmd->SetGuidance("Show the current source index and intensity");
133                                                   133 
134   setsourceCmd = new G4UIcmdWithAnInteger("/gp    134   setsourceCmd = new G4UIcmdWithAnInteger("/gps/source/set",this);
135   setsourceCmd->SetGuidance("Set the indexed s    135   setsourceCmd->SetGuidance("Set the indexed source as the current one");
136   setsourceCmd->SetGuidance(" so one can chang    136   setsourceCmd->SetGuidance(" so one can change its source definition");
137   setsourceCmd->SetParameterName("setsource",f    137   setsourceCmd->SetParameterName("setsource",false,false);
138   setsourceCmd->SetRange("setsource >= 0");       138   setsourceCmd->SetRange("setsource >= 0");
139                                                   139 
140   deletesourceCmd = new G4UIcmdWithAnInteger("    140   deletesourceCmd = new G4UIcmdWithAnInteger("/gps/source/delete",this);
141   deletesourceCmd->SetGuidance("Delete the ind    141   deletesourceCmd->SetGuidance("Delete the indexed source from the list");
142   deletesourceCmd->SetParameterName("deletesou    142   deletesourceCmd->SetParameterName("deletesource",false,false);
143   deletesourceCmd->SetRange("deletesource > 0"    143   deletesourceCmd->SetRange("deletesource > 0");
144                                                   144 
145   setintensityCmd = new G4UIcmdWithADouble("/g    145   setintensityCmd = new G4UIcmdWithADouble("/gps/source/intensity",this);
146   setintensityCmd->SetGuidance("Reset the curr    146   setintensityCmd->SetGuidance("Reset the current source to the specified intensity");
147   setintensityCmd->SetParameterName("setintens    147   setintensityCmd->SetParameterName("setintensity",false,false);
148   setintensityCmd->SetRange("setintensity > 0.    148   setintensityCmd->SetRange("setintensity > 0."); 
149                                                   149 
150   multiplevertexCmd = new G4UIcmdWithABool("/g    150   multiplevertexCmd = new G4UIcmdWithABool("/gps/source/multiplevertex",this);
151   multiplevertexCmd->SetGuidance("True for sim    151   multiplevertexCmd->SetGuidance("True for simultaneous generation multiple vertex");
152   multiplevertexCmd->SetGuidance(" Default is     152   multiplevertexCmd->SetGuidance(" Default is false");
153   multiplevertexCmd->SetParameterName("multipl    153   multiplevertexCmd->SetParameterName("multiplevertex",true);
154   multiplevertexCmd->SetDefaultValue(false);      154   multiplevertexCmd->SetDefaultValue(false);
155                                                   155 
156   flatsamplingCmd = new G4UIcmdWithABool("/gps    156   flatsamplingCmd = new G4UIcmdWithABool("/gps/source/flatsampling",this);
157   flatsamplingCmd->SetGuidance("True for apply    157   flatsamplingCmd->SetGuidance("True for applying flat (biased) sampling among the sources");
158   flatsamplingCmd->SetGuidance("Default is fal    158   flatsamplingCmd->SetGuidance("Default is false");
159   flatsamplingCmd->SetParameterName("flatsampl    159   flatsamplingCmd->SetParameterName("flatsampling",true);
160   flatsamplingCmd->SetDefaultValue(false);        160   flatsamplingCmd->SetDefaultValue(false);
161                                                   161 
162   // Below we reproduce commands awailable in     162   // Below we reproduce commands awailable in G4Particle Gun
163   //                                              163   //
164   listCmd = new G4UIcmdWithoutParameter("/gps/    164   listCmd = new G4UIcmdWithoutParameter("/gps/List",this);
165   listCmd->SetGuidance("List available particl    165   listCmd->SetGuidance("List available particles.");
166   listCmd->SetGuidance(" Invoke G4ParticleTabl    166   listCmd->SetGuidance(" Invoke G4ParticleTable.");
167                                                   167 
168   particleCmd = new G4UIcmdWithAString("/gps/p    168   particleCmd = new G4UIcmdWithAString("/gps/particle",this);
169   particleCmd->SetGuidance("Set particle to be    169   particleCmd->SetGuidance("Set particle to be generated.");
170   particleCmd->SetGuidance(" (geantino is defa    170   particleCmd->SetGuidance(" (geantino is default)");
171   particleCmd->SetGuidance(" (ion can be speci    171   particleCmd->SetGuidance(" (ion can be specified for shooting ions)");
172   particleCmd->SetParameterName("particleName"    172   particleCmd->SetParameterName("particleName",true);
173   particleCmd->SetDefaultValue("geantino");       173   particleCmd->SetDefaultValue("geantino");
174   G4String candidateList;                         174   G4String candidateList; 
175   G4int nPtcl = particleTable->entries();         175   G4int nPtcl = particleTable->entries();
176   for(G4int i=0; i<nPtcl; ++i)                    176   for(G4int i=0; i<nPtcl; ++i)
177   {                                               177   {
178     candidateList += particleTable->GetParticl    178     candidateList += particleTable->GetParticleName(i);
179     candidateList += " ";                         179     candidateList += " ";
180   }                                               180   }
181   candidateList += "ion ";                        181   candidateList += "ion ";
182   particleCmd->SetCandidates(candidateList);      182   particleCmd->SetCandidates(candidateList);
183                                                   183 
184   directionCmd = new G4UIcmdWith3Vector("/gps/    184   directionCmd = new G4UIcmdWith3Vector("/gps/direction",this);
185   directionCmd->SetGuidance("Set momentum dire    185   directionCmd->SetGuidance("Set momentum direction.");
186   directionCmd->SetGuidance(" Direction needs     186   directionCmd->SetGuidance(" Direction needs not to be a unit vector.");
187   directionCmd->SetGuidance(" Angular distribu    187   directionCmd->SetGuidance(" Angular distribution type is set to planar.");
188   directionCmd->SetParameterName("Px","Py","Pz    188   directionCmd->SetParameterName("Px","Py","Pz",false,false); 
189   directionCmd->SetRange("Px != 0 || Py != 0 |    189   directionCmd->SetRange("Px != 0 || Py != 0 || Pz != 0");
190                                                   190   
191   energyCmd = new G4UIcmdWithADoubleAndUnit("/    191   energyCmd = new G4UIcmdWithADoubleAndUnit("/gps/energy",this);
192   energyCmd->SetGuidance("Set kinetic energy."    192   energyCmd->SetGuidance("Set kinetic energy.");
193   energyCmd->SetParameterName("Energy",false,f    193   energyCmd->SetParameterName("Energy",false,false);
194   energyCmd->SetDefaultUnit("GeV");               194   energyCmd->SetDefaultUnit("GeV");
195   //energyCmd->SetUnitCategory("Energy");         195   //energyCmd->SetUnitCategory("Energy");
196   //energyCmd->SetUnitCandidates("eV keV MeV G    196   //energyCmd->SetUnitCandidates("eV keV MeV GeV TeV");
197                                                   197 
198   positionCmd = new G4UIcmdWith3VectorAndUnit(    198   positionCmd = new G4UIcmdWith3VectorAndUnit("/gps/position",this);
199   positionCmd->SetGuidance("Set starting posit    199   positionCmd->SetGuidance("Set starting position of the particle for a Point like source.");
200   positionCmd->SetGuidance(" Same effect as th    200   positionCmd->SetGuidance(" Same effect as the two /gps/pos/type Point /gps/pos/centre commands.");
201   positionCmd->SetParameterName("X","Y","Z",fa    201   positionCmd->SetParameterName("X","Y","Z",false,false);
202   positionCmd->SetDefaultUnit("cm");              202   positionCmd->SetDefaultUnit("cm");
203   //positionCmd->SetUnitCategory("Length");       203   //positionCmd->SetUnitCategory("Length");
204   //positionCmd->SetUnitCandidates("microm mm     204   //positionCmd->SetUnitCandidates("microm mm cm m km");
205                                                   205 
206   ionCmd = new G4UIcommand("/gps/ion",this);      206   ionCmd = new G4UIcommand("/gps/ion",this);
207   ionCmd->SetGuidance("Set properties of ion t    207   ionCmd->SetGuidance("Set properties of ion to be generated.");
208   ionCmd->SetGuidance("[usage] /gps/ion Z A Q     208   ionCmd->SetGuidance("[usage] /gps/ion Z A Q E");
209   ionCmd->SetGuidance("        Z:(int) AtomicN    209   ionCmd->SetGuidance("        Z:(int) AtomicNumber");
210   ionCmd->SetGuidance("        A:(int) AtomicM    210   ionCmd->SetGuidance("        A:(int) AtomicMass");
211   ionCmd->SetGuidance("        Q:(int) Charge     211   ionCmd->SetGuidance("        Q:(int) Charge of Ion (in unit of e)");
212   ionCmd->SetGuidance("        E:(double) Exci    212   ionCmd->SetGuidance("        E:(double) Excitation energy (in keV)");
213                                                   213 
214   G4UIparameter* param;                           214   G4UIparameter* param;
215   param = new G4UIparameter("Z",'i',false);       215   param = new G4UIparameter("Z",'i',false);
216   param->SetDefaultValue("1");                    216   param->SetDefaultValue("1");
217   ionCmd->SetParameter(param);                    217   ionCmd->SetParameter(param);
218   param = new G4UIparameter("A",'i',false);       218   param = new G4UIparameter("A",'i',false);
219   param->SetDefaultValue("1");                    219   param->SetDefaultValue("1");
220   ionCmd->SetParameter(param);                    220   ionCmd->SetParameter(param);
221   param = new G4UIparameter("Q",'i',true);        221   param = new G4UIparameter("Q",'i',true);
222   param->SetDefaultValue("0");                    222   param->SetDefaultValue("0");
223   ionCmd->SetParameter(param);                    223   ionCmd->SetParameter(param);
224   param = new G4UIparameter("E",'d',true);        224   param = new G4UIparameter("E",'d',true);
225   param->SetDefaultValue("0.0");                  225   param->SetDefaultValue("0.0");
226   ionCmd->SetParameter(param);                    226   ionCmd->SetParameter(param);
227                                                   227 
228   ionLvlCmd = new G4UIcommand("/gps/ionLvl",th    228   ionLvlCmd = new G4UIcommand("/gps/ionLvl",this);
229   ionLvlCmd->SetGuidance("Set properties of io    229   ionLvlCmd->SetGuidance("Set properties of ion to be generated.");
230   ionLvlCmd->SetGuidance("[usage] /gps/ion Z A    230   ionLvlCmd->SetGuidance("[usage] /gps/ion Z A Q Lvl");
231   ionLvlCmd->SetGuidance("        Z:(int) Atom    231   ionLvlCmd->SetGuidance("        Z:(int) AtomicNumber");
232   ionLvlCmd->SetGuidance("        A:(int) Atom    232   ionLvlCmd->SetGuidance("        A:(int) AtomicMass");
233   ionLvlCmd->SetGuidance("        Q:(int) Char    233   ionLvlCmd->SetGuidance("        Q:(int) Charge of Ion (in unit of e)");
234   ionLvlCmd->SetGuidance("        Lvl:(int) Nu    234   ionLvlCmd->SetGuidance("        Lvl:(int) Number of metastable state excitation level (0-9)");
235                                                   235 
236   G4UIparameter* paramL;                          236   G4UIparameter* paramL;
237   paramL = new G4UIparameter("Z",'i',false);      237   paramL = new G4UIparameter("Z",'i',false);
238   paramL->SetDefaultValue("1");                   238   paramL->SetDefaultValue("1");
239   ionLvlCmd->SetParameter(paramL);                239   ionLvlCmd->SetParameter(paramL);
240   paramL = new G4UIparameter("A",'i',false);      240   paramL = new G4UIparameter("A",'i',false);
241   paramL->SetDefaultValue("1");                   241   paramL->SetDefaultValue("1");
242   ionLvlCmd->SetParameter(paramL);                242   ionLvlCmd->SetParameter(paramL);
243   paramL = new G4UIparameter("Q",'i',true);       243   paramL = new G4UIparameter("Q",'i',true);
244   paramL->SetDefaultValue("0");                   244   paramL->SetDefaultValue("0");
245   ionLvlCmd->SetParameter(paramL);                245   ionLvlCmd->SetParameter(paramL);
246   paramL = new G4UIparameter("Lvl",'i',true);     246   paramL = new G4UIparameter("Lvl",'i',true);
247   paramL->SetDefaultValue("0.0");                 247   paramL->SetDefaultValue("0.0");
248   ionLvlCmd->SetParameter(paramL);                248   ionLvlCmd->SetParameter(paramL);
249                                                   249 
250   timeCmd = new G4UIcmdWithADoubleAndUnit("/gp    250   timeCmd = new G4UIcmdWithADoubleAndUnit("/gps/time",this);
251   timeCmd->SetGuidance("Set initial time of th    251   timeCmd->SetGuidance("Set initial time of the particle.");
252   timeCmd->SetParameterName("t0",false,false);    252   timeCmd->SetParameterName("t0",false,false);
253   timeCmd->SetDefaultUnit("ns");                  253   timeCmd->SetDefaultUnit("ns");
254   //timeCmd->SetUnitCategory("Time");             254   //timeCmd->SetUnitCategory("Time");
255   //timeCmd->SetUnitCandidates("ns ms s");        255   //timeCmd->SetUnitCandidates("ns ms s");
256                                                   256   
257   polCmd = new G4UIcmdWith3Vector("/gps/polari    257   polCmd = new G4UIcmdWith3Vector("/gps/polarization",this);
258   polCmd->SetGuidance("Set polarization.");       258   polCmd->SetGuidance("Set polarization.");
259   polCmd->SetParameterName("Px","Py","Pz",fals    259   polCmd->SetParameterName("Px","Py","Pz",false,false); 
260   polCmd->SetRange("Px>=-1.&&Px<=1.&&Py>=-1.&&    260   polCmd->SetRange("Px>=-1.&&Px<=1.&&Py>=-1.&&Py<=1.&&Pz>=-1.&&Pz<=1.");
261                                                   261 
262   numberCmd = new G4UIcmdWithAnInteger("/gps/n    262   numberCmd = new G4UIcmdWithAnInteger("/gps/number",this);
263   numberCmd->SetGuidance("Set number of partic    263   numberCmd->SetGuidance("Set number of particles to be generated per vertex.");
264   numberCmd->SetParameterName("N",false,false)    264   numberCmd->SetParameterName("N",false,false);
265   numberCmd->SetRange("N>0");                     265   numberCmd->SetRange("N>0");
266                                                   266 
267   // Verbosity                                    267   // Verbosity
268   //                                              268   //
269   verbosityCmd = new G4UIcmdWithAnInteger("/gp    269   verbosityCmd = new G4UIcmdWithAnInteger("/gps/verbose",this);
270   verbosityCmd->SetGuidance("Set Verbose level    270   verbosityCmd->SetGuidance("Set Verbose level for GPS");
271   verbosityCmd->SetGuidance(" 0 : Silent");       271   verbosityCmd->SetGuidance(" 0 : Silent");
272   verbosityCmd->SetGuidance(" 1 : Limited info    272   verbosityCmd->SetGuidance(" 1 : Limited information");
273   verbosityCmd->SetGuidance(" 2 : Detailed inf    273   verbosityCmd->SetGuidance(" 2 : Detailed information");
274   verbosityCmd->SetParameterName("level",false    274   verbosityCmd->SetParameterName("level",false);
275   verbosityCmd->SetRange("level>=0 && level <=    275   verbosityCmd->SetRange("level>=0 && level <=2");
276                                                   276 
277   volChkCmd = new G4UIcmdWithABool("/gps/check << 
278   volChkCmd->SetGuidance("Switch on/off the ch << 
279   volChkCmd->SetGuidance("By default the check << 
280   volChkCmd->SetGuidance("but the user has to  << 
281   volChkCmd->SetParameterName("switch",true,tr << 
282                                                << 
283   // Now extended commands                        277   // Now extended commands
284   // Positional ones:                             278   // Positional ones:
285   //                                              279   //
286   positionDirectory = new G4UIdirectory("/gps/    280   positionDirectory = new G4UIdirectory("/gps/pos/");
287   positionDirectory->SetGuidance("Positional c    281   positionDirectory->SetGuidance("Positional commands sub-directory");
288                                                   282 
289   typeCmd1 = new G4UIcmdWithAString("/gps/pos/    283   typeCmd1 = new G4UIcmdWithAString("/gps/pos/type",this);
290   typeCmd1->SetGuidance("Sets source distribut    284   typeCmd1->SetGuidance("Sets source distribution type.");
291   typeCmd1->SetGuidance("Either Point, Beam, P    285   typeCmd1->SetGuidance("Either Point, Beam, Plane, Surface or Volume");
292   typeCmd1->SetParameterName("DisType",false,f    286   typeCmd1->SetParameterName("DisType",false,false);
293   typeCmd1->SetDefaultValue("Point");             287   typeCmd1->SetDefaultValue("Point");
294   typeCmd1->SetCandidates("Point Beam Plane Su    288   typeCmd1->SetCandidates("Point Beam Plane Surface Volume");
295                                                   289 
296   shapeCmd1 = new G4UIcmdWithAString("/gps/pos    290   shapeCmd1 = new G4UIcmdWithAString("/gps/pos/shape",this);
297   shapeCmd1->SetGuidance("Sets source shape fo    291   shapeCmd1->SetGuidance("Sets source shape for Plan, Surface or Volume type source.");
298   shapeCmd1->SetParameterName("Shape",false,fa    292   shapeCmd1->SetParameterName("Shape",false,false);
299   shapeCmd1->SetDefaultValue("NULL");             293   shapeCmd1->SetDefaultValue("NULL");
300   shapeCmd1->SetCandidates("Circle Annulus Ell    294   shapeCmd1->SetCandidates("Circle Annulus Ellipse Square Rectangle Sphere Ellipsoid Cylinder EllipticCylinder Para");
301                                                   295 
302   centreCmd1 = new G4UIcmdWith3VectorAndUnit("    296   centreCmd1 = new G4UIcmdWith3VectorAndUnit("/gps/pos/centre",this);
303   centreCmd1->SetGuidance("Set centre coordina    297   centreCmd1->SetGuidance("Set centre coordinates of source.");
304   centreCmd1->SetParameterName("X","Y","Z",fal    298   centreCmd1->SetParameterName("X","Y","Z",false,false);
305   centreCmd1->SetDefaultUnit("cm");               299   centreCmd1->SetDefaultUnit("cm");
306   // centreCmd1->SetUnitCandidates("micron mm     300   // centreCmd1->SetUnitCandidates("micron mm cm m km");
307                                                   301 
308   posrot1Cmd1 = new G4UIcmdWith3Vector("/gps/p    302   posrot1Cmd1 = new G4UIcmdWith3Vector("/gps/pos/rot1",this);
309   posrot1Cmd1->SetGuidance("Set the 1st vector    303   posrot1Cmd1->SetGuidance("Set the 1st vector defining the rotation matrix'.");
310   posrot1Cmd1->SetGuidance("It does not need t    304   posrot1Cmd1->SetGuidance("It does not need to be a unit vector.");
311   posrot1Cmd1->SetParameterName("R1x","R1y","R    305   posrot1Cmd1->SetParameterName("R1x","R1y","R1z",false,false); 
312   posrot1Cmd1->SetRange("R1x != 0 || R1y != 0     306   posrot1Cmd1->SetRange("R1x != 0 || R1y != 0 || R1z != 0");
313                                                   307 
314   posrot2Cmd1 = new G4UIcmdWith3Vector("/gps/p    308   posrot2Cmd1 = new G4UIcmdWith3Vector("/gps/pos/rot2",this);
315   posrot2Cmd1->SetGuidance("Set the 2nd vector    309   posrot2Cmd1->SetGuidance("Set the 2nd vector defining the rotation matrix'.");
316   posrot2Cmd1->SetGuidance("It does not need t    310   posrot2Cmd1->SetGuidance("It does not need to be a unit vector.");
317   posrot2Cmd1->SetParameterName("R2x","R2y","R    311   posrot2Cmd1->SetParameterName("R2x","R2y","R2z",false,false); 
318   posrot2Cmd1->SetRange("R2x != 0 || R2y != 0     312   posrot2Cmd1->SetRange("R2x != 0 || R2y != 0 || R2z != 0");
319                                                   313 
320   halfxCmd1 = new G4UIcmdWithADoubleAndUnit("/    314   halfxCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/pos/halfx",this);
321   halfxCmd1->SetGuidance("Set x half length of    315   halfxCmd1->SetGuidance("Set x half length of source.");
322   halfxCmd1->SetParameterName("Halfx",false,fa    316   halfxCmd1->SetParameterName("Halfx",false,false);
323   halfxCmd1->SetDefaultUnit("cm");                317   halfxCmd1->SetDefaultUnit("cm");
324   // halfxCmd1->SetUnitCandidates("micron mm c    318   // halfxCmd1->SetUnitCandidates("micron mm cm m km");
325                                                   319 
326   halfyCmd1 = new G4UIcmdWithADoubleAndUnit("/    320   halfyCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/pos/halfy",this);
327   halfyCmd1->SetGuidance("Set y half length of    321   halfyCmd1->SetGuidance("Set y half length of source.");
328   halfyCmd1->SetParameterName("Halfy",false,fa    322   halfyCmd1->SetParameterName("Halfy",false,false);
329   halfyCmd1->SetDefaultUnit("cm");                323   halfyCmd1->SetDefaultUnit("cm");
330   // halfyCmd1->SetUnitCandidates("micron mm c    324   // halfyCmd1->SetUnitCandidates("micron mm cm m km");
331                                                   325 
332   halfzCmd1 = new G4UIcmdWithADoubleAndUnit("/    326   halfzCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/pos/halfz",this);
333   halfzCmd1->SetGuidance("Set z half length of    327   halfzCmd1->SetGuidance("Set z half length of source.");
334   halfzCmd1->SetParameterName("Halfz",false,fa    328   halfzCmd1->SetParameterName("Halfz",false,false);
335   halfzCmd1->SetDefaultUnit("cm");                329   halfzCmd1->SetDefaultUnit("cm");
336   // halfzCmd1->SetUnitCandidates("micron mm c    330   // halfzCmd1->SetUnitCandidates("micron mm cm m km");
337                                                   331 
338   radiusCmd1 = new G4UIcmdWithADoubleAndUnit("    332   radiusCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/pos/radius",this);
339   radiusCmd1->SetGuidance("Set radius of sourc    333   radiusCmd1->SetGuidance("Set radius of source.");
340   radiusCmd1->SetParameterName("Radius",false,    334   radiusCmd1->SetParameterName("Radius",false,false);
341   radiusCmd1->SetDefaultUnit("cm");               335   radiusCmd1->SetDefaultUnit("cm");
342   // radiusCmd1->SetUnitCandidates("micron mm     336   // radiusCmd1->SetUnitCandidates("micron mm cm m km");
343                                                   337 
344   radius0Cmd1 = new G4UIcmdWithADoubleAndUnit(    338   radius0Cmd1 = new G4UIcmdWithADoubleAndUnit("/gps/pos/inner_radius",this);
345   radius0Cmd1->SetGuidance("Set inner radius o    339   radius0Cmd1->SetGuidance("Set inner radius of source when required.");
346   radius0Cmd1->SetParameterName("Radius0",fals    340   radius0Cmd1->SetParameterName("Radius0",false,false);
347   radius0Cmd1->SetDefaultUnit("cm");              341   radius0Cmd1->SetDefaultUnit("cm");
348   // radius0Cmd1->SetUnitCandidates("micron mm    342   // radius0Cmd1->SetUnitCandidates("micron mm cm m km");
349                                                   343 
350   possigmarCmd1 = new G4UIcmdWithADoubleAndUni    344   possigmarCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/pos/sigma_r",this);
351   possigmarCmd1->SetGuidance("Set standard dev    345   possigmarCmd1->SetGuidance("Set standard deviation in radial of the beam positional profile");
352   possigmarCmd1->SetGuidance(" applicable to B    346   possigmarCmd1->SetGuidance(" applicable to Beam type source only");
353   possigmarCmd1->SetParameterName("Sigmar",fal    347   possigmarCmd1->SetParameterName("Sigmar",false,false);
354   possigmarCmd1->SetDefaultUnit("cm");            348   possigmarCmd1->SetDefaultUnit("cm");
355   // possigmarCmd1->SetUnitCandidates("micron     349   // possigmarCmd1->SetUnitCandidates("micron mm cm m km");
356                                                   350 
357   possigmaxCmd1 = new G4UIcmdWithADoubleAndUni    351   possigmaxCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/pos/sigma_x",this);
358   possigmaxCmd1->SetGuidance("Set standard dev    352   possigmaxCmd1->SetGuidance("Set standard deviation of beam positional profile in x-dir");
359   possigmaxCmd1->SetGuidance(" applicable to B    353   possigmaxCmd1->SetGuidance(" applicable to Beam type source only");
360   possigmaxCmd1->SetParameterName("Sigmax",fal    354   possigmaxCmd1->SetParameterName("Sigmax",false,false);
361   possigmaxCmd1->SetDefaultUnit("cm");            355   possigmaxCmd1->SetDefaultUnit("cm");
362   // possigmaxCmd1->SetUnitCandidates("micron     356   // possigmaxCmd1->SetUnitCandidates("micron mm cm m km");
363                                                   357 
364   possigmayCmd1 = new G4UIcmdWithADoubleAndUni    358   possigmayCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/pos/sigma_y",this);
365   possigmayCmd1->SetGuidance("Set standard dev    359   possigmayCmd1->SetGuidance("Set standard deviation of beam positional profile in y-dir");
366   possigmayCmd1->SetGuidance(" applicable to B    360   possigmayCmd1->SetGuidance(" applicable to Beam type source only");
367   possigmayCmd1->SetParameterName("Sigmay",fal    361   possigmayCmd1->SetParameterName("Sigmay",false,false);
368   possigmayCmd1->SetDefaultUnit("cm");            362   possigmayCmd1->SetDefaultUnit("cm");
369   // possigmayCmd1->SetUnitCandidates("micron     363   // possigmayCmd1->SetUnitCandidates("micron mm cm m km");
370                                                   364 
371   paralpCmd1 = new G4UIcmdWithADoubleAndUnit("    365   paralpCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/pos/paralp",this);
372   paralpCmd1->SetGuidance("Angle from y-axis o    366   paralpCmd1->SetGuidance("Angle from y-axis of y' in Para");
373   paralpCmd1->SetParameterName("paralp",false,    367   paralpCmd1->SetParameterName("paralp",false,false);
374   paralpCmd1->SetDefaultUnit("rad");              368   paralpCmd1->SetDefaultUnit("rad");
375   // paralpCmd1->SetUnitCandidates("rad deg");    369   // paralpCmd1->SetUnitCandidates("rad deg");
376                                                   370 
377   partheCmd1 = new G4UIcmdWithADoubleAndUnit("    371   partheCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/pos/parthe",this);
378   partheCmd1->SetGuidance("Polar angle through    372   partheCmd1->SetGuidance("Polar angle through centres of z faces");
379   partheCmd1->SetParameterName("parthe",false,    373   partheCmd1->SetParameterName("parthe",false,false);
380   partheCmd1->SetDefaultUnit("rad");              374   partheCmd1->SetDefaultUnit("rad");
381   // partheCmd1->SetUnitCandidates("rad deg");    375   // partheCmd1->SetUnitCandidates("rad deg");
382                                                   376 
383   parphiCmd1 = new G4UIcmdWithADoubleAndUnit("    377   parphiCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/pos/parphi",this);
384   parphiCmd1->SetGuidance("Azimuth angle throu    378   parphiCmd1->SetGuidance("Azimuth angle through centres of z faces");
385   parphiCmd1->SetParameterName("parphi",false,    379   parphiCmd1->SetParameterName("parphi",false,false);
386   parphiCmd1->SetDefaultUnit("rad");              380   parphiCmd1->SetDefaultUnit("rad");
387   // parphiCmd1->SetUnitCandidates("rad deg");    381   // parphiCmd1->SetUnitCandidates("rad deg");
388                                                   382 
389   confineCmd1 = new G4UIcmdWithAString("/gps/p    383   confineCmd1 = new G4UIcmdWithAString("/gps/pos/confine",this);
390   confineCmd1->SetGuidance("Confine source to     384   confineCmd1->SetGuidance("Confine source to volume (NULL to unset).");
391   confineCmd1->SetGuidance(" Usage: confine Vo    385   confineCmd1->SetGuidance(" Usage: confine VolName");
392   confineCmd1->SetParameterName("VolName",fals    386   confineCmd1->SetParameterName("VolName",false,false);
393   confineCmd1->SetDefaultValue("NULL");           387   confineCmd1->SetDefaultValue("NULL");
394                                                   388 
395   // Angular distribution commands                389   // Angular distribution commands
396   //                                              390   //
397   angularDirectory = new G4UIdirectory("/gps/a    391   angularDirectory = new G4UIdirectory("/gps/ang/");
398   angularDirectory->SetGuidance("Angular comma    392   angularDirectory->SetGuidance("Angular commands sub-directory");
399                                                   393 
400   angtypeCmd1 = new G4UIcmdWithAString("/gps/a    394   angtypeCmd1 = new G4UIcmdWithAString("/gps/ang/type",this);
401   angtypeCmd1->SetGuidance("Sets angular sourc    395   angtypeCmd1->SetGuidance("Sets angular source distribution type");
402   angtypeCmd1->SetGuidance(" Possible variable    396   angtypeCmd1->SetGuidance(" Possible variables are: iso, cos, planar, beam1d, beam2d, focused or user");
403   angtypeCmd1->SetParameterName("AngDis",false    397   angtypeCmd1->SetParameterName("AngDis",false,false);
404   angtypeCmd1->SetDefaultValue("iso");            398   angtypeCmd1->SetDefaultValue("iso");
405   angtypeCmd1->SetCandidates("iso cos planar b    399   angtypeCmd1->SetCandidates("iso cos planar beam1d beam2d focused user");
406                                                   400 
407   angrot1Cmd1 = new G4UIcmdWith3Vector("/gps/a    401   angrot1Cmd1 = new G4UIcmdWith3Vector("/gps/ang/rot1",this);
408   angrot1Cmd1->SetGuidance("Sets the 1st vecto    402   angrot1Cmd1->SetGuidance("Sets the 1st vector for angular distribution rotation matrix");
409   angrot1Cmd1->SetGuidance(" Need not be a uni    403   angrot1Cmd1->SetGuidance(" Need not be a unit vector");
410   angrot1Cmd1->SetParameterName("AR1x","AR1y",    404   angrot1Cmd1->SetParameterName("AR1x","AR1y","AR1z",false,false);
411   angrot1Cmd1->SetRange("AR1x != 0 || AR1y !=     405   angrot1Cmd1->SetRange("AR1x != 0 || AR1y != 0 || AR1z != 0");
412                                                   406 
413   angrot2Cmd1 = new G4UIcmdWith3Vector("/gps/a    407   angrot2Cmd1 = new G4UIcmdWith3Vector("/gps/ang/rot2",this);
414   angrot2Cmd1->SetGuidance("Sets the 2nd vecto    408   angrot2Cmd1->SetGuidance("Sets the 2nd vector for angular distribution rotation matrix");
415   angrot2Cmd1->SetGuidance(" Need not be a uni    409   angrot2Cmd1->SetGuidance(" Need not be a unit vector");
416   angrot2Cmd1->SetParameterName("AR2x","AR2y",    410   angrot2Cmd1->SetParameterName("AR2x","AR2y","AR2z",false,false);
417   angrot2Cmd1->SetRange("AR2x != 0 || AR2y !=     411   angrot2Cmd1->SetRange("AR2x != 0 || AR2y != 0 || AR2z != 0");
418                                                   412 
419   minthetaCmd1 = new G4UIcmdWithADoubleAndUnit    413   minthetaCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/ang/mintheta",this);
420   minthetaCmd1->SetGuidance("Set minimum theta    414   minthetaCmd1->SetGuidance("Set minimum theta");
421   minthetaCmd1->SetParameterName("MinTheta",tr    415   minthetaCmd1->SetParameterName("MinTheta",true,false);
422   minthetaCmd1->SetDefaultValue(0.);              416   minthetaCmd1->SetDefaultValue(0.);
423   minthetaCmd1->SetDefaultUnit("rad");            417   minthetaCmd1->SetDefaultUnit("rad");
424   // minthetaCmd1->SetUnitCandidates("rad deg"    418   // minthetaCmd1->SetUnitCandidates("rad deg");
425                                                   419 
426   maxthetaCmd1 = new G4UIcmdWithADoubleAndUnit    420   maxthetaCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/ang/maxtheta",this);
427   maxthetaCmd1->SetGuidance("Set maximum theta    421   maxthetaCmd1->SetGuidance("Set maximum theta");
428   maxthetaCmd1->SetParameterName("MaxTheta",tr    422   maxthetaCmd1->SetParameterName("MaxTheta",true,false);
429   maxthetaCmd1->SetDefaultValue(pi);              423   maxthetaCmd1->SetDefaultValue(pi);
430   maxthetaCmd1->SetDefaultUnit("rad");            424   maxthetaCmd1->SetDefaultUnit("rad");
431   // maxthetaCmd1->SetUnitCandidates("rad deg"    425   // maxthetaCmd1->SetUnitCandidates("rad deg");
432                                                   426 
433   minphiCmd1 = new G4UIcmdWithADoubleAndUnit("    427   minphiCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/ang/minphi",this);
434   minphiCmd1->SetGuidance("Set minimum phi");     428   minphiCmd1->SetGuidance("Set minimum phi");
435   minphiCmd1->SetParameterName("MinPhi",true,f    429   minphiCmd1->SetParameterName("MinPhi",true,false);
436   minphiCmd1->SetDefaultValue(0.);             << 
437   minphiCmd1->SetDefaultUnit("rad");              430   minphiCmd1->SetDefaultUnit("rad");
438   // minphiCmd1->SetUnitCandidates("rad deg");    431   // minphiCmd1->SetUnitCandidates("rad deg");
439                                                   432 
440   maxphiCmd1 = new G4UIcmdWithADoubleAndUnit("    433   maxphiCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/ang/maxphi",this);
441   maxphiCmd1->SetGuidance("Set maximum phi");     434   maxphiCmd1->SetGuidance("Set maximum phi");
442   maxphiCmd1->SetParameterName("MaxPhi",true,f    435   maxphiCmd1->SetParameterName("MaxPhi",true,false);
443   maxphiCmd1->SetDefaultValue(2.*pi);             436   maxphiCmd1->SetDefaultValue(2.*pi);
444   maxphiCmd1->SetDefaultUnit("rad");              437   maxphiCmd1->SetDefaultUnit("rad");
445   // maxphiCmd1->SetUnitCandidates("rad deg");    438   // maxphiCmd1->SetUnitCandidates("rad deg");
446                                                   439 
447   angsigmarCmd1 = new G4UIcmdWithADoubleAndUni    440   angsigmarCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/ang/sigma_r",this);
448   angsigmarCmd1->SetGuidance("Set standard dev    441   angsigmarCmd1->SetGuidance("Set standard deviation in direction for 1D beam.");
449   angsigmarCmd1->SetParameterName("Sigmara",fa    442   angsigmarCmd1->SetParameterName("Sigmara",false,false);
450   angsigmarCmd1->SetDefaultUnit("rad");           443   angsigmarCmd1->SetDefaultUnit("rad");
451   // angsigmarCmd1->SetUnitCandidates("rad deg    444   // angsigmarCmd1->SetUnitCandidates("rad deg");
452                                                   445   
453   angsigmaxCmd1 = new G4UIcmdWithADoubleAndUni    446   angsigmaxCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/ang/sigma_x",this);
454   angsigmaxCmd1->SetGuidance("Set standard dev    447   angsigmaxCmd1->SetGuidance("Set standard deviation in direction in x-direc. for 2D beam");
455   angsigmaxCmd1->SetParameterName("Sigmaxa",fa    448   angsigmaxCmd1->SetParameterName("Sigmaxa",false,false);
456   angsigmaxCmd1->SetDefaultUnit("rad");           449   angsigmaxCmd1->SetDefaultUnit("rad");
457   // angsigmaxCmd1->SetUnitCandidates("rad deg    450   // angsigmaxCmd1->SetUnitCandidates("rad deg");
458                                                   451 
459   angsigmayCmd1 = new G4UIcmdWithADoubleAndUni    452   angsigmayCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/ang/sigma_y",this);
460   angsigmayCmd1->SetGuidance("Set standard dev    453   angsigmayCmd1->SetGuidance("Set standard deviation in direction in y-direc. for 2D beam");
461   angsigmayCmd1->SetParameterName("Sigmaya",fa    454   angsigmayCmd1->SetParameterName("Sigmaya",false,false);
462   angsigmayCmd1->SetDefaultUnit("rad");           455   angsigmayCmd1->SetDefaultUnit("rad");
463   // angsigmayCmd1->SetUnitCandidates("rad deg    456   // angsigmayCmd1->SetUnitCandidates("rad deg");
464                                                   457 
465   angfocusCmd = new G4UIcmdWith3VectorAndUnit(    458   angfocusCmd = new G4UIcmdWith3VectorAndUnit("/gps/ang/focuspoint",this);
466   angfocusCmd->SetGuidance("Set the focusing p    459   angfocusCmd->SetGuidance("Set the focusing point for the beam");
467   angfocusCmd->SetParameterName("x","y","z",fa    460   angfocusCmd->SetParameterName("x","y","z",false,false);
468   angfocusCmd->SetDefaultUnit("cm");              461   angfocusCmd->SetDefaultUnit("cm");
469   // angfocusCmd->SetUnitCandidates("micron mm    462   // angfocusCmd->SetUnitCandidates("micron mm cm m km");
470                                                   463 
471   useuserangaxisCmd1 = new G4UIcmdWithABool("/    464   useuserangaxisCmd1 = new G4UIcmdWithABool("/gps/ang/user_coor",this);
472   useuserangaxisCmd1->SetGuidance("True for us    465   useuserangaxisCmd1->SetGuidance("True for using user defined angular co-ordinates");
473   useuserangaxisCmd1->SetGuidance(" Default is    466   useuserangaxisCmd1->SetGuidance(" Default is false");
474   useuserangaxisCmd1->SetParameterName("useuse    467   useuserangaxisCmd1->SetParameterName("useuserangaxis",true);
475   useuserangaxisCmd1->SetDefaultValue(false);     468   useuserangaxisCmd1->SetDefaultValue(false);
476                                                   469 
477   surfnormCmd1 = new G4UIcmdWithABool("/gps/an    470   surfnormCmd1 = new G4UIcmdWithABool("/gps/ang/surfnorm",this);
478   surfnormCmd1->SetGuidance("Makes a user-defi    471   surfnormCmd1->SetGuidance("Makes a user-defined distribution with respect to surface normals rather than x,y,z axes.");
479   surfnormCmd1->SetGuidance(" Default is false    472   surfnormCmd1->SetGuidance(" Default is false");
480   surfnormCmd1->SetParameterName("surfnorm",tr    473   surfnormCmd1->SetParameterName("surfnorm",true);
481   surfnormCmd1->SetDefaultValue(false);           474   surfnormCmd1->SetDefaultValue(false);
482                                                   475 
483   // Energy commands                              476   // Energy commands
484   //                                              477   //
485   energyDirectory = new G4UIdirectory("/gps/en    478   energyDirectory = new G4UIdirectory("/gps/ene/");
486   energyDirectory->SetGuidance("Spectral comma    479   energyDirectory->SetGuidance("Spectral commands sub-directory");
487                                                   480 
488   energytypeCmd1 = new G4UIcmdWithAString("/gp    481   energytypeCmd1 = new G4UIcmdWithAString("/gps/ene/type",this);
489   energytypeCmd1->SetGuidance("Sets energy dis    482   energytypeCmd1->SetGuidance("Sets energy distribution type");
490   energytypeCmd1->SetParameterName("EnergyDis"    483   energytypeCmd1->SetParameterName("EnergyDis",false,false);
491   energytypeCmd1->SetDefaultValue("Mono");        484   energytypeCmd1->SetDefaultValue("Mono");
492   energytypeCmd1->SetCandidates("Mono Lin Pow     485   energytypeCmd1->SetCandidates("Mono Lin Pow Exp CPow Gauss Brem Bbody Cdg User Arb Epn LW");
493                                                   486 
494   eminCmd1 = new G4UIcmdWithADoubleAndUnit("/g    487   eminCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/ene/min",this);
495   eminCmd1->SetGuidance("Sets minimum energy")    488   eminCmd1->SetGuidance("Sets minimum energy");
496   eminCmd1->SetParameterName("emin",false,fals    489   eminCmd1->SetParameterName("emin",false,false);
497   eminCmd1->SetDefaultUnit("keV");                490   eminCmd1->SetDefaultUnit("keV");
498   // eminCmd1->SetUnitCandidates("eV keV MeV G    491   // eminCmd1->SetUnitCandidates("eV keV MeV GeV TeV PeV");
499                                                   492 
500   emaxCmd1 = new G4UIcmdWithADoubleAndUnit("/g    493   emaxCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/ene/max",this);
501   emaxCmd1->SetGuidance("Sets maximum energy")    494   emaxCmd1->SetGuidance("Sets maximum energy");
502   emaxCmd1->SetParameterName("emax",false,fals    495   emaxCmd1->SetParameterName("emax",false,false);
503   emaxCmd1->SetDefaultUnit("keV");                496   emaxCmd1->SetDefaultUnit("keV");
504   // emaxCmd1->SetUnitCandidates("eV keV MeV G    497   // emaxCmd1->SetUnitCandidates("eV keV MeV GeV TeV PeV");
505                                                   498 
506   monoenergyCmd1 = new G4UIcmdWithADoubleAndUn    499   monoenergyCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/ene/mono",this);
507   monoenergyCmd1->SetGuidance("Sets a monocrom    500   monoenergyCmd1->SetGuidance("Sets a monocromatic energy (same as  gps/energy)");
508   monoenergyCmd1->SetParameterName("monoenergy    501   monoenergyCmd1->SetParameterName("monoenergy",false,false);
509   monoenergyCmd1->SetDefaultUnit("keV");          502   monoenergyCmd1->SetDefaultUnit("keV");
510   // monoenergyCmd1->SetUnitCandidates("eV keV    503   // monoenergyCmd1->SetUnitCandidates("eV keV MeV GeV TeV PeV");
511                                                   504 
512   engsigmaCmd1 = new G4UIcmdWithADoubleAndUnit    505   engsigmaCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/ene/sigma",this);
513   engsigmaCmd1->SetGuidance("Sets the standard    506   engsigmaCmd1->SetGuidance("Sets the standard deviation for Gaussian energy dist.");
514   engsigmaCmd1->SetParameterName("Sigmae",fals    507   engsigmaCmd1->SetParameterName("Sigmae",false,false);
515   engsigmaCmd1->SetDefaultUnit("keV");            508   engsigmaCmd1->SetDefaultUnit("keV");
516   // engsigmaCmd1->SetUnitCandidates("eV keV M    509   // engsigmaCmd1->SetUnitCandidates("eV keV MeV GeV TeV PeV");
517                                                   510 
518   alphaCmd1 = new G4UIcmdWithADouble("/gps/ene    511   alphaCmd1 = new G4UIcmdWithADouble("/gps/ene/alpha",this);
519   alphaCmd1->SetGuidance("Sets Alpha (index) f    512   alphaCmd1->SetGuidance("Sets Alpha (index) for power-law energy dist.");
520   alphaCmd1->SetParameterName("alpha",false,fa    513   alphaCmd1->SetParameterName("alpha",false,false);
521                                                   514   
522   tempCmd1 = new G4UIcmdWithADouble("/gps/ene/    515   tempCmd1 = new G4UIcmdWithADouble("/gps/ene/temp",this);
523   tempCmd1->SetGuidance("Sets the temperature     516   tempCmd1->SetGuidance("Sets the temperature for Brem and BBody distributions (in Kelvin)");
524   tempCmd1->SetParameterName("temp",false,fals    517   tempCmd1->SetParameterName("temp",false,false);
525                                                   518 
526   ezeroCmd1 = new G4UIcmdWithADouble("/gps/ene    519   ezeroCmd1 = new G4UIcmdWithADouble("/gps/ene/ezero",this);
527   ezeroCmd1->SetGuidance("Sets E_0 for exponen    520   ezeroCmd1->SetGuidance("Sets E_0 for exponential distribution (in MeV)");
528   ezeroCmd1->SetParameterName("ezero",false,fa    521   ezeroCmd1->SetParameterName("ezero",false,false);
529                                                   522 
530   gradientCmd1 = new G4UIcmdWithADouble("/gps/    523   gradientCmd1 = new G4UIcmdWithADouble("/gps/ene/gradient",this);
531   gradientCmd1->SetGuidance("Sets the gradient    524   gradientCmd1->SetGuidance("Sets the gradient for Lin distribution (in 1/MeV)");
532   gradientCmd1->SetParameterName("gradient",fa    525   gradientCmd1->SetParameterName("gradient",false,false);
533                                                   526 
534   interceptCmd1 = new G4UIcmdWithADouble("/gps    527   interceptCmd1 = new G4UIcmdWithADouble("/gps/ene/intercept",this);
535   interceptCmd1->SetGuidance("Sets the interce    528   interceptCmd1->SetGuidance("Sets the intercept for Lin distributions (in MeV)");
536   interceptCmd1->SetParameterName("intercept",    529   interceptCmd1->SetParameterName("intercept",false,false);
537                                                   530 
538   arbeintCmd1 = new G4UIcmdWithADouble("/gps/e    531   arbeintCmd1 = new G4UIcmdWithADouble("/gps/ene/biasAlpha",this);
539   arbeintCmd1->SetGuidance("Sets the power-law    532   arbeintCmd1->SetGuidance("Sets the power-law index for the energy sampling distri. )");
540   arbeintCmd1->SetParameterName("arbeint",fals    533   arbeintCmd1->SetParameterName("arbeint",false,false);
541                                                   534 
542   calculateCmd1 = new G4UIcmdWithoutParameter(    535   calculateCmd1 = new G4UIcmdWithoutParameter("/gps/ene/calculate",this);
543   calculateCmd1->SetGuidance("Calculates the d    536   calculateCmd1->SetGuidance("Calculates the distributions for Cdg and BBody");
544                                                   537 
545   energyspecCmd1 = new G4UIcmdWithABool("/gps/    538   energyspecCmd1 = new G4UIcmdWithABool("/gps/ene/emspec",this);
546   energyspecCmd1->SetGuidance("True for energy    539   energyspecCmd1->SetGuidance("True for energy and false for momentum spectra");
547   energyspecCmd1->SetParameterName("energyspec    540   energyspecCmd1->SetParameterName("energyspec",true);
548   energyspecCmd1->SetDefaultValue(true);          541   energyspecCmd1->SetDefaultValue(true);
549                                                   542 
550   diffspecCmd1 = new G4UIcmdWithABool("/gps/en    543   diffspecCmd1 = new G4UIcmdWithABool("/gps/ene/diffspec",this);
551   diffspecCmd1->SetGuidance("True for differen    544   diffspecCmd1->SetGuidance("True for differential and flase for integral spectra");
552   diffspecCmd1->SetParameterName("diffspec",tr    545   diffspecCmd1->SetParameterName("diffspec",true);
553   diffspecCmd1->SetDefaultValue(true);            546   diffspecCmd1->SetDefaultValue(true);
554                                                   547 
555   applyEnergyWeightCmd1 = new G4UIcmdWithABool    548   applyEnergyWeightCmd1 = new G4UIcmdWithABool("/gps/ene/applyEneWeight",this);
556   applyEnergyWeightCmd1->SetGuidance("Apply en    549   applyEnergyWeightCmd1->SetGuidance("Apply energy weight.");
557   applyEnergyWeightCmd1->SetGuidance("- Instea    550   applyEnergyWeightCmd1->SetGuidance("- Instead of using the Arb type histogram for sampling the energy spectrum,");
558   applyEnergyWeightCmd1->SetGuidance(" energy     551   applyEnergyWeightCmd1->SetGuidance(" energy is sampled by Linear distribution, and the Arb type histogram is");
559   applyEnergyWeightCmd1->SetGuidance(" used fo    552   applyEnergyWeightCmd1->SetGuidance(" used for the weight of the generated particle.");
560   applyEnergyWeightCmd1->SetGuidance("- \"/gps    553   applyEnergyWeightCmd1->SetGuidance("- \"/gps/ene/type LW\" automatically applies this command.");
561   applyEnergyWeightCmd1->SetGuidance("- If thi    554   applyEnergyWeightCmd1->SetGuidance("- If this command has to be explicitly used, \"/gps/ene/type\" distribution mush be Lin.");
562   applyEnergyWeightCmd1->SetParameterName("fla    555   applyEnergyWeightCmd1->SetParameterName("flag",true);
563   applyEnergyWeightCmd1->SetDefaultValue(true)    556   applyEnergyWeightCmd1->SetDefaultValue(true);
564                                                   557 
565   // Biasing + histograms in general              558   // Biasing + histograms in general
566   //                                              559   //
567   histDirectory = new G4UIdirectory("/gps/hist    560   histDirectory = new G4UIdirectory("/gps/hist/");
568   histDirectory->SetGuidance("Histogram, biasi    561   histDirectory->SetGuidance("Histogram, biasing commands sub-directory");
569                                                   562 
570   histnameCmd1 = new G4UIcmdWithAString("/gps/    563   histnameCmd1 = new G4UIcmdWithAString("/gps/hist/type",this);
571   histnameCmd1->SetGuidance("Sets histogram ty    564   histnameCmd1->SetGuidance("Sets histogram type");
572   histnameCmd1->SetParameterName("HistType",fa    565   histnameCmd1->SetParameterName("HistType",false,false);
573   histnameCmd1->SetDefaultValue("biasx");         566   histnameCmd1->SetDefaultValue("biasx");
574   histnameCmd1->SetCandidates("biasx biasy bia    567   histnameCmd1->SetCandidates("biasx biasy biasz biast biasp biase biaspt biaspp theta phi energy arb epn");
575                                                   568 
576   resethistCmd1 = new G4UIcmdWithAString("/gps    569   resethistCmd1 = new G4UIcmdWithAString("/gps/hist/reset",this);
577   resethistCmd1->SetGuidance("Reset (clean) th    570   resethistCmd1->SetGuidance("Reset (clean) the histogram ");
578   resethistCmd1->SetParameterName("HistType",f    571   resethistCmd1->SetParameterName("HistType",false,false);
579   resethistCmd1->SetDefaultValue("energy");       572   resethistCmd1->SetDefaultValue("energy");
580   resethistCmd1->SetCandidates("biasx biasy bi    573   resethistCmd1->SetCandidates("biasx biasy biasz biast biasp biase biaspt biaspp theta phi energy arb epn");
581                                                   574 
582   histpointCmd1 = new G4UIcmdWith3Vector("/gps    575   histpointCmd1 = new G4UIcmdWith3Vector("/gps/hist/point",this);
583   histpointCmd1->SetGuidance("Allows user to d    576   histpointCmd1->SetGuidance("Allows user to define a histogram");
584   histpointCmd1->SetGuidance(" Enter: Ehi Weig    577   histpointCmd1->SetGuidance(" Enter: Ehi Weight");
585   histpointCmd1->SetParameterName("Ehi","Weigh    578   histpointCmd1->SetParameterName("Ehi","Weight","Junk",true,true);
586   histpointCmd1->SetRange("Ehi >= 0. && Weight    579   histpointCmd1->SetRange("Ehi >= 0. && Weight >= 0.");
587                                                   580 
588   histfileCmd1 = new G4UIcmdWithAString("/gps/    581   histfileCmd1 = new G4UIcmdWithAString("/gps/hist/file",this);
589   histfileCmd1->SetGuidance("Imports the arb e    582   histfileCmd1->SetGuidance("Imports the arb energy hist in an ASCII file");
590   histfileCmd1->SetParameterName("HistFile",fa    583   histfileCmd1->SetParameterName("HistFile",false,false);
591                                                   584 
592   arbintCmd1 = new G4UIcmdWithAString("/gps/hi    585   arbintCmd1 = new G4UIcmdWithAString("/gps/hist/inter",this);
593   arbintCmd1->SetGuidance("Sets the interpolat    586   arbintCmd1->SetGuidance("Sets the interpolation method for arbitrary distribution.");
594   arbintCmd1->SetGuidance("Spline interpolatio    587   arbintCmd1->SetGuidance("Spline interpolation may not be applicable for some distributions.");
595   arbintCmd1->SetParameterName("int",false,fal    588   arbintCmd1->SetParameterName("int",false,false);
596   arbintCmd1->SetDefaultValue("Lin");             589   arbintCmd1->SetDefaultValue("Lin");
597   arbintCmd1->SetCandidates("Lin Log Exp Splin    590   arbintCmd1->SetCandidates("Lin Log Exp Spline");
598 }                                                 591 }
599                                                   592 
600 G4GeneralParticleSourceMessenger::~G4GeneralPa    593 G4GeneralParticleSourceMessenger::~G4GeneralParticleSourceMessenger()
601 {                                                 594 {
602   delete positionDirectory;                       595   delete positionDirectory;
603   delete typeCmd1;                                596   delete typeCmd1;
604   delete shapeCmd1;                               597   delete shapeCmd1;
605   delete centreCmd1;                              598   delete centreCmd1;
606   delete posrot1Cmd1;                             599   delete posrot1Cmd1;
607   delete posrot2Cmd1;                             600   delete posrot2Cmd1;
608   delete halfxCmd1;                               601   delete halfxCmd1;
609   delete halfyCmd1;                               602   delete halfyCmd1;
610   delete halfzCmd1;                               603   delete halfzCmd1;
611   delete radiusCmd1;                              604   delete radiusCmd1;
612   delete radius0Cmd1;                             605   delete radius0Cmd1;
613   delete possigmarCmd1;                           606   delete possigmarCmd1;
614   delete possigmaxCmd1;                           607   delete possigmaxCmd1;
615   delete possigmayCmd1;                           608   delete possigmayCmd1;
616   delete paralpCmd1;                              609   delete paralpCmd1;
617   delete partheCmd1;                              610   delete partheCmd1;
618   delete parphiCmd1;                              611   delete parphiCmd1;
619   delete confineCmd1;                             612   delete confineCmd1;
620                                                   613 
621   delete angularDirectory;                        614   delete angularDirectory;
622   delete angtypeCmd1;                             615   delete angtypeCmd1;
623   delete angrot1Cmd1;                             616   delete angrot1Cmd1;
624   delete angrot2Cmd1;                             617   delete angrot2Cmd1;
625   delete minthetaCmd1;                            618   delete minthetaCmd1;
626   delete maxthetaCmd1;                            619   delete maxthetaCmd1;
627   delete minphiCmd1;                              620   delete minphiCmd1;
628   delete maxphiCmd1;                              621   delete maxphiCmd1;
629   delete angsigmarCmd1;                           622   delete angsigmarCmd1;
630   delete angsigmaxCmd1;                           623   delete angsigmaxCmd1;
631   delete angsigmayCmd1;                           624   delete angsigmayCmd1;
632   delete angfocusCmd;                             625   delete angfocusCmd;
633   delete useuserangaxisCmd1;                      626   delete useuserangaxisCmd1;
634   delete surfnormCmd1;                            627   delete surfnormCmd1;
635                                                   628 
636   delete energyDirectory;                         629   delete energyDirectory;
637   delete energytypeCmd1;                          630   delete energytypeCmd1;
638   delete eminCmd1;                                631   delete eminCmd1;
639   delete emaxCmd1;                                632   delete emaxCmd1;
640   delete monoenergyCmd1;                          633   delete monoenergyCmd1;
641   delete engsigmaCmd1;                            634   delete engsigmaCmd1;
642   delete alphaCmd1;                               635   delete alphaCmd1;
643   delete tempCmd1;                                636   delete tempCmd1;
644   delete ezeroCmd1;                               637   delete ezeroCmd1;
645   delete gradientCmd1;                            638   delete gradientCmd1;
646   delete interceptCmd1;                           639   delete interceptCmd1;
647   delete arbeintCmd1;                             640   delete arbeintCmd1;
648   delete calculateCmd1;                           641   delete calculateCmd1;
649   delete energyspecCmd1;                          642   delete energyspecCmd1;
650   delete diffspecCmd1;                            643   delete diffspecCmd1;
651   delete applyEnergyWeightCmd1;                   644   delete applyEnergyWeightCmd1;
652                                                   645 
653   delete histDirectory;                           646   delete histDirectory;
654   delete histnameCmd1;                            647   delete histnameCmd1;
655   delete resethistCmd1;                           648   delete resethistCmd1;
656   delete histpointCmd1;                           649   delete histpointCmd1;
657   delete histfileCmd1;                            650   delete histfileCmd1;
658   delete arbintCmd1;                              651   delete arbintCmd1;
659                                                   652 
660   delete verbosityCmd;                            653   delete verbosityCmd;
661   delete volChkCmd;                            << 
662                                                << 
663   delete ionCmd;                                  654   delete ionCmd;
664   delete ionLvlCmd;                               655   delete ionLvlCmd;
665   delete particleCmd;                             656   delete particleCmd;
666   delete timeCmd;                                 657   delete timeCmd;
667   delete polCmd;                                  658   delete polCmd;
668   delete numberCmd;                               659   delete numberCmd;
669   delete positionCmd;                             660   delete positionCmd;
670   delete directionCmd;                            661   delete directionCmd;
671   delete energyCmd;                               662   delete energyCmd;
672   delete listCmd;                                 663   delete listCmd;
673                                                   664 
674   delete sourceDirectory;                         665   delete sourceDirectory;
675   delete addsourceCmd;                            666   delete addsourceCmd;
676   delete listsourceCmd;                           667   delete listsourceCmd;
677   delete clearsourceCmd;                          668   delete clearsourceCmd;
678   delete getsourceCmd;                            669   delete getsourceCmd;
679   delete setsourceCmd;                            670   delete setsourceCmd;
680   delete setintensityCmd;                         671   delete setintensityCmd;
681   delete deletesourceCmd;                         672   delete deletesourceCmd;
682   delete multiplevertexCmd;                       673   delete multiplevertexCmd;
683   delete flatsamplingCmd;                         674   delete flatsamplingCmd;
684                                                   675 
685   delete gpsDirectory;                            676   delete gpsDirectory;
686   theInstance = nullptr;                          677   theInstance = nullptr;
687 }                                                 678 }
688                                                   679 
689 #define CHECKPG() { if (fParticleGun==nullptr)    680 #define CHECKPG() { if (fParticleGun==nullptr) { \
690                       G4ExceptionDescription m    681                       G4ExceptionDescription msg; \
691                       msg << "Command "<< comm    682                       msg << "Command "<< command->GetCommandPath()<<"/";\
692                       msg << command->GetComma    683                       msg << command->GetCommandName(); \
693                       msg << " used but no par    684                       msg << " used but no particle sources are set.";\
694                       msg <<" Add at least a s    685                       msg <<" Add at least a source with: /gps/source/add.";\
695                       G4Exception("G4GeneralPa    686                       G4Exception("G4GeneralParticleSourceMessenger::SetNewValue","G4GPS003",\
696                                   FatalExcepti    687                                   FatalException,msg); return;\
697                   } }                             688                   } }
698                                                   689 
699 void G4GeneralParticleSourceMessenger::SetNewV    690 void G4GeneralParticleSourceMessenger::SetNewValue(G4UIcommand *command, G4String newValues)
700 {                                                 691 {
701 //  if(command == typeCmd)                        692 //  if(command == typeCmd)
702 //    {                                           693 //    {
703 //      CHECKPG(); fParticleGun->GetPosDist()-    694 //      CHECKPG(); fParticleGun->GetPosDist()->SetPosDisType(newValues);
704 //      G4cout << " G4GeneralParticleSourceMes    695 //      G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
705 //             << " The command is obsolete an    696 //             << " The command is obsolete and will be removed soon." << G4endl
706 //             << " Please try to use the new     697 //             << " Please try to use the new structured commands!" << G4endl;
707 //    }                                           698 //    }
708 //  else if(command == shapeCmd)                  699 //  else if(command == shapeCmd)
709 //    {                                           700 //    {
710 //      CHECKPG(); fParticleGun->GetPosDist()-    701 //      CHECKPG(); fParticleGun->GetPosDist()->SetPosDisShape(newValues);
711 //      G4cout << " G4GeneralParticleSourceMes    702 //      G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
712 //             << " The command is obsolete an    703 //             << " The command is obsolete and will be removed soon." << G4endl
713 //             << " Please try to use the new     704 //             << " Please try to use the new structured commands!" << G4endl;
714 //    }                                           705 //    }
715 //  else if(command == centreCmd)                 706 //  else if(command == centreCmd)
716 //    {                                           707 //    {
717 //      CHECKPG(); fParticleGun->GetPosDist()-    708 //      CHECKPG(); fParticleGun->GetPosDist()->SetCentreCoords(centreCmd->GetNew3VectorValue(newValues));
718 //      G4cout << " G4GeneralParticleSourceMes    709 //      G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
719 //             << " The command is obsolete an    710 //             << " The command is obsolete and will be removed soon." << G4endl
720 //             << " Please try to use the new     711 //             << " Please try to use the new structured commands!" << G4endl;
721 //    }                                           712 //    }
722 //  else if(command == posrot1Cmd)                713 //  else if(command == posrot1Cmd)
723 //    {                                           714 //    {
724 //      CHECKPG(); fParticleGun->GetPosDist()-    715 //      CHECKPG(); fParticleGun->GetPosDist()->SetPosRot1(posrot1Cmd->GetNew3VectorValue(newValues));
725 //      G4cout << " G4GeneralParticleSourceMes    716 //      G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
726 //             << " The command is obsolete an    717 //             << " The command is obsolete and will be removed soon." << G4endl
727 //             << " Please try to use the new     718 //             << " Please try to use the new structured commands!" << G4endl;
728 //    }                                           719 //    }
729 //  else if(command == posrot2Cmd)                720 //  else if(command == posrot2Cmd)
730 //    {                                           721 //    {
731 //      CHECKPG(); fParticleGun->GetPosDist()-    722 //      CHECKPG(); fParticleGun->GetPosDist()->SetPosRot2(posrot2Cmd->GetNew3VectorValue(newValues));
732 //      G4cout << " G4GeneralParticleSourceMes    723 //      G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
733 //             << " The command is obsolete an    724 //             << " The command is obsolete and will be removed soon." << G4endl
734 //             << " Please try to use the new     725 //             << " Please try to use the new structured commands!" << G4endl;
735 //    }                                           726 //    }
736 //  else if(command == halfxCmd)                  727 //  else if(command == halfxCmd)
737 //    {                                           728 //    {
738 //      CHECKPG(); fParticleGun->GetPosDist()-    729 //      CHECKPG(); fParticleGun->GetPosDist()->SetHalfX(halfxCmd->GetNewDoubleValue(newValues));
739 //      G4cout << " G4GeneralParticleSourceMes    730 //      G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
740 //             << " The command is obsolete an    731 //             << " The command is obsolete and will be removed soon." << G4endl
741 //             << " Please try to use the new     732 //             << " Please try to use the new structured commands!" << G4endl;
742 //    }                                           733 //    }
743 //  else if(command == halfyCmd)                  734 //  else if(command == halfyCmd)
744 //    {                                           735 //    {
745 //      CHECKPG(); fParticleGun->GetPosDist()-    736 //      CHECKPG(); fParticleGun->GetPosDist()->SetHalfY(halfyCmd->GetNewDoubleValue(newValues));
746 //      G4cout << " G4GeneralParticleSourceMes    737 //      G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
747 //             << " The command is obsolete an    738 //             << " The command is obsolete and will be removed soon." << G4endl
748 //             << " Please try to use the new     739 //             << " Please try to use the new structured commands!" << G4endl;
749 //    }                                           740 //    }
750 //  else if(command == halfzCmd)                  741 //  else if(command == halfzCmd)
751 //    {                                           742 //    {
752 //      CHECKPG(); fParticleGun->GetPosDist()-    743 //      CHECKPG(); fParticleGun->GetPosDist()->SetHalfZ(halfzCmd->GetNewDoubleValue(newValues));
753 //      G4cout << " G4GeneralParticleSourceMes    744 //      G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
754 //             << " The command is obsolete an    745 //             << " The command is obsolete and will be removed soon." << G4endl
755 //             << " Please try to use the new     746 //             << " Please try to use the new structured commands!" << G4endl;
756 //    }                                           747 //    }
757 //  else if(command == radiusCmd)                 748 //  else if(command == radiusCmd)
758 //    {                                           749 //    {
759 //      CHECKPG(); fParticleGun->GetPosDist()-    750 //      CHECKPG(); fParticleGun->GetPosDist()->SetRadius(radiusCmd->GetNewDoubleValue(newValues));
760 //      G4cout << " G4GeneralParticleSourceMes    751 //      G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
761 //             << " The command is obsolete an    752 //             << " The command is obsolete and will be removed soon." << G4endl
762 //             << " Please try to use the new     753 //             << " Please try to use the new structured commands!" << G4endl;
763 //    }                                           754 //    }
764 //  else if(command == radius0Cmd)                755 //  else if(command == radius0Cmd)
765 //    {                                           756 //    {
766 //      CHECKPG(); fParticleGun->GetPosDist()-    757 //      CHECKPG(); fParticleGun->GetPosDist()->SetRadius0(radius0Cmd->GetNewDoubleValue(newValues));
767 //      G4cout << " G4GeneralParticleSourceMes    758 //      G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
768 //             << " The command is obsolete an    759 //             << " The command is obsolete and will be removed soon." << G4endl
769 //             << " Please try to use the new     760 //             << " Please try to use the new structured commands!" << G4endl;
770 //    }                                           761 //    }
771 //  else if(command == possigmarCmd)              762 //  else if(command == possigmarCmd)
772 //    {                                           763 //    {
773 //      CHECKPG(); fParticleGun->GetPosDist()-    764 //      CHECKPG(); fParticleGun->GetPosDist()->SetBeamSigmaInR(possigmarCmd->GetNewDoubleValue(newValues));
774 //      G4cout << " G4GeneralParticleSourceMes    765 //      G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
775 //             << " The command is obsolete an    766 //             << " The command is obsolete and will be removed soon." << G4endl
776 //             << " Please try to use the new     767 //             << " Please try to use the new structured commands!" << G4endl;
777 //    }                                           768 //    }
778 //  else if(command == possigmaxCmd)              769 //  else if(command == possigmaxCmd)
779 //    {                                           770 //    {
780 //      CHECKPG(); fParticleGun->GetPosDist()-    771 //      CHECKPG(); fParticleGun->GetPosDist()->SetBeamSigmaInX(possigmaxCmd->GetNewDoubleValue(newValues));
781 //      G4cout << " G4GeneralParticleSourceMes    772 //      G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
782 //             << " The command is obsolete an    773 //             << " The command is obsolete and will be removed soon." << G4endl
783 //             << " Please try to use the new     774 //             << " Please try to use the new structured commands!" << G4endl;
784 //    }                                           775 //    }
785 //  else if(command == possigmayCmd)              776 //  else if(command == possigmayCmd)
786 //    {                                           777 //    {
787 //      CHECKPG(); fParticleGun->GetPosDist()-    778 //      CHECKPG(); fParticleGun->GetPosDist()->SetBeamSigmaInY(possigmayCmd->GetNewDoubleValue(newValues));
788 //      G4cout << " G4GeneralParticleSourceMes    779 //      G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
789 //             << " The command is obsolete an    780 //             << " The command is obsolete and will be removed soon." << G4endl
790 //             << " Please try to use the new     781 //             << " Please try to use the new structured commands!" << G4endl;
791 //    }                                           782 //    }
792 //  else if(command == paralpCmd)                 783 //  else if(command == paralpCmd)
793 //    {                                           784 //    {
794 //      CHECKPG(); fParticleGun->GetPosDist()-    785 //      CHECKPG(); fParticleGun->GetPosDist()->SetParAlpha(paralpCmd->GetNewDoubleValue(newValues));
795 //      G4cout << " G4GeneralParticleSourceMes    786 //      G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
796 //             << " The command is obsolete an    787 //             << " The command is obsolete and will be removed soon." << G4endl
797 //             << " Please try to use the new     788 //             << " Please try to use the new structured commands!" << G4endl;
798 //    }                                           789 //    }
799 //  else if(command == partheCmd)                 790 //  else if(command == partheCmd)
800 //    {                                           791 //    {
801 //      CHECKPG(); fParticleGun->GetPosDist()-    792 //      CHECKPG(); fParticleGun->GetPosDist()->SetParTheta(partheCmd->GetNewDoubleValue(newValues));
802 //      G4cout << " G4GeneralParticleSourceMes    793 //      G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
803 //             << " The command is obsolete an    794 //             << " The command is obsolete and will be removed soon." << G4endl
804 //             << " Please try to use the new     795 //             << " Please try to use the new structured commands!" << G4endl;
805 //    }                                           796 //    }
806 //  else if(command == parphiCmd)                 797 //  else if(command == parphiCmd)
807 //    {                                           798 //    {
808 //      CHECKPG(); fParticleGun->GetPosDist()-    799 //      CHECKPG(); fParticleGun->GetPosDist()->SetParPhi(parphiCmd->GetNewDoubleValue(newValues));
809 //      G4cout << " G4GeneralParticleSourceMes    800 //      G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
810 //             << " The command is obsolete an    801 //             << " The command is obsolete and will be removed soon." << G4endl
811 //             << " Please try to use the new     802 //             << " Please try to use the new structured commands!" << G4endl;
812 //    }                                           803 //    }
813 //  else if(command == confineCmd)                804 //  else if(command == confineCmd)
814 //    {                                           805 //    {
815 //      CHECKPG(); fParticleGun->GetPosDist()-    806 //      CHECKPG(); fParticleGun->GetPosDist()->ConfineSourceToVolume(newValues);
816 //      G4cout << " G4GeneralParticleSourceMes    807 //      G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
817 //             << " The command is obsolete an    808 //             << " The command is obsolete and will be removed soon." << G4endl
818 //             << " Please try to use the new     809 //             << " Please try to use the new structured commands!" << G4endl;
819 //    }                                           810 //    }
820 //  else if(command == angtypeCmd)                811 //  else if(command == angtypeCmd)
821 //    {                                           812 //    {
822 //      CHECKPG(); fParticleGun->GetAngDist()-    813 //      CHECKPG(); fParticleGun->GetAngDist()->SetAngDistType(newValues);
823 //      G4cout << " G4GeneralParticleSourceMes    814 //      G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
824 //             << " The command is obsolete an    815 //             << " The command is obsolete and will be removed soon." << G4endl
825 //             << " Please try to use the new     816 //             << " Please try to use the new structured commands!" << G4endl;
826 //    }                                           817 //    }
827 //  else if(command == angrot1Cmd)                818 //  else if(command == angrot1Cmd)
828 //    {                                           819 //    {
829 //      CHECKPG();                                820 //      CHECKPG();
830 //      G4String a = "angref1";                   821 //      G4String a = "angref1";
831 //      fParticleGun->GetAngDist()->DefineAngR    822 //      fParticleGun->GetAngDist()->DefineAngRefAxes(a,angrot1Cmd->GetNew3VectorValue(newValues));
832 //      G4cout << " G4GeneralParticleSourceMes    823 //      G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
833 //             << " The command is obsolete an    824 //             << " The command is obsolete and will be removed soon." << G4endl
834 //             << " Please try to use the new     825 //             << " Please try to use the new structured commands!" << G4endl;
835 //    }                                           826 //    }
836 //  else if(command == angrot2Cmd)                827 //  else if(command == angrot2Cmd)
837 //    {                                           828 //    {
838 //      CHECKPG();                                829 //      CHECKPG();
839 //      G4String a = "angref2";                   830 //      G4String a = "angref2";
840 //      fParticleGun->GetAngDist()->DefineAngR    831 //      fParticleGun->GetAngDist()->DefineAngRefAxes(a,angrot2Cmd->GetNew3VectorValue(newValues));
841 //      G4cout << " G4GeneralParticleSourceMes    832 //      G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
842 //             << " The command is obsolete an    833 //             << " The command is obsolete and will be removed soon." << G4endl
843 //             << " Please try to use the new     834 //             << " Please try to use the new structured commands!" << G4endl;
844 //    }                                           835 //    }
845 //  else if(command == minthetaCmd)               836 //  else if(command == minthetaCmd)
846 //    {                                           837 //    {
847 //      CHECKPG(); fParticleGun->GetAngDist()-    838 //      CHECKPG(); fParticleGun->GetAngDist()->SetMinTheta(minthetaCmd->GetNewDoubleValue(newValues));
848 //      G4cout << " G4GeneralParticleSourceMes    839 //      G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
849 //             << " The command is obsolete an    840 //             << " The command is obsolete and will be removed soon." << G4endl
850 //             << " Please try to use the new     841 //             << " Please try to use the new structured commands!" << G4endl;
851 //    }                                           842 //    }
852 //  else if(command == minphiCmd)                 843 //  else if(command == minphiCmd)
853 //    {                                           844 //    {
854 //      CHECKPG(); fParticleGun->GetAngDist()-    845 //      CHECKPG(); fParticleGun->GetAngDist()->SetMinPhi(minphiCmd->GetNewDoubleValue(newValues));
855 //      G4cout << " G4GeneralParticleSourceMes    846 //      G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
856 //             << " The command is obsolete an    847 //             << " The command is obsolete and will be removed soon." << G4endl
857 //             << " Please try to use the new     848 //             << " Please try to use the new structured commands!" << G4endl;
858 //    }                                           849 //    }
859 //  else if(command == maxthetaCmd)               850 //  else if(command == maxthetaCmd)
860 //    {                                           851 //    {
861 //      CHECKPG(); fParticleGun->GetAngDist()-    852 //      CHECKPG(); fParticleGun->GetAngDist()->SetMaxTheta(maxthetaCmd->GetNewDoubleValue(newValues));
862 //      G4cout << " G4GeneralParticleSourceMes    853 //      G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
863 //             << " The command is obsolete an    854 //             << " The command is obsolete and will be removed soon." << G4endl
864 //             << " Please try to use the new     855 //             << " Please try to use the new structured commands!" << G4endl;
865 //    }                                           856 //    }
866 //  else if(command == maxphiCmd)                 857 //  else if(command == maxphiCmd)
867 //    {                                           858 //    {
868 //      CHECKPG(); fParticleGun->GetAngDist()-    859 //      CHECKPG(); fParticleGun->GetAngDist()->SetMaxPhi(maxphiCmd->GetNewDoubleValue(newValues));
869 //      G4cout << " G4GeneralParticleSourceMes    860 //      G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
870 //             << " The command is obsolete an    861 //             << " The command is obsolete and will be removed soon." << G4endl
871 //             << " Please try to use the new     862 //             << " Please try to use the new structured commands!" << G4endl;
872 //    }                                           863 //    }
873 //  else if(command == angsigmarCmd)              864 //  else if(command == angsigmarCmd)
874 //    {                                           865 //    {
875 //      CHECKPG(); fParticleGun->GetAngDist()-    866 //      CHECKPG(); fParticleGun->GetAngDist()->SetBeamSigmaInAngR(angsigmarCmd->GetNewDoubleValue(newValues));
876 //      G4cout << " G4GeneralParticleSourceMes    867 //      G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
877 //             << " The command is obsolete an    868 //             << " The command is obsolete and will be removed soon." << G4endl
878 //             << " Please try to use the new     869 //             << " Please try to use the new structured commands!" << G4endl;
879 //    }                                           870 //    }
880 //  else if(command == angsigmaxCmd)              871 //  else if(command == angsigmaxCmd)
881 //    {                                           872 //    {
882 //      CHECKPG(); fParticleGun->GetAngDist()-    873 //      CHECKPG(); fParticleGun->GetAngDist()->SetBeamSigmaInAngX(angsigmaxCmd->GetNewDoubleValue(newValues));
883 //      G4cout << " G4GeneralParticleSourceMes    874 //      G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
884 //             << " The command is obsolete an    875 //             << " The command is obsolete and will be removed soon." << G4endl
885 //             << " Please try to use the new     876 //             << " Please try to use the new structured commands!" << G4endl;
886 //    }                                           877 //    }
887 //  else if(command == angsigmayCmd)              878 //  else if(command == angsigmayCmd)
888 //    {                                           879 //    {
889 //      CHECKPG(); fParticleGun->GetAngDist()-    880 //      CHECKPG(); fParticleGun->GetAngDist()->SetBeamSigmaInAngY(angsigmayCmd->GetNewDoubleValue(newValues));
890 //      G4cout << " G4GeneralParticleSourceMes    881 //      G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
891 //             << " The command is obsolete an    882 //             << " The command is obsolete and will be removed soon." << G4endl
892 //             << " Please try to use the new     883 //             << " Please try to use the new structured commands!" << G4endl;
893 //    }                                           884 //    }
894 //  else if(command == useuserangaxisCmd)         885 //  else if(command == useuserangaxisCmd)
895 //    {                                           886 //    {
896 //      CHECKPG(); fParticleGun->GetAngDist()-    887 //      CHECKPG(); fParticleGun->GetAngDist()->SetUseUserAngAxis(useuserangaxisCmd->GetNewBoolValue(newValues));
897 //      G4cout << " G4GeneralParticleSourceMes    888 //      G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
898 //             << " The command is obsolete an    889 //             << " The command is obsolete and will be removed soon." << G4endl
899 //             << " Please try to use the new     890 //             << " Please try to use the new structured commands!" << G4endl;
900 //    }                                           891 //    }
901 //  else if(command == surfnormCmd)               892 //  else if(command == surfnormCmd)
902 //    {                                           893 //    {
903 //      CHECKPG(); fParticleGun->GetAngDist()-    894 //      CHECKPG(); fParticleGun->GetAngDist()->SetUserWRTSurface(surfnormCmd->GetNewBoolValue(newValues));
904 //      G4cout << " G4GeneralParticleSourceMes    895 //      G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
905 //             << " The command is obsolete an    896 //             << " The command is obsolete and will be removed soon." << G4endl
906 //             << " Please try to use the new     897 //             << " Please try to use the new structured commands!" << G4endl;
907 //    }                                           898 //    }
908 //  else if(command == energytypeCmd)             899 //  else if(command == energytypeCmd)
909 //    {                                           900 //    {
910 //      CHECKPG(); fParticleGun->GetEneDist()-    901 //      CHECKPG(); fParticleGun->GetEneDist()->SetEnergyDisType(newValues);
911 //      G4cout << " G4GeneralParticleSourceMes    902 //      G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
912 //             << " The command is obsolete an    903 //             << " The command is obsolete and will be removed soon." << G4endl
913 //             << " Please try to use the new     904 //             << " Please try to use the new structured commands!" << G4endl;
914 //    }                                           905 //    }
915 //  else if(command == eminCmd)                   906 //  else if(command == eminCmd)
916 //    {                                           907 //    {
917 //      CHECKPG(); fParticleGun->GetEneDist()-    908 //      CHECKPG(); fParticleGun->GetEneDist()->SetEmin(eminCmd->GetNewDoubleValue(newValues));
918 //      G4cout << " G4GeneralParticleSourceMes    909 //      G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
919 //             << " The command is obsolete an    910 //             << " The command is obsolete and will be removed soon." << G4endl
920 //             << " Please try to use the new     911 //             << " Please try to use the new structured commands!" << G4endl;
921 //    }                                           912 //    }
922 //  else if(command == emaxCmd)                   913 //  else if(command == emaxCmd)
923 //    {                                           914 //    {
924 //      CHECKPG(); fParticleGun->GetEneDist()-    915 //      CHECKPG(); fParticleGun->GetEneDist()->SetEmax(emaxCmd->GetNewDoubleValue(newValues));
925 //      G4cout << " G4GeneralParticleSourceMes    916 //      G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
926 //             << " The command is obsolete an    917 //             << " The command is obsolete and will be removed soon." << G4endl
927 //             << " Please try to use the new     918 //             << " Please try to use the new structured commands!" << G4endl;
928 //    }                                           919 //    }
929 //  else if(command == monoenergyCmd)             920 //  else if(command == monoenergyCmd)
930 //    {                                           921 //    {
931 //      CHECKPG(); fParticleGun->GetEneDist()-    922 //      CHECKPG(); fParticleGun->GetEneDist()->SetMonoEnergy(monoenergyCmd->GetNewDoubleValue(newValues));
932 //      G4cout << " G4GeneralParticleSourceMes    923 //      G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
933 //             << " The command is obsolete an    924 //             << " The command is obsolete and will be removed soon." << G4endl
934 //             << " Please try to use the new     925 //             << " Please try to use the new structured commands!" << G4endl;
935 //    }                                           926 //    }
936 //  else if(command == engsigmaCmd)               927 //  else if(command == engsigmaCmd)
937 //    {                                           928 //    {
938 //      CHECKPG(); fParticleGun->GetEneDist()-    929 //      CHECKPG(); fParticleGun->GetEneDist()->SetBeamSigmaInE(engsigmaCmd->GetNewDoubleValue(newValues));
939 //      G4cout << " G4GeneralParticleSourceMes    930 //      G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
940 //             << " The command is obsolete an    931 //             << " The command is obsolete and will be removed soon." << G4endl
941 //             << " Please try to use the new     932 //             << " Please try to use the new structured commands!" << G4endl;
942 //    }                                           933 //    }
943 //  else if(command == alphaCmd)                  934 //  else if(command == alphaCmd)
944 //    {                                           935 //    {
945 //      CHECKPG(); fParticleGun->GetEneDist()-    936 //      CHECKPG(); fParticleGun->GetEneDist()->SetAlpha(alphaCmd->GetNewDoubleValue(newValues));
946 //      G4cout << " G4GeneralParticleSourceMes    937 //      G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
947 //             << " The command is obsolete an    938 //             << " The command is obsolete and will be removed soon." << G4endl
948 //             << " Please try to use the new     939 //             << " Please try to use the new structured commands!" << G4endl;
949 //    }                                           940 //    }
950 //  else if(command == tempCmd)                   941 //  else if(command == tempCmd)
951 //    {                                           942 //    {
952 //      CHECKPG(); fParticleGun->GetEneDist()-    943 //      CHECKPG(); fParticleGun->GetEneDist()->SetTemp(tempCmd->GetNewDoubleValue(newValues));
953 //      G4cout << " G4GeneralParticleSourceMes    944 //      G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
954 //             << " The command is obsolete an    945 //             << " The command is obsolete and will be removed soon." << G4endl
955 //             << " Please try to use the new     946 //             << " Please try to use the new structured commands!" << G4endl;
956 //    }                                           947 //    }
957 //  else if(command == ezeroCmd)                  948 //  else if(command == ezeroCmd)
958 //    {                                           949 //    {
959 //      CHECKPG(); fParticleGun->GetEneDist()-    950 //      CHECKPG(); fParticleGun->GetEneDist()->SetEzero(ezeroCmd->GetNewDoubleValue(newValues));
960 //      G4cout << " G4GeneralParticleSourceMes    951 //      G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
961 //             << " The command is obsolete an    952 //             << " The command is obsolete and will be removed soon." << G4endl
962 //             << " Please try to use the new     953 //             << " Please try to use the new structured commands!" << G4endl;
963 //    }                                           954 //    }
964 //  else if(command == gradientCmd)               955 //  else if(command == gradientCmd)
965 //    {                                           956 //    {
966 //      CHECKPG(); fParticleGun->GetEneDist()-    957 //      CHECKPG(); fParticleGun->GetEneDist()->SetGradient(gradientCmd->GetNewDoubleValue(newValues));
967 //      G4cout << " G4GeneralParticleSourceMes    958 //      G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
968 //             << " The command is obsolete an    959 //             << " The command is obsolete and will be removed soon." << G4endl
969 //             << " Please try to use the new     960 //             << " Please try to use the new structured commands!" << G4endl;
970 //    }                                           961 //    }
971 //  else if(command == interceptCmd)              962 //  else if(command == interceptCmd)
972 //    {                                           963 //    {
973 //      CHECKPG(); fParticleGun->GetEneDist()-    964 //      CHECKPG(); fParticleGun->GetEneDist()->SetInterCept(interceptCmd->GetNewDoubleValue(newValues));
974 //      G4cout << " G4GeneralParticleSourceMes    965 //      G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
975 //             << " The command is obsolete an    966 //             << " The command is obsolete and will be removed soon." << G4endl
976 //             << " Please try to use the new     967 //             << " Please try to use the new structured commands!" << G4endl;
977 //    }                                           968 //    }
978 //  else if(command == calculateCmd)              969 //  else if(command == calculateCmd)
979 //    {                                           970 //    {
980 //      CHECKPG(); fParticleGun->GetEneDist()-    971 //      CHECKPG(); fParticleGun->GetEneDist()->Calculate();
981 //      G4cout << " G4GeneralParticleSourceMes    972 //      G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
982 //             << " The command is obsolete an    973 //             << " The command is obsolete and will be removed soon." << G4endl
983 //             << " Please try to use the new     974 //             << " Please try to use the new structured commands!" << G4endl;
984 //    }                                           975 //    }
985 //  else if(command == energyspecCmd)             976 //  else if(command == energyspecCmd)
986 //    {                                           977 //    {
987 //      CHECKPG(); fParticleGun->GetEneDist()-    978 //      CHECKPG(); fParticleGun->GetEneDist()->InputEnergySpectra(energyspecCmd->GetNewBoolValue(newValues));
988 //      G4cout << " G4GeneralParticleSourceMes    979 //      G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
989 //             << " The command is obsolete an    980 //             << " The command is obsolete and will be removed soon." << G4endl
990 //             << " Please try to use the new     981 //             << " Please try to use the new structured commands!" << G4endl;
991 //    }                                           982 //    }
992 //  else if(command == diffspecCmd)               983 //  else if(command == diffspecCmd)
993 //    {                                           984 //    {
994 //      CHECKPG(); fParticleGun->GetEneDist()-    985 //      CHECKPG(); fParticleGun->GetEneDist()->InputDifferentialSpectra(diffspecCmd->GetNewBoolValue(newValues));
995 //      G4cout << " G4GeneralParticleSourceMes    986 //      G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
996 //             << " The command is obsolete an    987 //             << " The command is obsolete and will be removed soon." << G4endl
997 //             << " Please try to use the new     988 //             << " Please try to use the new structured commands!" << G4endl;
998 //    }                                           989 //    }
999 //  else if(command == histnameCmd)               990 //  else if(command == histnameCmd)
1000 //    {                                          991 //    {
1001 //      histtype = newValues;                    992 //      histtype = newValues;
1002 //      G4cout << " G4GeneralParticleSourceMe    993 //      G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1003 //             << " The command is obsolete a    994 //             << " The command is obsolete and will be removed soon." << G4endl
1004 //             << " Please try to use the new    995 //             << " Please try to use the new structured commands!" << G4endl;
1005 //    }                                          996 //    }
1006 //  else                                         997 //  else
1007 //      if(command == histpointCmd)              998 //      if(command == histpointCmd)
1008 //    {                                          999 //    {
1009 //      CHECKPG();                               1000 //      CHECKPG();
1010 //      if(histtype == "biasx")                  1001 //      if(histtype == "biasx")
1011 //        fParticleGun->GetBiasRndm()->SetXBi    1002 //        fParticleGun->GetBiasRndm()->SetXBias(histpointCmd->GetNew3VectorValue(newValues));
1012 //      if(histtype == "biasy")                  1003 //      if(histtype == "biasy")
1013 //        fParticleGun->GetBiasRndm()->SetYBi    1004 //        fParticleGun->GetBiasRndm()->SetYBias(histpointCmd->GetNew3VectorValue(newValues));
1014 //      if(histtype == "biasz")                  1005 //      if(histtype == "biasz")
1015 //        fParticleGun->GetBiasRndm()->SetZBi    1006 //        fParticleGun->GetBiasRndm()->SetZBias(histpointCmd->GetNew3VectorValue(newValues));
1016 //      if(histtype == "biast")                  1007 //      if(histtype == "biast")
1017 //        fParticleGun->GetBiasRndm()->SetThe    1008 //        fParticleGun->GetBiasRndm()->SetThetaBias(histpointCmd->GetNew3VectorValue(newValues));
1018 //      if(histtype == "biasp")                  1009 //      if(histtype == "biasp")
1019 //        fParticleGun->GetBiasRndm()->SetPhi    1010 //        fParticleGun->GetBiasRndm()->SetPhiBias(histpointCmd->GetNew3VectorValue(newValues));
1020 //      if(histtype == "biase")                  1011 //      if(histtype == "biase")
1021 //        fParticleGun->GetBiasRndm()->SetEne    1012 //        fParticleGun->GetBiasRndm()->SetEnergyBias(histpointCmd->GetNew3VectorValue(newValues));
1022 //      if(histtype == "theta")                  1013 //      if(histtype == "theta")
1023 //        fParticleGun->GetAngDist()->UserDef    1014 //        fParticleGun->GetAngDist()->UserDefAngTheta(histpointCmd->GetNew3VectorValue(newValues));
1024 //      if(histtype == "phi")                    1015 //      if(histtype == "phi")
1025 //        fParticleGun->GetAngDist()->UserDef    1016 //        fParticleGun->GetAngDist()->UserDefAngPhi(histpointCmd->GetNew3VectorValue(newValues));
1026 //      if(histtype == "energy")                 1017 //      if(histtype == "energy")
1027 //        fParticleGun->GetEneDist()->UserEne    1018 //        fParticleGun->GetEneDist()->UserEnergyHisto(histpointCmd->GetNew3VectorValue(newValues));
1028 //      if(histtype == "arb")                    1019 //      if(histtype == "arb")
1029 //        fParticleGun->GetEneDist()->ArbEner    1020 //        fParticleGun->GetEneDist()->ArbEnergyHisto(histpointCmd->GetNew3VectorValue(newValues));
1030 //      if(histtype == "epn")                    1021 //      if(histtype == "epn")
1031 //        fParticleGun->GetEneDist()->EpnEner    1022 //        fParticleGun->GetEneDist()->EpnEnergyHisto(histpointCmd->GetNew3VectorValue(newValues));
1032 //      G4cout << " G4GeneralParticleSourceMe    1023 //      G4cout << " G4GeneralParticleSourceMessenger - Warning: The command is obsolete and will be removed soon. Please try to use the new structured commands!" << G4endl;
1033 //    }                                          1024 //    }
1034 //  else if(command == resethistCmd)             1025 //  else if(command == resethistCmd)
1035 //    {                                          1026 //    {
1036 //      CHECKPG();                               1027 //      CHECKPG();
1037 //      if(newValues == "theta" || newValues     1028 //      if(newValues == "theta" || newValues == "phi") {
1038 //        fParticleGun->GetAngDist()->ReSetHi    1029 //        fParticleGun->GetAngDist()->ReSetHist(newValues);
1039 //      } else if (newValues == "energy" || n    1030 //      } else if (newValues == "energy" || newValues == "arb" || newValues == "epn") {
1040 //        fParticleGun->GetEneDist()->ReSetHi    1031 //        fParticleGun->GetEneDist()->ReSetHist(newValues);
1041 //      } else {                                 1032 //      } else {
1042 //        fParticleGun->GetBiasRndm()->ReSetH    1033 //        fParticleGun->GetBiasRndm()->ReSetHist(newValues);
1043 //      }                                        1034 //      }
1044 //      G4cout << " G4GeneralParticleSourceMe    1035 //      G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1045 //             << " The command is obsolete a    1036 //             << " The command is obsolete and will be removed soon." << G4endl
1046 //             << " Please try to use the new    1037 //             << " Please try to use the new structured commands!" << G4endl;
1047 //    }                                          1038 //    }
1048 //  else if(command == arbintCmd)                1039 //  else if(command == arbintCmd)
1049 //    {                                          1040 //    {
1050 //      CHECKPG();                               1041 //      CHECKPG();
1051 //      fParticleGun->GetEneDist()->ArbInterp    1042 //      fParticleGun->GetEneDist()->ArbInterpolate(newValues);
1052 //      G4cout << " G4GeneralParticleSourceMe    1043 //      G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1053 //             << " The command is obsolete a    1044 //             << " The command is obsolete and will be removed soon." << G4endl
1054 //             << " Please try to use the new    1045 //             << " Please try to use the new structured commands!" << G4endl;
1055 //    }                                          1046 //    }
1056 // else                                          1047 // else
1057        if( command==directionCmd )               1048        if( command==directionCmd )
1058     {                                            1049     {
1059       CHECKPG();                                 1050       CHECKPG();
1060       fParticleGun->GetAngDist()->SetAngDistT    1051       fParticleGun->GetAngDist()->SetAngDistType("planar");
1061       fParticleGun->GetAngDist()->SetParticle    1052       fParticleGun->GetAngDist()->SetParticleMomentumDirection(directionCmd->GetNew3VectorValue(newValues));
1062     }                                            1053     }
1063   else if( command==energyCmd )                  1054   else if( command==energyCmd )
1064     {                                            1055     {
1065       CHECKPG();                                 1056       CHECKPG();
1066       fParticleGun->GetEneDist()->SetEnergyDi    1057       fParticleGun->GetEneDist()->SetEnergyDisType("Mono");
1067       fParticleGun->GetEneDist()->SetMonoEner    1058       fParticleGun->GetEneDist()->SetMonoEnergy(energyCmd->GetNewDoubleValue(newValues));
1068     }                                            1059     }
1069   else if( command==positionCmd )                1060   else if( command==positionCmd )
1070     {                                            1061     {
1071       CHECKPG();                                 1062       CHECKPG();
1072       fParticleGun->GetPosDist()->SetPosDisTy    1063       fParticleGun->GetPosDist()->SetPosDisType("Point");    
1073       fParticleGun->GetPosDist()->SetCentreCo    1064       fParticleGun->GetPosDist()->SetCentreCoords(positionCmd->GetNew3VectorValue(newValues));
1074     }                                            1065     }
1075   else if(command == verbosityCmd)               1066   else if(command == verbosityCmd)
1076     {                                            1067     {
1077       fGPS->SetVerbosity(verbosityCmd->GetNew    1068       fGPS->SetVerbosity(verbosityCmd->GetNewIntValue(newValues));
1078       // CHECKPG();                              1069       // CHECKPG();
1079       // fParticleGun->SetVerbosity(verbosity    1070       // fParticleGun->SetVerbosity(verbosityCmd->GetNewIntValue(newValues));
1080     }                                            1071     }
1081   else if( command==volChkCmd )               << 
1082     {                                         << 
1083       fGPS->CheckInside(volChkCmd->GetNewBool << 
1084     }                                         << 
1085   else if( command==particleCmd )                1072   else if( command==particleCmd )
1086     {                                            1073     {
1087       if (newValues =="ion")                     1074       if (newValues =="ion")
1088       {                                          1075       {
1089         fShootIon = true;                        1076         fShootIon = true;
1090       }                                          1077       }
1091       else                                       1078       else
1092       {                                          1079       {
1093         fShootIon = false;                       1080         fShootIon = false;
1094         G4ParticleDefinition* pd = particleTa    1081         G4ParticleDefinition* pd = particleTable->FindParticle(newValues);
1095         if(pd != nullptr)                        1082         if(pd != nullptr)
1096         {                                        1083         {
1097           CHECKPG();                             1084           CHECKPG();
1098           fParticleGun->SetParticleDefinition    1085           fParticleGun->SetParticleDefinition( pd );
1099         }                                        1086         }
1100       }                                          1087       }
1101     }                                            1088     }
1102   else if( command==timeCmd )                    1089   else if( command==timeCmd )
1103     {                                            1090     {
1104       CHECKPG();                                 1091       CHECKPG();
1105       fParticleGun->SetParticleTime(timeCmd->    1092       fParticleGun->SetParticleTime(timeCmd->GetNewDoubleValue(newValues));
1106     }                                            1093     }
1107   else if( command==polCmd )                     1094   else if( command==polCmd )
1108     {                                            1095     {
1109       CHECKPG();                                 1096       CHECKPG();
1110       fParticleGun->SetParticlePolarization(p    1097       fParticleGun->SetParticlePolarization(polCmd->GetNew3VectorValue(newValues));
1111     }                                            1098     }
1112   else if( command==numberCmd )                  1099   else if( command==numberCmd )
1113     {                                            1100     {
1114       CHECKPG();                                 1101       CHECKPG();
1115       fParticleGun->SetNumberOfParticles(numb    1102       fParticleGun->SetNumberOfParticles(numberCmd->GetNewIntValue(newValues));
1116     }                                            1103     }
1117   else if( command==ionCmd )                     1104   else if( command==ionCmd )
1118     {                                            1105     {
1119       IonCommand(newValues);                     1106       IonCommand(newValues);
1120     }                                            1107     }
1121   else if( command==ionLvlCmd )                  1108   else if( command==ionLvlCmd )
1122     {                                            1109     {
1123       IonLvlCommand(newValues);                  1110       IonLvlCommand(newValues);
1124     }                                            1111     }
1125   else if( command==listCmd )                    1112   else if( command==listCmd )
1126     {                                            1113     { 
1127       particleTable->DumpTable();                1114       particleTable->DumpTable(); 
1128     }                                            1115     }
1129   else if( command==addsourceCmd )               1116   else if( command==addsourceCmd )
1130     {                                            1117     {
1131       fGPS->AddaSource(addsourceCmd->GetNewDo    1118       fGPS->AddaSource(addsourceCmd->GetNewDoubleValue(newValues));
1132     }                                            1119     }
1133   else if( command==listsourceCmd )              1120   else if( command==listsourceCmd )
1134     {                                            1121     { 
1135       fGPS->ListSource();                        1122       fGPS->ListSource();
1136     }                                            1123     }
1137   else if( command==clearsourceCmd )             1124   else if( command==clearsourceCmd )
1138     {                                            1125     { 
1139       fGPS->ClearAll();                          1126       fGPS->ClearAll();
1140       fParticleGun = nullptr;                    1127       fParticleGun = nullptr;      
1141     }                                            1128     }
1142   else if( command==getsourceCmd )               1129   else if( command==getsourceCmd )
1143     {                                            1130     { 
1144       G4cout << " Current source index:" << f    1131       G4cout << " Current source index:" << fGPS->GetCurrentSourceIndex() 
1145              << " ; Intensity:" << fGPS->GetC    1132              << " ; Intensity:" << fGPS->GetCurrentSourceIntensity() << G4endl;
1146     }                                            1133     }
1147   else if( command==setsourceCmd )               1134   else if( command==setsourceCmd )
1148     {                                            1135     { 
1149       // NOTE: This will also sets fParticleG    1136       // NOTE: This will also sets fParticleGun to the courrent source
1150       //       Not very clean, the GPS::SetCu    1137       //       Not very clean, the GPS::SetCurrentSourceto will call:
1151       //       SetParticleSource( G4ParticleS    1138       //       SetParticleSource( G4ParticleSource* )
1152       //       The point is that GPS has no p    1139       //       The point is that GPS has no public API to get a source by index
1153       // TODO: Can we add this API?              1140       // TODO: Can we add this API?
1154       const G4int sn = setsourceCmd->GetNewIn    1141       const G4int sn = setsourceCmd->GetNewIntValue(newValues);
1155       if ( sn >= fGPS->GetNumberofSource() )     1142       if ( sn >= fGPS->GetNumberofSource() )
1156       {                                          1143       {
1157         G4ExceptionDescription msg;              1144         G4ExceptionDescription msg;
1158         msg << "Using command " << setsourceC    1145         msg << "Using command " << setsourceCmd->GetCommandPath() << "/"
1159             << setsourceCmd->GetCommandName()    1146             << setsourceCmd->GetCommandName() << " " << sn;
1160         msg << " is invalid " << fGPS->GetNum    1147         msg << " is invalid " << fGPS->GetNumberofSource()
1161             << " source(s) are defined.";        1148             << " source(s) are defined.";
1162         G4Exception("G4GeneralParticleSourceM    1149         G4Exception("G4GeneralParticleSourceMessenger::SetNewValue",
1163                     "G4GPS005", FatalExceptio    1150                     "G4GPS005", FatalException, msg);
1164       }                                          1151       }
1165       fGPS->SetCurrentSourceto(setsourceCmd->    1152       fGPS->SetCurrentSourceto(setsourceCmd->GetNewIntValue(newValues));
1166     }                                            1153     }
1167   else if( command==setintensityCmd )            1154   else if( command==setintensityCmd )
1168     {                                            1155     { 
1169       fGPS->SetCurrentSourceIntensity(setinte    1156       fGPS->SetCurrentSourceIntensity(setintensityCmd->GetNewDoubleValue(newValues));
1170     }                                            1157     }
1171   else if( command==deletesourceCmd )            1158   else if( command==deletesourceCmd )
1172     {                                            1159     { 
1173       fGPS->DeleteaSource(deletesourceCmd->Ge    1160       fGPS->DeleteaSource(deletesourceCmd->GetNewIntValue(newValues));
1174     }                                            1161     }
1175   else if(command == multiplevertexCmd)          1162   else if(command == multiplevertexCmd)
1176     {                                            1163     {
1177       fGPS->SetMultipleVertex(multiplevertexC    1164       fGPS->SetMultipleVertex(multiplevertexCmd->GetNewBoolValue(newValues));
1178     }                                            1165     }
1179   else if(command == flatsamplingCmd)            1166   else if(command == flatsamplingCmd)
1180     {                                            1167     {
1181       fGPS->SetFlatSampling(flatsamplingCmd->    1168       fGPS->SetFlatSampling(flatsamplingCmd->GetNewBoolValue(newValues));
1182     }                                            1169     }
1183   //                                             1170   //
1184   // new implementations                         1171   // new implementations
1185   //                                             1172   //
1186   else if(command == typeCmd1)                   1173   else if(command == typeCmd1)
1187     {                                            1174     {
1188       CHECKPG();                                 1175       CHECKPG();
1189       fParticleGun->GetPosDist()->SetPosDisTy    1176       fParticleGun->GetPosDist()->SetPosDisType(newValues);
1190     }                                            1177     }
1191   else if(command == shapeCmd1)                  1178   else if(command == shapeCmd1)
1192     {                                            1179     {
1193       CHECKPG();                                 1180       CHECKPG();
1194       fParticleGun->GetPosDist()->SetPosDisSh    1181       fParticleGun->GetPosDist()->SetPosDisShape(newValues);
1195     }                                            1182     }
1196   else if(command == centreCmd1)                 1183   else if(command == centreCmd1)
1197     {                                            1184     {
1198       CHECKPG();                                 1185       CHECKPG();
1199       fParticleGun->GetPosDist()->SetCentreCo    1186       fParticleGun->GetPosDist()->SetCentreCoords(centreCmd1->GetNew3VectorValue(newValues));
1200     }                                            1187     }
1201   else if(command == posrot1Cmd1)                1188   else if(command == posrot1Cmd1)
1202     {                                            1189     {
1203       CHECKPG();                                 1190       CHECKPG();
1204       fParticleGun->GetPosDist()->SetPosRot1(    1191       fParticleGun->GetPosDist()->SetPosRot1(posrot1Cmd1->GetNew3VectorValue(newValues));
1205     }                                            1192     }
1206   else if(command == posrot2Cmd1)                1193   else if(command == posrot2Cmd1)
1207     {                                            1194     {
1208       CHECKPG();                                 1195       CHECKPG();
1209       fParticleGun->GetPosDist()->SetPosRot2(    1196       fParticleGun->GetPosDist()->SetPosRot2(posrot2Cmd1->GetNew3VectorValue(newValues));
1210     }                                            1197     }
1211   else if(command == halfxCmd1)                  1198   else if(command == halfxCmd1)
1212     {                                            1199     {
1213       CHECKPG();                                 1200       CHECKPG();
1214       fParticleGun->GetPosDist()->SetHalfX(ha    1201       fParticleGun->GetPosDist()->SetHalfX(halfxCmd1->GetNewDoubleValue(newValues));
1215     }                                            1202     }
1216   else if(command == halfyCmd1)                  1203   else if(command == halfyCmd1)
1217     {                                            1204     {
1218       CHECKPG();                                 1205       CHECKPG();
1219       fParticleGun->GetPosDist()->SetHalfY(ha    1206       fParticleGun->GetPosDist()->SetHalfY(halfyCmd1->GetNewDoubleValue(newValues));
1220     }                                            1207     }
1221   else if(command == halfzCmd1)                  1208   else if(command == halfzCmd1)
1222     {                                            1209     {
1223       CHECKPG();                                 1210       CHECKPG();
1224       fParticleGun->GetPosDist()->SetHalfZ(ha    1211       fParticleGun->GetPosDist()->SetHalfZ(halfzCmd1->GetNewDoubleValue(newValues));
1225     }                                            1212     }
1226   else if(command == radiusCmd1)                 1213   else if(command == radiusCmd1)
1227     {                                            1214     {
1228       CHECKPG();                                 1215       CHECKPG();
1229       fParticleGun->GetPosDist()->SetRadius(r    1216       fParticleGun->GetPosDist()->SetRadius(radiusCmd1->GetNewDoubleValue(newValues));
1230     }                                            1217     }
1231   else if(command == radius0Cmd1)                1218   else if(command == radius0Cmd1)
1232     {                                            1219     {
1233       CHECKPG();                                 1220       CHECKPG();
1234       fParticleGun->GetPosDist()->SetRadius0(    1221       fParticleGun->GetPosDist()->SetRadius0(radius0Cmd1->GetNewDoubleValue(newValues));
1235     }                                            1222     }
1236   else if(command == possigmarCmd1)              1223   else if(command == possigmarCmd1)
1237     {                                            1224     {
1238       CHECKPG();                                 1225       CHECKPG();
1239       fParticleGun->GetPosDist()->SetBeamSigm    1226       fParticleGun->GetPosDist()->SetBeamSigmaInR(possigmarCmd1->GetNewDoubleValue(newValues));
1240     }                                            1227     }
1241   else if(command == possigmaxCmd1)              1228   else if(command == possigmaxCmd1)
1242     {                                            1229     {
1243       CHECKPG();                                 1230       CHECKPG();
1244       fParticleGun->GetPosDist()->SetBeamSigm    1231       fParticleGun->GetPosDist()->SetBeamSigmaInX(possigmaxCmd1->GetNewDoubleValue(newValues));
1245     }                                            1232     }
1246   else if(command == possigmayCmd1)              1233   else if(command == possigmayCmd1)
1247     {                                            1234     {
1248       CHECKPG();                                 1235       CHECKPG();
1249       fParticleGun->GetPosDist()->SetBeamSigm    1236       fParticleGun->GetPosDist()->SetBeamSigmaInY(possigmayCmd1->GetNewDoubleValue(newValues));
1250     }                                            1237     }
1251   else if(command == paralpCmd1)                 1238   else if(command == paralpCmd1)
1252     {                                            1239     {
1253       CHECKPG();                                 1240       CHECKPG();
1254       fParticleGun->GetPosDist()->SetParAlpha    1241       fParticleGun->GetPosDist()->SetParAlpha(paralpCmd1->GetNewDoubleValue(newValues));
1255     }                                            1242     }
1256   else if(command == partheCmd1)                 1243   else if(command == partheCmd1)
1257     {                                            1244     {
1258       CHECKPG();                                 1245       CHECKPG();
1259       fParticleGun->GetPosDist()->SetParTheta    1246       fParticleGun->GetPosDist()->SetParTheta(partheCmd1->GetNewDoubleValue(newValues));
1260     }                                            1247     }
1261   else if(command == parphiCmd1)                 1248   else if(command == parphiCmd1)
1262     {                                            1249     {
1263       CHECKPG();                                 1250       CHECKPG();
1264       fParticleGun->GetPosDist()->SetParPhi(p    1251       fParticleGun->GetPosDist()->SetParPhi(parphiCmd1->GetNewDoubleValue(newValues));
1265     }                                            1252     }
1266   else if(command == confineCmd1)                1253   else if(command == confineCmd1)
1267     {                                            1254     {
1268       CHECKPG();                                 1255       CHECKPG();
1269       fParticleGun->GetPosDist()->ConfineSour    1256       fParticleGun->GetPosDist()->ConfineSourceToVolume(newValues);
1270     }                                            1257     }
1271   else if(command == angtypeCmd1)                1258   else if(command == angtypeCmd1)
1272     {                                            1259     {
1273       CHECKPG();                                 1260       CHECKPG();
1274       fParticleGun->GetAngDist()->SetAngDistT    1261       fParticleGun->GetAngDist()->SetAngDistType(newValues);
1275     }                                            1262     }
1276   else if(command == angrot1Cmd1)                1263   else if(command == angrot1Cmd1)
1277     {                                            1264     {
1278       CHECKPG();                                 1265       CHECKPG(); 
1279       G4String a = "angref1";                    1266       G4String a = "angref1";
1280       fParticleGun->GetAngDist()->DefineAngRe    1267       fParticleGun->GetAngDist()->DefineAngRefAxes(a,angrot1Cmd1->GetNew3VectorValue(newValues));
1281     }                                            1268     }
1282   else if(command == angrot2Cmd1)                1269   else if(command == angrot2Cmd1)
1283     {                                            1270     {
1284       CHECKPG();                                 1271       CHECKPG(); 
1285       G4String a = "angref2";                    1272       G4String a = "angref2";
1286       fParticleGun->GetAngDist()->DefineAngRe    1273       fParticleGun->GetAngDist()->DefineAngRefAxes(a,angrot2Cmd1->GetNew3VectorValue(newValues));
1287     }                                            1274     }
1288   else if(command == minthetaCmd1)               1275   else if(command == minthetaCmd1)
1289     {                                            1276     {
1290       CHECKPG();                                 1277       CHECKPG(); 
1291       fParticleGun->GetAngDist()->SetMinTheta    1278       fParticleGun->GetAngDist()->SetMinTheta(minthetaCmd1->GetNewDoubleValue(newValues));
1292     }                                            1279     }
1293   else if(command == minphiCmd1)                 1280   else if(command == minphiCmd1)
1294     {                                            1281     {
1295       CHECKPG();                                 1282       CHECKPG();
1296       fParticleGun->GetAngDist()->SetMinPhi(m    1283       fParticleGun->GetAngDist()->SetMinPhi(minphiCmd1->GetNewDoubleValue(newValues));
1297     }                                            1284     }
1298   else if(command == maxthetaCmd1)               1285   else if(command == maxthetaCmd1)
1299     {                                            1286     {
1300       CHECKPG();                                 1287       CHECKPG();
1301       fParticleGun->GetAngDist()->SetMaxTheta    1288       fParticleGun->GetAngDist()->SetMaxTheta(maxthetaCmd1->GetNewDoubleValue(newValues));
1302     }                                            1289     }
1303   else if(command == maxphiCmd1)                 1290   else if(command == maxphiCmd1)
1304     {                                            1291     {
1305       CHECKPG();                                 1292       CHECKPG();
1306       fParticleGun->GetAngDist()->SetMaxPhi(m    1293       fParticleGun->GetAngDist()->SetMaxPhi(maxphiCmd1->GetNewDoubleValue(newValues));
1307     }                                            1294     }
1308   else if(command == angsigmarCmd1)              1295   else if(command == angsigmarCmd1)
1309     {                                            1296     {
1310       CHECKPG();                                 1297       CHECKPG();
1311       fParticleGun->GetAngDist()->SetBeamSigm    1298       fParticleGun->GetAngDist()->SetBeamSigmaInAngR(angsigmarCmd1->GetNewDoubleValue(newValues));
1312     }                                            1299     }
1313   else if(command == angsigmaxCmd1)              1300   else if(command == angsigmaxCmd1)
1314     {                                            1301     {
1315       CHECKPG();                                 1302       CHECKPG();
1316       fParticleGun->GetAngDist()->SetBeamSigm    1303       fParticleGun->GetAngDist()->SetBeamSigmaInAngX(angsigmaxCmd1->GetNewDoubleValue(newValues));
1317     }                                            1304     }
1318   else if(command == angsigmayCmd1)              1305   else if(command == angsigmayCmd1)
1319     {                                            1306     {
1320       CHECKPG();                                 1307       CHECKPG();
1321       fParticleGun->GetAngDist()->SetBeamSigm    1308       fParticleGun->GetAngDist()->SetBeamSigmaInAngY(angsigmayCmd1->GetNewDoubleValue(newValues));
1322     }                                            1309     }
1323   else if(command == angfocusCmd)                1310   else if(command == angfocusCmd)
1324     {                                            1311     {
1325       CHECKPG();                                 1312       CHECKPG();
1326       fParticleGun->GetAngDist()->SetFocusPoi    1313       fParticleGun->GetAngDist()->SetFocusPoint(angfocusCmd->GetNew3VectorValue(newValues));
1327     }                                            1314     }
1328   else if(command == useuserangaxisCmd1)         1315   else if(command == useuserangaxisCmd1)
1329     {                                            1316     {
1330       CHECKPG();                                 1317       CHECKPG();
1331       fParticleGun->GetAngDist()->SetUseUserA    1318       fParticleGun->GetAngDist()->SetUseUserAngAxis(useuserangaxisCmd1->GetNewBoolValue(newValues));
1332     }                                            1319     }
1333   else if(command == surfnormCmd1)               1320   else if(command == surfnormCmd1)
1334     {                                            1321     {
1335       CHECKPG();                                 1322       CHECKPG();
1336       fParticleGun->GetAngDist()->SetUserWRTS    1323       fParticleGun->GetAngDist()->SetUserWRTSurface(surfnormCmd1->GetNewBoolValue(newValues));
1337     }                                            1324     }
1338   else if(command == energytypeCmd1)             1325   else if(command == energytypeCmd1)
1339     {                                            1326     {
1340       CHECKPG();                                 1327       CHECKPG();
1341       if(newValues=="LW")                        1328       if(newValues=="LW")
1342       {                                          1329       {
1343         fParticleGun->GetEneDist()->SetEnergy    1330         fParticleGun->GetEneDist()->SetEnergyDisType("Lin");
1344         fParticleGun->GetEneDist()->SetGradie    1331         fParticleGun->GetEneDist()->SetGradient(0.);
1345         fParticleGun->GetEneDist()->SetInterC    1332         fParticleGun->GetEneDist()->SetInterCept(1.);
1346         fParticleGun->GetEneDist()->ApplyEner    1333         fParticleGun->GetEneDist()->ApplyEnergyWeight(true);
1347       }                                          1334       }
1348       else                                       1335       else
1349       {                                          1336       {
1350         fParticleGun->GetEneDist()->SetEnergy    1337         fParticleGun->GetEneDist()->SetEnergyDisType(newValues);
1351         fParticleGun->GetEneDist()->ApplyEner    1338         fParticleGun->GetEneDist()->ApplyEnergyWeight(false);
1352       }                                          1339       }
1353     }                                            1340     }
1354   else if(command == eminCmd1)                   1341   else if(command == eminCmd1)
1355     {                                            1342     {
1356       CHECKPG();                                 1343       CHECKPG();
1357       fParticleGun->GetEneDist()->SetEmin(emi    1344       fParticleGun->GetEneDist()->SetEmin(eminCmd1->GetNewDoubleValue(newValues));
1358     }                                            1345     }
1359   else if(command == emaxCmd1)                   1346   else if(command == emaxCmd1)
1360     {                                            1347     {
1361       CHECKPG();                                 1348       CHECKPG();
1362       fParticleGun->GetEneDist()->SetEmax(ema    1349       fParticleGun->GetEneDist()->SetEmax(emaxCmd1->GetNewDoubleValue(newValues));
1363     }                                            1350     }
1364   else if(command == monoenergyCmd1)             1351   else if(command == monoenergyCmd1)
1365     {                                            1352     {
1366       CHECKPG();                                 1353       CHECKPG();
1367       fParticleGun->GetEneDist()->SetMonoEner    1354       fParticleGun->GetEneDist()->SetMonoEnergy(monoenergyCmd1->GetNewDoubleValue(newValues));
1368     }                                            1355     }
1369   else if(command == engsigmaCmd1)               1356   else if(command == engsigmaCmd1)
1370     {                                            1357     {
1371       CHECKPG();                                 1358       CHECKPG();
1372       fParticleGun->GetEneDist()->SetBeamSigm    1359       fParticleGun->GetEneDist()->SetBeamSigmaInE(engsigmaCmd1->GetNewDoubleValue(newValues));
1373     }                                            1360     }
1374   else if(command == alphaCmd1)                  1361   else if(command == alphaCmd1)
1375     {                                            1362     {
1376       CHECKPG();                                 1363       CHECKPG();
1377       fParticleGun->GetEneDist()->SetAlpha(al    1364       fParticleGun->GetEneDist()->SetAlpha(alphaCmd1->GetNewDoubleValue(newValues));
1378     }                                            1365     }
1379   else if(command == tempCmd1)                   1366   else if(command == tempCmd1)
1380     {                                            1367     {
1381       CHECKPG();                                 1368       CHECKPG();
1382       fParticleGun->GetEneDist()->SetTemp(tem    1369       fParticleGun->GetEneDist()->SetTemp(tempCmd1->GetNewDoubleValue(newValues));
1383     }                                            1370     }
1384   else if(command == ezeroCmd1)                  1371   else if(command == ezeroCmd1)
1385     {                                            1372     {
1386       CHECKPG();                                 1373       CHECKPG();
1387       fParticleGun->GetEneDist()->SetEzero(ez    1374       fParticleGun->GetEneDist()->SetEzero(ezeroCmd1->GetNewDoubleValue(newValues));
1388     }                                            1375     }
1389   else if(command == gradientCmd1)               1376   else if(command == gradientCmd1)
1390     {                                            1377     {
1391       CHECKPG();                                 1378       CHECKPG();
1392       fParticleGun->GetEneDist()->SetGradient    1379       fParticleGun->GetEneDist()->SetGradient(gradientCmd1->GetNewDoubleValue(newValues));
1393     }                                            1380     }
1394   else if(command == interceptCmd1)              1381   else if(command == interceptCmd1)
1395     {                                            1382     {
1396       CHECKPG();                                 1383       CHECKPG();
1397       fParticleGun->GetEneDist()->SetInterCep    1384       fParticleGun->GetEneDist()->SetInterCept(interceptCmd1->GetNewDoubleValue(newValues));
1398     }                                            1385     }
1399   else if(command == arbeintCmd1)                1386   else if(command == arbeintCmd1)
1400     {                                            1387     {
1401       CHECKPG();                                 1388       CHECKPG();
1402       fParticleGun->GetEneDist()->SetBiasAlph    1389       fParticleGun->GetEneDist()->SetBiasAlpha(arbeintCmd1->GetNewDoubleValue(newValues));
1403     }                                            1390     }
1404   else if(command == calculateCmd1)              1391   else if(command == calculateCmd1)
1405     {                                            1392     {
1406       CHECKPG();                                 1393       CHECKPG();
1407       fParticleGun->GetEneDist()->Calculate()    1394       fParticleGun->GetEneDist()->Calculate();
1408     }                                            1395     }
1409   else if(command == energyspecCmd1)             1396   else if(command == energyspecCmd1)
1410     {                                            1397     {
1411       CHECKPG();                                 1398       CHECKPG();
1412       fParticleGun->GetEneDist()->InputEnergy    1399       fParticleGun->GetEneDist()->InputEnergySpectra(energyspecCmd1->GetNewBoolValue(newValues));
1413     }                                            1400     }
1414   else if(command == diffspecCmd1)               1401   else if(command == diffspecCmd1)
1415     {                                            1402     {
1416       CHECKPG();                                 1403       CHECKPG();
1417       fParticleGun->GetEneDist()->InputDiffer    1404       fParticleGun->GetEneDist()->InputDifferentialSpectra(diffspecCmd1->GetNewBoolValue(newValues));
1418     }                                            1405     }
1419   else if(command == applyEnergyWeightCmd1)      1406   else if(command == applyEnergyWeightCmd1)
1420     {                                            1407     {
1421       CHECKPG();                                 1408       CHECKPG();
1422       const auto& eDisType = fParticleGun->Ge << 1409       auto eDisType = fParticleGun->GetEneDist()->GetEnergyDisType();
1423       if(eDisType != "Lin")                      1410       if(eDisType != "Lin")
1424       {                                          1411       {
1425         G4ExceptionDescription ed;               1412         G4ExceptionDescription ed;
1426         ed << "Energy distribution is defined    1413         ed << "Energy distribution is defined as " << eDisType << ". /gps/ene/applyEneWeight is available only for Linear distribution.";
1427         command->CommandFailed(ed);              1414         command->CommandFailed(ed);
1428         return;                                  1415         return;
1429       }                                          1416       }
1430       fParticleGun->GetEneDist()->ApplyEnergy    1417       fParticleGun->GetEneDist()->ApplyEnergyWeight(applyEnergyWeightCmd1->GetNewBoolValue(newValues));
1431     }                                            1418     } 
1432   else if(command == histnameCmd1)               1419   else if(command == histnameCmd1)
1433     {                                            1420     {
1434       histtype = newValues;                      1421       histtype = newValues;
1435     }                                            1422     }
1436   else if(command == histfileCmd1)               1423   else if(command == histfileCmd1)
1437     {                                            1424     {
1438       histtype = "arb";                          1425       histtype = "arb";
1439       CHECKPG();                                 1426       CHECKPG();
1440       fParticleGun->GetEneDist()->ArbEnergyHi    1427       fParticleGun->GetEneDist()->ArbEnergyHistoFile(newValues);
1441     }                                            1428     }
1442   else if(command == histpointCmd1)              1429   else if(command == histpointCmd1)
1443     {                                            1430     {
1444       CHECKPG();                                 1431       CHECKPG(); 
1445       if(histtype == "biasx")                    1432       if(histtype == "biasx")
1446         fParticleGun->GetBiasRndm()->SetXBias    1433         fParticleGun->GetBiasRndm()->SetXBias(histpointCmd1->GetNew3VectorValue(newValues));
1447       if(histtype == "biasy")                    1434       if(histtype == "biasy")
1448         fParticleGun->GetBiasRndm()->SetYBias    1435         fParticleGun->GetBiasRndm()->SetYBias(histpointCmd1->GetNew3VectorValue(newValues));
1449       if(histtype == "biasz")                    1436       if(histtype == "biasz")
1450         fParticleGun->GetBiasRndm()->SetZBias    1437         fParticleGun->GetBiasRndm()->SetZBias(histpointCmd1->GetNew3VectorValue(newValues));
1451       if(histtype == "biast")                    1438       if(histtype == "biast")
1452         fParticleGun->GetBiasRndm()->SetTheta    1439         fParticleGun->GetBiasRndm()->SetThetaBias(histpointCmd1->GetNew3VectorValue(newValues));
1453       if(histtype == "biasp")                    1440       if(histtype == "biasp")
1454         fParticleGun->GetBiasRndm()->SetPhiBi    1441         fParticleGun->GetBiasRndm()->SetPhiBias(histpointCmd1->GetNew3VectorValue(newValues));
1455       if(histtype == "biaspt")                   1442       if(histtype == "biaspt")
1456         fParticleGun->GetBiasRndm()->SetPosTh    1443         fParticleGun->GetBiasRndm()->SetPosThetaBias(histpointCmd1->GetNew3VectorValue(newValues));
1457       if(histtype == "biaspp")                   1444       if(histtype == "biaspp")
1458         fParticleGun->GetBiasRndm()->SetPosPh    1445         fParticleGun->GetBiasRndm()->SetPosPhiBias(histpointCmd1->GetNew3VectorValue(newValues));
1459       if(histtype == "biase")                    1446       if(histtype == "biase")
1460         fParticleGun->GetBiasRndm()->SetEnerg    1447         fParticleGun->GetBiasRndm()->SetEnergyBias(histpointCmd1->GetNew3VectorValue(newValues));
1461       if(histtype == "theta")                    1448       if(histtype == "theta")
1462         fParticleGun->GetAngDist()->UserDefAn    1449         fParticleGun->GetAngDist()->UserDefAngTheta(histpointCmd1->GetNew3VectorValue(newValues));
1463       if(histtype == "phi")                      1450       if(histtype == "phi")
1464         fParticleGun->GetAngDist()->UserDefAn    1451         fParticleGun->GetAngDist()->UserDefAngPhi(histpointCmd1->GetNew3VectorValue(newValues));
1465       if(histtype == "energy")                   1452       if(histtype == "energy")
1466         fParticleGun->GetEneDist()->UserEnerg    1453         fParticleGun->GetEneDist()->UserEnergyHisto(histpointCmd1->GetNew3VectorValue(newValues));
1467       if(histtype == "arb")                      1454       if(histtype == "arb")
1468         fParticleGun->GetEneDist()->ArbEnergy    1455         fParticleGun->GetEneDist()->ArbEnergyHisto(histpointCmd1->GetNew3VectorValue(newValues));
1469       if(histtype == "epn")                      1456       if(histtype == "epn")
1470         fParticleGun->GetEneDist()->EpnEnergy    1457         fParticleGun->GetEneDist()->EpnEnergyHisto(histpointCmd1->GetNew3VectorValue(newValues));
1471     }                                            1458     }
1472   else if(command == resethistCmd1)              1459   else if(command == resethistCmd1)
1473     {                                            1460     {
1474       CHECKPG();                                 1461       CHECKPG(); 
1475       if(newValues == "theta" || newValues ==    1462       if(newValues == "theta" || newValues == "phi")
1476       {                                          1463       {
1477         fParticleGun->GetAngDist()->ReSetHist    1464         fParticleGun->GetAngDist()->ReSetHist(newValues);
1478       }                                          1465       }
1479       else if (newValues == "energy" || newVa    1466       else if (newValues == "energy" || newValues == "arb" || newValues == "epn")
1480       {                                          1467       {
1481         fParticleGun->GetEneDist()->ReSetHist    1468         fParticleGun->GetEneDist()->ReSetHist(newValues);
1482       }                                          1469       }
1483       else                                       1470       else
1484       {                                          1471       {
1485         fParticleGun->GetBiasRndm()->ReSetHis    1472         fParticleGun->GetBiasRndm()->ReSetHist(newValues);
1486       }                                          1473       }
1487     }                                            1474     }
1488   else if(command == arbintCmd1)                 1475   else if(command == arbintCmd1)
1489     {                                            1476     {
1490       CHECKPG(); fParticleGun->GetEneDist()->    1477       CHECKPG(); fParticleGun->GetEneDist()->ArbInterpolate(newValues);
1491     }                                            1478     }
1492   else                                           1479   else 
1493     {                                            1480     {
1494       G4cout << "Error entering command" << G    1481       G4cout << "Error entering command" << G4endl;
1495     }                                            1482     }
1496 }                                                1483 }
1497                                                  1484 
1498 G4String G4GeneralParticleSourceMessenger::Ge << 1485 G4String G4GeneralParticleSourceMessenger::GetCurrentValue(G4UIcommand*)
1499 {                                                1486 {
1500   G4String cv;                                   1487   G4String cv;
1501                                                  1488   
1502   if( command==volChkCmd )                    << 
1503   { cv = volChkCmd->ConvertToString(fParticle << 
1504   else                                        << 
1505   {                                           << 
1506   //  if( command==directionCmd )                1489   //  if( command==directionCmd )
1507   //  { cv = directionCmd->ConvertToString(fP    1490   //  { cv = directionCmd->ConvertToString(fParticleGun->GetParticleMomentumDirection()); }
1508   //  else if( command==energyCmd )              1491   //  else if( command==energyCmd )
1509   //  { cv = energyCmd->ConvertToString(fPart    1492   //  { cv = energyCmd->ConvertToString(fParticleGun->GetParticleEnergy(),"GeV"); }
1510   //  else if( command==positionCmd )            1493   //  else if( command==positionCmd )
1511   //  { cv = positionCmd->ConvertToString(fPa    1494   //  { cv = positionCmd->ConvertToString(fParticleGun->GetParticlePosition(),"cm"); }
1512   //  else if( command==timeCmd )                1495   //  else if( command==timeCmd )
1513   //  { cv = timeCmd->ConvertToString(fPartic    1496   //  { cv = timeCmd->ConvertToString(fParticleGun->GetParticleTime(),"ns"); }
1514   //  else if( command==polCmd )                 1497   //  else if( command==polCmd )
1515   //  { cv = polCmd->ConvertToString(fParticl    1498   //  { cv = polCmd->ConvertToString(fParticleGun->GetParticlePolarization()); }
1516   //  else if( command==numberCmd )              1499   //  else if( command==numberCmd )
1517   //  { cv = numberCmd->ConvertToString(fPart    1500   //  { cv = numberCmd->ConvertToString(fParticleGun->GetNumberOfParticles()); }
1518                                                  1501   
1519   cv = "Not implemented yet";                    1502   cv = "Not implemented yet";
1520   }                                           << 
1521                                                  1503 
1522   return cv;                                     1504   return cv;
1523 }                                                1505 }
1524                                                  1506 
1525 void G4GeneralParticleSourceMessenger::IonCom << 1507 void G4GeneralParticleSourceMessenger::IonCommand(G4String newValues)
1526 {                                                1508 {
1527   if (fShootIon)                                 1509   if (fShootIon)
1528   {                                              1510   {
1529     G4Tokenizer next( newValues );               1511     G4Tokenizer next( newValues );
1530     // check argument                            1512     // check argument
1531     fAtomicNumber = StoI(next());                1513     fAtomicNumber = StoI(next());
1532     fAtomicMass = StoI(next());                  1514     fAtomicMass = StoI(next());
1533     G4String sQ = next();                        1515     G4String sQ = next();
1534     if (sQ.empty())                           << 1516     if (sQ.isNull())
1535     {                                            1517     {
1536       fIonCharge = fAtomicNumber;                1518       fIonCharge = fAtomicNumber;
1537     }                                            1519     }
1538     else                                         1520     else
1539     {                                            1521     {
1540       fIonCharge = StoI(sQ);                     1522       fIonCharge = StoI(sQ);
1541       sQ = next();                               1523       sQ = next();
1542       if (sQ.empty())                         << 1524       if (sQ.isNull())
1543       {                                          1525       {
1544         fIonExciteEnergy = 0.0;                  1526         fIonExciteEnergy = 0.0;
1545       }                                          1527       }
1546       else                                       1528       else
1547       {                                          1529       {
1548         fIonExciteEnergy = StoD(sQ) * keV;       1530         fIonExciteEnergy = StoD(sQ) * keV;
1549       }                                          1531       }
1550     }                                            1532     }
1551     G4ParticleDefinition* ion = G4IonTable::G    1533     G4ParticleDefinition* ion = G4IonTable::GetIonTable()
1552         ->GetIon(fAtomicNumber, fAtomicMass,     1534         ->GetIon(fAtomicNumber, fAtomicMass, fIonExciteEnergy);
1553     if (ion==nullptr)                            1535     if (ion==nullptr)
1554     {                                            1536     {
1555       G4ExceptionDescription ed;                 1537       G4ExceptionDescription ed;
1556       ed << "Ion with Z=" << fAtomicNumber;      1538       ed << "Ion with Z=" << fAtomicNumber;
1557       ed << " A=" << fAtomicMass << " is not     1539       ed << " A=" << fAtomicMass << " is not defined";    
1558       ionCmd->CommandFailed(ed);                 1540       ionCmd->CommandFailed(ed);
1559     }                                            1541     }
1560     else                                         1542     else
1561     {                                            1543     {
1562       fParticleGun->SetParticleDefinition(ion    1544       fParticleGun->SetParticleDefinition(ion);
1563       fParticleGun->SetParticleCharge(fIonCha    1545       fParticleGun->SetParticleCharge(fIonCharge*eplus);
1564     }                                            1546     }
1565   }                                              1547   }
1566   else                                           1548   else
1567   {                                              1549   {
1568     G4ExceptionDescription ed;                   1550     G4ExceptionDescription ed;
1569     ed << "Set /gps/particle to ion before us    1551     ed << "Set /gps/particle to ion before using /gps/ion command";
1570     ionCmd->CommandFailed(ed);                   1552     ionCmd->CommandFailed(ed);
1571   }                                              1553   }
1572 }                                                1554 }
1573                                                  1555 
1574 void G4GeneralParticleSourceMessenger::IonLvl << 1556 void G4GeneralParticleSourceMessenger::IonLvlCommand(G4String newValues)
1575 {                                                1557 {
1576   if (fShootIon)                                 1558   if (fShootIon)
1577   {                                              1559   {
1578     G4Tokenizer next(newValues);                 1560     G4Tokenizer next(newValues);
1579     // check argument                            1561     // check argument
1580     fAtomicNumberL = StoI(next());               1562     fAtomicNumberL = StoI(next());
1581     fAtomicMassL = StoI(next());                 1563     fAtomicMassL = StoI(next());
1582     G4String sQ = next();                        1564     G4String sQ = next();
1583     if (sQ.empty())                           << 1565     if (sQ.isNull())
1584     {                                            1566     {
1585       fIonChargeL = fAtomicNumberL;              1567       fIonChargeL = fAtomicNumberL;
1586     }                                            1568     }
1587     else                                         1569     else
1588     {                                            1570     {
1589       fIonChargeL = StoI(sQ);                    1571       fIonChargeL = StoI(sQ);
1590       sQ = next();                               1572       sQ = next();
1591       if (sQ.empty())                         << 1573       if (sQ.isNull())
1592       {                                          1574       {
1593         fIonEnergyLevel = 0;                     1575         fIonEnergyLevel = 0;
1594       }                                          1576       }
1595       else                                       1577       else
1596       {                                          1578       {
1597         fIonEnergyLevel = StoI(sQ);              1579         fIonEnergyLevel = StoI(sQ);
1598       }                                          1580       }
1599     }                                            1581     }
1600                                                  1582 
1601     G4ParticleDefinition* ion = G4IonTable::G    1583     G4ParticleDefinition* ion = G4IonTable::GetIonTable()
1602         ->GetIon(fAtomicNumberL, fAtomicMassL    1584         ->GetIon(fAtomicNumberL, fAtomicMassL, fIonEnergyLevel);
1603     if (ion == nullptr)                          1585     if (ion == nullptr)
1604     {                                            1586     {
1605       G4ExceptionDescription ed;                 1587       G4ExceptionDescription ed;
1606       ed << "Ion with Z=" << fAtomicNumberL;     1588       ed << "Ion with Z=" << fAtomicNumberL;
1607       ed << " A=" << fAtomicMassL << " is not    1589       ed << " A=" << fAtomicMassL << " is not defined";
1608       ionLvlCmd->CommandFailed(ed);              1590       ionLvlCmd->CommandFailed(ed);
1609     }                                            1591     }
1610     else                                         1592     else
1611     {                                            1593     {
1612       fParticleGun->SetParticleDefinition(ion    1594       fParticleGun->SetParticleDefinition(ion);
1613       fParticleGun->SetParticleCharge(fIonCha    1595       fParticleGun->SetParticleCharge(fIonChargeL*eplus);
1614     }                                            1596     }
1615                                                  1597 
1616   }                                              1598   }
1617   else                                           1599   else
1618   {                                              1600   {
1619     G4ExceptionDescription ed;                   1601     G4ExceptionDescription ed;
1620     ed << "Set /gps/particle to ion before us    1602     ed << "Set /gps/particle to ion before using /gps/ionLvl command";
1621     ionLvlCmd->CommandFailed(ed);                1603     ionLvlCmd->CommandFailed(ed);
1622   }                                              1604   }
1623 }                                                1605 }
1624                                                  1606