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 // This is the *BASIC* version of IORT, a Gean 26 // This is the *BASIC* version of IORT, a Geant4-based application 27 // 27 // 28 // Main Authors: G.Russo(a,b), C.Casarino*(c), 28 // Main Authors: G.Russo(a,b), C.Casarino*(c), G.C. Candiano(c), G.A.P. Cirrone(d), F.Romano(d) 29 // Contributor Authors: S.Guatelli(e) 29 // Contributor Authors: S.Guatelli(e) 30 // Past Authors: G.Arnetta(c), S.E.Mazzaglia(d 30 // Past Authors: G.Arnetta(c), S.E.Mazzaglia(d) 31 // 31 // 32 // (a) Fondazione Istituto San Raffaele G.Gi 32 // (a) Fondazione Istituto San Raffaele G.Giglio, Cefalù, Italy 33 // (b) IBFM-CNR , Segrate (Milano), Italy 33 // (b) IBFM-CNR , Segrate (Milano), Italy 34 // (c) LATO (Laboratorio di Tecnologie Oncol 34 // (c) LATO (Laboratorio di Tecnologie Oncologiche), Cefalù, Italy 35 // (d) Laboratori Nazionali del Sud of the I 35 // (d) Laboratori Nazionali del Sud of the INFN, Catania, Italy 36 // (e) University of Wollongong, Australia << 36 // (e) University of Wallongong, Australia 37 // 37 // 38 // *Corresponding author, email to carlo.cas 38 // *Corresponding author, email to carlo.casarino@polooncologicocefalu.it 39 ////////////////////////////////////////////// 39 ////////////////////////////////////////////////////////////////////////////////////////////// 40 40 41 #include "IORTPrimaryGeneratorMessenger.hh" 41 #include "IORTPrimaryGeneratorMessenger.hh" 42 #include "IORTPrimaryGeneratorAction.hh" 42 #include "IORTPrimaryGeneratorAction.hh" 43 #include "G4UIdirectory.hh" 43 #include "G4UIdirectory.hh" 44 #include "G4UIcmdWithADoubleAndUnit.hh" 44 #include "G4UIcmdWithADoubleAndUnit.hh" 45 #include "G4UIcmdWithADouble.hh" 45 #include "G4UIcmdWithADouble.hh" 46 46 47 IORTPrimaryGeneratorMessenger::IORTPrimaryGene 47 IORTPrimaryGeneratorMessenger::IORTPrimaryGeneratorMessenger( 48 I 48 IORTPrimaryGeneratorAction* IORTGun) 49 :IORTAction(IORTGun) 49 :IORTAction(IORTGun) 50 { 50 { 51 // 51 // 52 // Definition of the interactive commands to 52 // Definition of the interactive commands to modify the parameters of the 53 // generation of primary particles 53 // generation of primary particles 54 // 54 // 55 beamParametersDir = new G4UIdirectory("/beam/ 55 beamParametersDir = new G4UIdirectory("/beam/"); 56 beamParametersDir -> SetGuidance("set paramet 56 beamParametersDir -> SetGuidance("set parameters of beam"); 57 57 58 EnergyDir = new G4UIdirectory("/beam/energy/" 58 EnergyDir = new G4UIdirectory("/beam/energy/"); 59 EnergyDir -> SetGuidance ("set energy of beam 59 EnergyDir -> SetGuidance ("set energy of beam"); 60 60 61 particlePositionDir = new G4UIdirectory("/bea 61 particlePositionDir = new G4UIdirectory("/beam/position/"); 62 particlePositionDir -> SetGuidance ("set posi 62 particlePositionDir -> SetGuidance ("set position of particle"); 63 63 64 64 65 65 66 66 67 MomentumDir = new G4UIdirectory("/beam/moment 67 MomentumDir = new G4UIdirectory("/beam/momentum/"); 68 MomentumDir -> SetGuidance ("set momentum of 68 MomentumDir -> SetGuidance ("set momentum of particle "); 69 69 70 70 71 ThetaCmd = new G4UIcmdWithADoubleAndUnit("/be 71 ThetaCmd = new G4UIcmdWithADoubleAndUnit("/beam/momentum/Theta",this); 72 ThetaCmd -> SetGuidance("set Theta"); 72 ThetaCmd -> SetGuidance("set Theta"); 73 ThetaCmd -> SetParameterName("Theta",false); 73 ThetaCmd -> SetParameterName("Theta",false); 74 ThetaCmd -> SetDefaultUnit("deg"); 74 ThetaCmd -> SetDefaultUnit("deg"); 75 ThetaCmd -> SetUnitCandidates("deg rad"); 75 ThetaCmd -> SetUnitCandidates("deg rad"); 76 ThetaCmd -> AvailableForStates(G4State_PreIni 76 ThetaCmd -> AvailableForStates(G4State_PreInit,G4State_Idle); 77 77 78 78 79 /* 79 /* 80 sigmaMomentumYCmd = new G4UIcmdWithADouble("/ 80 sigmaMomentumYCmd = new G4UIcmdWithADouble("/beam/momentum/sigmaY",this); 81 sigmaMomentumYCmd -> SetGuidance("set sigma m 81 sigmaMomentumYCmd -> SetGuidance("set sigma momentum y"); 82 sigmaMomentumYCmd -> SetParameterName("moment 82 sigmaMomentumYCmd -> SetParameterName("momentum",false); 83 sigmaMomentumYCmd -> AvailableForStates(G4Sta 83 sigmaMomentumYCmd -> AvailableForStates(G4State_PreInit,G4State_Idle); 84 84 85 sigmaMomentumZCmd = new G4UIcmdWithADouble("/ 85 sigmaMomentumZCmd = new G4UIcmdWithADouble("/beam/momentum/sigmaZ",this); 86 sigmaMomentumZCmd -> SetGuidance("set sigma m 86 sigmaMomentumZCmd -> SetGuidance("set sigma momentum z"); 87 sigmaMomentumZCmd -> SetParameterName("moment 87 sigmaMomentumZCmd -> SetParameterName("momentum",false); 88 sigmaMomentumZCmd -> AvailableForStates(G4Sta 88 sigmaMomentumZCmd -> AvailableForStates(G4State_PreInit,G4State_Idle); 89 */ 89 */ 90 meanKineticEnergyCmd = new G4UIcmdWithADouble 90 meanKineticEnergyCmd = new G4UIcmdWithADoubleAndUnit("/beam/energy/meanEnergy",this); 91 meanKineticEnergyCmd -> SetGuidance("set mean 91 meanKineticEnergyCmd -> SetGuidance("set mean Kinetic energy"); 92 meanKineticEnergyCmd -> SetParameterName("Ene 92 meanKineticEnergyCmd -> SetParameterName("Energy",false); 93 meanKineticEnergyCmd -> SetDefaultUnit("MeV") 93 meanKineticEnergyCmd -> SetDefaultUnit("MeV"); 94 meanKineticEnergyCmd -> SetUnitCandidates("eV 94 meanKineticEnergyCmd -> SetUnitCandidates("eV keV MeV GeV TeV"); 95 meanKineticEnergyCmd -> AvailableForStates(G4 95 meanKineticEnergyCmd -> AvailableForStates(G4State_PreInit,G4State_Idle); 96 96 97 sigmaEnergyCmd = new G4UIcmdWithADoubleAndUni 97 sigmaEnergyCmd = new G4UIcmdWithADoubleAndUnit("/beam/energy/sigmaEnergy",this); 98 sigmaEnergyCmd -> SetGuidance("set sigma ener 98 sigmaEnergyCmd -> SetGuidance("set sigma energy"); 99 sigmaEnergyCmd -> SetParameterName("Energy",f 99 sigmaEnergyCmd -> SetParameterName("Energy",false); 100 sigmaEnergyCmd -> SetDefaultUnit("keV"); 100 sigmaEnergyCmd -> SetDefaultUnit("keV"); 101 sigmaEnergyCmd -> SetUnitCandidates("eV keV M 101 sigmaEnergyCmd -> SetUnitCandidates("eV keV MeV GeV TeV"); 102 sigmaEnergyCmd -> AvailableForStates(G4State_ 102 sigmaEnergyCmd -> AvailableForStates(G4State_PreInit,G4State_Idle); 103 103 104 XpositionCmd = new G4UIcmdWithADoubleAndUnit( 104 XpositionCmd = new G4UIcmdWithADoubleAndUnit("/beam/position/Xposition",this); 105 XpositionCmd -> SetGuidance("set x coordinate 105 XpositionCmd -> SetGuidance("set x coordinate of particle"); 106 XpositionCmd -> SetParameterName("position",f 106 XpositionCmd -> SetParameterName("position",false); 107 XpositionCmd -> SetDefaultUnit("mm"); 107 XpositionCmd -> SetDefaultUnit("mm"); 108 XpositionCmd -> SetUnitCandidates("mm cm m"); 108 XpositionCmd -> SetUnitCandidates("mm cm m"); 109 XpositionCmd -> AvailableForStates(G4State_Pr 109 XpositionCmd -> AvailableForStates(G4State_PreInit,G4State_Idle); 110 110 111 YpositionCmd = new G4UIcmdWithADoubleAndUnit( 111 YpositionCmd = new G4UIcmdWithADoubleAndUnit("/beam/position/Yposition",this); 112 YpositionCmd -> SetGuidance("set y coordinate 112 YpositionCmd -> SetGuidance("set y coordinate of particle"); 113 YpositionCmd -> SetParameterName("position",f 113 YpositionCmd -> SetParameterName("position",false); 114 YpositionCmd -> SetDefaultUnit("mm"); 114 YpositionCmd -> SetDefaultUnit("mm"); 115 YpositionCmd -> SetUnitCandidates("mm cm m"); 115 YpositionCmd -> SetUnitCandidates("mm cm m"); 116 YpositionCmd -> AvailableForStates(G4State_Pr 116 YpositionCmd -> AvailableForStates(G4State_PreInit,G4State_Idle); 117 117 118 sigmaYCmd = new G4UIcmdWithADoubleAndUnit("/b 118 sigmaYCmd = new G4UIcmdWithADoubleAndUnit("/beam/position/Yposition/sigmaY",this); 119 sigmaYCmd -> SetGuidance("set sigma y"); 119 sigmaYCmd -> SetGuidance("set sigma y"); 120 sigmaYCmd -> SetParameterName("position",fals 120 sigmaYCmd -> SetParameterName("position",false); 121 sigmaYCmd -> SetDefaultUnit("mm"); 121 sigmaYCmd -> SetDefaultUnit("mm"); 122 sigmaYCmd -> SetUnitCandidates("mm cm m"); 122 sigmaYCmd -> SetUnitCandidates("mm cm m"); 123 sigmaYCmd -> AvailableForStates(G4State_PreIn 123 sigmaYCmd -> AvailableForStates(G4State_PreInit,G4State_Idle); 124 124 125 ZpositionCmd = new G4UIcmdWithADoubleAndUnit( 125 ZpositionCmd = new G4UIcmdWithADoubleAndUnit("/beam/position/Zposition",this); 126 ZpositionCmd -> SetGuidance("set z coordinate 126 ZpositionCmd -> SetGuidance("set z coordinate of particle"); 127 ZpositionCmd -> SetParameterName("position",f 127 ZpositionCmd -> SetParameterName("position",false); 128 ZpositionCmd -> SetDefaultUnit("mm"); 128 ZpositionCmd -> SetDefaultUnit("mm"); 129 ZpositionCmd -> SetUnitCandidates("mm cm m"); 129 ZpositionCmd -> SetUnitCandidates("mm cm m"); 130 ZpositionCmd -> AvailableForStates(G4State_Pr 130 ZpositionCmd -> AvailableForStates(G4State_PreInit,G4State_Idle); 131 131 132 sigmaZCmd = new G4UIcmdWithADoubleAndUnit("/b 132 sigmaZCmd = new G4UIcmdWithADoubleAndUnit("/beam/position/Zposition/sigmaZ",this); 133 sigmaZCmd -> SetGuidance("set sigma z"); 133 sigmaZCmd -> SetGuidance("set sigma z"); 134 sigmaZCmd -> SetParameterName("position",fals 134 sigmaZCmd -> SetParameterName("position",false); 135 sigmaZCmd -> SetDefaultUnit("mm"); 135 sigmaZCmd -> SetDefaultUnit("mm"); 136 sigmaZCmd -> SetUnitCandidates("mm cm m"); 136 sigmaZCmd -> SetUnitCandidates("mm cm m"); 137 sigmaZCmd -> AvailableForStates(G4State_PreIn 137 sigmaZCmd -> AvailableForStates(G4State_PreInit,G4State_Idle); 138 } 138 } 139 139 140 IORTPrimaryGeneratorMessenger::~IORTPrimaryGen 140 IORTPrimaryGeneratorMessenger::~IORTPrimaryGeneratorMessenger() 141 { 141 { 142 delete beamParametersDir; 142 delete beamParametersDir; 143 delete EnergyDir; 143 delete EnergyDir; 144 delete meanKineticEnergyCmd; 144 delete meanKineticEnergyCmd; 145 delete sigmaEnergyCmd; 145 delete sigmaEnergyCmd; 146 delete particlePositionDir; 146 delete particlePositionDir; 147 delete MomentumDir; 147 delete MomentumDir; 148 delete XpositionCmd; 148 delete XpositionCmd; 149 delete YpositionCmd; 149 delete YpositionCmd; 150 delete ZpositionCmd; 150 delete ZpositionCmd; 151 delete sigmaYCmd; 151 delete sigmaYCmd; 152 delete sigmaZCmd; 152 delete sigmaZCmd; 153 delete ThetaCmd; 153 delete ThetaCmd; 154 // delete sigmaMomentumYCmd; 154 // delete sigmaMomentumYCmd; 155 // delete sigmaMomentumZCmd; 155 // delete sigmaMomentumZCmd; 156 } 156 } 157 157 158 void IORTPrimaryGeneratorMessenger::SetNewValu 158 void IORTPrimaryGeneratorMessenger::SetNewValue(G4UIcommand* command,G4String newValue) 159 { 159 { 160 if ( command == meanKineticEnergyCmd ) 160 if ( command == meanKineticEnergyCmd ) 161 { IORTAction -> SetmeanKineticEnergy(meanK 161 { IORTAction -> SetmeanKineticEnergy(meanKineticEnergyCmd 162 -> GetNewDoubleValue(newValue)); 162 -> GetNewDoubleValue(newValue));} 163 if ( command == sigmaEnergyCmd ) 163 if ( command == sigmaEnergyCmd ) 164 { IORTAction -> SetsigmaEnergy(sigmaEnergy 164 { IORTAction -> SetsigmaEnergy(sigmaEnergyCmd 165 -> GetNewDoubleValue(newValue)); 165 -> GetNewDoubleValue(newValue));} 166 if ( command == XpositionCmd ) 166 if ( command == XpositionCmd ) 167 { IORTAction -> SetXposition(XpositionCmd 167 { IORTAction -> SetXposition(XpositionCmd 168 -> GetNewDoubleValue(newValue));} 168 -> GetNewDoubleValue(newValue));} 169 169 170 if ( command == YpositionCmd ) 170 if ( command == YpositionCmd ) 171 { IORTAction -> SetYposition(YpositionCmd 171 { IORTAction -> SetYposition(YpositionCmd 172 -> GetNewDoubleValue(newValue));} 172 -> GetNewDoubleValue(newValue));} 173 173 174 if ( command == ZpositionCmd ) 174 if ( command == ZpositionCmd ) 175 { IORTAction -> SetZposition(ZpositionCmd 175 { IORTAction -> SetZposition(ZpositionCmd 176 -> GetNewDoubleValue(newValue));} 176 -> GetNewDoubleValue(newValue));} 177 177 178 if ( command == sigmaYCmd ) 178 if ( command == sigmaYCmd ) 179 { IORTAction -> SetsigmaY(sigmaYCmd 179 { IORTAction -> SetsigmaY(sigmaYCmd 180 -> GetNewDoubleValue(newValue)) 180 -> GetNewDoubleValue(newValue));} 181 181 182 if ( command == sigmaZCmd ) 182 if ( command == sigmaZCmd ) 183 { IORTAction -> SetsigmaZ(sigmaZCmd 183 { IORTAction -> SetsigmaZ(sigmaZCmd 184 -> GetNewDoubleValue(newValue)) 184 -> GetNewDoubleValue(newValue));} 185 185 186 if ( command == ThetaCmd ) 186 if ( command == ThetaCmd ) 187 { IORTAction -> SetTheta(ThetaCmd 187 { IORTAction -> SetTheta(ThetaCmd 188 -> GetNewDoubleValue(newValue)) 188 -> GetNewDoubleValue(newValue));} 189 189 190 190 191 /* 191 /* 192 if ( command == sigmaMomentumYCmd ) 192 if ( command == sigmaMomentumYCmd ) 193 { IORTAction -> SetsigmaMomentumY(sigmaMom 193 { IORTAction -> SetsigmaMomentumY(sigmaMomentumYCmd 194 -> GetNewDoubleValue(newValue 194 -> GetNewDoubleValue(newValue));} 195 195 196 if ( command == sigmaMomentumZCmd ) 196 if ( command == sigmaMomentumZCmd ) 197 { IORTAction -> SetsigmaMomentumZ(sigmaMom 197 { IORTAction -> SetsigmaMomentumZ(sigmaMomentumZCmd 198 -> GetNewDoubleValue(newValue 198 -> GetNewDoubleValue(newValue));} 199 */ 199 */ 200 } 200 } 201 201