Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
IORTPrimaryGeneratorMessenger.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 // This is the *BASIC* version of IORT, a Geant4-based application
27 //
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)
30 // Past Authors: G.Arnetta(c), S.E.Mazzaglia(d)
31 //
32 // (a) Fondazione Istituto San Raffaele G.Giglio, Cefalù, Italy
33 // (b) IBFM-CNR , Segrate (Milano), Italy
34 // (c) LATO (Laboratorio di Tecnologie Oncologiche), Cefalù, Italy
35 // (d) Laboratori Nazionali del Sud of the INFN, Catania, Italy
36 // (e) University of Wallongong, Australia
37 //
38 // *Corresponding author, email to carlo.casarino@polooncologicocefalu.it
39 //////////////////////////////////////////////////////////////////////////////////////////////
40 
43 #include "G4UIdirectory.hh"
45 #include "G4UIcmdWithADouble.hh"
46 
49 :IORTAction(IORTGun)
50 {
51  //
52  // Definition of the interactive commands to modify the parameters of the
53  // generation of primary particles
54  //
55  beamParametersDir = new G4UIdirectory("/beam/");
56  beamParametersDir -> SetGuidance("set parameters of beam");
57 
58  EnergyDir = new G4UIdirectory("/beam/energy/");
59  EnergyDir -> SetGuidance ("set energy of beam");
60 
61  particlePositionDir = new G4UIdirectory("/beam/position/");
62  particlePositionDir -> SetGuidance ("set position of particle");
63 
64 
65 
66 
67  MomentumDir = new G4UIdirectory("/beam/momentum/");
68  MomentumDir -> SetGuidance ("set momentum of particle ");
69 
70 
71  ThetaCmd = new G4UIcmdWithADoubleAndUnit("/beam/momentum/Theta",this);
72  ThetaCmd -> SetGuidance("set Theta");
73  ThetaCmd -> SetParameterName("Theta",false);
74  ThetaCmd -> SetDefaultUnit("deg");
75  ThetaCmd -> SetUnitCandidates("deg rad");
76  ThetaCmd -> AvailableForStates(G4State_PreInit,G4State_Idle);
77 
78 
79 /*
80  sigmaMomentumYCmd = new G4UIcmdWithADouble("/beam/momentum/sigmaY",this);
81  sigmaMomentumYCmd -> SetGuidance("set sigma momentum y");
82  sigmaMomentumYCmd -> SetParameterName("momentum",false);
83  sigmaMomentumYCmd -> AvailableForStates(G4State_PreInit,G4State_Idle);
84 
85  sigmaMomentumZCmd = new G4UIcmdWithADouble("/beam/momentum/sigmaZ",this);
86  sigmaMomentumZCmd -> SetGuidance("set sigma momentum z");
87  sigmaMomentumZCmd -> SetParameterName("momentum",false);
88  sigmaMomentumZCmd -> AvailableForStates(G4State_PreInit,G4State_Idle);
89  */
90  meanKineticEnergyCmd = new G4UIcmdWithADoubleAndUnit("/beam/energy/meanEnergy",this);
91  meanKineticEnergyCmd -> SetGuidance("set mean Kinetic energy");
92  meanKineticEnergyCmd -> SetParameterName("Energy",false);
93  meanKineticEnergyCmd -> SetDefaultUnit("MeV");
94  meanKineticEnergyCmd -> SetUnitCandidates("eV keV MeV GeV TeV");
95  meanKineticEnergyCmd -> AvailableForStates(G4State_PreInit,G4State_Idle);
96 
97  sigmaEnergyCmd = new G4UIcmdWithADoubleAndUnit("/beam/energy/sigmaEnergy",this);
98  sigmaEnergyCmd -> SetGuidance("set sigma energy");
99  sigmaEnergyCmd -> SetParameterName("Energy",false);
100  sigmaEnergyCmd -> SetDefaultUnit("keV");
101  sigmaEnergyCmd -> SetUnitCandidates("eV keV MeV GeV TeV");
102  sigmaEnergyCmd -> AvailableForStates(G4State_PreInit,G4State_Idle);
103 
104  XpositionCmd = new G4UIcmdWithADoubleAndUnit("/beam/position/Xposition",this);
105  XpositionCmd -> SetGuidance("set x coordinate of particle");
106  XpositionCmd -> SetParameterName("position",false);
107  XpositionCmd -> SetDefaultUnit("mm");
108  XpositionCmd -> SetUnitCandidates("mm cm m");
109  XpositionCmd -> AvailableForStates(G4State_PreInit,G4State_Idle);
110 
111  YpositionCmd = new G4UIcmdWithADoubleAndUnit("/beam/position/Yposition",this);
112  YpositionCmd -> SetGuidance("set y coordinate of particle");
113  YpositionCmd -> SetParameterName("position",false);
114  YpositionCmd -> SetDefaultUnit("mm");
115  YpositionCmd -> SetUnitCandidates("mm cm m");
116  YpositionCmd -> AvailableForStates(G4State_PreInit,G4State_Idle);
117 
118  sigmaYCmd = new G4UIcmdWithADoubleAndUnit("/beam/position/Yposition/sigmaY",this);
119  sigmaYCmd -> SetGuidance("set sigma y");
120  sigmaYCmd -> SetParameterName("position",false);
121  sigmaYCmd -> SetDefaultUnit("mm");
122  sigmaYCmd -> SetUnitCandidates("mm cm m");
123  sigmaYCmd -> AvailableForStates(G4State_PreInit,G4State_Idle);
124 
125  ZpositionCmd = new G4UIcmdWithADoubleAndUnit("/beam/position/Zposition",this);
126  ZpositionCmd -> SetGuidance("set z coordinate of particle");
127  ZpositionCmd -> SetParameterName("position",false);
128  ZpositionCmd -> SetDefaultUnit("mm");
129  ZpositionCmd -> SetUnitCandidates("mm cm m");
130  ZpositionCmd -> AvailableForStates(G4State_PreInit,G4State_Idle);
131 
132  sigmaZCmd = new G4UIcmdWithADoubleAndUnit("/beam/position/Zposition/sigmaZ",this);
133  sigmaZCmd -> SetGuidance("set sigma z");
134  sigmaZCmd -> SetParameterName("position",false);
135  sigmaZCmd -> SetDefaultUnit("mm");
136  sigmaZCmd -> SetUnitCandidates("mm cm m");
137  sigmaZCmd -> AvailableForStates(G4State_PreInit,G4State_Idle);
138 }
139 
141 {
142  delete beamParametersDir;
143  delete EnergyDir;
144  delete meanKineticEnergyCmd;
145  delete sigmaEnergyCmd;
146  delete particlePositionDir;
147  delete MomentumDir;
148  delete XpositionCmd;
149  delete YpositionCmd;
150  delete ZpositionCmd;
151  delete sigmaYCmd;
152  delete sigmaZCmd;
153  delete ThetaCmd;
154 // delete sigmaMomentumYCmd;
155 // delete sigmaMomentumZCmd;
156 }
157 
159 {
160  if ( command == meanKineticEnergyCmd )
161  { IORTAction -> SetmeanKineticEnergy(meanKineticEnergyCmd
162  -> GetNewDoubleValue(newValue));}
163  if ( command == sigmaEnergyCmd )
164  { IORTAction -> SetsigmaEnergy(sigmaEnergyCmd
165  -> GetNewDoubleValue(newValue));}
166  if ( command == XpositionCmd )
167  { IORTAction -> SetXposition(XpositionCmd
168  -> GetNewDoubleValue(newValue));}
169 
170  if ( command == YpositionCmd )
171  { IORTAction -> SetYposition(YpositionCmd
172  -> GetNewDoubleValue(newValue));}
173 
174  if ( command == ZpositionCmd )
175  { IORTAction -> SetZposition(ZpositionCmd
176  -> GetNewDoubleValue(newValue));}
177 
178  if ( command == sigmaYCmd )
179  { IORTAction -> SetsigmaY(sigmaYCmd
180  -> GetNewDoubleValue(newValue));}
181 
182  if ( command == sigmaZCmd )
183  { IORTAction -> SetsigmaZ(sigmaZCmd
184  -> GetNewDoubleValue(newValue));}
185 
186 if ( command == ThetaCmd )
187  { IORTAction -> SetTheta(ThetaCmd
188  -> GetNewDoubleValue(newValue));}
189 
190 
191 /*
192  if ( command == sigmaMomentumYCmd )
193  { IORTAction -> SetsigmaMomentumY(sigmaMomentumYCmd
194  -> GetNewDoubleValue(newValue));}
195 
196  if ( command == sigmaMomentumZCmd )
197  { IORTAction -> SetsigmaMomentumZ(sigmaMomentumZCmd
198  -> GetNewDoubleValue(newValue));}
199 */
200 }
IORTPrimaryGeneratorMessenger(IORTPrimaryGeneratorAction *)
void SetNewValue(G4UIcommand *, G4String)