Loading...
Searching...
No Matches
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//
26//
27/// \file field/field04/src/F04DetectorMessenger.cc
28/// \brief Implementation of the F04DetectorMessenger class
29//
30
32
33#include "G4UIdirectory.hh"
34#include "G4UIcmdWithAString.hh"
35#include "G4UIcmdWithAnInteger.hh"
36#include "G4UIcmdWithADoubleAndUnit.hh"
37#include "G4UIcmdWithoutParameter.hh"
38
39//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
40
42 : fDetector(detector)
43{
44 fDetDir = new G4UIdirectory("/field04/");
45 fDetDir->SetGuidance(" field04 Simulation ");
46
47 fWorldMaterCmd = new G4UIcmdWithAString("/field04/SetWorldMat",this);
48 fWorldMaterCmd->SetGuidance("Select Material of the World");
49 fWorldMaterCmd->SetParameterName("wchoice",true);
50 fWorldMaterCmd->SetDefaultValue("Air");
51 fWorldMaterCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
52 fWorldMaterCmd->SetToBeBroadcasted(false);
53
54 fWorldRCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetWorldR",this);
55 fWorldRCmd->SetGuidance("Set Radius of the World");
56 fWorldRCmd->SetParameterName("WSizeR",false,false);
57 fWorldRCmd->SetDefaultUnit("cm");
58 fWorldRCmd->SetRange("WSizeR>0.");
59 fWorldRCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
60 fWorldRCmd->SetToBeBroadcasted(false);
61
62 fWorldZCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetWorldZ",this);
63 fWorldZCmd->SetGuidance("Set Length of the World");
64 fWorldZCmd->SetParameterName("WSizeZ",false,false);
65 fWorldZCmd->SetDefaultUnit("cm");
66 fWorldZCmd->SetRange("WSizeZ>0.");
67 fWorldZCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
68 fWorldZCmd->SetToBeBroadcasted(false);
69
70 fCaptureRCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetCaptureR",this);
71 fCaptureRCmd->SetGuidance("Set Radius of the Capture Magnet");
72 fCaptureRCmd->SetParameterName("CSizeR",false,false);
73 fCaptureRCmd->SetDefaultUnit("cm");
74 fCaptureRCmd->SetRange("CSizeR>0.");
75 fCaptureRCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
76 fCaptureRCmd->SetToBeBroadcasted(false);
77
78 fCaptureZCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetCaptureZ",this);
79 fCaptureZCmd->SetGuidance("Set Length of the Capture Magnet");
80 fCaptureZCmd->SetParameterName("CSizeZ",false,false);
81 fCaptureZCmd->SetDefaultUnit("cm");
82 fCaptureZCmd->SetRange("CSizeZ>0.");
83 fCaptureZCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
84 fCaptureZCmd->SetToBeBroadcasted(false);
85
86 fTransferRCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetTransferR",this);
87 fTransferRCmd->SetGuidance("Set Radius of the Transfer Magnet");
88 fTransferRCmd->SetParameterName("TSizeR",false,false);
89 fTransferRCmd->SetDefaultUnit("cm");
90 fTransferRCmd->SetRange("TSizeR>0.");
91 fTransferRCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
92 fTransferRCmd->SetToBeBroadcasted(false);
93
94 fTransferZCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetTransferZ",this);
95 fTransferZCmd->SetGuidance("Set Length of the Transfer Magnet");
96 fTransferZCmd->SetParameterName("TSizeZ",false,false);
97 fTransferZCmd->SetDefaultUnit("cm");
98 fTransferZCmd->SetRange("TSizeZ>0.");
99 fTransferZCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
100 fTransferZCmd->SetToBeBroadcasted(false);
101
102 fTransferPCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetTransferP",this);
103 fTransferPCmd->SetGuidance("Set Z pos of the T-Mgnt from end of C-Mgnt");
104 fTransferPCmd->SetParameterName("TSizeP",false,false);
105 fTransferPCmd->SetDefaultUnit("cm");
106 fTransferPCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
107 fTransferPCmd->SetToBeBroadcasted(false);
108
109 fTgtMaterCmd = new G4UIcmdWithAString("/field04/SetTgtMat",this);
110 fTgtMaterCmd->SetGuidance("Select Material of the Target");
111 fTgtMaterCmd->SetParameterName("tchoice",true);
112 fTgtMaterCmd->SetDefaultValue("Tungsten");
113 fTgtMaterCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
114 fTgtMaterCmd->SetToBeBroadcasted(false);
115
116 fTgtRadCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetTgtRad",this);
117 fTgtRadCmd->SetGuidance("Set Radius of the Target");
118 fTgtRadCmd->SetParameterName("TgtSizeR",false,false);
119 fTgtRadCmd->SetDefaultUnit("cm");
120 fTgtRadCmd->SetRange("TgtSizeR>0.");
121 fTgtRadCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
122 fTgtRadCmd->SetToBeBroadcasted(false);
123
124 fTgtThickCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetTgtThick",this);
125 fTgtThickCmd->SetGuidance("Set Thickness of the Target");
126 fTgtThickCmd->SetParameterName("TgtSizeZ",false,false);
127 fTgtThickCmd->SetDefaultUnit("cm");
128 fTgtThickCmd->SetRange("TgtSizeZ>0.");
129 fTgtThickCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
130 fTgtThickCmd->SetToBeBroadcasted(false);
131
132 fTgtPosCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetTgtPos",this);
133 fTgtPosCmd->SetGuidance("Set Z pos of the tgt relative to C-Mgnt centre");
134 fTgtPosCmd->SetParameterName("TgtSizeP",false,false);
135 fTgtPosCmd->SetDefaultUnit("cm");
136 fTgtPosCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
137 fTgtPosCmd->SetToBeBroadcasted(false);
138
139 fTgtAngCmd = new G4UIcmdWithAnInteger("/field04/SetTgtAng",this);
140 fTgtAngCmd->
141 SetGuidance("Set the angle [in deg] of the Tgt relative to C-Mgnt centre");
142 fTgtAngCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
143 fTgtAngCmd->SetToBeBroadcasted(false);
144
145 fDgrMaterCmd = new G4UIcmdWithAString("/field04/SetDgrMat",this);
146 fDgrMaterCmd->SetGuidance("Select Material of the Degrader");
147 fDgrMaterCmd->SetParameterName("dchoice",true);
148 fDgrMaterCmd->SetDefaultValue("Lead");
149 fDgrMaterCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
150 fDgrMaterCmd->SetToBeBroadcasted(false);
151
152 fDgrRadCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetDgrRad",this);
153 fDgrRadCmd->SetGuidance("Set Radius of the Degrader");
154 fDgrRadCmd->SetParameterName("DrgSizeR",false,false);
155 fDgrRadCmd->SetDefaultUnit("cm");
156 fDgrRadCmd->SetRange("DrgSizeR>0.");
157 fDgrRadCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
158 fDgrRadCmd->SetToBeBroadcasted(false);
159
160 fDgrThickCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetDgrThick",this);
161 fDgrThickCmd->SetGuidance("Set Thickness of the Degrader");
162 fDgrThickCmd->SetParameterName("DgrSizeZ",false,false);
163 fDgrThickCmd->SetDefaultUnit("cm");
164 fDgrThickCmd->SetRange("DgrSizeZ>0.");
165 fDgrThickCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
166 fDgrThickCmd->SetToBeBroadcasted(false);
167
168 fDgrPosCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetDgrPos",this);
169 fDgrPosCmd->SetGuidance("Set Z pos of the Dgr relative to T-Mgnt centre");
170 fDgrPosCmd->SetParameterName("DgrSizeP",false,false);
171 fDgrPosCmd->SetDefaultUnit("cm");
172 fDgrPosCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
173 fDgrPosCmd->SetToBeBroadcasted(false);
174}
175
176//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
177
179{
180 delete fDetDir;
181
182 delete fWorldMaterCmd;
183 delete fWorldRCmd;
184 delete fWorldZCmd;
185
186 delete fCaptureRCmd;
187 delete fCaptureZCmd;
188
189 delete fTransferRCmd;
190 delete fTransferZCmd;
191 delete fTransferPCmd;
192
193 delete fTgtMaterCmd;
194 delete fTgtRadCmd;
195 delete fTgtThickCmd;
196 delete fTgtPosCmd;
197 delete fTgtAngCmd;
198
199 delete fDgrMaterCmd;
200 delete fDgrRadCmd;
201 delete fDgrThickCmd;
202 delete fDgrPosCmd;
203}
204
205//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
206
208{
209 if( command == fWorldMaterCmd )
210 { fDetector->SetWorldMaterial(newValue);}
211
212 if( command == fTgtMaterCmd )
213 { fDetector->SetTargetMaterial(newValue);}
214
215 if( command == fDgrMaterCmd )
216 { fDetector->SetDegraderMaterial(newValue);}
217
218 if( command == fWorldRCmd )
219 { fDetector->SetWorldSizeR(fWorldRCmd->GetNewDoubleValue(newValue));}
220
221 if( command == fWorldZCmd )
222 { fDetector->SetWorldSizeZ(fWorldZCmd->GetNewDoubleValue(newValue));}
223
224 if( command == fCaptureRCmd )
225 fDetector->SetCaptureMgntRadius(fCaptureRCmd->GetNewDoubleValue(newValue));
226
227 if( command == fCaptureZCmd )
228 fDetector->SetCaptureMgntLength(fCaptureZCmd->GetNewDoubleValue(newValue));
229
230 if( command == fTransferRCmd )
231 fDetector->SetTransferMgntRadius(fTransferRCmd->GetNewDoubleValue(newValue));
232
233 if( command == fTransferZCmd )
234 fDetector->SetTransferMgntLength(fTransferZCmd->GetNewDoubleValue(newValue));
235
236 if( command == fTransferPCmd )
237 fDetector->SetTransferMgntPos(fTransferPCmd->GetNewDoubleValue(newValue));
238
239 if( command == fTgtRadCmd )
240 fDetector->SetTargetRadius(fTgtRadCmd->GetNewDoubleValue(newValue));
241
242 if( command == fTgtThickCmd )
243 fDetector->SetTargetThickness(fTgtThickCmd->GetNewDoubleValue(newValue));
244
245 if( command == fTgtPosCmd )
246 fDetector->SetTargetPos(fTgtPosCmd->GetNewDoubleValue(newValue));
247
248 if( command == fTgtAngCmd )
249 fDetector->SetTargetAngle(fTgtAngCmd->GetNewIntValue(newValue));
250
251 if( command == fDgrRadCmd )
252 fDetector->SetDegraderRadius(fDgrRadCmd->GetNewDoubleValue(newValue));
253
254 if( command == fDgrThickCmd )
255 fDetector->SetDegraderThickness(fDgrThickCmd->GetNewDoubleValue(newValue));
256
257 if( command == fDgrPosCmd )
258 fDetector->SetDegraderPos(fDgrPosCmd->GetNewDoubleValue(newValue));
259
260 if( command == fWorldZCmd )
261 fDetector->SetWorldSizeZ(fWorldZCmd->GetNewDoubleValue(newValue));
262
263 if( command == fWorldRCmd )
264 fDetector->SetWorldSizeR(fWorldRCmd->GetNewDoubleValue(newValue));
265}
Definition of the F04DetectorMessenger class.
G4UIcmdWithAString * fWorldMaterCmd
G4UIcmdWithADoubleAndUnit * fCaptureZCmd
G4UIcmdWithADoubleAndUnit * fTransferZCmd
F04DetectorConstruction * fDetector
G4UIcmdWithADoubleAndUnit * fWorldZCmd
F04DetectorMessenger(F04DetectorConstruction *)
G4UIcmdWithADoubleAndUnit * fTgtThickCmd
void SetNewValue(G4UIcommand *, G4String) override
G4UIcmdWithAnInteger * fTgtAngCmd
G4UIcmdWithADoubleAndUnit * fTransferPCmd
G4UIcmdWithADoubleAndUnit * fTgtRadCmd
G4UIcmdWithADoubleAndUnit * fDgrPosCmd
G4UIcmdWithAString * fTgtMaterCmd
G4UIcmdWithAString * fDgrMaterCmd
G4UIcmdWithADoubleAndUnit * fTransferRCmd
G4UIcmdWithADoubleAndUnit * fTgtPosCmd
G4UIcmdWithADoubleAndUnit * fDgrRadCmd
G4UIcmdWithADoubleAndUnit * fWorldRCmd
G4UIcmdWithADoubleAndUnit * fDgrThickCmd
G4UIcmdWithADoubleAndUnit * fCaptureRCmd

Applications | User Support | Publications | Collaboration