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