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