Geant4  10.00.p03
HadrontherapyPrimaryGeneratorMessenger.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 Hadrontherapy, a Geant4-based application
27 // See more at: http://g4advancedexamples.lngs.infn.it/Examples/hadrontherapy
28 //
29 // Visit the Hadrontherapy web site (http://www.lns.infn.it/link/Hadrontherapy) to request
30 // the *COMPLETE* version of this program, together with its documentation;
31 // Hadrontherapy (both basic and full version) are supported by the Italian INFN
32 // Institute in the framework of the MC-INFN Group
33 //
34 
37 #include "G4UIdirectory.hh"
39 #include "G4UIcmdWithADouble.hh"
40 #include "G4SystemOfUnits.hh"
41 
43  HadrontherapyPrimaryGeneratorAction* HadrontherapyGun)
44 :HadrontherapyAction(HadrontherapyGun)
45 {
46  //
47  // Definition of the interactive commands to modify the parameters of the
48  // generation of primary particles
49  //
50  beamParametersDir = new G4UIdirectory("/beam/");
51  beamParametersDir -> SetGuidance("set parameters of beam");
52 
53  EnergyDir = new G4UIdirectory("/beam/energy/");
54  EnergyDir -> SetGuidance ("set energy of beam");
55 
56  particlePositionDir = new G4UIdirectory("/beam/position/");
57  particlePositionDir -> SetGuidance ("set position of particle");
58 
59  MomentumDir = new G4UIdirectory("/beam/momentum/");
60  MomentumDir -> SetGuidance ("set momentum of particle ");
61 /*
62  sigmaMomentumYCmd = new G4UIcmdWithADouble("/beam/momentum/sigmaY",this);
63  sigmaMomentumYCmd -> SetGuidance("set sigma momentum y");
64  sigmaMomentumYCmd -> SetParameterName("momentum",false);
65  sigmaMomentumYCmd -> AvailableForStates(G4State_PreInit,G4State_Idle);
66 
67  sigmaMomentumZCmd = new G4UIcmdWithADouble("/beam/momentum/sigmaZ",this);
68  sigmaMomentumZCmd -> SetGuidance("set sigma momentum z");
69  sigmaMomentumZCmd -> SetParameterName("momentum",false);
70  sigmaMomentumZCmd -> AvailableForStates(G4State_PreInit,G4State_Idle);
71 
72  meanKineticEnergyCmd = new G4UIcmdWithADoubleAndUnit("/beam/energy/meanEnergy",this);
73  meanKineticEnergyCmd -> SetGuidance("set mean Kinetic energy");
74  meanKineticEnergyCmd -> SetParameterName("Energy",false);
75  meanKineticEnergyCmd -> SetDefaultUnit("MeV");
76  meanKineticEnergyCmd -> SetUnitCandidates("eV keV MeV GeV TeV");
77  meanKineticEnergyCmd -> AvailableForStates(G4State_PreInit,G4State_Idle);
78 
79  sigmaEnergyCmd = new G4UIcmdWithADoubleAndUnit("/beam/energy/sigmaEnergy",this);
80  sigmaEnergyCmd -> SetGuidance("set sigma energy");
81  sigmaEnergyCmd -> SetParameterName("Energy",false);
82  sigmaEnergyCmd -> SetDefaultUnit("keV");
83  sigmaEnergyCmd -> SetUnitCandidates("eV keV MeV GeV TeV");
84  sigmaEnergyCmd -> AvailableForStates(G4State_PreInit,G4State_Idle);
85 
86  XpositionCmd = new G4UIcmdWithADoubleAndUnit("/beam/position/Xposition",this);
87  XpositionCmd -> SetGuidance("set x coordinate of particle");
88  XpositionCmd -> SetParameterName("position",false);
89  XpositionCmd -> SetDefaultUnit("mm");
90  XpositionCmd -> SetUnitCandidates("mm cm m");
91  XpositionCmd -> AvailableForStates(G4State_PreInit,G4State_Idle);
92 
93  YpositionCmd = new G4UIcmdWithADoubleAndUnit("/beam/position/Yposition",this);
94  YpositionCmd -> SetGuidance("set y coordinate of particle");
95  YpositionCmd -> SetParameterName("position",false);
96  YpositionCmd -> SetDefaultUnit("mm");
97  YpositionCmd -> SetUnitCandidates("mm cm m");
98  YpositionCmd -> AvailableForStates(G4State_PreInit,G4State_Idle);
99 
100  sigmaYCmd = new G4UIcmdWithADoubleAndUnit("/beam/position/Yposition/sigmaY",this);
101  sigmaYCmd -> SetGuidance("set sigma y");
102  sigmaYCmd -> SetParameterName("position",false);
103  sigmaYCmd -> SetDefaultUnit("mm");
104  sigmaYCmd -> SetUnitCandidates("mm cm m");
105  sigmaYCmd -> AvailableForStates(G4State_PreInit,G4State_Idle);
106 
107  ZpositionCmd = new G4UIcmdWithADoubleAndUnit("/beam/position/Zposition",this);
108  ZpositionCmd -> SetGuidance("set z coordinate of particle");
109  ZpositionCmd -> SetParameterName("position",false);
110  ZpositionCmd -> SetDefaultUnit("mm");
111  ZpositionCmd -> SetUnitCandidates("mm cm m");
112  ZpositionCmd -> AvailableForStates(G4State_PreInit,G4State_Idle);
113 
114  sigmaZCmd = new G4UIcmdWithADoubleAndUnit("/beam/position/Zposition/sigmaZ",this);
115  sigmaZCmd -> SetGuidance("set sigma z");
116  sigmaZCmd -> SetParameterName("position",false);
117  sigmaZCmd -> SetDefaultUnit("mm");
118  sigmaZCmd -> SetUnitCandidates("mm cm m");
119  sigmaZCmd -> AvailableForStates(G4State_PreInit,G4State_Idle);
120 */
121 }
122 
124 {
125  delete beamParametersDir;
126  delete EnergyDir;
127  // delete meanKineticEnergyCmd;
128  // delete sigmaEnergyCmd;
129  delete particlePositionDir;
130  delete MomentumDir;
131 /* delete XpositionCmd;
132  delete YpositionCmd;
133  delete ZpositionCmd;
134  delete sigmaYCmd;
135  delete sigmaZCmd;
136  delete sigmaMomentumYCmd;
137  delete sigmaMomentumZCmd; */
138 }
139 /*
140 void HadrontherapyPrimaryGeneratorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
141 {
142  if ( command == meanKineticEnergyCmd )
143  { HadrontherapyAction -> SetmeanKineticEnergy(meanKineticEnergyCmd
144  -> GetNewDoubleValue(newValue));}
145  if ( command == sigmaEnergyCmd )
146  { HadrontherapyAction -> SetsigmaEnergy(sigmaEnergyCmd
147  -> GetNewDoubleValue(newValue));}
148  if ( command == XpositionCmd )
149  { HadrontherapyAction -> SetXposition(XpositionCmd
150  -> GetNewDoubleValue(newValue));}
151 
152  if ( command == YpositionCmd )
153  { HadrontherapyAction -> SetYposition(YpositionCmd
154  -> GetNewDoubleValue(newValue));}
155 
156  if ( command == ZpositionCmd )
157  { HadrontherapyAction -> SetZposition(ZpositionCmd
158  -> GetNewDoubleValue(newValue));}
159 
160  if ( command == sigmaYCmd )
161  { HadrontherapyAction -> SetsigmaY(sigmaYCmd
162  -> GetNewDoubleValue(newValue));}
163 
164  if ( command == sigmaZCmd )
165  { HadrontherapyAction -> SetsigmaZ(sigmaZCmd
166  -> GetNewDoubleValue(newValue));}
167 
168  if ( command == sigmaMomentumYCmd )
169  { HadrontherapyAction -> SetsigmaMomentumY(sigmaMomentumYCmd
170  -> GetNewDoubleValue(newValue));}
171 
172  if ( command == sigmaMomentumZCmd )
173  { HadrontherapyAction -> SetsigmaMomentumZ(sigmaMomentumZCmd
174  -> GetNewDoubleValue(newValue));}
175 } */
HadrontherapyPrimaryGeneratorMessenger(HadrontherapyPrimaryGeneratorAction *)