Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 // 26 // 27 // ------------------------------------------- 27 // -------------------------------------------------------------- 28 // GEANT 4 - Underground Dark Matter Detecto 28 // GEANT 4 - Underground Dark Matter Detector Advanced Example 29 // 29 // 30 // For information related to this code c 30 // For information related to this code contact: Alex Howard 31 // e-mail: alexander.howard@cern.ch 31 // e-mail: alexander.howard@cern.ch 32 // ------------------------------------------- 32 // -------------------------------------------------------------- 33 // Comments 33 // Comments 34 // 34 // 35 // Underground Advanced 35 // Underground Advanced 36 // by A. Howard and H. Araujo 36 // by A. Howard and H. Araujo 37 // (27th November 2001) 37 // (27th November 2001) 38 // 38 // 39 // ParticleSourceMessenger program 39 // ParticleSourceMessenger program 40 // ------------------------------------------- 40 // -------------------------------------------------------------- 41 ////////////////////////////////////////////// 41 ////////////////////////////////////////////////////////////////////////////// 42 // This particle source is a shortened version 42 // This particle source is a shortened version of G4GeneralParticleSource by 43 // C Ferguson, F Lei & P Truscott (University 43 // C Ferguson, F Lei & P Truscott (University of Southampton / DERA), with 44 // some minor modifications. 44 // some minor modifications. 45 ////////////////////////////////////////////// 45 ////////////////////////////////////////////////////////////////////////////// 46 46 47 #include <fstream> 47 #include <fstream> 48 #include <iomanip> 48 #include <iomanip> 49 49 50 #include "DMXParticleSourceMessenger.hh" 50 #include "DMXParticleSourceMessenger.hh" 51 #include "DMXParticleSource.hh" 51 #include "DMXParticleSource.hh" 52 52 53 #include "G4SystemOfUnits.hh" 53 #include "G4SystemOfUnits.hh" 54 #include "G4Geantino.hh" 54 #include "G4Geantino.hh" 55 #include "G4ThreeVector.hh" 55 #include "G4ThreeVector.hh" 56 #include "G4ParticleTable.hh" 56 #include "G4ParticleTable.hh" 57 #include "G4IonTable.hh" << 58 #include "G4UIdirectory.hh" 57 #include "G4UIdirectory.hh" 59 #include "G4UIcmdWithoutParameter.hh" 58 #include "G4UIcmdWithoutParameter.hh" 60 #include "G4UIcmdWithAString.hh" 59 #include "G4UIcmdWithAString.hh" 61 #include "G4UIcmdWithADoubleAndUnit.hh" 60 #include "G4UIcmdWithADoubleAndUnit.hh" 62 #include "G4UIcmdWith3Vector.hh" 61 #include "G4UIcmdWith3Vector.hh" 63 #include "G4UIcmdWith3VectorAndUnit.hh" 62 #include "G4UIcmdWith3VectorAndUnit.hh" 64 #include "G4UIcmdWithAnInteger.hh" 63 #include "G4UIcmdWithAnInteger.hh" 65 #include "G4UIcmdWithADouble.hh" 64 #include "G4UIcmdWithADouble.hh" 66 #include "G4UIcmdWithABool.hh" 65 #include "G4UIcmdWithABool.hh" 67 #include "G4ios.hh" 66 #include "G4ios.hh" 68 #include "G4Tokenizer.hh" 67 #include "G4Tokenizer.hh" 69 68 70 ////////////////////////////////////////////// 69 /////////////////////////////////////////////////////////////////////////////// 71 DMXParticleSourceMessenger::DMXParticleSourceM 70 DMXParticleSourceMessenger::DMXParticleSourceMessenger 72 (DMXParticleSource *fPtclGun) : fParticleGun(f 71 (DMXParticleSource *fPtclGun) : fParticleGun(fPtclGun),fShootIon(false) { 73 72 74 particleTable = G4ParticleTable::GetParticle 73 particleTable = G4ParticleTable::GetParticleTable(); 75 74 76 // create directory 75 // create directory 77 gunDirectory = new G4UIdirectory("/dmx/gun/" 76 gunDirectory = new G4UIdirectory("/dmx/gun/"); 78 gunDirectory->SetGuidance("Particle Source c 77 gunDirectory->SetGuidance("Particle Source control commands."); 79 78 80 // list available particles 79 // list available particles 81 listCmd = new G4UIcmdWithoutParameter("/dmx/ 80 listCmd = new G4UIcmdWithoutParameter("/dmx/gun/List",this); 82 listCmd->SetGuidance("List available particl 81 listCmd->SetGuidance("List available particles."); 83 listCmd->SetGuidance(" Invoke G4ParticleTabl 82 listCmd->SetGuidance(" Invoke G4ParticleTable."); 84 83 85 // set particle 84 // set particle 86 particleCmd = new G4UIcmdWithAString("/dmx/g 85 particleCmd = new G4UIcmdWithAString("/dmx/gun/particle",this); 87 particleCmd->SetGuidance("Set particle to be 86 particleCmd->SetGuidance("Set particle to be generated."); 88 particleCmd->SetGuidance(" (geantino is defa 87 particleCmd->SetGuidance(" (geantino is default)"); 89 particleCmd->SetGuidance(" (ion can be speci 88 particleCmd->SetGuidance(" (ion can be specified for shooting ions)"); 90 particleCmd->SetParameterName("particleName" 89 particleCmd->SetParameterName("particleName",true); 91 particleCmd->SetDefaultValue("geantino"); 90 particleCmd->SetDefaultValue("geantino"); 92 G4String candidateList; 91 G4String candidateList; 93 G4int nPtcl = particleTable->entries(); 92 G4int nPtcl = particleTable->entries(); 94 for(G4int i=0;i<nPtcl;i++) 93 for(G4int i=0;i<nPtcl;i++) 95 { 94 { 96 candidateList += particleTable->GetParti 95 candidateList += particleTable->GetParticleName(i); 97 candidateList += " "; 96 candidateList += " "; 98 } 97 } 99 candidateList += "ion "; 98 candidateList += "ion "; 100 particleCmd->SetCandidates(candidateList); 99 particleCmd->SetCandidates(candidateList); 101 100 102 101 103 // particle direction 102 // particle direction 104 directionCmd = new G4UIcmdWith3Vector("/dmx/ 103 directionCmd = new G4UIcmdWith3Vector("/dmx/gun/direction",this); 105 directionCmd->SetGuidance("Set momentum dire 104 directionCmd->SetGuidance("Set momentum direction."); 106 directionCmd->SetGuidance("Direction needs n 105 directionCmd->SetGuidance("Direction needs not to be a unit vector."); 107 directionCmd->SetParameterName("Px","Py","Pz 106 directionCmd->SetParameterName("Px","Py","Pz",true,true); 108 directionCmd->SetRange("Px != 0 || Py != 0 | 107 directionCmd->SetRange("Px != 0 || Py != 0 || Pz != 0"); 109 108 110 // particle energy 109 // particle energy 111 energyCmd = new G4UIcmdWithADoubleAndUnit("/ 110 energyCmd = new G4UIcmdWithADoubleAndUnit("/dmx/gun/energy",this); 112 energyCmd->SetGuidance("Set kinetic energy." 111 energyCmd->SetGuidance("Set kinetic energy."); 113 energyCmd->SetParameterName("Energy",true,tr 112 energyCmd->SetParameterName("Energy",true,true); 114 energyCmd->SetDefaultUnit("GeV"); 113 energyCmd->SetDefaultUnit("GeV"); 115 //energyCmd->SetUnitCategory("Energy"); 114 //energyCmd->SetUnitCategory("Energy"); 116 //energyCmd->SetUnitCandidates("eV keV MeV G 115 //energyCmd->SetUnitCandidates("eV keV MeV GeV TeV"); 117 116 118 positionCmd = new G4UIcmdWith3VectorAndUnit( 117 positionCmd = new G4UIcmdWith3VectorAndUnit("/dmx/gun/position",this); 119 positionCmd->SetGuidance("Set starting posit 118 positionCmd->SetGuidance("Set starting position of the particle."); 120 positionCmd->SetParameterName("X","Y","Z",tr 119 positionCmd->SetParameterName("X","Y","Z",true,true); 121 positionCmd->SetDefaultUnit("cm"); 120 positionCmd->SetDefaultUnit("cm"); 122 //positionCmd->SetUnitCategory("Length"); 121 //positionCmd->SetUnitCategory("Length"); 123 //positionCmd->SetUnitCandidates("microm mm 122 //positionCmd->SetUnitCandidates("microm mm cm m km"); 124 123 125 124 126 // ion 125 // ion 127 ionCmd = new G4UIcommand("/dmx/gun/ion",this 126 ionCmd = new G4UIcommand("/dmx/gun/ion",this); 128 ionCmd->SetGuidance("Set properties of ion t 127 ionCmd->SetGuidance("Set properties of ion to be generated."); 129 ionCmd->SetGuidance("[usage] /gun/ion Z A Q 128 ionCmd->SetGuidance("[usage] /gun/ion Z A Q E"); 130 ionCmd->SetGuidance(" Z:(int) AtomicN 129 ionCmd->SetGuidance(" Z:(int) AtomicNumber"); 131 ionCmd->SetGuidance(" A:(int) AtomicM 130 ionCmd->SetGuidance(" A:(int) AtomicMass"); 132 ionCmd->SetGuidance(" Q:(int) Charge 131 ionCmd->SetGuidance(" Q:(int) Charge of Ion (in unit of e)"); 133 ionCmd->SetGuidance(" E:(double) Exci 132 ionCmd->SetGuidance(" E:(double) Excitation energy (in keV)"); 134 133 135 G4UIparameter* param; 134 G4UIparameter* param; 136 param = new G4UIparameter("Z",'i',false); 135 param = new G4UIparameter("Z",'i',false); 137 param->SetDefaultValue("1"); 136 param->SetDefaultValue("1"); 138 ionCmd->SetParameter(param); 137 ionCmd->SetParameter(param); 139 param = new G4UIparameter("A",'i',false); 138 param = new G4UIparameter("A",'i',false); 140 param->SetDefaultValue("1"); 139 param->SetDefaultValue("1"); 141 ionCmd->SetParameter(param); 140 ionCmd->SetParameter(param); 142 param = new G4UIparameter("Q",'i',true); 141 param = new G4UIparameter("Q",'i',true); 143 param->SetDefaultValue("0"); 142 param->SetDefaultValue("0"); 144 ionCmd->SetParameter(param); 143 ionCmd->SetParameter(param); 145 param = new G4UIparameter("E",'d',true); 144 param = new G4UIparameter("E",'d',true); 146 param->SetDefaultValue("0.0"); 145 param->SetDefaultValue("0.0"); 147 ionCmd->SetParameter(param); 146 ionCmd->SetParameter(param); 148 147 149 148 150 // source distribution type 149 // source distribution type 151 typeCmd = new G4UIcmdWithAString("/dmx/gun/t 150 typeCmd = new G4UIcmdWithAString("/dmx/gun/type",this); 152 typeCmd->SetGuidance("Sets source distributi 151 typeCmd->SetGuidance("Sets source distribution type."); 153 typeCmd->SetGuidance("Either Point or Volume 152 typeCmd->SetGuidance("Either Point or Volume"); 154 typeCmd->SetParameterName("DisType",true,tru 153 typeCmd->SetParameterName("DisType",true,true); 155 typeCmd->SetDefaultValue("Point"); 154 typeCmd->SetDefaultValue("Point"); 156 typeCmd->SetCandidates("Point Volume"); 155 typeCmd->SetCandidates("Point Volume"); 157 156 158 // source shape 157 // source shape 159 shapeCmd = new G4UIcmdWithAString("/dmx/gun/ 158 shapeCmd = new G4UIcmdWithAString("/dmx/gun/shape",this); 160 shapeCmd->SetGuidance("Sets source shape typ 159 shapeCmd->SetGuidance("Sets source shape type."); 161 shapeCmd->SetParameterName("Shape",true,true 160 shapeCmd->SetParameterName("Shape",true,true); 162 shapeCmd->SetDefaultValue("NULL"); 161 shapeCmd->SetDefaultValue("NULL"); 163 shapeCmd->SetCandidates("Sphere Cylinder"); 162 shapeCmd->SetCandidates("Sphere Cylinder"); 164 163 165 // centre coordinates 164 // centre coordinates 166 centreCmd = new G4UIcmdWith3VectorAndUnit("/ 165 centreCmd = new G4UIcmdWith3VectorAndUnit("/dmx/gun/centre",this); 167 centreCmd->SetGuidance("Set centre coordinat 166 centreCmd->SetGuidance("Set centre coordinates of source."); 168 centreCmd->SetParameterName("X","Y","Z",true 167 centreCmd->SetParameterName("X","Y","Z",true,true); 169 centreCmd->SetDefaultUnit("cm"); 168 centreCmd->SetDefaultUnit("cm"); 170 centreCmd->SetUnitCandidates("nm um mm cm m 169 centreCmd->SetUnitCandidates("nm um mm cm m km"); 171 170 172 // half height of source 171 // half height of source 173 halfzCmd = new G4UIcmdWithADoubleAndUnit("/d 172 halfzCmd = new G4UIcmdWithADoubleAndUnit("/dmx/gun/halfz",this); 174 halfzCmd->SetGuidance("Set z half length of 173 halfzCmd->SetGuidance("Set z half length of source."); 175 halfzCmd->SetParameterName("Halfz",true,true 174 halfzCmd->SetParameterName("Halfz",true,true); 176 halfzCmd->SetDefaultUnit("cm"); 175 halfzCmd->SetDefaultUnit("cm"); 177 halfzCmd->SetUnitCandidates("nm um mm cm m k 176 halfzCmd->SetUnitCandidates("nm um mm cm m km"); 178 177 179 // radius of source 178 // radius of source 180 radiusCmd = new G4UIcmdWithADoubleAndUnit("/ 179 radiusCmd = new G4UIcmdWithADoubleAndUnit("/dmx/gun/radius",this); 181 radiusCmd->SetGuidance("Set radius of source 180 radiusCmd->SetGuidance("Set radius of source."); 182 radiusCmd->SetParameterName("Radius",true,tr 181 radiusCmd->SetParameterName("Radius",true,true); 183 radiusCmd->SetDefaultUnit("cm"); 182 radiusCmd->SetDefaultUnit("cm"); 184 radiusCmd->SetUnitCandidates("nm um mm cm m 183 radiusCmd->SetUnitCandidates("nm um mm cm m km"); 185 184 186 // confine to volume 185 // confine to volume 187 confineCmd = new G4UIcmdWithAString("/dmx/gu 186 confineCmd = new G4UIcmdWithAString("/dmx/gun/confine",this); 188 confineCmd->SetGuidance("Confine source to v 187 confineCmd->SetGuidance("Confine source to volume (NULL to unset)."); 189 confineCmd->SetGuidance("usage: confine VolN 188 confineCmd->SetGuidance("usage: confine VolName"); 190 confineCmd->SetParameterName("VolName",true, 189 confineCmd->SetParameterName("VolName",true,true); 191 confineCmd->SetDefaultValue("NULL"); 190 confineCmd->SetDefaultValue("NULL"); 192 191 193 // angular distribution 192 // angular distribution 194 angtypeCmd = new G4UIcmdWithAString("/dmx/gu 193 angtypeCmd = new G4UIcmdWithAString("/dmx/gun/angtype",this); 195 angtypeCmd->SetGuidance("Sets angular source 194 angtypeCmd->SetGuidance("Sets angular source distribution type"); 196 angtypeCmd->SetGuidance("Possible variables 195 angtypeCmd->SetGuidance("Possible variables are: iso direction"); 197 angtypeCmd->SetParameterName("AngDis",true,t 196 angtypeCmd->SetParameterName("AngDis",true,true); 198 angtypeCmd->SetDefaultValue("iso"); 197 angtypeCmd->SetDefaultValue("iso"); 199 angtypeCmd->SetCandidates("iso direction"); 198 angtypeCmd->SetCandidates("iso direction"); 200 199 201 // energy distribution 200 // energy distribution 202 energytypeCmd = new G4UIcmdWithAString("/dmx 201 energytypeCmd = new G4UIcmdWithAString("/dmx/gun/energytype",this); 203 energytypeCmd->SetGuidance("Sets energy dist 202 energytypeCmd->SetGuidance("Sets energy distribution type"); 204 energytypeCmd->SetGuidance("Possible variabl 203 energytypeCmd->SetGuidance("Possible variables are: Mono"); 205 energytypeCmd->SetParameterName("EnergyDis", 204 energytypeCmd->SetParameterName("EnergyDis",true,true); 206 energytypeCmd->SetDefaultValue("Mono"); 205 energytypeCmd->SetDefaultValue("Mono"); 207 energytypeCmd->SetCandidates("Mono"); 206 energytypeCmd->SetCandidates("Mono"); 208 207 209 // verbosity 208 // verbosity 210 verbosityCmd = new G4UIcmdWithAnInteger("/dm 209 verbosityCmd = new G4UIcmdWithAnInteger("/dmx/gun/verbose",this); 211 verbosityCmd->SetGuidance("Set Verbose level 210 verbosityCmd->SetGuidance("Set Verbose level for gun"); 212 verbosityCmd->SetGuidance(" 0 : Silent"); 211 verbosityCmd->SetGuidance(" 0 : Silent"); 213 verbosityCmd->SetGuidance(" 1 : Limited info 212 verbosityCmd->SetGuidance(" 1 : Limited information"); 214 verbosityCmd->SetGuidance(" 2 : Detailed inf 213 verbosityCmd->SetGuidance(" 2 : Detailed information"); 215 verbosityCmd->SetParameterName("level",false 214 verbosityCmd->SetParameterName("level",false); 216 verbosityCmd->SetRange("level>=0 && level <= 215 verbosityCmd->SetRange("level>=0 && level <=2"); 217 216 218 } 217 } 219 218 220 219 221 DMXParticleSourceMessenger::~DMXParticleSource 220 DMXParticleSourceMessenger::~DMXParticleSourceMessenger() { 222 221 223 delete typeCmd; 222 delete typeCmd; 224 delete shapeCmd; 223 delete shapeCmd; 225 delete centreCmd; 224 delete centreCmd; 226 delete halfzCmd; 225 delete halfzCmd; 227 delete radiusCmd; 226 delete radiusCmd; 228 delete confineCmd; 227 delete confineCmd; 229 delete angtypeCmd; 228 delete angtypeCmd; 230 delete energytypeCmd; 229 delete energytypeCmd; 231 delete verbosityCmd; 230 delete verbosityCmd; 232 delete ionCmd; 231 delete ionCmd; 233 delete particleCmd; 232 delete particleCmd; 234 delete positionCmd; 233 delete positionCmd; 235 delete directionCmd; 234 delete directionCmd; 236 delete energyCmd; 235 delete energyCmd; 237 delete listCmd; 236 delete listCmd; 238 237 239 delete gunDirectory; 238 delete gunDirectory; 240 } 239 } 241 240 242 void DMXParticleSourceMessenger::SetNewValue 241 void DMXParticleSourceMessenger::SetNewValue 243 (G4UIcommand *command, G4String newValues) 242 (G4UIcommand *command, G4String newValues) { 244 243 245 if(command == typeCmd) 244 if(command == typeCmd) 246 fParticleGun->SetPosDisType(newValues); 245 fParticleGun->SetPosDisType(newValues); 247 246 248 else if(command == shapeCmd) 247 else if(command == shapeCmd) 249 fParticleGun->SetPosDisShape(newValues); 248 fParticleGun->SetPosDisShape(newValues); 250 249 251 else if(command == centreCmd) 250 else if(command == centreCmd) 252 fParticleGun->SetCentreCoords(centreCmd->G 251 fParticleGun->SetCentreCoords(centreCmd->GetNew3VectorValue(newValues)); 253 252 254 else if(command == halfzCmd) 253 else if(command == halfzCmd) 255 fParticleGun->SetHalfZ(halfzCmd->GetNewDou 254 fParticleGun->SetHalfZ(halfzCmd->GetNewDoubleValue(newValues)); 256 255 257 else if(command == radiusCmd) 256 else if(command == radiusCmd) 258 fParticleGun->SetRadius(radiusCmd->GetNewD 257 fParticleGun->SetRadius(radiusCmd->GetNewDoubleValue(newValues)); 259 258 260 else if(command == angtypeCmd) 259 else if(command == angtypeCmd) 261 fParticleGun->SetAngDistType(newValues); 260 fParticleGun->SetAngDistType(newValues); 262 261 263 else if(command == confineCmd) 262 else if(command == confineCmd) 264 fParticleGun->ConfineSourceToVolume(newVal 263 fParticleGun->ConfineSourceToVolume(newValues); 265 264 266 else if(command == energytypeCmd) 265 else if(command == energytypeCmd) 267 fParticleGun->SetEnergyDisType(newValues); 266 fParticleGun->SetEnergyDisType(newValues); 268 267 269 else if(command == verbosityCmd) 268 else if(command == verbosityCmd) 270 fParticleGun->SetVerbosity(verbosityCmd->G 269 fParticleGun->SetVerbosity(verbosityCmd->GetNewIntValue(newValues)); 271 270 272 else if( command==particleCmd ) { 271 else if( command==particleCmd ) { 273 if (newValues =="ion") { 272 if (newValues =="ion") { 274 fShootIon = true; 273 fShootIon = true; 275 } else { 274 } else { 276 fShootIon = false; 275 fShootIon = false; 277 G4ParticleDefinition* pd = particleTable 276 G4ParticleDefinition* pd = particleTable->FindParticle(newValues); 278 if(pd != NULL) 277 if(pd != NULL) 279 { fParticleGun->SetParticleDefinition( pd 278 { fParticleGun->SetParticleDefinition( pd ); } 280 } 279 } 281 } 280 } 282 281 283 else if( command==ionCmd ) { 282 else if( command==ionCmd ) { 284 if (fShootIon) { 283 if (fShootIon) { 285 G4Tokenizer next( newValues ); 284 G4Tokenizer next( newValues ); 286 // check argument 285 // check argument 287 fAtomicNumber = StoI(next()); 286 fAtomicNumber = StoI(next()); 288 fAtomicMass = StoI(next()); 287 fAtomicMass = StoI(next()); 289 G4String sQ = next(); 288 G4String sQ = next(); 290 if (sQ.empty()) { << 289 if (sQ.isNull()) { 291 fIonCharge = fAtomicNumber; 290 fIonCharge = fAtomicNumber; 292 } else { 291 } else { 293 fIonCharge = StoI(sQ); 292 fIonCharge = StoI(sQ); 294 sQ = next(); 293 sQ = next(); 295 if (sQ.empty()) { << 294 if (sQ.isNull()) { 296 fIonExciteEnergy = 0.0; 295 fIonExciteEnergy = 0.0; 297 } else { 296 } else { 298 fIonExciteEnergy = StoD(sQ) * keV; 297 fIonExciteEnergy = StoD(sQ) * keV; 299 } 298 } 300 } 299 } 301 300 302 G4ParticleDefinition* ion; 301 G4ParticleDefinition* ion; 303 ion = G4IonTable::GetIonTable()->GetIon << 302 ion = particleTable->GetIon(fAtomicNumber,fAtomicMass,fIonExciteEnergy); 304 if (ion==0) { 303 if (ion==0) { 305 G4cout << "Ion with Z=" << fAtomicNumber; 304 G4cout << "Ion with Z=" << fAtomicNumber; 306 G4cout << " A=" << fAtomicMass << "is not be 305 G4cout << " A=" << fAtomicMass << "is not be defined" << G4endl; 307 } else { 306 } else { 308 fParticleGun->SetParticleDefinition(ion); 307 fParticleGun->SetParticleDefinition(ion); 309 fParticleGun->SetParticleCharge(fIonCharge*e 308 fParticleGun->SetParticleCharge(fIonCharge*eplus); 310 } 309 } 311 } else { 310 } else { 312 G4cout<<"Set /dmx/gun/particle to ion be 311 G4cout<<"Set /dmx/gun/particle to ion before using /dmx/gun/ion command"; 313 G4cout<<G4endl; 312 G4cout<<G4endl; 314 } 313 } 315 } 314 } 316 315 317 else if( command==listCmd ) 316 else if( command==listCmd ) 318 particleTable->DumpTable(); 317 particleTable->DumpTable(); 319 318 320 else if( command==directionCmd ) { 319 else if( command==directionCmd ) { 321 fParticleGun->SetAngDistType("direction"); 320 fParticleGun->SetAngDistType("direction"); 322 fParticleGun->SetParticleMomentumDirection 321 fParticleGun->SetParticleMomentumDirection 323 (directionCmd->GetNew3VectorValue(newVal 322 (directionCmd->GetNew3VectorValue(newValues)); 324 } 323 } 325 324 326 else if( command==energyCmd ) { 325 else if( command==energyCmd ) { 327 fParticleGun->SetEnergyDisType("Mono"); 326 fParticleGun->SetEnergyDisType("Mono"); 328 fParticleGun->SetMonoEnergy(energyCmd->Get 327 fParticleGun->SetMonoEnergy(energyCmd->GetNewDoubleValue(newValues)); 329 } 328 } 330 329 331 else if( command==positionCmd ) { 330 else if( command==positionCmd ) { 332 fParticleGun->SetPosDisType("Point"); 331 fParticleGun->SetPosDisType("Point"); 333 fParticleGun->SetCentreCoords(positionCmd- 332 fParticleGun->SetCentreCoords(positionCmd->GetNew3VectorValue(newValues)); 334 } 333 } 335 else 334 else 336 G4cout << "Error entering command" << G4en 335 G4cout << "Error entering command" << G4endl; 337 } 336 } 338 337 339 338 340 339 341 340 342 341