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 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

  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 optical/wls/src/WLSDetectorMessenger.cc
 28 /// \brief Implementation of the WLSDetectorMessenger class
 29 //
 30 //
 31 #include "WLSDetectorMessenger.hh"
 32 
 33 #include "G4UIcmdWithABool.hh"
 34 #include "G4UIcmdWithADouble.hh"
 35 #include "G4UIcmdWithADoubleAndUnit.hh"
 36 #include "G4UIcmdWithAString.hh"
 37 #include "G4UIcmdWithAnInteger.hh"
 38 #include "G4UIcmdWithoutParameter.hh"
 39 #include "G4UIdirectory.hh"
 40 
 41 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 42 
 43 WLSDetectorMessenger::WLSDetectorMessenger(WLSDetectorConstruction* det) : fDetector(det)
 44 {
 45   fDetDir = new G4UIdirectory("/WLS/");
 46   fDetDir->SetGuidance(" Geometry Setup ");
 47 
 48   fSetPhotonDetGeometryCmd = new G4UIcmdWithAString("/WLS/setPhotonDetGeometry", this);
 49   fSetPhotonDetGeometryCmd->SetGuidance("Select the geometry of the PhotonDet detector");
 50   fSetPhotonDetGeometryCmd->SetGuidance("Only Accepts 'Circle' and 'Square'");
 51   fSetPhotonDetGeometryCmd->SetCandidates("Circle Square");
 52   fSetPhotonDetGeometryCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
 53   fSetPhotonDetGeometryCmd->SetToBeBroadcasted(false);
 54 
 55   fSetNumOfCladLayersCmd = new G4UIcmdWithAnInteger("/WLS/setNumOfLayers", this);
 56   fSetNumOfCladLayersCmd->SetGuidance("Select the number of cladding layers");
 57   fSetNumOfCladLayersCmd->SetGuidance("Maximum number is 2");
 58   fSetNumOfCladLayersCmd->SetParameterName("numberOfLayers", false);
 59   fSetNumOfCladLayersCmd->SetRange("numberOfLayers>=0 && numberOfLayers<=2");
 60   fSetNumOfCladLayersCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
 61   fSetNumOfCladLayersCmd->SetToBeBroadcasted(false);
 62 
 63   fSetSurfaceRoughnessCmd = new G4UIcmdWithADouble("/WLS/setSurfaceRoughness", this);
 64   fSetSurfaceRoughnessCmd->SetGuidance("Set the roughness between Clad1 and WLS Fiber");
 65   fSetSurfaceRoughnessCmd->SetParameterName("roughness", false);
 66   fSetSurfaceRoughnessCmd->SetRange("roughness>0 && roughness<=1");
 67   fSetSurfaceRoughnessCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
 68   fSetSurfaceRoughnessCmd->SetToBeBroadcasted(false);
 69 
 70   fSetXYRatioCmd = new G4UIcmdWithADouble("/WLS/setXYRatio", this);
 71   fSetXYRatioCmd->SetGuidance("Set the ratio between x and y axis (x/y)");
 72   fSetXYRatioCmd->SetParameterName("ratio", false);
 73   fSetXYRatioCmd->SetRange("ratio>0 && ratio<=1");
 74   fSetXYRatioCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
 75   fSetXYRatioCmd->SetToBeBroadcasted(false);
 76 
 77   fSetMirrorPolishCmd = new G4UIcmdWithADouble("/WLS/setMirrorPolish", this);
 78   fSetMirrorPolishCmd->SetGuidance("Set the polish of the mirror");
 79   fSetMirrorPolishCmd->SetParameterName("polish", false);
 80   fSetMirrorPolishCmd->SetRange("polish>0 && polish<=1");
 81   fSetMirrorPolishCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
 82   fSetMirrorPolishCmd->SetToBeBroadcasted(false);
 83 
 84   fSetMirrorReflectivityCmd = new G4UIcmdWithADouble("/WLS/setMirrorReflectivity", this);
 85   fSetMirrorReflectivityCmd->SetGuidance("Set the reflectivity of the mirror");
 86   fSetMirrorReflectivityCmd->SetParameterName("reflectivity", false);
 87   fSetMirrorReflectivityCmd->SetRange("reflectivity>=0 && reflectivity<=1");
 88   fSetMirrorReflectivityCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
 89   fSetMirrorReflectivityCmd->SetToBeBroadcasted(false);
 90 
 91   fSetPhotonDetPolishCmd = new G4UIcmdWithADouble("/WLS/setPhotonDetPolish", this);
 92   fSetPhotonDetPolishCmd->SetGuidance("Set the polish of the mirror");
 93   fSetPhotonDetPolishCmd->SetParameterName("polish", false);
 94   fSetPhotonDetPolishCmd->SetRange("polish>0 && polish<=1");
 95   fSetPhotonDetPolishCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
 96   fSetPhotonDetPolishCmd->SetToBeBroadcasted(false);
 97 
 98   fSetPhotonDetReflectivityCmd = new G4UIcmdWithADouble("/WLS/setPhotonDetReflectivity", this);
 99   fSetPhotonDetReflectivityCmd->SetGuidance("Set the reflectivity of the mirror");
100   fSetPhotonDetReflectivityCmd->SetParameterName("reflectivity", false);
101   fSetPhotonDetReflectivityCmd->SetRange("reflectivity>=0 && reflectivity<=1");
102   fSetPhotonDetReflectivityCmd->AvailableForStates(G4State_PreInit);
103   fSetPhotonDetReflectivityCmd->SetToBeBroadcasted(false);
104 
105   fSetWLSLengthCmd = new G4UIcmdWithADoubleAndUnit("/WLS/setWLSLength", this);
106   fSetWLSLengthCmd->SetGuidance("Set the half length of the WLS fiber");
107   fSetWLSLengthCmd->SetParameterName("length", false);
108   fSetWLSLengthCmd->SetRange("length>0.");
109   fSetWLSLengthCmd->SetUnitCategory("Length");
110   fSetWLSLengthCmd->SetDefaultUnit("mm");
111   fSetWLSLengthCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
112   fSetWLSLengthCmd->SetToBeBroadcasted(false);
113 
114   fSetWLSRadiusCmd = new G4UIcmdWithADoubleAndUnit("/WLS/setWLSRadius", this);
115   fSetWLSRadiusCmd->SetGuidance("Set the radius of the WLS fiber");
116   fSetWLSRadiusCmd->SetParameterName("radius", false);
117   fSetWLSRadiusCmd->SetRange("radius>0.");
118   fSetWLSRadiusCmd->SetUnitCategory("Length");
119   fSetWLSRadiusCmd->SetDefaultUnit("mm");
120   fSetWLSRadiusCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
121   fSetWLSRadiusCmd->SetToBeBroadcasted(false);
122 
123   fSetClad1RadiusCmd = new G4UIcmdWithADoubleAndUnit("/WLS/setClad1Radius", this);
124   fSetClad1RadiusCmd->SetGuidance("Set the radius of Cladding 1");
125   fSetClad1RadiusCmd->SetParameterName("radius", false);
126   fSetClad1RadiusCmd->SetRange("radius>0.");
127   fSetClad1RadiusCmd->SetUnitCategory("Length");
128   fSetClad1RadiusCmd->SetDefaultUnit("mm");
129   fSetClad1RadiusCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
130   fSetClad1RadiusCmd->SetToBeBroadcasted(false);
131 
132   fSetClad2RadiusCmd = new G4UIcmdWithADoubleAndUnit("/WLS/setClad2Radius", this);
133   fSetClad2RadiusCmd->SetGuidance("Set the radius of Cladding 2");
134   fSetClad2RadiusCmd->SetParameterName("radius", false);
135   fSetClad2RadiusCmd->SetRange("radius>0.");
136   fSetClad2RadiusCmd->SetUnitCategory("Length");
137   fSetClad2RadiusCmd->SetDefaultUnit("mm");
138   fSetClad2RadiusCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
139   fSetClad2RadiusCmd->SetToBeBroadcasted(false);
140 
141   fSetPhotonDetHalfLengthCmd = new G4UIcmdWithADoubleAndUnit("/WLS/setPhotonDetHalfLength", this);
142   fSetPhotonDetHalfLengthCmd->SetGuidance("Set the half length of PhotonDet detector");
143   fSetPhotonDetHalfLengthCmd->SetParameterName("halfL", false);
144   fSetPhotonDetHalfLengthCmd->SetRange("halfL>0.");
145   fSetPhotonDetHalfLengthCmd->SetUnitCategory("Length");
146   fSetPhotonDetHalfLengthCmd->SetDefaultUnit("mm");
147   fSetPhotonDetHalfLengthCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
148   fSetPhotonDetHalfLengthCmd->SetToBeBroadcasted(false);
149 
150   fSetGapCmd = new G4UIcmdWithADoubleAndUnit("/WLS/setGap", this);
151   fSetGapCmd->SetGuidance("Set the distance between PhotonDet and fiber end");
152   fSetGapCmd->SetParameterName("theta", false);
153   fSetGapCmd->SetUnitCategory("Length");
154   fSetGapCmd->SetDefaultUnit("mm");
155   fSetGapCmd->SetRange("theta>=0.");
156   fSetGapCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
157   fSetGapCmd->SetToBeBroadcasted(false);
158 
159   fSetPhotonDetAlignmentCmd = new G4UIcmdWithADoubleAndUnit("/WLS/setAlignment", this);
160   fSetPhotonDetAlignmentCmd->SetGuidance("Set the deviation of PhotonDet from z axis");
161   fSetPhotonDetAlignmentCmd->SetParameterName("theta", false);
162   fSetPhotonDetAlignmentCmd->SetUnitCategory("Angle");
163   fSetPhotonDetAlignmentCmd->SetDefaultUnit("deg");
164   fSetPhotonDetAlignmentCmd->SetRange("theta>-90. && theta<90.");
165   fSetPhotonDetAlignmentCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
166   fSetPhotonDetAlignmentCmd->SetToBeBroadcasted(false);
167 
168   fSetMirrorCmd = new G4UIcmdWithABool("/WLS/setMirror", this);
169   fSetMirrorCmd->SetGuidance("Place a mirror at the end of the fiber");
170   fSetMirrorCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
171   fSetMirrorCmd->SetToBeBroadcasted(false);
172 
173   fSetBarLengthCmd = new G4UIcmdWithADoubleAndUnit("/WLS/setBarLength", this);
174   fSetBarLengthCmd->SetGuidance("Set the length of the scintillator bar");
175   fSetBarLengthCmd->SetParameterName("length", false);
176   fSetBarLengthCmd->SetRange("length>0.");
177   fSetBarLengthCmd->SetUnitCategory("Length");
178   fSetBarLengthCmd->SetDefaultUnit("mm");
179   fSetBarLengthCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
180   fSetBarLengthCmd->SetToBeBroadcasted(false);
181 
182   fSetBarBaseCmd = new G4UIcmdWithADoubleAndUnit("/WLS/setBarBase", this);
183   fSetBarBaseCmd->SetGuidance("Set the side length of the scintillator bar");
184   fSetBarBaseCmd->SetParameterName("length", false);
185   fSetBarBaseCmd->SetRange("length>0.");
186   fSetBarBaseCmd->SetUnitCategory("Length");
187   fSetBarBaseCmd->SetDefaultUnit("mm");
188   fSetBarBaseCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
189   fSetBarBaseCmd->SetToBeBroadcasted(false);
190 
191   fSetHoleRadiusCmd = new G4UIcmdWithADoubleAndUnit("/WLS/setHoleRadius", this);
192   fSetHoleRadiusCmd->SetGuidance("Set the radius of the fiber hole");
193   fSetHoleRadiusCmd->SetParameterName("radius", false);
194   fSetHoleRadiusCmd->SetRange("radius>0.");
195   fSetHoleRadiusCmd->SetUnitCategory("Length");
196   fSetHoleRadiusCmd->SetDefaultUnit("mm");
197   fSetHoleRadiusCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
198   fSetHoleRadiusCmd->SetToBeBroadcasted(false);
199 
200   fSetCoatingThicknessCmd = new G4UIcmdWithADoubleAndUnit("/WLS/setCoatingThickness", this);
201   fSetCoatingThicknessCmd->SetGuidance("Set thickness of the coating on the bars");
202   fSetCoatingThicknessCmd->SetParameterName("thick", false);
203   fSetCoatingThicknessCmd->SetUnitCategory("Length");
204   fSetCoatingThicknessCmd->SetDefaultUnit("mm");
205   fSetCoatingThicknessCmd->SetRange("thick>=0.");
206   fSetCoatingThicknessCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
207   fSetCoatingThicknessCmd->SetToBeBroadcasted(false);
208 
209   fSetCoatingRadiusCmd = new G4UIcmdWithADoubleAndUnit("/WLS/setCoatingRadius", this);
210   fSetCoatingRadiusCmd->SetGuidance("Set inner radius of the corner bar coating");
211   fSetCoatingRadiusCmd->SetParameterName("cradius", false);
212   fSetCoatingRadiusCmd->SetUnitCategory("Length");
213   fSetCoatingRadiusCmd->SetDefaultUnit("mm");
214   fSetCoatingRadiusCmd->SetRange("cradius>=0.");
215   fSetCoatingRadiusCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
216   fSetCoatingRadiusCmd->SetToBeBroadcasted(false);
217 }
218 
219 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
220 
221 WLSDetectorMessenger::~WLSDetectorMessenger()
222 {
223   delete fDetDir;
224 
225   delete fSetBarLengthCmd;
226   delete fSetBarBaseCmd;
227   delete fSetClad1RadiusCmd;
228   delete fSetClad2RadiusCmd;
229   delete fSetCoatingThicknessCmd;
230   delete fSetCoatingRadiusCmd;
231   delete fSetGapCmd;
232   delete fSetHoleRadiusCmd;
233   delete fSetMirrorCmd;
234   delete fSetMirrorPolishCmd;
235   delete fSetMirrorReflectivityCmd;
236   delete fSetNumOfCladLayersCmd;
237   delete fSetPhotonDetAlignmentCmd;
238   delete fSetPhotonDetGeometryCmd;
239   delete fSetPhotonDetHalfLengthCmd;
240   delete fSetPhotonDetPolishCmd;
241   delete fSetPhotonDetReflectivityCmd;
242   delete fSetSurfaceRoughnessCmd;
243   delete fSetWLSLengthCmd;
244   delete fSetWLSRadiusCmd;
245   delete fSetXYRatioCmd;
246 }
247 
248 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
249 
250 void WLSDetectorMessenger::SetNewValue(G4UIcommand* command, G4String val)
251 {
252   if (command == fSetPhotonDetGeometryCmd) {
253     fDetector->SetPhotonDetGeometry(val);
254   }
255   else if (command == fSetNumOfCladLayersCmd) {
256     fDetector->SetNumberOfCladding(G4UIcmdWithAnInteger::GetNewIntValue(val));
257   }
258   else if (command == fSetSurfaceRoughnessCmd) {
259     fDetector->SetSurfaceRoughness(G4UIcmdWithADouble::GetNewDoubleValue(val));
260   }
261   else if (command == fSetXYRatioCmd) {
262     fDetector->SetXYRatio(G4UIcmdWithADouble::GetNewDoubleValue(val));
263   }
264   else if (command == fSetMirrorPolishCmd) {
265     fDetector->SetMirrorPolish(G4UIcmdWithADouble::GetNewDoubleValue(val));
266   }
267   else if (command == fSetMirrorReflectivityCmd) {
268     fDetector->SetMirrorReflectivity(G4UIcmdWithADouble::GetNewDoubleValue(val));
269   }
270   else if (command == fSetPhotonDetPolishCmd) {
271     fDetector->SetPhotonDetPolish(G4UIcmdWithADouble::GetNewDoubleValue(val));
272   }
273   else if (command == fSetPhotonDetReflectivityCmd) {
274     fDetector->SetPhotonDetReflectivity(G4UIcmdWithADouble::GetNewDoubleValue(val));
275   }
276   else if (command == fSetWLSLengthCmd) {
277     fDetector->SetWLSLength(G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(val));
278   }
279   else if (command == fSetWLSRadiusCmd) {
280     fDetector->SetWLSRadius(G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(val));
281   }
282   else if (command == fSetClad1RadiusCmd) {
283     fDetector->SetClad1Radius(G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(val));
284   }
285   else if (command == fSetClad2RadiusCmd) {
286     fDetector->SetClad2Radius(G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(val));
287   }
288   else if (command == fSetPhotonDetHalfLengthCmd) {
289     fDetector->SetPhotonDetHalfLength(G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(val));
290   }
291   else if (command == fSetGapCmd) {
292     fDetector->SetGap(G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(val));
293   }
294   else if (command == fSetPhotonDetAlignmentCmd) {
295     fDetector->SetPhotonDetAlignment(G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(val));
296   }
297   else if (command == fSetMirrorCmd) {
298     fDetector->SetMirror(G4UIcmdWithABool::GetNewBoolValue(val));
299   }
300   else if (command == fSetBarLengthCmd) {
301     fDetector->SetBarLength(G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(val));
302   }
303   else if (command == fSetBarBaseCmd) {
304     fDetector->SetBarBase(G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(val));
305   }
306   else if (command == fSetHoleRadiusCmd) {
307     fDetector->SetHoleRadius(G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(val));
308   }
309   else if (command == fSetCoatingThicknessCmd) {
310     fDetector->SetCoatingThickness(G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(val));
311   }
312   else if (command == fSetCoatingRadiusCmd) {
313     fDetector->SetCoatingRadius(G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(val));
314   }
315 }
316