Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:22:24

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 //
0027 /// \file optical/wls/src/WLSDetectorMessenger.cc
0028 /// \brief Implementation of the WLSDetectorMessenger class
0029 //
0030 //
0031 #include "WLSDetectorMessenger.hh"
0032 
0033 #include "G4UIcmdWithABool.hh"
0034 #include "G4UIcmdWithADouble.hh"
0035 #include "G4UIcmdWithADoubleAndUnit.hh"
0036 #include "G4UIcmdWithAString.hh"
0037 #include "G4UIcmdWithAnInteger.hh"
0038 #include "G4UIcmdWithoutParameter.hh"
0039 #include "G4UIdirectory.hh"
0040 
0041 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0042 
0043 WLSDetectorMessenger::WLSDetectorMessenger(WLSDetectorConstruction* det) : fDetector(det)
0044 {
0045   fDetDir = new G4UIdirectory("/WLS/");
0046   fDetDir->SetGuidance(" Geometry Setup ");
0047 
0048   fSetPhotonDetGeometryCmd = new G4UIcmdWithAString("/WLS/setPhotonDetGeometry", this);
0049   fSetPhotonDetGeometryCmd->SetGuidance("Select the geometry of the PhotonDet detector");
0050   fSetPhotonDetGeometryCmd->SetGuidance("Only Accepts 'Circle' and 'Square'");
0051   fSetPhotonDetGeometryCmd->SetCandidates("Circle Square");
0052   fSetPhotonDetGeometryCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0053   fSetPhotonDetGeometryCmd->SetToBeBroadcasted(false);
0054 
0055   fSetNumOfCladLayersCmd = new G4UIcmdWithAnInteger("/WLS/setNumOfLayers", this);
0056   fSetNumOfCladLayersCmd->SetGuidance("Select the number of cladding layers");
0057   fSetNumOfCladLayersCmd->SetGuidance("Maximum number is 2");
0058   fSetNumOfCladLayersCmd->SetParameterName("numberOfLayers", false);
0059   fSetNumOfCladLayersCmd->SetRange("numberOfLayers>=0 && numberOfLayers<=2");
0060   fSetNumOfCladLayersCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0061   fSetNumOfCladLayersCmd->SetToBeBroadcasted(false);
0062 
0063   fSetSurfaceRoughnessCmd = new G4UIcmdWithADouble("/WLS/setSurfaceRoughness", this);
0064   fSetSurfaceRoughnessCmd->SetGuidance("Set the roughness between Clad1 and WLS Fiber");
0065   fSetSurfaceRoughnessCmd->SetParameterName("roughness", false);
0066   fSetSurfaceRoughnessCmd->SetRange("roughness>0 && roughness<=1");
0067   fSetSurfaceRoughnessCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0068   fSetSurfaceRoughnessCmd->SetToBeBroadcasted(false);
0069 
0070   fSetXYRatioCmd = new G4UIcmdWithADouble("/WLS/setXYRatio", this);
0071   fSetXYRatioCmd->SetGuidance("Set the ratio between x and y axis (x/y)");
0072   fSetXYRatioCmd->SetParameterName("ratio", false);
0073   fSetXYRatioCmd->SetRange("ratio>0 && ratio<=1");
0074   fSetXYRatioCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0075   fSetXYRatioCmd->SetToBeBroadcasted(false);
0076 
0077   fSetMirrorPolishCmd = new G4UIcmdWithADouble("/WLS/setMirrorPolish", this);
0078   fSetMirrorPolishCmd->SetGuidance("Set the polish of the mirror");
0079   fSetMirrorPolishCmd->SetParameterName("polish", false);
0080   fSetMirrorPolishCmd->SetRange("polish>0 && polish<=1");
0081   fSetMirrorPolishCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0082   fSetMirrorPolishCmd->SetToBeBroadcasted(false);
0083 
0084   fSetMirrorReflectivityCmd = new G4UIcmdWithADouble("/WLS/setMirrorReflectivity", this);
0085   fSetMirrorReflectivityCmd->SetGuidance("Set the reflectivity of the mirror");
0086   fSetMirrorReflectivityCmd->SetParameterName("reflectivity", false);
0087   fSetMirrorReflectivityCmd->SetRange("reflectivity>=0 && reflectivity<=1");
0088   fSetMirrorReflectivityCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0089   fSetMirrorReflectivityCmd->SetToBeBroadcasted(false);
0090 
0091   fSetPhotonDetPolishCmd = new G4UIcmdWithADouble("/WLS/setPhotonDetPolish", this);
0092   fSetPhotonDetPolishCmd->SetGuidance("Set the polish of the mirror");
0093   fSetPhotonDetPolishCmd->SetParameterName("polish", false);
0094   fSetPhotonDetPolishCmd->SetRange("polish>0 && polish<=1");
0095   fSetPhotonDetPolishCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0096   fSetPhotonDetPolishCmd->SetToBeBroadcasted(false);
0097 
0098   fSetPhotonDetReflectivityCmd = new G4UIcmdWithADouble("/WLS/setPhotonDetReflectivity", this);
0099   fSetPhotonDetReflectivityCmd->SetGuidance("Set the reflectivity of the mirror");
0100   fSetPhotonDetReflectivityCmd->SetParameterName("reflectivity", false);
0101   fSetPhotonDetReflectivityCmd->SetRange("reflectivity>=0 && reflectivity<=1");
0102   fSetPhotonDetReflectivityCmd->AvailableForStates(G4State_PreInit);
0103   fSetPhotonDetReflectivityCmd->SetToBeBroadcasted(false);
0104 
0105   fSetWLSLengthCmd = new G4UIcmdWithADoubleAndUnit("/WLS/setWLSLength", this);
0106   fSetWLSLengthCmd->SetGuidance("Set the half length of the WLS fiber");
0107   fSetWLSLengthCmd->SetParameterName("length", false);
0108   fSetWLSLengthCmd->SetRange("length>0.");
0109   fSetWLSLengthCmd->SetUnitCategory("Length");
0110   fSetWLSLengthCmd->SetDefaultUnit("mm");
0111   fSetWLSLengthCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0112   fSetWLSLengthCmd->SetToBeBroadcasted(false);
0113 
0114   fSetWLSRadiusCmd = new G4UIcmdWithADoubleAndUnit("/WLS/setWLSRadius", this);
0115   fSetWLSRadiusCmd->SetGuidance("Set the radius of the WLS fiber");
0116   fSetWLSRadiusCmd->SetParameterName("radius", false);
0117   fSetWLSRadiusCmd->SetRange("radius>0.");
0118   fSetWLSRadiusCmd->SetUnitCategory("Length");
0119   fSetWLSRadiusCmd->SetDefaultUnit("mm");
0120   fSetWLSRadiusCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0121   fSetWLSRadiusCmd->SetToBeBroadcasted(false);
0122 
0123   fSetClad1RadiusCmd = new G4UIcmdWithADoubleAndUnit("/WLS/setClad1Radius", this);
0124   fSetClad1RadiusCmd->SetGuidance("Set the radius of Cladding 1");
0125   fSetClad1RadiusCmd->SetParameterName("radius", false);
0126   fSetClad1RadiusCmd->SetRange("radius>0.");
0127   fSetClad1RadiusCmd->SetUnitCategory("Length");
0128   fSetClad1RadiusCmd->SetDefaultUnit("mm");
0129   fSetClad1RadiusCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0130   fSetClad1RadiusCmd->SetToBeBroadcasted(false);
0131 
0132   fSetClad2RadiusCmd = new G4UIcmdWithADoubleAndUnit("/WLS/setClad2Radius", this);
0133   fSetClad2RadiusCmd->SetGuidance("Set the radius of Cladding 2");
0134   fSetClad2RadiusCmd->SetParameterName("radius", false);
0135   fSetClad2RadiusCmd->SetRange("radius>0.");
0136   fSetClad2RadiusCmd->SetUnitCategory("Length");
0137   fSetClad2RadiusCmd->SetDefaultUnit("mm");
0138   fSetClad2RadiusCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0139   fSetClad2RadiusCmd->SetToBeBroadcasted(false);
0140 
0141   fSetPhotonDetHalfLengthCmd = new G4UIcmdWithADoubleAndUnit("/WLS/setPhotonDetHalfLength", this);
0142   fSetPhotonDetHalfLengthCmd->SetGuidance("Set the half length of PhotonDet detector");
0143   fSetPhotonDetHalfLengthCmd->SetParameterName("halfL", false);
0144   fSetPhotonDetHalfLengthCmd->SetRange("halfL>0.");
0145   fSetPhotonDetHalfLengthCmd->SetUnitCategory("Length");
0146   fSetPhotonDetHalfLengthCmd->SetDefaultUnit("mm");
0147   fSetPhotonDetHalfLengthCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0148   fSetPhotonDetHalfLengthCmd->SetToBeBroadcasted(false);
0149 
0150   fSetGapCmd = new G4UIcmdWithADoubleAndUnit("/WLS/setGap", this);
0151   fSetGapCmd->SetGuidance("Set the distance between PhotonDet and fiber end");
0152   fSetGapCmd->SetParameterName("theta", false);
0153   fSetGapCmd->SetUnitCategory("Length");
0154   fSetGapCmd->SetDefaultUnit("mm");
0155   fSetGapCmd->SetRange("theta>=0.");
0156   fSetGapCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0157   fSetGapCmd->SetToBeBroadcasted(false);
0158 
0159   fSetPhotonDetAlignmentCmd = new G4UIcmdWithADoubleAndUnit("/WLS/setAlignment", this);
0160   fSetPhotonDetAlignmentCmd->SetGuidance("Set the deviation of PhotonDet from z axis");
0161   fSetPhotonDetAlignmentCmd->SetParameterName("theta", false);
0162   fSetPhotonDetAlignmentCmd->SetUnitCategory("Angle");
0163   fSetPhotonDetAlignmentCmd->SetDefaultUnit("deg");
0164   fSetPhotonDetAlignmentCmd->SetRange("theta>-90. && theta<90.");
0165   fSetPhotonDetAlignmentCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0166   fSetPhotonDetAlignmentCmd->SetToBeBroadcasted(false);
0167 
0168   fSetMirrorCmd = new G4UIcmdWithABool("/WLS/setMirror", this);
0169   fSetMirrorCmd->SetGuidance("Place a mirror at the end of the fiber");
0170   fSetMirrorCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0171   fSetMirrorCmd->SetToBeBroadcasted(false);
0172 
0173   fSetBarLengthCmd = new G4UIcmdWithADoubleAndUnit("/WLS/setBarLength", this);
0174   fSetBarLengthCmd->SetGuidance("Set the length of the scintillator bar");
0175   fSetBarLengthCmd->SetParameterName("length", false);
0176   fSetBarLengthCmd->SetRange("length>0.");
0177   fSetBarLengthCmd->SetUnitCategory("Length");
0178   fSetBarLengthCmd->SetDefaultUnit("mm");
0179   fSetBarLengthCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0180   fSetBarLengthCmd->SetToBeBroadcasted(false);
0181 
0182   fSetBarBaseCmd = new G4UIcmdWithADoubleAndUnit("/WLS/setBarBase", this);
0183   fSetBarBaseCmd->SetGuidance("Set the side length of the scintillator bar");
0184   fSetBarBaseCmd->SetParameterName("length", false);
0185   fSetBarBaseCmd->SetRange("length>0.");
0186   fSetBarBaseCmd->SetUnitCategory("Length");
0187   fSetBarBaseCmd->SetDefaultUnit("mm");
0188   fSetBarBaseCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0189   fSetBarBaseCmd->SetToBeBroadcasted(false);
0190 
0191   fSetHoleRadiusCmd = new G4UIcmdWithADoubleAndUnit("/WLS/setHoleRadius", this);
0192   fSetHoleRadiusCmd->SetGuidance("Set the radius of the fiber hole");
0193   fSetHoleRadiusCmd->SetParameterName("radius", false);
0194   fSetHoleRadiusCmd->SetRange("radius>0.");
0195   fSetHoleRadiusCmd->SetUnitCategory("Length");
0196   fSetHoleRadiusCmd->SetDefaultUnit("mm");
0197   fSetHoleRadiusCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0198   fSetHoleRadiusCmd->SetToBeBroadcasted(false);
0199 
0200   fSetCoatingThicknessCmd = new G4UIcmdWithADoubleAndUnit("/WLS/setCoatingThickness", this);
0201   fSetCoatingThicknessCmd->SetGuidance("Set thickness of the coating on the bars");
0202   fSetCoatingThicknessCmd->SetParameterName("thick", false);
0203   fSetCoatingThicknessCmd->SetUnitCategory("Length");
0204   fSetCoatingThicknessCmd->SetDefaultUnit("mm");
0205   fSetCoatingThicknessCmd->SetRange("thick>=0.");
0206   fSetCoatingThicknessCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0207   fSetCoatingThicknessCmd->SetToBeBroadcasted(false);
0208 
0209   fSetCoatingRadiusCmd = new G4UIcmdWithADoubleAndUnit("/WLS/setCoatingRadius", this);
0210   fSetCoatingRadiusCmd->SetGuidance("Set inner radius of the corner bar coating");
0211   fSetCoatingRadiusCmd->SetParameterName("cradius", false);
0212   fSetCoatingRadiusCmd->SetUnitCategory("Length");
0213   fSetCoatingRadiusCmd->SetDefaultUnit("mm");
0214   fSetCoatingRadiusCmd->SetRange("cradius>=0.");
0215   fSetCoatingRadiusCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0216   fSetCoatingRadiusCmd->SetToBeBroadcasted(false);
0217 }
0218 
0219 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0220 
0221 WLSDetectorMessenger::~WLSDetectorMessenger()
0222 {
0223   delete fDetDir;
0224 
0225   delete fSetBarLengthCmd;
0226   delete fSetBarBaseCmd;
0227   delete fSetClad1RadiusCmd;
0228   delete fSetClad2RadiusCmd;
0229   delete fSetCoatingThicknessCmd;
0230   delete fSetCoatingRadiusCmd;
0231   delete fSetGapCmd;
0232   delete fSetHoleRadiusCmd;
0233   delete fSetMirrorCmd;
0234   delete fSetMirrorPolishCmd;
0235   delete fSetMirrorReflectivityCmd;
0236   delete fSetNumOfCladLayersCmd;
0237   delete fSetPhotonDetAlignmentCmd;
0238   delete fSetPhotonDetGeometryCmd;
0239   delete fSetPhotonDetHalfLengthCmd;
0240   delete fSetPhotonDetPolishCmd;
0241   delete fSetPhotonDetReflectivityCmd;
0242   delete fSetSurfaceRoughnessCmd;
0243   delete fSetWLSLengthCmd;
0244   delete fSetWLSRadiusCmd;
0245   delete fSetXYRatioCmd;
0246 }
0247 
0248 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0249 
0250 void WLSDetectorMessenger::SetNewValue(G4UIcommand* command, G4String val)
0251 {
0252   if (command == fSetPhotonDetGeometryCmd) {
0253     fDetector->SetPhotonDetGeometry(val);
0254   }
0255   else if (command == fSetNumOfCladLayersCmd) {
0256     fDetector->SetNumberOfCladding(G4UIcmdWithAnInteger::GetNewIntValue(val));
0257   }
0258   else if (command == fSetSurfaceRoughnessCmd) {
0259     fDetector->SetSurfaceRoughness(G4UIcmdWithADouble::GetNewDoubleValue(val));
0260   }
0261   else if (command == fSetXYRatioCmd) {
0262     fDetector->SetXYRatio(G4UIcmdWithADouble::GetNewDoubleValue(val));
0263   }
0264   else if (command == fSetMirrorPolishCmd) {
0265     fDetector->SetMirrorPolish(G4UIcmdWithADouble::GetNewDoubleValue(val));
0266   }
0267   else if (command == fSetMirrorReflectivityCmd) {
0268     fDetector->SetMirrorReflectivity(G4UIcmdWithADouble::GetNewDoubleValue(val));
0269   }
0270   else if (command == fSetPhotonDetPolishCmd) {
0271     fDetector->SetPhotonDetPolish(G4UIcmdWithADouble::GetNewDoubleValue(val));
0272   }
0273   else if (command == fSetPhotonDetReflectivityCmd) {
0274     fDetector->SetPhotonDetReflectivity(G4UIcmdWithADouble::GetNewDoubleValue(val));
0275   }
0276   else if (command == fSetWLSLengthCmd) {
0277     fDetector->SetWLSLength(G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(val));
0278   }
0279   else if (command == fSetWLSRadiusCmd) {
0280     fDetector->SetWLSRadius(G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(val));
0281   }
0282   else if (command == fSetClad1RadiusCmd) {
0283     fDetector->SetClad1Radius(G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(val));
0284   }
0285   else if (command == fSetClad2RadiusCmd) {
0286     fDetector->SetClad2Radius(G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(val));
0287   }
0288   else if (command == fSetPhotonDetHalfLengthCmd) {
0289     fDetector->SetPhotonDetHalfLength(G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(val));
0290   }
0291   else if (command == fSetGapCmd) {
0292     fDetector->SetGap(G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(val));
0293   }
0294   else if (command == fSetPhotonDetAlignmentCmd) {
0295     fDetector->SetPhotonDetAlignment(G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(val));
0296   }
0297   else if (command == fSetMirrorCmd) {
0298     fDetector->SetMirror(G4UIcmdWithABool::GetNewBoolValue(val));
0299   }
0300   else if (command == fSetBarLengthCmd) {
0301     fDetector->SetBarLength(G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(val));
0302   }
0303   else if (command == fSetBarBaseCmd) {
0304     fDetector->SetBarBase(G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(val));
0305   }
0306   else if (command == fSetHoleRadiusCmd) {
0307     fDetector->SetHoleRadius(G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(val));
0308   }
0309   else if (command == fSetCoatingThicknessCmd) {
0310     fDetector->SetCoatingThickness(G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(val));
0311   }
0312   else if (command == fSetCoatingRadiusCmd) {
0313     fDetector->SetCoatingRadius(G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(val));
0314   }
0315 }