Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
WLSDetectorMessenger.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: WLSDetectorMessenger.cc 77487 2013-11-25 10:15:04Z gcosmo $
27 //
28 /// \file optical/wls/src/WLSDetectorMessenger.cc
29 /// \brief Implementation of the WLSDetectorMessenger class
30 //
31 //
32 #include "WLSDetectorMessenger.hh"
33 
34 #include "G4UIdirectory.hh"
35 #include "G4UIcmdWithABool.hh"
36 #include "G4UIcmdWithAString.hh"
37 #include "G4UIcmdWithADouble.hh"
38 #include "G4UIcmdWithAnInteger.hh"
41 
42 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
43 
45  : fDetector(det)
46 {
47  fDetDir = new G4UIdirectory("/WLS/");
48  fDetDir->SetGuidance(" Geometry Setup ");
49 
50  SetPhotonDetGeometryCmd =
51  new G4UIcmdWithAString("/WLS/setPhotonDetGeometry",this);
52  SetPhotonDetGeometryCmd->
53  SetGuidance("Select the geometry of the PhotonDet detector");
54  SetPhotonDetGeometryCmd->SetGuidance("Only Accepts 'Circle' and 'Square'");
55  SetPhotonDetGeometryCmd->SetCandidates("Circle Square");
56  SetPhotonDetGeometryCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
57  SetPhotonDetGeometryCmd->SetToBeBroadcasted(false);
58 
59  SetNumOfCladLayersCmd = new G4UIcmdWithAnInteger("/WLS/setNumOfLayers", this);
60  SetNumOfCladLayersCmd->SetGuidance("Select the number of cladding layers");
61  SetNumOfCladLayersCmd->SetGuidance("Maximum number is 2");
62  SetNumOfCladLayersCmd->SetParameterName("numberOfLayers",false);
63  SetNumOfCladLayersCmd->SetRange("numberOfLayers>=0 && numberOfLayers<=2");
64  SetNumOfCladLayersCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
65  SetNumOfCladLayersCmd->SetToBeBroadcasted(false);
66 
67  SetSurfaceRoughnessCmd =
68  new G4UIcmdWithADouble("/WLS/setSurfaceRoughness", this);
69  SetSurfaceRoughnessCmd->
70  SetGuidance("Set the roughness between Clad1 and WLS Fiber");
71  SetSurfaceRoughnessCmd->SetParameterName("roughness",false);
72  SetSurfaceRoughnessCmd->SetRange("roughness>0 && roughness<=1");
73  SetSurfaceRoughnessCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
74  SetSurfaceRoughnessCmd->SetToBeBroadcasted(false);
75 
76  SetXYRatioCmd = new G4UIcmdWithADouble("/WLS/setXYRatio", this);
77  SetXYRatioCmd->SetGuidance("Set the ratio between x and y axis (x/y)");
78  SetXYRatioCmd->SetParameterName("ratio",false);
79  SetXYRatioCmd->SetRange("ratio>0 && ratio<=1");
81  SetXYRatioCmd->SetToBeBroadcasted(false);
82 
83  SetMirrorPolishCmd = new G4UIcmdWithADouble("/WLS/setMirrorPolish", this);
84  SetMirrorPolishCmd->SetGuidance("Set the polish of the mirror");
85  SetMirrorPolishCmd->SetParameterName("polish",false);
86  SetMirrorPolishCmd->SetRange("polish>0 && polish<=1");
87  SetMirrorPolishCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
88  SetMirrorPolishCmd->SetToBeBroadcasted(false);
89 
90  SetMirrorReflectivityCmd =
91  new G4UIcmdWithADouble("/WLS/setMirrorReflectivity", this);
92  SetMirrorReflectivityCmd->SetGuidance("Set the reflectivity of the mirror");
93  SetMirrorReflectivityCmd->SetParameterName("reflectivity",false);
94  SetMirrorReflectivityCmd->SetRange("reflectivity>=0 && reflectivity<=1");
95  SetMirrorReflectivityCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
96  SetMirrorReflectivityCmd->SetToBeBroadcasted(false);
97 
98  SetPhotonDetPolishCmd =
99  new G4UIcmdWithADouble("/WLS/setPhotonDetPolish", this);
100  SetPhotonDetPolishCmd->SetGuidance("Set the polish of the mirror");
101  SetPhotonDetPolishCmd->SetParameterName("polish",false);
102  SetPhotonDetPolishCmd->SetRange("polish>0 && polish<=1");
103  SetPhotonDetPolishCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
104  SetPhotonDetPolishCmd->SetToBeBroadcasted(false);
105 
106  SetPhotonDetReflectivityCmd =
107  new G4UIcmdWithADouble("/WLS/setPhotonDetReflectivity", this);
108  SetPhotonDetReflectivityCmd->
109  SetGuidance("Set the reflectivity of the mirror");
110  SetPhotonDetReflectivityCmd->SetParameterName("reflectivity",false);
111  SetPhotonDetReflectivityCmd->SetRange("reflectivity>=0 && reflectivity<=1");
112  SetPhotonDetReflectivityCmd->AvailableForStates(G4State_PreInit);
113  SetPhotonDetReflectivityCmd->SetToBeBroadcasted(false);
114 
115  SetWLSLengthCmd = new G4UIcmdWithADoubleAndUnit("/WLS/setWLSLength",this);
116  SetWLSLengthCmd->SetGuidance("Set the half length of the WLS fiber");
117  SetWLSLengthCmd->SetParameterName("length",false);
118  SetWLSLengthCmd->SetRange("length>0.");
119  SetWLSLengthCmd->SetUnitCategory("Length");
120  SetWLSLengthCmd->SetDefaultUnit("mm");
122  SetWLSLengthCmd->SetToBeBroadcasted(false);
123 
124  SetWLSRadiusCmd = new G4UIcmdWithADoubleAndUnit("/WLS/setWLSRadius",this);
125  SetWLSRadiusCmd->SetGuidance("Set the radius of the WLS fiber");
126  SetWLSRadiusCmd->SetParameterName("radius",false);
127  SetWLSRadiusCmd->SetRange("radius>0.");
128  SetWLSRadiusCmd->SetUnitCategory("Length");
129  SetWLSRadiusCmd->SetDefaultUnit("mm");
131  SetWLSRadiusCmd->SetToBeBroadcasted(false);
132 
133  SetClad1RadiusCmd = new G4UIcmdWithADoubleAndUnit("/WLS/setClad1Radius",this);
134  SetClad1RadiusCmd->SetGuidance("Set the radius of Cladding 1");
135  SetClad1RadiusCmd->SetParameterName("radius",false);
136  SetClad1RadiusCmd->SetRange("radius>0.");
137  SetClad1RadiusCmd->SetUnitCategory("Length");
138  SetClad1RadiusCmd->SetDefaultUnit("mm");
139  SetClad1RadiusCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
140  SetClad1RadiusCmd->SetToBeBroadcasted(false);
141 
142  SetClad2RadiusCmd = new G4UIcmdWithADoubleAndUnit("/WLS/setClad2Radius",this);
143  SetClad2RadiusCmd->SetGuidance("Set the radius of Cladding 2");
144  SetClad2RadiusCmd->SetParameterName("radius",false);
145  SetClad2RadiusCmd->SetRange("radius>0.");
146  SetClad2RadiusCmd->SetUnitCategory("Length");
147  SetClad2RadiusCmd->SetDefaultUnit("mm");
148  SetClad2RadiusCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
149  SetClad2RadiusCmd->SetToBeBroadcasted(false);
150 
151  SetPhotonDetHalfLengthCmd =
152  new G4UIcmdWithADoubleAndUnit("/WLS/setPhotonDetHalfLength",this);
153  SetPhotonDetHalfLengthCmd->
154  SetGuidance("Set the half length of PhotonDet detector");
155  SetPhotonDetHalfLengthCmd->SetParameterName("halfL",false);
156  SetPhotonDetHalfLengthCmd->SetRange("halfL>0.");
157  SetPhotonDetHalfLengthCmd->SetUnitCategory("Length");
158  SetPhotonDetHalfLengthCmd->SetDefaultUnit("mm");
159  SetPhotonDetHalfLengthCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
160  SetPhotonDetHalfLengthCmd->SetToBeBroadcasted(false);
161 
162  SetGapCmd = new G4UIcmdWithADoubleAndUnit("/WLS/setGap",this);
163  SetGapCmd->SetGuidance("Set the distance between PhotonDet and fiber end");
164  SetGapCmd->SetParameterName("theta",false);
165  SetGapCmd->SetUnitCategory("Length");
166  SetGapCmd->SetDefaultUnit("mm");
167  SetGapCmd->SetRange("theta>=0.");
169  SetGapCmd->SetToBeBroadcasted(false);
170 
171  SetPhotonDetAlignmentCmd =
172  new G4UIcmdWithADoubleAndUnit("/WLS/setAlignment",this);
173  SetPhotonDetAlignmentCmd->
174  SetGuidance("Set the deviation of PhotonDet from z axis");
175  SetPhotonDetAlignmentCmd->SetParameterName("theta",false);
176  SetPhotonDetAlignmentCmd->SetUnitCategory("Angle");
177  SetPhotonDetAlignmentCmd->SetDefaultUnit("deg");
178  SetPhotonDetAlignmentCmd->SetRange("theta>-90. && theta<90.");
179  SetPhotonDetAlignmentCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
180  SetPhotonDetAlignmentCmd->SetToBeBroadcasted(false);
181 
182  SetMirrorCmd = new G4UIcmdWithABool("/WLS/setMirror", this);
183  SetMirrorCmd->SetGuidance("Place a mirror at the end of the fiber");
185  SetMirrorCmd->SetToBeBroadcasted(false);
186 
187  SetBarLengthCmd = new G4UIcmdWithADoubleAndUnit("/WLS/setBarLength",this);
188  SetBarLengthCmd->SetGuidance("Set the length of the scintillator bar");
189  SetBarLengthCmd->SetParameterName("length",false);
190  SetBarLengthCmd->SetRange("length>0.");
191  SetBarLengthCmd->SetUnitCategory("Length");
192  SetBarLengthCmd->SetDefaultUnit("mm");
194  SetBarLengthCmd->SetToBeBroadcasted(false);
195 
196  SetBarBaseCmd = new G4UIcmdWithADoubleAndUnit("/WLS/setBarBase",this);
197  SetBarBaseCmd->SetGuidance("Set the side length of the scintillator bar");
198  SetBarBaseCmd->SetParameterName("length",false);
199  SetBarBaseCmd->SetRange("length>0.");
200  SetBarBaseCmd->SetUnitCategory("Length");
201  SetBarBaseCmd->SetDefaultUnit("mm");
203  SetBarBaseCmd->SetToBeBroadcasted(false);
204 
205  SetHoleRadiusCmd = new G4UIcmdWithADoubleAndUnit("/WLS/setHoleRadius",this);
206  SetHoleRadiusCmd->SetGuidance("Set the radius of the fiber hole");
207  SetHoleRadiusCmd->SetParameterName("radius",false);
208  SetHoleRadiusCmd->SetRange("radius>0.");
209  SetHoleRadiusCmd->SetUnitCategory("Length");
210  SetHoleRadiusCmd->SetDefaultUnit("mm");
212  SetHoleRadiusCmd->SetToBeBroadcasted(false);
213 
214  SetCoatingThicknessCmd =
215  new G4UIcmdWithADoubleAndUnit("/WLS/setCoatingThickness",this);
216  SetCoatingThicknessCmd->
217  SetGuidance("Set thickness of the coating on the bars");
218  SetCoatingThicknessCmd->SetParameterName("thick",false);
219  SetCoatingThicknessCmd->SetUnitCategory("Length");
220  SetCoatingThicknessCmd->SetDefaultUnit("mm");
221  SetCoatingThicknessCmd->SetRange("thick>=0.");
222  SetCoatingThicknessCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
223  SetCoatingThicknessCmd->SetToBeBroadcasted(false);
224 
225  SetCoatingRadiusCmd =
226  new G4UIcmdWithADoubleAndUnit("/WLS/setCoatingRadius",this);
227  SetCoatingRadiusCmd->
228  SetGuidance("Set inner radius of the corner bar coating");
229  SetCoatingRadiusCmd->SetParameterName("cradius",false);
230  SetCoatingRadiusCmd->SetUnitCategory("Length");
231  SetCoatingRadiusCmd->SetDefaultUnit("mm");
232  SetCoatingRadiusCmd->SetRange("cradius>=0.");
233  SetCoatingRadiusCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
234  SetCoatingRadiusCmd->SetToBeBroadcasted(false);
235 }
236 
237 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
238 
240 {
241  delete fDetDir;
242 
243  delete SetPhotonDetGeometryCmd;
244  delete SetNumOfCladLayersCmd;
245  delete SetWLSLengthCmd;
246  delete SetWLSRadiusCmd;
247  delete SetClad1RadiusCmd;
248  delete SetClad2RadiusCmd;
249  delete SetPhotonDetHalfLengthCmd;
250  delete SetGapCmd;
251  delete SetPhotonDetAlignmentCmd;
252  delete SetSurfaceRoughnessCmd;
253  delete SetMirrorPolishCmd;
254  delete SetMirrorReflectivityCmd;
255  delete SetXYRatioCmd;
256  delete SetMirrorCmd;
257  delete SetBarLengthCmd;
258  delete SetBarBaseCmd;
259  delete SetHoleRadiusCmd;
260  delete SetCoatingThicknessCmd;
261  delete SetCoatingRadiusCmd;
262 }
263 
264 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
265 
267 {
268  if( command == SetPhotonDetGeometryCmd ) {
269 
270  fDetector->SetPhotonDetGeometry(val);
271  }
272  else if( command == SetNumOfCladLayersCmd ) {
273 
275  }
276  else if( command == SetSurfaceRoughnessCmd ) {
277 
279  }
280  else if( command == SetXYRatioCmd ) {
281 
283  }
284  else if( command == SetMirrorPolishCmd ) {
285 
287  }
288  else if( command == SetMirrorReflectivityCmd ) {
289 
290  fDetector->
291  SetMirrorReflectivity(G4UIcmdWithADouble::GetNewDoubleValue(val));
292  }
293  else if( command == SetPhotonDetPolishCmd ) {
294 
296  }
297  else if( command == SetPhotonDetReflectivityCmd ) {
298 
299  fDetector->
300  SetPhotonDetReflectivity(G4UIcmdWithADouble::GetNewDoubleValue(val));
301  }
302  else if( command == SetWLSLengthCmd ) {
303 
305  }
306  else if( command == SetWLSRadiusCmd ) {
307 
309  }
310  else if( command == SetClad1RadiusCmd ) {
311 
312  fDetector->
314  }
315  else if( command == SetClad2RadiusCmd ) {
316 
317  fDetector->
319  }
320  else if( command == SetPhotonDetHalfLengthCmd ) {
321 
322  fDetector->
323  SetPhotonDetHalfLength(G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(val));
324  }
325  else if( command == SetGapCmd ) {
326 
328  }
329  else if( command == SetPhotonDetAlignmentCmd ) {
330 
331  fDetector->
332  SetPhotonDetAlignment(G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(val));
333  }
334  else if( command == SetMirrorCmd ) {
335 
337  }
338  else if( command == SetBarLengthCmd ) {
339 
341  }
342  else if( command == SetBarBaseCmd ) {
343 
345  }
346  else if( command == SetHoleRadiusCmd ) {
347 
349  }
350  else if( command == SetCoatingThicknessCmd ) {
351 
353  }
354  else if( command == SetCoatingRadiusCmd ) {
355 
357  }
358 }
virtual void SetNewValue(G4UIcommand *, G4String)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
static G4int GetNewIntValue(const char *paramString)
WLSDetectorMessenger(WLSDetectorConstruction *)
void SetToBeBroadcasted(G4bool val)
Definition: G4UIcommand.hh:184
void SetUnitCategory(const char *unitCategory)
static G4double GetNewDoubleValue(const char *paramString)
static G4bool GetNewBoolValue(const char *paramString)
static G4double GetNewDoubleValue(const char *paramString)
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 SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetDefaultUnit(const char *defUnit)
void SetCandidates(const char *candidateList)
Definition of the WLSDetectorMessenger class.
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)