Geant4  10.03.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 //
26 // $Id: F04DetectorMessenger.cc 78551 2014-01-07 09:45:08Z 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  fWorldMaterCmd->SetToBeBroadcasted(false);
54 
55  fWorldRCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetWorldR",this);
56  fWorldRCmd->SetGuidance("Set Radius of the World");
57  fWorldRCmd->SetParameterName("WSizeR",false,false);
58  fWorldRCmd->SetDefaultUnit("cm");
59  fWorldRCmd->SetRange("WSizeR>0.");
61  fWorldRCmd->SetToBeBroadcasted(false);
62 
63  fWorldZCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetWorldZ",this);
64  fWorldZCmd->SetGuidance("Set Length of the World");
65  fWorldZCmd->SetParameterName("WSizeZ",false,false);
66  fWorldZCmd->SetDefaultUnit("cm");
67  fWorldZCmd->SetRange("WSizeZ>0.");
69  fWorldZCmd->SetToBeBroadcasted(false);
70 
71  fCaptureRCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetCaptureR",this);
72  fCaptureRCmd->SetGuidance("Set Radius of the Capture Magnet");
73  fCaptureRCmd->SetParameterName("CSizeR",false,false);
74  fCaptureRCmd->SetDefaultUnit("cm");
75  fCaptureRCmd->SetRange("CSizeR>0.");
77  fCaptureRCmd->SetToBeBroadcasted(false);
78 
79  fCaptureZCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetCaptureZ",this);
80  fCaptureZCmd->SetGuidance("Set Length of the Capture Magnet");
81  fCaptureZCmd->SetParameterName("CSizeZ",false,false);
82  fCaptureZCmd->SetDefaultUnit("cm");
83  fCaptureZCmd->SetRange("CSizeZ>0.");
85  fCaptureZCmd->SetToBeBroadcasted(false);
86 
87  fTransferRCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetTransferR",this);
88  fTransferRCmd->SetGuidance("Set Radius of the Transfer Magnet");
89  fTransferRCmd->SetParameterName("TSizeR",false,false);
90  fTransferRCmd->SetDefaultUnit("cm");
91  fTransferRCmd->SetRange("TSizeR>0.");
93  fTransferRCmd->SetToBeBroadcasted(false);
94 
95  fTransferZCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetTransferZ",this);
96  fTransferZCmd->SetGuidance("Set Length of the Transfer Magnet");
97  fTransferZCmd->SetParameterName("TSizeZ",false,false);
98  fTransferZCmd->SetDefaultUnit("cm");
99  fTransferZCmd->SetRange("TSizeZ>0.");
101  fTransferZCmd->SetToBeBroadcasted(false);
102 
103  fTransferPCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetTransferP",this);
104  fTransferPCmd->SetGuidance("Set Z pos of the T-Mgnt from end of C-Mgnt");
105  fTransferPCmd->SetParameterName("TSizeP",false,false);
106  fTransferPCmd->SetDefaultUnit("cm");
108  fTransferPCmd->SetToBeBroadcasted(false);
109 
110  fTgtMaterCmd = new G4UIcmdWithAString("/field04/SetTgtMat",this);
111  fTgtMaterCmd->SetGuidance("Select Material of the Target");
112  fTgtMaterCmd->SetParameterName("tchoice",true);
113  fTgtMaterCmd->SetDefaultValue("Tungsten");
115  fTgtMaterCmd->SetToBeBroadcasted(false);
116 
117  fTgtRadCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetTgtRad",this);
118  fTgtRadCmd->SetGuidance("Set Radius of the Target");
119  fTgtRadCmd->SetParameterName("TgtSizeR",false,false);
120  fTgtRadCmd->SetDefaultUnit("cm");
121  fTgtRadCmd->SetRange("TgtSizeR>0.");
123  fTgtRadCmd->SetToBeBroadcasted(false);
124 
125  fTgtThickCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetTgtThick",this);
126  fTgtThickCmd->SetGuidance("Set Thickness of the Target");
127  fTgtThickCmd->SetParameterName("TgtSizeZ",false,false);
128  fTgtThickCmd->SetDefaultUnit("cm");
129  fTgtThickCmd->SetRange("TgtSizeZ>0.");
131  fTgtThickCmd->SetToBeBroadcasted(false);
132 
133  fTgtPosCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetTgtPos",this);
134  fTgtPosCmd->SetGuidance("Set Z pos of the tgt relative to C-Mgnt centre");
135  fTgtPosCmd->SetParameterName("TgtSizeP",false,false);
136  fTgtPosCmd->SetDefaultUnit("cm");
138  fTgtPosCmd->SetToBeBroadcasted(false);
139 
140  fTgtAngCmd = new G4UIcmdWithAnInteger("/field04/SetTgtAng",this);
141  fTgtAngCmd->
142  SetGuidance("Set the angle [in deg] of the Tgt relative to C-Mgnt centre");
144  fTgtAngCmd->SetToBeBroadcasted(false);
145 
146  fDgrMaterCmd = new G4UIcmdWithAString("/field04/SetDgrMat",this);
147  fDgrMaterCmd->SetGuidance("Select Material of the Degrader");
148  fDgrMaterCmd->SetParameterName("dchoice",true);
149  fDgrMaterCmd->SetDefaultValue("Lead");
151  fDgrMaterCmd->SetToBeBroadcasted(false);
152 
153  fDgrRadCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetDgrRad",this);
154  fDgrRadCmd->SetGuidance("Set Radius of the Degrader");
155  fDgrRadCmd->SetParameterName("DrgSizeR",false,false);
156  fDgrRadCmd->SetDefaultUnit("cm");
157  fDgrRadCmd->SetRange("DrgSizeR>0.");
159  fDgrRadCmd->SetToBeBroadcasted(false);
160 
161  fDgrThickCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetDgrThick",this);
162  fDgrThickCmd->SetGuidance("Set Thickness of the Degrader");
163  fDgrThickCmd->SetParameterName("DgrSizeZ",false,false);
164  fDgrThickCmd->SetDefaultUnit("cm");
165  fDgrThickCmd->SetRange("DgrSizeZ>0.");
167  fDgrThickCmd->SetToBeBroadcasted(false);
168 
169  fDgrPosCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetDgrPos",this);
170  fDgrPosCmd->SetGuidance("Set Z pos of the Dgr relative to T-Mgnt centre");
171  fDgrPosCmd->SetParameterName("DgrSizeP",false,false);
172  fDgrPosCmd->SetDefaultUnit("cm");
174  fDgrPosCmd->SetToBeBroadcasted(false);
175 }
176 
177 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
178 
180 {
181  delete fDetDir;
182 
183  delete fWorldMaterCmd;
184  delete fWorldRCmd;
185  delete fWorldZCmd;
186 
187  delete fCaptureRCmd;
188  delete fCaptureZCmd;
189 
190  delete fTransferRCmd;
191  delete fTransferZCmd;
192  delete fTransferPCmd;
193 
194  delete fTgtMaterCmd;
195  delete fTgtRadCmd;
196  delete fTgtThickCmd;
197  delete fTgtPosCmd;
198  delete fTgtAngCmd;
199 
200  delete fDgrMaterCmd;
201  delete fDgrRadCmd;
202  delete fDgrThickCmd;
203  delete fDgrPosCmd;
204 }
205 
206 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
207 
209 {
210  if( command == fWorldMaterCmd )
211  { fDetector->SetWorldMaterial(newValue);}
212 
213  if( command == fTgtMaterCmd )
214  { fDetector->SetTargetMaterial(newValue);}
215 
216  if( command == fDgrMaterCmd )
217  { fDetector->SetDegraderMaterial(newValue);}
218 
219  if( command == fWorldRCmd )
220  { fDetector->SetWorldSizeR(fWorldRCmd->GetNewDoubleValue(newValue));}
221 
222  if( command == fWorldZCmd )
223  { fDetector->SetWorldSizeZ(fWorldZCmd->GetNewDoubleValue(newValue));}
224 
225  if( command == fCaptureRCmd )
226  fDetector->SetCaptureMgntRadius(fCaptureRCmd->GetNewDoubleValue(newValue));
227 
228  if( command == fCaptureZCmd )
229  fDetector->SetCaptureMgntLength(fCaptureZCmd->GetNewDoubleValue(newValue));
230 
231  if( command == fTransferRCmd )
232  fDetector->SetTransferMgntRadius(fTransferRCmd->GetNewDoubleValue(newValue));
233 
234  if( command == fTransferZCmd )
235  fDetector->SetTransferMgntLength(fTransferZCmd->GetNewDoubleValue(newValue));
236 
237  if( command == fTransferPCmd )
238  fDetector->SetTransferMgntPos(fTransferPCmd->GetNewDoubleValue(newValue));
239 
240  if( command == fTgtRadCmd )
241  fDetector->SetTargetRadius(fTgtRadCmd->GetNewDoubleValue(newValue));
242 
243  if( command == fTgtThickCmd )
244  fDetector->SetTargetThickness(fTgtThickCmd->GetNewDoubleValue(newValue));
245 
246  if( command == fTgtPosCmd )
247  fDetector->SetTargetPos(fTgtPosCmd->GetNewDoubleValue(newValue));
248 
249  if( command == fTgtAngCmd )
250  fDetector->SetTargetAngle(fTgtAngCmd->GetNewIntValue(newValue));
251 
252  if( command == fDgrRadCmd )
253  fDetector->SetDegraderRadius(fDgrRadCmd->GetNewDoubleValue(newValue));
254 
255  if( command == fDgrThickCmd )
256  fDetector->SetDegraderThickness(fDgrThickCmd->GetNewDoubleValue(newValue));
257 
258  if( command == fDgrPosCmd )
259  fDetector->SetDegraderPos(fDgrPosCmd->GetNewDoubleValue(newValue));
260 
261  if( command == fWorldZCmd )
262  fDetector->SetWorldSizeZ(fWorldZCmd->GetNewDoubleValue(newValue));
263 
264  if( command == fWorldRCmd )
265  fDetector->SetWorldSizeR(fWorldRCmd->GetNewDoubleValue(newValue));
266 }
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
static G4int GetNewIntValue(const char *paramString)
void SetToBeBroadcasted(G4bool val)
Definition: G4UIcommand.hh:184
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:240
void SetDefaultValue(const char *defVal)
void SetDefaultUnit(const char *defUnit)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)