Geant4_10
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 // $Id: F04DetectorMessenger.cc 76690 2013-11-14 08:45:07Z gcosmo $
27 //
30 //
31 
32 #include "F04DetectorMessenger.hh"
33 
34 #include "G4UIdirectory.hh"
35 #include "G4UIcmdWithAString.hh"
36 #include "G4UIcmdWithAnInteger.hh"
39 
40 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
41 
43  : fDetector(detector)
44 {
45  fDetDir = new G4UIdirectory("/field04/");
46  fDetDir->SetGuidance(" field04 Simulation ");
47 
48  fWorldMaterCmd = new G4UIcmdWithAString("/field04/SetWorldMat",this);
49  fWorldMaterCmd->SetGuidance("Select Material of the World");
50  fWorldMaterCmd->SetParameterName("wchoice",true);
51  fWorldMaterCmd->SetDefaultValue("Air");
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.");
60 
61  fWorldZCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetWorldZ",this);
62  fWorldZCmd->SetGuidance("Set Length of the World");
63  fWorldZCmd->SetParameterName("WSizeZ",false,false);
64  fWorldZCmd->SetDefaultUnit("cm");
65  fWorldZCmd->SetRange("WSizeZ>0.");
67 
68  fCaptureRCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetCaptureR",this);
69  fCaptureRCmd->SetGuidance("Set Radius of the Capture Magnet");
70  fCaptureRCmd->SetParameterName("CSizeR",false,false);
71  fCaptureRCmd->SetDefaultUnit("cm");
72  fCaptureRCmd->SetRange("CSizeR>0.");
74 
75  fCaptureZCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetCaptureZ",this);
76  fCaptureZCmd->SetGuidance("Set Length of the Capture Magnet");
77  fCaptureZCmd->SetParameterName("CSizeZ",false,false);
78  fCaptureZCmd->SetDefaultUnit("cm");
79  fCaptureZCmd->SetRange("CSizeZ>0.");
81 
82  fTransferRCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetTransferR",this);
83  fTransferRCmd->SetGuidance("Set Radius of the Transfer Magnet");
84  fTransferRCmd->SetParameterName("TSizeR",false,false);
85  fTransferRCmd->SetDefaultUnit("cm");
86  fTransferRCmd->SetRange("TSizeR>0.");
88 
89  fTransferZCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetTransferZ",this);
90  fTransferZCmd->SetGuidance("Set Length of the Transfer Magnet");
91  fTransferZCmd->SetParameterName("TSizeZ",false,false);
92  fTransferZCmd->SetDefaultUnit("cm");
93  fTransferZCmd->SetRange("TSizeZ>0.");
95 
96  fTransferPCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetTransferP",this);
97  fTransferPCmd->SetGuidance("Set Z pos of the T-Mgnt from end of C-Mgnt");
98  fTransferPCmd->SetParameterName("TSizeP",false,false);
99  fTransferPCmd->SetDefaultUnit("cm");
101 
102  fTgtMaterCmd = new G4UIcmdWithAString("/field04/SetTgtMat",this);
103  fTgtMaterCmd->SetGuidance("Select Material of the Target");
104  fTgtMaterCmd->SetParameterName("tchoice",true);
105  fTgtMaterCmd->SetDefaultValue("Tungsten");
107 
108  fTgtRadCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetTgtRad",this);
109  fTgtRadCmd->SetGuidance("Set Radius of the Target");
110  fTgtRadCmd->SetParameterName("TgtSizeR",false,false);
111  fTgtRadCmd->SetDefaultUnit("cm");
112  fTgtRadCmd->SetRange("TgtSizeR>0.");
114 
115  fTgtThickCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetTgtThick",this);
116  fTgtThickCmd->SetGuidance("Set Thickness of the Target");
117  fTgtThickCmd->SetParameterName("TgtSizeZ",false,false);
118  fTgtThickCmd->SetDefaultUnit("cm");
119  fTgtThickCmd->SetRange("TgtSizeZ>0.");
121 
122  fTgtPosCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetTgtPos",this);
123  fTgtPosCmd->SetGuidance("Set Z pos of the tgt relative to C-Mgnt centre");
124  fTgtPosCmd->SetParameterName("TgtSizeP",false,false);
125  fTgtPosCmd->SetDefaultUnit("cm");
127 
128  fTgtAngCmd = new G4UIcmdWithAnInteger("/field04/SetTgtAng",this);
129  fTgtAngCmd->
130  SetGuidance("Set the angle [in deg] of the Tgt relative to C-Mgnt centre");
132 
133  fDgrMaterCmd = new G4UIcmdWithAString("/field04/SetDgrMat",this);
134  fDgrMaterCmd->SetGuidance("Select Material of the Degrader");
135  fDgrMaterCmd->SetParameterName("dchoice",true);
136  fDgrMaterCmd->SetDefaultValue("Lead");
138 
139  fDgrRadCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetDgrRad",this);
140  fDgrRadCmd->SetGuidance("Set Radius of the Degrader");
141  fDgrRadCmd->SetParameterName("DrgSizeR",false,false);
142  fDgrRadCmd->SetDefaultUnit("cm");
143  fDgrRadCmd->SetRange("DrgSizeR>0.");
145 
146  fDgrThickCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetDgrThick",this);
147  fDgrThickCmd->SetGuidance("Set Thickness of the Degrader");
148  fDgrThickCmd->SetParameterName("DgrSizeZ",false,false);
149  fDgrThickCmd->SetDefaultUnit("cm");
150  fDgrThickCmd->SetRange("DgrSizeZ>0.");
152 
153  fDgrPosCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetDgrPos",this);
154  fDgrPosCmd->SetGuidance("Set Z pos of the Dgr relative to T-Mgnt centre");
155  fDgrPosCmd->SetParameterName("DgrSizeP",false,false);
156  fDgrPosCmd->SetDefaultUnit("cm");
158 
159  fUpdateCmd = new G4UIcmdWithoutParameter("/field04/Update",this);
160  fUpdateCmd->SetGuidance("Update field04 geometry");
161  fUpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
162  fUpdateCmd->SetGuidance("if you changed geometrical value(s).");
164 
165 }
166 
167 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
168 
170 {
171  delete fDetDir;
172 
173  delete fWorldMaterCmd;
174  delete fWorldRCmd;
175  delete fWorldZCmd;
176 
177  delete fCaptureRCmd;
178  delete fCaptureZCmd;
179 
180  delete fTransferRCmd;
181  delete fTransferZCmd;
182  delete fTransferPCmd;
183 
184  delete fTgtMaterCmd;
185  delete fTgtRadCmd;
186  delete fTgtThickCmd;
187  delete fTgtPosCmd;
188  delete fTgtAngCmd;
189 
190  delete fDgrMaterCmd;
191  delete fDgrRadCmd;
192  delete fDgrThickCmd;
193  delete fDgrPosCmd;
194 
195  delete fUpdateCmd;
196 }
197 
198 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
199 
201 {
202  if( command == fWorldMaterCmd )
203  { fDetector->SetWorldMaterial(newValue);}
204 
205  if( command == fTgtMaterCmd )
206  { fDetector->SetTargetMaterial(newValue);}
207 
208  if( command == fDgrMaterCmd )
209  { fDetector->SetDegraderMaterial(newValue);}
210 
211  if( command == fWorldRCmd )
212  { fDetector->SetWorldSizeR(fWorldRCmd->GetNewDoubleValue(newValue));}
213 
214  if( command == fWorldZCmd )
215  { fDetector->SetWorldSizeZ(fWorldZCmd->GetNewDoubleValue(newValue));}
216 
217  if( command == fCaptureRCmd )
218  fDetector->SetCaptureMgntRadius(fCaptureRCmd->GetNewDoubleValue(newValue));
219 
220  if( command == fCaptureZCmd )
221  fDetector->SetCaptureMgntLength(fCaptureZCmd->GetNewDoubleValue(newValue));
222 
223  if( command == fTransferRCmd )
224  fDetector->SetTransferMgntRadius(fTransferRCmd->GetNewDoubleValue(newValue));
225 
226  if( command == fTransferZCmd )
227  fDetector->SetTransferMgntLength(fTransferZCmd->GetNewDoubleValue(newValue));
228 
229  if( command == fTransferPCmd )
230  fDetector->SetTransferMgntPos(fTransferPCmd->GetNewDoubleValue(newValue));
231 
232  if( command == fTgtRadCmd )
233  fDetector->SetTargetRadius(fTgtRadCmd->GetNewDoubleValue(newValue));
234 
235  if( command == fTgtThickCmd )
236  fDetector->SetTargetThickness(fTgtThickCmd->GetNewDoubleValue(newValue));
237 
238  if( command == fTgtPosCmd )
239  fDetector->SetTargetPos(fTgtPosCmd->GetNewDoubleValue(newValue));
240 
241  if( command == fTgtAngCmd )
242  fDetector->SetTargetAngle(fTgtAngCmd->GetNewIntValue(newValue));
243 
244  if( command == fDgrRadCmd )
245  fDetector->SetDegraderRadius(fDgrRadCmd->GetNewDoubleValue(newValue));
246 
247  if( command == fDgrThickCmd )
248  fDetector->SetDegraderThickness(fDgrThickCmd->GetNewDoubleValue(newValue));
249 
250  if( command == fDgrPosCmd )
251  fDetector->SetDegraderPos(fDgrPosCmd->GetNewDoubleValue(newValue));
252 
253  if( command == fWorldZCmd )
254  fDetector->SetWorldSizeZ(fWorldZCmd->GetNewDoubleValue(newValue));
255 
256  if( command == fWorldRCmd )
257  fDetector->SetWorldSizeR(fWorldRCmd->GetNewDoubleValue(newValue));
258 
259  if( command == fUpdateCmd ) fDetector->UpdateGeometry();
260 
261 }
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
static G4int GetNewIntValue(const char *paramString)
F04DetectorMessenger(F04DetectorConstruction *)
static G4double GetNewDoubleValue(const char *paramString)
virtual void SetNewValue(G4UIcommand *, G4String)
Definition of the F04DetectorMessenger class.
void SetRange(const char *rs)
Definition: G4UIcommand.hh:125
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:225
void SetDefaultValue(const char *defVal)
void SetDefaultUnit(const char *defUnit)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)