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