Geant4  10.01.p03
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 // Visit the Hadrontherapy web site (http://www.lns.infn.it/link/Hadrontherapy) to request
27 // the *COMPLETE* version of this program, together with its documentation;
28 // Hadrontherapy (both basic and full version) are supported by the Italian INFN
29 // Institute in the framework of the MC-INFN Group
30 //
31 
33 #include "PassiveProtonBeamLine.hh"
34 #include "G4UIdirectory.hh"
36 #include "G4UIcmdWithAString.hh"
37 #include "G4SystemOfUnits.hh"
38 
40 :passiveProton(beamLine)
41 
42 {
43  changeTheBeamLineDir = new G4UIdirectory("/ChangeBeamLine/");
44  changeTheBeamLineDir -> SetGuidance("Command to change the transport beam line");
45 
46  changeTheBeamLineNameCmd = new G4UIcmdWithAString("/ChangeBeamLine/beamLineName",this);
47  changeTheBeamLineNameCmd -> SetGuidance("Insert the name of the beam line you want simulate");
48  changeTheBeamLineNameCmd -> SetParameterName("List",false);
49  changeTheBeamLineNameCmd -> AvailableForStates(G4State_PreInit);
50 
51  modulatorDir = new G4UIdirectory("/modulator/");
52  modulatorDir -> SetGuidance("Command to rotate the modulator wheel");
53 
54  beamLineDir = new G4UIdirectory("/beamLine/");
55  beamLineDir -> SetGuidance("set specification of range shifter");
56 
57  rangeShifterDir = new G4UIdirectory("/beamLine/RangeShifter/");
58  rangeShifterDir -> SetGuidance("set specification of range shifter");
59 
60  firstScatteringFoilDir = new G4UIdirectory("/beamLine/ScatteringFoil1/");
61  firstScatteringFoilDir -> SetGuidance("set specification of first scattering foil");
62 
63  secondScatteringFoilDir = new G4UIdirectory("/beamLine/ScatteringFoil2/");
64  secondScatteringFoilDir -> SetGuidance("set specification of second scattering foil");
65 
66  rangeStopperDir = new G4UIdirectory("/beamLine/Stopper/");
67  rangeStopperDir -> SetGuidance("set specification of stopper");
68 
69  finalCollimatorDir = new G4UIdirectory("/beamLine/FinalCollimator/");
70  finalCollimatorDir -> SetGuidance("set specification of final collimator");
71 
72  modulatorAngleCmd = new G4UIcmdWithADoubleAndUnit("/modulator/angle",this);
73  modulatorAngleCmd -> SetGuidance("Set Modulator Angle");
74  modulatorAngleCmd -> SetParameterName("Size",false);
75  modulatorAngleCmd -> SetRange("Size>=0.");
76  modulatorAngleCmd -> SetUnitCategory("Angle");
77  modulatorAngleCmd -> AvailableForStates(G4State_Idle);
78 
79  rangeShifterMatCmd = new G4UIcmdWithAString("/beamLine/RangeShifter/RSMat",this);
80  rangeShifterMatCmd -> SetGuidance("Set material of range shifter");
81  rangeShifterMatCmd -> SetParameterName("choice",false);
82  rangeShifterMatCmd -> AvailableForStates(G4State_Idle);
83 
84  rangeShifterXSizeCmd = new G4UIcmdWithADoubleAndUnit("/beamLine/RangeShifter/thickness",this);
85  rangeShifterXSizeCmd -> SetGuidance("Set half of the thickness of range shifter along X axis");
86  rangeShifterXSizeCmd -> SetParameterName("Size",false);
87  rangeShifterXSizeCmd -> SetDefaultUnit("mm");
88  rangeShifterXSizeCmd -> SetUnitCandidates("mm cm m");
89  rangeShifterXSizeCmd -> AvailableForStates(G4State_Idle);
90 
91  rangeShifterXPositionCmd = new G4UIcmdWithADoubleAndUnit("/beamLine/RangeShifter/position",this);
92  rangeShifterXPositionCmd -> SetGuidance("Set position of range shifter");
93  rangeShifterXPositionCmd -> SetParameterName("Size",false);
94  rangeShifterXPositionCmd -> SetDefaultUnit("mm");
95  rangeShifterXPositionCmd -> SetUnitCandidates("mm cm m");
96  rangeShifterXPositionCmd -> AvailableForStates(G4State_Idle);
97 
98  firstScatteringFoilXSizeCmd = new G4UIcmdWithADoubleAndUnit("/beamLine/ScatteringFoil1/thickness",this);
99  firstScatteringFoilXSizeCmd -> SetGuidance("Set half thickness of first scattering foil");
100  firstScatteringFoilXSizeCmd -> SetParameterName("Size",false);
101  firstScatteringFoilXSizeCmd -> SetDefaultUnit("mm");
102  firstScatteringFoilXSizeCmd -> SetUnitCandidates("mm cm m");
103  firstScatteringFoilXSizeCmd -> AvailableForStates(G4State_Idle);
104 
105  secondScatteringFoilXSizeCmd = new G4UIcmdWithADoubleAndUnit("/beamLine/ScatteringFoil2/thickness",this);
106  secondScatteringFoilXSizeCmd -> SetGuidance("Set half thickness of second scattering foil");
107  secondScatteringFoilXSizeCmd -> SetParameterName("Size",false);
108  secondScatteringFoilXSizeCmd -> SetDefaultUnit("mm");
109  secondScatteringFoilXSizeCmd -> SetUnitCandidates("mm cm m");
110  secondScatteringFoilXSizeCmd -> AvailableForStates(G4State_Idle);
111 
112  outerRadiusStopperCmd = new G4UIcmdWithADoubleAndUnit("/beamLine/Stopper/outRadius",this);
113  outerRadiusStopperCmd -> SetGuidance("Set size of outer radius");
114  outerRadiusStopperCmd -> SetParameterName("Size",false);
115  outerRadiusStopperCmd -> SetDefaultUnit("mm");
116  outerRadiusStopperCmd -> SetUnitCandidates("mm cm m");
117  outerRadiusStopperCmd -> AvailableForStates(G4State_Idle);
118 
119  innerRadiusFinalCollimatorCmd = new G4UIcmdWithADoubleAndUnit("/beamLine/FinalCollimator/halfInnerRad",this);
120  innerRadiusFinalCollimatorCmd -> SetGuidance("Set size of inner radius ( max 21.5 mm)");
121  innerRadiusFinalCollimatorCmd -> SetParameterName("Size",false);
122  innerRadiusFinalCollimatorCmd -> SetDefaultUnit("mm");
123  innerRadiusFinalCollimatorCmd -> SetUnitCandidates("mm cm m");
124  innerRadiusFinalCollimatorCmd -> AvailableForStates(G4State_Idle);
125 }
126 
128 {
130  delete outerRadiusStopperCmd;
134  delete rangeShifterXSizeCmd;
135  delete rangeShifterMatCmd;
136  delete modulatorAngleCmd;
137  delete finalCollimatorDir;
138  delete rangeStopperDir;
140  delete firstScatteringFoilDir;
141  delete rangeShifterDir;
142  delete beamLineDir;
143  delete modulatorDir;
144 }
145 
146 
147 
148 
150 {
151  if( command == modulatorAngleCmd )
152  { passiveProton -> SetModulatorAngle
153  (modulatorAngleCmd -> GetNewDoubleValue(newValue));}
154 
155  else if( command == rangeShifterMatCmd )
156  { passiveProton -> SetRSMaterial(newValue);}
157 
158  else if( command == rangeShifterXSizeCmd )
159  { passiveProton -> SetRangeShifterXSize
160  (rangeShifterXSizeCmd -> GetNewDoubleValue(newValue));}
161 
162  else if( command == rangeShifterXPositionCmd )
163  { passiveProton -> SetRangeShifterXPosition
164  (rangeShifterXPositionCmd -> GetNewDoubleValue(newValue));}
165 
166  else if( command == firstScatteringFoilXSizeCmd )
167  { passiveProton -> SetFirstScatteringFoilXSize
168  (firstScatteringFoilXSizeCmd -> GetNewDoubleValue(newValue));}
169 
170  else if( command == secondScatteringFoilXSizeCmd )
171  { passiveProton -> SetSecondScatteringFoilXSize
172  (secondScatteringFoilXSizeCmd -> GetNewDoubleValue(newValue));}
173 
174  else if( command == outerRadiusStopperCmd )
175  { passiveProton -> SetOuterRadiusStopper(
176  outerRadiusStopperCmd -> GetNewDoubleValue(newValue));}
177 
178  else if( command == innerRadiusFinalCollimatorCmd )
179  { passiveProton -> SetInnerRadiusFinalCollimator
180  (innerRadiusFinalCollimatorCmd -> GetNewDoubleValue(newValue));}
181 }
182 
PassiveProtonBeamLineMessenger(PassiveProtonBeamLine *)
G4UIcmdWithADoubleAndUnit * rangeShifterXSizeCmd
G4UIcmdWithADoubleAndUnit * firstScatteringFoilXSizeCmd
G4UIcmdWithADoubleAndUnit * rangeShifterXPositionCmd
G4UIcmdWithADoubleAndUnit * modulatorAngleCmd
G4UIcmdWithADoubleAndUnit * innerRadiusFinalCollimatorCmd
G4UIcmdWithADoubleAndUnit * outerRadiusStopperCmd
G4UIcmdWithADoubleAndUnit * secondScatteringFoilXSizeCmd