Geant4  10.01
LaserDrivenBeamLineMessenger.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 "LaserDrivenBeamLine.hh"
34 #include "G4UIdirectory.hh"
37 #include "G4UIcmdWithAString.hh"
38 #include "G4SystemOfUnits.hh"
39 
42  :laserDrivenMessengerPointer(laserDriven)
43 {
44 // Messenger directories for the Energy Selector module
45  laserDrivenDir = new G4UIdirectory("/LaserDriven/");
46  laserDrivenDir -> SetGuidance("The Laser Driven Beam Line module of Hadrontherapy");
47 
48  // Messenger directories for the Energy Selector module
49  energySelectorDir = new G4UIdirectory("/LaserDriven/EnergySelector/");
50  energySelectorDir -> SetGuidance("The Energy selector (ESS) module of Hadrontherapy");
51 
52  FcollimatorDir = new G4UIdirectory("/LaserDriven/EnergySelector/FirstCollimator/");
53  FcollimatorDir -> SetGuidance("Define geometrical characteristics of the ESS first collimator");
54 
55  ScollimatorDir = new G4UIdirectory("/LaserDriven/EnergySelector/SecondCollimator/");
56  ScollimatorDir -> SetGuidance("Define geometrical characteristics of the ESS second collimator");
57 
58  slitDir = new G4UIdirectory("/LaserDriven/EnergySelector/Slit/");
59  slitDir -> SetGuidance("Define geometrical characteristics of the ESS slit");
60 
61  // Messenger directories for the Quadrupole module
62  quadrupoleDir = new G4UIdirectory("/LaserDriven/Quadrupoles/");
63  quadrupoleDir -> SetGuidance("The Quadrupoles module of Hadrontherapy");
64 
65  relativePosDir = new G4UIdirectory("/LaserDriven/Quadrupoles/xRelPosition/");
66  relativePosDir -> SetGuidance("Define the x relative positions of the quadrupoles");
67 
68  // ESS DISABLE
69  DisableESSCmd = new G4UIcmdWithoutParameter("/LaserDriven/EnergySelector/Disable", this);
70  DisableESSCmd -> SetGuidance("Disable the Energy Selector.");
71  DisableESSCmd -> SetGuidance("This command MUST be applied before \"beamOn\" ");
72  DisableESSCmd -> AvailableForStates(G4State_Idle);
73 
74  // THE FIRST ESS COLLIMATOR
75  //
76  // Diameter of the first collimator
77  FcollimatorRadiusCmd = new G4UIcmdWithADoubleAndUnit("/LaserDriven/EnergySelector/FirstCollimator/Radius", this);
78  FcollimatorRadiusCmd -> SetGuidance("Set the Radius of the first collimator");
79  FcollimatorRadiusCmd -> SetParameterName("Size",false);
80  FcollimatorRadiusCmd -> SetDefaultUnit("mm");
81  FcollimatorRadiusCmd -> SetUnitCandidates("mm cm m");
82  FcollimatorRadiusCmd -> AvailableForStates(G4State_Idle);
83 
84  // Thickness of the first collimator
85  FcollimatorThicknessCmd = new G4UIcmdWithADoubleAndUnit("/LaserDriven/EnergySelector/FirstCollimator/Thickness", this);
86  FcollimatorThicknessCmd -> SetGuidance("Set the thickness of the first collimator");
87  FcollimatorThicknessCmd -> SetParameterName("Size",false);
88  FcollimatorThicknessCmd -> SetDefaultUnit("mm");
89  FcollimatorThicknessCmd -> SetUnitCandidates("mm cm m");
90  FcollimatorThicknessCmd -> AvailableForStates(G4State_Idle);
91 
92  // Z Position of the first collimator hole
93  FcollimatorZpositionCmd = new G4UIcmdWithADoubleAndUnit("/LaserDriven/EnergySelector/FirstCollimator/zPosizion", this);
94  FcollimatorZpositionCmd -> SetGuidance("Set the Z position of the first collimator hole as respect the internal vacuum chamber center axis");
95  FcollimatorZpositionCmd -> SetParameterName("Size",false);
96  FcollimatorZpositionCmd -> SetDefaultUnit("mm");
97  FcollimatorZpositionCmd -> SetUnitCandidates("mm cm m");
98  FcollimatorZpositionCmd -> AvailableForStates(G4State_Idle);
99 
100  // THE SECOND ESS COLLIMATOR
101  //
102  // Diameter of the second collimator
103  ScollimatorRadiusCmd = new G4UIcmdWithADoubleAndUnit("/LaserDriven/EnergySelector/SecondCollimator/Radius", this);
104  ScollimatorRadiusCmd -> SetGuidance("Set the Radius of the second collimator");
105  ScollimatorRadiusCmd -> SetParameterName("Size",false);
106  ScollimatorRadiusCmd -> SetDefaultUnit("mm");
107  ScollimatorRadiusCmd -> SetUnitCandidates("mm cm m");
108  ScollimatorRadiusCmd -> AvailableForStates(G4State_Idle);
109 
110  // Thickness of the second collimator
111  ScollimatorThicknessCmd = new G4UIcmdWithADoubleAndUnit("/LaserDriven/EnergySelector/SecondCollimator/Thickness", this);
112  ScollimatorThicknessCmd -> SetGuidance("Set the thickness of the second collimator");
113  ScollimatorThicknessCmd -> SetParameterName("Size",false);
114  ScollimatorThicknessCmd -> SetDefaultUnit("mm");
115  ScollimatorThicknessCmd -> SetUnitCandidates("mm cm m");
116  ScollimatorThicknessCmd -> AvailableForStates(G4State_Idle);
117 
118  // Z Position of the second collimator hole
119  ScollimatorZpositionCmd = new G4UIcmdWithADoubleAndUnit("/LaserDriven/EnergySelector/SecondCollimator/zPosizion", this);
120  ScollimatorZpositionCmd -> SetGuidance("Set the Z position of the second collimator hole as respect the internal vacuum chamber center axis");
121  ScollimatorZpositionCmd -> SetParameterName("Size",false);
122  ScollimatorZpositionCmd -> SetDefaultUnit("mm");
123  ScollimatorZpositionCmd -> SetUnitCandidates("mm cm m");
124  ScollimatorZpositionCmd -> AvailableForStates(G4State_Idle);
125 
126  // THE SLIT
127  //
128  // Thickness Slit
129  SlitThicknessCmd = new G4UIcmdWithADoubleAndUnit("/LaserDriven/EnergySelector/Slit/thickness",this);
130  SlitThicknessCmd -> SetGuidance("Set the X dimension of the Slit, the maximum value is 10 mm");
131  SlitThicknessCmd -> SetParameterName("Size",false);
132  SlitThicknessCmd -> SetDefaultUnit("mm");
133  SlitThicknessCmd -> SetUnitCandidates("mm cm m");
134  SlitThicknessCmd -> AvailableForStates(G4State_Idle);
135 
136  //Hole dimension of the Slit (in Y direction)
137  holeSlitDimensionYCmd = new G4UIcmdWithADoubleAndUnit("/LaserDriven/EnergySelector/Slit/HoleDimensionY",this);
138  holeSlitDimensionYCmd -> SetGuidance("Set the Y dimension of the Slit Hole");
139  holeSlitDimensionYCmd -> SetParameterName("Size",false);
140  holeSlitDimensionYCmd -> SetDefaultUnit("mm");
141  holeSlitDimensionYCmd -> SetUnitCandidates("mm cm m");
142  holeSlitDimensionYCmd -> AvailableForStates(G4State_Idle);
143 
144  // Hole dimension of the Slit (in Z direction)
145  holeSlitDimensionZCmd = new G4UIcmdWithADoubleAndUnit("/LaserDriven/EnergySelector/Slit/HoleDimensionZ",this);
146  holeSlitDimensionZCmd -> SetGuidance("Set the Z dimension of the external part of magnet 4");
147  holeSlitDimensionZCmd -> SetParameterName("Size",false);
148  holeSlitDimensionZCmd -> SetDefaultUnit("mm");
149  holeSlitDimensionZCmd -> SetUnitCandidates("mm cm m");
150  holeSlitDimensionZCmd -> AvailableForStates(G4State_Idle);
151 
152  // Hole position of the Slit (in Z direction as respect the Slit body)
153  slitHolePositionZCmd = new G4UIcmdWithADoubleAndUnit("/LaserDriven/EnergySelector/Slit/HolePositionZ", this);
154  slitHolePositionZCmd -> SetGuidance("Set the Slit hole position in the Z direction as respect the Slit body center");
155  slitHolePositionZCmd -> SetParameterName("Size",false);
156  slitHolePositionZCmd -> SetDefaultUnit("mm");
157  slitHolePositionZCmd -> SetUnitCandidates("mm cm m");
158  slitHolePositionZCmd -> AvailableForStates(G4State_Idle);
159 
160 // Quadrupole system DISABLE
161  DisableQuadsCmd = new G4UIcmdWithoutParameter("/LaserDriven/Quadrupoles/DisableQuads", this);
162  DisableQuadsCmd -> SetGuidance("Disable the Quadrupole system.");
163  DisableQuadsCmd -> SetGuidance("This command MUST be applied before \"beamOn\" ");
164  DisableQuadsCmd -> AvailableForStates(G4State_Idle);
165 }
166 
169 {
170 
171  delete laserDrivenDir;
172  delete energySelectorDir;
173  delete FcollimatorDir;
174  delete ScollimatorDir;
175  delete slitDir;
176  delete quadrupoleDir;
177  delete relativePosDir;
178  delete DisableESSCmd;
179  delete FcollimatorRadiusCmd;
180  delete FcollimatorThicknessCmd;
182  delete ScollimatorRadiusCmd;
183  delete ScollimatorThicknessCmd;
185 
186  delete SlitThicknessCmd;
187  delete holeSlitDimensionYCmd;
188  delete holeSlitDimensionZCmd;
189  delete slitHolePositionZCmd;
190 
191  delete DisableQuadsCmd;
192 
193 }
196 {
197  if (command == DisableESSCmd)
198  {
199  laserDrivenMessengerPointer -> RemoveESS();
200  }
201  if( command == FcollimatorRadiusCmd )
202  {
203  laserDrivenMessengerPointer -> SetFirstCollimatorRadius
204  (FcollimatorRadiusCmd -> GetNewDoubleValue(newValue));
205  }
206  else if( command == FcollimatorThicknessCmd )
207  {
208  laserDrivenMessengerPointer -> SetFirstCollimatorThickness
209  (FcollimatorThicknessCmd -> GetNewDoubleValue(newValue));
210  }
211  else if( command == FcollimatorZpositionCmd )
212  {
213  laserDrivenMessengerPointer -> SetFirstCollimatorPositionZ
214  (FcollimatorZpositionCmd -> GetNewDoubleValue(newValue));
215  }
216  else if( command == ScollimatorRadiusCmd )
217  {
218  laserDrivenMessengerPointer -> SetSecondCollimatorRadius
219  (ScollimatorRadiusCmd -> GetNewDoubleValue(newValue));
220  }
221  else if( command == ScollimatorThicknessCmd )
222  {
223  laserDrivenMessengerPointer -> SetSecondCollimatorThickness
224  (ScollimatorThicknessCmd -> GetNewDoubleValue(newValue));
225  }
226  else if( command == ScollimatorZpositionCmd )
227  {
228  laserDrivenMessengerPointer -> SetSecondCollimatorPositionZ
229  (ScollimatorZpositionCmd -> GetNewDoubleValue(newValue));
230  }
231  else if( command == SlitThicknessCmd )
232  {
233  laserDrivenMessengerPointer -> SetThicknessSlit
234  (SlitThicknessCmd -> GetNewDoubleValue(newValue));
235  }
236  else if( command == holeSlitDimensionYCmd )
237  {
238  laserDrivenMessengerPointer -> SetSlitHoleDimensionY
239  (holeSlitDimensionYCmd -> GetNewDoubleValue(newValue));
240  }
241  else if( command == holeSlitDimensionZCmd )
242  {
243  laserDrivenMessengerPointer -> SetSlitHoleDimensionZ
244  (holeSlitDimensionZCmd -> GetNewDoubleValue(newValue));
245  }
246  else if( command == slitHolePositionZCmd )
247  {
248  laserDrivenMessengerPointer -> SetSlitHolePositionZ
249  (slitHolePositionZCmd -> GetNewDoubleValue(newValue));
250  }
251  else if (command==DisableQuadsCmd)
252  {
253  laserDrivenMessengerPointer -> RemoveQuads();
254  }
255 
256 }
257 
LaserDrivenBeamLine * laserDrivenMessengerPointer
G4UIcmdWithoutParameter * DisableQuadsCmd
LaserDrivenBeamLineMessenger(LaserDrivenBeamLine *)
G4UIcmdWithADoubleAndUnit * ScollimatorThicknessCmd
G4UIcmdWithADoubleAndUnit * holeSlitDimensionZCmd
G4UIcmdWithADoubleAndUnit * SlitThicknessCmd
G4UIcmdWithADoubleAndUnit * slitHolePositionZCmd
G4UIcmdWithADoubleAndUnit * FcollimatorZpositionCmd
G4UIcmdWithADoubleAndUnit * ScollimatorRadiusCmd
void SetNewValue(G4UIcommand *, G4String)
G4UIcmdWithADoubleAndUnit * FcollimatorRadiusCmd
G4UIcmdWithADoubleAndUnit * ScollimatorZpositionCmd
G4UIcmdWithADoubleAndUnit * FcollimatorThicknessCmd
G4UIcmdWithADoubleAndUnit * holeSlitDimensionYCmd