Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
F04DetectorMessenger.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 //
28 //
29 //
30 #include "F04DetectorMessenger.hh"
31 
32 #include "G4UIdirectory.hh"
33 #include "G4UIcmdWithAString.hh"
34 #include "G4UIcmdWithAnInteger.hh"
37 
38 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
39 
41  : fDetector(detector)
42 {
43  fDetDir = new G4UIdirectory("/field04/");
44  fDetDir->SetGuidance(" field04 Simulation ");
45 
46  fWorldMaterCmd = new G4UIcmdWithAString("/field04/SetWorldMat",this);
47  fWorldMaterCmd->SetGuidance("Select Material of the World");
48  fWorldMaterCmd->SetParameterName("wchoice",true);
49  fWorldMaterCmd->SetDefaultValue("Air");
51 
52  fWorldRCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetWorldR",this);
53  fWorldRCmd->SetGuidance("Set Radius of the World");
54  fWorldRCmd->SetParameterName("WSizeR",false,false);
55  fWorldRCmd->SetDefaultUnit("cm");
56  fWorldRCmd->SetRange("WSizeR>0.");
58 
59  fWorldZCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetWorldZ",this);
60  fWorldZCmd->SetGuidance("Set Length of the World");
61  fWorldZCmd->SetParameterName("WSizeZ",false,false);
62  fWorldZCmd->SetDefaultUnit("cm");
63  fWorldZCmd->SetRange("WSizeZ>0.");
65 
66  fCaptureRCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetCaptureR",this);
67  fCaptureRCmd->SetGuidance("Set Radius of the Capture Magnet");
68  fCaptureRCmd->SetParameterName("CSizeR",false,false);
69  fCaptureRCmd->SetDefaultUnit("cm");
70  fCaptureRCmd->SetRange("CSizeR>0.");
72 
73  fCaptureZCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetCaptureZ",this);
74  fCaptureZCmd->SetGuidance("Set Length of the Capture Magnet");
75  fCaptureZCmd->SetParameterName("CSizeZ",false,false);
76  fCaptureZCmd->SetDefaultUnit("cm");
77  fCaptureZCmd->SetRange("CSizeZ>0.");
79 
80  fCaptureB1Cmd = new G4UIcmdWithADoubleAndUnit("/field04/SetCaptureB1",this);
81  fCaptureB1Cmd->SetGuidance("Set B1 of the Capture Magnet");
82  fCaptureB1Cmd->SetParameterName("CSizeB1",false,false);
83  fCaptureB1Cmd->SetDefaultUnit("tesla");
84  fCaptureB1Cmd->SetRange("CSizeB1>0.");
86 
87  fCaptureB2Cmd = new G4UIcmdWithADoubleAndUnit("/field04/SetCaptureB2",this);
88  fCaptureB2Cmd->SetGuidance("Set B2 of the Capture Magnet");
89  fCaptureB2Cmd->SetParameterName("CSizeB2",false,false);
90  fCaptureB2Cmd->SetDefaultUnit("tesla");
91  fCaptureB2Cmd->SetRange("CSizeB2>0.");
93 
94  fTransferRCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetTransferR",this);
95  fTransferRCmd->SetGuidance("Set Radius of the Transfer Magnet");
96  fTransferRCmd->SetParameterName("TSizeR",false,false);
97  fTransferRCmd->SetDefaultUnit("cm");
98  fTransferRCmd->SetRange("TSizeR>0.");
100 
101  fTransferZCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetTransferZ",this);
102  fTransferZCmd->SetGuidance("Set Length of the Transfer Magnet");
103  fTransferZCmd->SetParameterName("TSizeZ",false,false);
104  fTransferZCmd->SetDefaultUnit("cm");
105  fTransferZCmd->SetRange("TSizeZ>0.");
107 
108  fTransferBCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetTransferB",this);
109  fTransferBCmd->SetGuidance("Set B of the Transfer Magnet");
110  fTransferBCmd->SetParameterName("TSizeB",false,false);
111  fTransferBCmd->SetDefaultUnit("tesla");
112  fTransferBCmd->SetRange("TSizeB>0.");
114 
115  fTransferPCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetTransferP",this);
116  fTransferPCmd->SetGuidance("Set Z pos of the T-Mgnt from end of C-Mgnt");
117  fTransferPCmd->SetParameterName("TSizeP",false,false);
118  fTransferPCmd->SetDefaultUnit("cm");
120 
121  fTgtMaterCmd = new G4UIcmdWithAString("/field04/SetTgtMat",this);
122  fTgtMaterCmd->SetGuidance("Select Material of the Target");
123  fTgtMaterCmd->SetParameterName("tchoice",true);
124  fTgtMaterCmd->SetDefaultValue("Tungsten");
126 
127  fTgtRadCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetTgtRad",this);
128  fTgtRadCmd->SetGuidance("Set Radius of the Target");
129  fTgtRadCmd->SetParameterName("TgtSizeR",false,false);
130  fTgtRadCmd->SetDefaultUnit("cm");
131  fTgtRadCmd->SetRange("TgtSizeR>0.");
133 
134  fTgtThickCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetTgtThick",this);
135  fTgtThickCmd->SetGuidance("Set Thickness of the Target");
136  fTgtThickCmd->SetParameterName("TgtSizeZ",false,false);
137  fTgtThickCmd->SetDefaultUnit("cm");
138  fTgtThickCmd->SetRange("TgtSizeZ>0.");
140 
141  fTgtPosCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetTgtPos",this);
142  fTgtPosCmd->SetGuidance("Set Z pos of the tgt relative to C-Mgnt centre");
143  fTgtPosCmd->SetParameterName("TgtSizeP",false,false);
144  fTgtPosCmd->SetDefaultUnit("cm");
146 
147  fTgtAngCmd = new G4UIcmdWithAnInteger("/field04/SetTgtAng",this);
148  fTgtAngCmd->
149  SetGuidance("Set the angle [in deg] of the Tgt relative to C-Mgnt centre");
151 
152  fDgrMaterCmd = new G4UIcmdWithAString("/field04/SetDgrMat",this);
153  fDgrMaterCmd->SetGuidance("Select Material of the Degrader");
154  fDgrMaterCmd->SetParameterName("dchoice",true);
155  fDgrMaterCmd->SetDefaultValue("Lead");
157 
158  fDgrRadCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetDgrRad",this);
159  fDgrRadCmd->SetGuidance("Set Radius of the Degrader");
160  fDgrRadCmd->SetParameterName("DrgSizeR",false,false);
161  fDgrRadCmd->SetDefaultUnit("cm");
162  fDgrRadCmd->SetRange("DrgSizeR>0.");
164 
165  fDgrThickCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetDgrThick",this);
166  fDgrThickCmd->SetGuidance("Set Thickness of the Degrader");
167  fDgrThickCmd->SetParameterName("DgrSizeZ",false,false);
168  fDgrThickCmd->SetDefaultUnit("cm");
169  fDgrThickCmd->SetRange("DgrSizeZ>0.");
171 
172  fDgrPosCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetDgrPos",this);
173  fDgrPosCmd->SetGuidance("Set Z pos of the Dgr relative to T-Mgnt centre");
174  fDgrPosCmd->SetParameterName("DgrSizeP",false,false);
175  fDgrPosCmd->SetDefaultUnit("cm");
177 
178  fUpdateCmd = new G4UIcmdWithoutParameter("/field04/Update",this);
179  fUpdateCmd->SetGuidance("Update field04 geometry");
180  fUpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
181  fUpdateCmd->SetGuidance("if you changed geometrical value(s).");
183 
184 }
185 
186 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
187 
189 {
190  delete fDetDir;
191 
192  delete fWorldMaterCmd;
193  delete fWorldRCmd;
194  delete fWorldZCmd;
195 
196  delete fCaptureRCmd;
197  delete fCaptureZCmd;
198  delete fCaptureB1Cmd;
199  delete fCaptureB2Cmd;
200 
201  delete fTransferRCmd;
202  delete fTransferZCmd;
203  delete fTransferBCmd;
204  delete fTransferPCmd;
205 
206  delete fTgtMaterCmd;
207  delete fTgtRadCmd;
208  delete fTgtThickCmd;
209  delete fTgtPosCmd;
210  delete fTgtAngCmd;
211 
212  delete fDgrMaterCmd;
213  delete fDgrRadCmd;
214  delete fDgrThickCmd;
215  delete fDgrPosCmd;
216 
217  delete fUpdateCmd;
218 }
219 
220 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
221 
223 {
224  if( command == fWorldMaterCmd )
225  { fDetector->SetWorldMaterial(newValue);}
226 
227  if( command == fTgtMaterCmd )
228  { fDetector->SetTargetMaterial(newValue);}
229 
230  if( command == fDgrMaterCmd )
231  { fDetector->SetDegraderMaterial(newValue);}
232 
233  if( command == fWorldRCmd )
234  { fDetector->SetWorldSizeR(fWorldRCmd->GetNewDoubleValue(newValue));}
235 
236  if( command == fWorldZCmd )
237  { fDetector->SetWorldSizeZ(fWorldZCmd->GetNewDoubleValue(newValue));}
238 
239  if( command == fCaptureRCmd )
240  fDetector->SetCaptureMgntRadius(fCaptureRCmd->GetNewDoubleValue(newValue));
241 
242  if( command == fCaptureZCmd )
243  fDetector->SetCaptureMgntLength(fCaptureZCmd->GetNewDoubleValue(newValue));
244 
245  if( command == fCaptureB1Cmd )
246  fDetector->SetCaptureMgntB1(fCaptureB1Cmd->GetNewDoubleValue(newValue));
247 
248  if( command == fCaptureB2Cmd )
249  fDetector->SetCaptureMgntB2(fCaptureB2Cmd->GetNewDoubleValue(newValue));
250 
251  if( command == fTransferRCmd )
252  fDetector->SetTransferMgntRadius(fTransferRCmd->GetNewDoubleValue(newValue));
253 
254  if( command == fTransferZCmd )
255  fDetector->SetTransferMgntLength(fTransferZCmd->GetNewDoubleValue(newValue));
256 
257  if( command == fTransferBCmd )
258  fDetector->SetTransferMgntB(fTransferBCmd->GetNewDoubleValue(newValue));
259 
260  if( command == fTransferPCmd )
261  fDetector->SetTransferMgntPos(fTransferPCmd->GetNewDoubleValue(newValue));
262 
263  if( command == fTgtRadCmd )
264  fDetector->SetTargetRadius(fTgtRadCmd->GetNewDoubleValue(newValue));
265 
266  if( command == fTgtThickCmd )
267  fDetector->SetTargetThickness(fTgtThickCmd->GetNewDoubleValue(newValue));
268 
269  if( command == fTgtPosCmd )
270  fDetector->SetTargetPos(fTgtPosCmd->GetNewDoubleValue(newValue));
271 
272  if( command == fTgtAngCmd )
273  fDetector->SetTargetAngle(fTgtAngCmd->GetNewIntValue(newValue));
274 
275  if( command == fDgrRadCmd )
276  fDetector->SetDegraderRadius(fDgrRadCmd->GetNewDoubleValue(newValue));
277 
278  if( command == fDgrThickCmd )
279  fDetector->SetDegraderThickness(fDgrThickCmd->GetNewDoubleValue(newValue));
280 
281  if( command == fDgrPosCmd )
282  fDetector->SetDegraderPos(fDgrPosCmd->GetNewDoubleValue(newValue));
283 
284  if( command == fWorldZCmd )
285  fDetector->SetWorldSizeZ(fWorldZCmd->GetNewDoubleValue(newValue));
286 
287  if( command == fWorldRCmd )
288  fDetector->SetWorldSizeR(fWorldRCmd->GetNewDoubleValue(newValue));
289 
290  if( command == fUpdateCmd ) fDetector->UpdateGeometry();
291 
292 }