Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PassiveProtonBeamLineMessenger.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 
36 #include "PassiveProtonBeamLine.hh"
37 #include "G4UIdirectory.hh"
39 #include "G4UIcmdWithAString.hh"
40 #include "G4SystemOfUnits.hh"
41 
43 :passiveProton(beamLine)
44 
45 {
46  changeTheBeamLineDir = new G4UIdirectory("/ChangeBeamLine/");
47  changeTheBeamLineDir -> SetGuidance("Command to change the transport beam line");
48 
49  changeTheBeamLineNameCmd = new G4UIcmdWithAString("/ChangeBeamLine/beamLineName",this);
50  changeTheBeamLineNameCmd -> SetGuidance("Insert the name of the beam line you want simulate");
51  changeTheBeamLineNameCmd -> SetParameterName("List",false);
52  changeTheBeamLineNameCmd -> AvailableForStates(G4State_PreInit);
53 
54  modulatorDir = new G4UIdirectory("/modulator/");
55  modulatorDir -> SetGuidance("Command to rotate the modulator wheel");
56 
57  beamLineDir = new G4UIdirectory("/beamLine/");
58  beamLineDir -> SetGuidance("set specification of range shifter");
59 
60  rangeShifterDir = new G4UIdirectory("/beamLine/RangeShifter/");
61  rangeShifterDir -> SetGuidance("set specification of range shifter");
62 
63  firstScatteringFoilDir = new G4UIdirectory("/beamLine/ScatteringFoil1/");
64  firstScatteringFoilDir -> SetGuidance("set specification of first scattering foil");
65 
66  secondScatteringFoilDir = new G4UIdirectory("/beamLine/ScatteringFoil2/");
67  secondScatteringFoilDir -> SetGuidance("set specification of second scattering foil");
68 
69  rangeStopperDir = new G4UIdirectory("/beamLine/Stopper/");
70  rangeStopperDir -> SetGuidance("set specification of stopper");
71 
72  finalCollimatorDir = new G4UIdirectory("/beamLine/FinalCollimator/");
73  finalCollimatorDir -> SetGuidance("set specification of final collimator");
74 
75  modulatorAngleCmd = new G4UIcmdWithADoubleAndUnit("/modulator/angle",this);
76  modulatorAngleCmd -> SetGuidance("Set Modulator Angle");
77  modulatorAngleCmd -> SetParameterName("Size",false);
78  modulatorAngleCmd -> SetRange("Size>=0.");
79  modulatorAngleCmd -> SetUnitCategory("Angle");
80  modulatorAngleCmd -> AvailableForStates(G4State_Idle);
81 
82  rangeShifterMatCmd = new G4UIcmdWithAString("/beamLine/RangeShifter/RSMat",this);
83  rangeShifterMatCmd -> SetGuidance("Set material of range shifter");
84  rangeShifterMatCmd -> SetParameterName("choice",false);
85  rangeShifterMatCmd -> AvailableForStates(G4State_Idle);
86 
87  rangeShifterXSizeCmd = new G4UIcmdWithADoubleAndUnit("/beamLine/RangeShifter/thickness",this);
88  rangeShifterXSizeCmd -> SetGuidance("Set half of the thickness of range shifter along X axis");
89  rangeShifterXSizeCmd -> SetParameterName("Size",false);
90  rangeShifterXSizeCmd -> SetDefaultUnit("mm");
91  rangeShifterXSizeCmd -> SetUnitCandidates("mm cm m");
92  rangeShifterXSizeCmd -> AvailableForStates(G4State_Idle);
93 
94  rangeShifterXPositionCmd = new G4UIcmdWithADoubleAndUnit("/beamLine/RangeShifter/position",this);
95  rangeShifterXPositionCmd -> SetGuidance("Set position of range shifter");
96  rangeShifterXPositionCmd -> SetParameterName("Size",false);
97  rangeShifterXPositionCmd -> SetDefaultUnit("mm");
98  rangeShifterXPositionCmd -> SetUnitCandidates("mm cm m");
99  rangeShifterXPositionCmd -> AvailableForStates(G4State_Idle);
100 
101  firstScatteringFoilXSizeCmd = new G4UIcmdWithADoubleAndUnit("/beamLine/ScatteringFoil1/thickness",this);
102  firstScatteringFoilXSizeCmd -> SetGuidance("Set half thickness of first scattering foil");
103  firstScatteringFoilXSizeCmd -> SetParameterName("Size",false);
104  firstScatteringFoilXSizeCmd -> SetDefaultUnit("mm");
105  firstScatteringFoilXSizeCmd -> SetUnitCandidates("mm cm m");
106  firstScatteringFoilXSizeCmd -> AvailableForStates(G4State_Idle);
107 
108  secondScatteringFoilXSizeCmd = new G4UIcmdWithADoubleAndUnit("/beamLine/ScatteringFoil2/thickness",this);
109  secondScatteringFoilXSizeCmd -> SetGuidance("Set half thickness of second scattering foil");
110  secondScatteringFoilXSizeCmd -> SetParameterName("Size",false);
111  secondScatteringFoilXSizeCmd -> SetDefaultUnit("mm");
112  secondScatteringFoilXSizeCmd -> SetUnitCandidates("mm cm m");
113  secondScatteringFoilXSizeCmd -> AvailableForStates(G4State_Idle);
114 
115  outerRadiusStopperCmd = new G4UIcmdWithADoubleAndUnit("/beamLine/Stopper/outRadius",this);
116  outerRadiusStopperCmd -> SetGuidance("Set size of outer radius");
117  outerRadiusStopperCmd -> SetParameterName("Size",false);
118  outerRadiusStopperCmd -> SetDefaultUnit("mm");
119  outerRadiusStopperCmd -> SetUnitCandidates("mm cm m");
120  outerRadiusStopperCmd -> AvailableForStates(G4State_Idle);
121 
122  innerRadiusFinalCollimatorCmd = new G4UIcmdWithADoubleAndUnit("/beamLine/FinalCollimator/halfInnerRad",this);
123  innerRadiusFinalCollimatorCmd -> SetGuidance("Set size of inner radius ( max 21.5 mm)");
124  innerRadiusFinalCollimatorCmd -> SetParameterName("Size",false);
125  innerRadiusFinalCollimatorCmd -> SetDefaultUnit("mm");
126  innerRadiusFinalCollimatorCmd -> SetUnitCandidates("mm cm m");
127  innerRadiusFinalCollimatorCmd -> AvailableForStates(G4State_Idle);
128 }
129 
131 {
132  delete innerRadiusFinalCollimatorCmd;
133  delete outerRadiusStopperCmd;
134  delete secondScatteringFoilXSizeCmd;
135  delete firstScatteringFoilXSizeCmd;
136  delete rangeShifterXPositionCmd;
137  delete rangeShifterXSizeCmd;
138  delete rangeShifterMatCmd;
139  delete modulatorAngleCmd;
140  delete finalCollimatorDir;
141  delete rangeStopperDir;
142  delete secondScatteringFoilDir;
143  delete firstScatteringFoilDir;
144  delete rangeShifterDir;
145  delete beamLineDir;
146  delete modulatorDir;
147 }
148 
149 
150 
151 
153 {
154  if( command == modulatorAngleCmd )
155  { passiveProton -> SetModulatorAngle
156  (modulatorAngleCmd -> GetNewDoubleValue(newValue));}
157 
158  else if( command == rangeShifterMatCmd )
159  { passiveProton -> SetRSMaterial(newValue);}
160 
161  else if( command == rangeShifterXSizeCmd )
162  { passiveProton -> SetRangeShifterXSize
163  (rangeShifterXSizeCmd -> GetNewDoubleValue(newValue));}
164 
165  else if( command == rangeShifterXPositionCmd )
166  { passiveProton -> SetRangeShifterXPosition
167  (rangeShifterXPositionCmd -> GetNewDoubleValue(newValue));}
168 
169  else if( command == firstScatteringFoilXSizeCmd )
170  { passiveProton -> SetFirstScatteringFoilXSize
171  (firstScatteringFoilXSizeCmd -> GetNewDoubleValue(newValue));}
172 
173  else if( command == secondScatteringFoilXSizeCmd )
174  { passiveProton -> SetSecondScatteringFoilXSize
175  (secondScatteringFoilXSizeCmd -> GetNewDoubleValue(newValue));}
176 
177  else if( command == outerRadiusStopperCmd )
178  { passiveProton -> SetOuterRadiusStopper(
179  outerRadiusStopperCmd -> GetNewDoubleValue(newValue));}
180 
181  else if( command == innerRadiusFinalCollimatorCmd )
182  { passiveProton -> SetInnerRadiusFinalCollimator
183  (innerRadiusFinalCollimatorCmd -> GetNewDoubleValue(newValue));}
184 }
185