Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-15 08:29:34

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