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.1.p3)


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