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