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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/LXe/src/LXeDetectorMessenger.cc
 28 /// \brief Implementation of the LXeDetectorMessenger class
 29 //
 30 //
 31 #include "LXeDetectorMessenger.hh"
 32 
 33 #include "LXeDetectorConstruction.hh"
 34 
 35 #include "G4RunManager.hh"
 36 #include "G4Scintillation.hh"
 37 #include "G4UIcmdWith3VectorAndUnit.hh"
 38 #include "G4UIcmdWithABool.hh"
 39 #include "G4UIcmdWithADouble.hh"
 40 #include "G4UIcmdWithADoubleAndUnit.hh"
 41 #include "G4UIcmdWithAnInteger.hh"
 42 #include "G4UIcommand.hh"
 43 #include "G4UIdirectory.hh"
 44 
 45 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 46 
 47 LXeDetectorMessenger::LXeDetectorMessenger(LXeDetectorConstruction* detector)
 48   : fLXeDetector(detector)
 49 {
 50   // Setup a command directory for detector controls with guidance
 51   fDetectorDir = new G4UIdirectory("/LXe/detector/");
 52   fDetectorDir->SetGuidance("Detector geometry control");
 53 
 54   fVolumesDir = new G4UIdirectory("/LXe/detector/volumes/");
 55   fVolumesDir->SetGuidance("Enable/disable volumes");
 56 
 57   // Various commands for modifying detector geometry
 58   fDimensionsCmd = new G4UIcmdWith3VectorAndUnit("/LXe/detector/dimensions", this);
 59   fDimensionsCmd->SetGuidance("Set the dimensions of the detector volume.");
 60   fDimensionsCmd->SetParameterName("scint_x", "scint_y", "scint_z", false);
 61   fDimensionsCmd->SetDefaultUnit("cm");
 62   fDimensionsCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
 63   fDimensionsCmd->SetToBeBroadcasted(false);
 64 
 65   fHousingThicknessCmd = new G4UIcmdWithADoubleAndUnit("/LXe/detector/housingThickness", this);
 66   fHousingThicknessCmd->SetGuidance("Set the thickness of the housing.");
 67   fHousingThicknessCmd->SetParameterName("d_mtl", false);
 68   fHousingThicknessCmd->SetDefaultUnit("cm");
 69   fHousingThicknessCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
 70   fHousingThicknessCmd->SetToBeBroadcasted(false);
 71 
 72   fPmtRadiusCmd = new G4UIcmdWithADoubleAndUnit("/LXe/detector/pmtRadius", this);
 73   fPmtRadiusCmd->SetGuidance("Set the radius of the PMTs.");
 74   fPmtRadiusCmd->SetParameterName("radius", false);
 75   fPmtRadiusCmd->SetDefaultUnit("cm");
 76   fPmtRadiusCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
 77   fPmtRadiusCmd->SetToBeBroadcasted(false);
 78 
 79   fNxCmd = new G4UIcmdWithAnInteger("/LXe/detector/nx", this);
 80   fNxCmd->SetGuidance("Set the number of PMTs along the x-dimension.");
 81   fNxCmd->SetParameterName("nx", false);
 82   fNxCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
 83   fNxCmd->SetToBeBroadcasted(false);
 84 
 85   fNyCmd = new G4UIcmdWithAnInteger("/LXe/detector/ny", this);
 86   fNyCmd->SetGuidance("Set the number of PMTs along the y-dimension.");
 87   fNyCmd->SetParameterName("ny", false);
 88   fNyCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
 89   fNyCmd->SetToBeBroadcasted(false);
 90 
 91   fNzCmd = new G4UIcmdWithAnInteger("/LXe/detector/nz", this);
 92   fNzCmd->SetGuidance("Set the number of PMTs along the z-dimension.");
 93   fNzCmd->SetParameterName("nz", false);
 94   fNzCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
 95   fNzCmd->SetToBeBroadcasted(false);
 96 
 97   fSphereCmd = new G4UIcmdWithABool("/LXe/detector/volumes/sphere", this);
 98   fSphereCmd->SetGuidance("Enable/Disable the sphere.");
 99   fSphereCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
100   fSphereCmd->SetToBeBroadcasted(false);
101 
102   fReflectivityCmd = new G4UIcmdWithADouble("/LXe/detector/reflectivity", this);
103   fReflectivityCmd->SetGuidance("Set the reflectivity of the housing.");
104   fReflectivityCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
105   fReflectivityCmd->SetToBeBroadcasted(false);
106 
107   fWlsCmd = new G4UIcmdWithABool("/LXe/detector/volumes/wls", this);
108   fWlsCmd->SetGuidance("Enable/Disable the WLS slab");
109   fWlsCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
110   fWlsCmd->SetToBeBroadcasted(false);
111 
112   fLxeCmd = new G4UIcmdWithABool("/LXe/detector/volumes/lxe", this);
113   fLxeCmd->SetGuidance("Enable/Disable the main detector volume.");
114   fLxeCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
115   fLxeCmd->SetToBeBroadcasted(false);
116 
117   fNFibersCmd = new G4UIcmdWithAnInteger("/LXe/detector/nfibers", this);
118   fNFibersCmd->SetGuidance("Set the number of WLS fibers in the WLS slab.");
119   fNFibersCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
120   fNFibersCmd->SetToBeBroadcasted(false);
121 
122   fMainScintYield = new G4UIcmdWithADouble("/LXe/detector/MainScintYield", this);
123   fMainScintYield->SetGuidance("Set scinitillation yield of main volume.");
124   fMainScintYield->SetGuidance("Specified in photons/MeV");
125   fMainScintYield->AvailableForStates(G4State_PreInit, G4State_Idle);
126   fMainScintYield->SetToBeBroadcasted(false);
127 
128   fWLSScintYield = new G4UIcmdWithADouble("/LXe/detector/WLSScintYield", this);
129   fWLSScintYield->SetGuidance("Set scintillation yield of WLS Slab");
130   fWLSScintYield->SetGuidance("Specified in photons/MeV");
131   fWLSScintYield->AvailableForStates(G4State_PreInit, G4State_Idle);
132   fWLSScintYield->SetToBeBroadcasted(false);
133 
134   fSaveThresholdCmd = new G4UIcmdWithAnInteger("/LXe/saveThreshold", this);
135   fSaveThresholdCmd->SetGuidance(
136     "Set the photon count threshold for saving the random number seed");
137   fSaveThresholdCmd->SetParameterName("photons", true);
138   fSaveThresholdCmd->SetDefaultValue(4500);
139   fSaveThresholdCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
140 
141   fDefaultsCmd = new G4UIcommand("/LXe/detector/defaults", this);
142   fDefaultsCmd->SetGuidance("Set all detector geometry values to defaults.");
143   fDefaultsCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
144   fDefaultsCmd->SetToBeBroadcasted(false);
145 }
146 
147 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
148 
149 LXeDetectorMessenger::~LXeDetectorMessenger()
150 {
151   delete fDimensionsCmd;
152   delete fHousingThicknessCmd;
153   delete fPmtRadiusCmd;
154   delete fNxCmd;
155   delete fNyCmd;
156   delete fNzCmd;
157   delete fSphereCmd;
158   delete fWlsCmd;
159   delete fLxeCmd;
160   delete fNFibersCmd;
161   delete fReflectivityCmd;
162   delete fMainScintYield;
163   delete fWLSScintYield;
164   delete fSaveThresholdCmd;
165   delete fDefaultsCmd;
166   delete fDetectorDir;
167   delete fVolumesDir;
168 }
169 
170 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
171 
172 void LXeDetectorMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
173 {
174   if (command == fDimensionsCmd) {
175     fLXeDetector->SetDimensions(fDimensionsCmd->GetNew3VectorValue(newValue));
176   }
177   else if (command == fHousingThicknessCmd) {
178     fLXeDetector->SetHousingThickness(fHousingThicknessCmd->GetNewDoubleValue(newValue));
179   }
180   else if (command == fPmtRadiusCmd) {
181     fLXeDetector->SetPMTRadius(fPmtRadiusCmd->GetNewDoubleValue(newValue));
182   }
183   else if (command == fNxCmd) {
184     fLXeDetector->SetNX(fNxCmd->GetNewIntValue(newValue));
185   }
186   else if (command == fNyCmd) {
187     fLXeDetector->SetNY(fNyCmd->GetNewIntValue(newValue));
188   }
189   else if (command == fNzCmd) {
190     fLXeDetector->SetNZ(fNzCmd->GetNewIntValue(newValue));
191   }
192   else if (command == fSphereCmd) {
193     fLXeDetector->SetSphereOn(fSphereCmd->GetNewBoolValue(newValue));
194   }
195   else if (command == fReflectivityCmd) {
196     fLXeDetector->SetHousingReflectivity(fReflectivityCmd->GetNewDoubleValue(newValue));
197   }
198   else if (command == fWlsCmd) {
199     fLXeDetector->SetWLSSlabOn(fWlsCmd->GetNewBoolValue(newValue));
200   }
201   else if (command == fLxeCmd) {
202     fLXeDetector->SetMainVolumeOn(fLxeCmd->GetNewBoolValue(newValue));
203   }
204   else if (command == fNFibersCmd) {
205     fLXeDetector->SetNFibers(fNFibersCmd->GetNewIntValue(newValue));
206   }
207   else if (command == fMainScintYield) {
208     fLXeDetector->SetMainScintYield(fMainScintYield->GetNewDoubleValue(newValue));
209   }
210   else if (command == fWLSScintYield) {
211     fLXeDetector->SetWLSScintYield(fWLSScintYield->GetNewDoubleValue(newValue));
212   }
213   else if (command == fSaveThresholdCmd) {
214     fLXeDetector->SetSaveThreshold(fSaveThresholdCmd->GetNewIntValue(newValue));
215   }
216   else if (command == fDefaultsCmd) {
217     fLXeDetector->SetDefaults();
218     G4RunManager::GetRunManager()->ReinitializeGeometry();
219   }
220 }
221