Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 // 26 // 27 /// \file optical/LXe/src/LXeDetectorMessenger 27 /// \file optical/LXe/src/LXeDetectorMessenger.cc 28 /// \brief Implementation of the LXeDetectorMe 28 /// \brief Implementation of the LXeDetectorMessenger class 29 // 29 // 30 // 30 // 31 #include "LXeDetectorMessenger.hh" 31 #include "LXeDetectorMessenger.hh" 32 << 33 #include "LXeDetectorConstruction.hh" 32 #include "LXeDetectorConstruction.hh" 34 33 35 #include "G4RunManager.hh" << 36 #include "G4Scintillation.hh" << 37 #include "G4UIcmdWith3VectorAndUnit.hh" << 38 #include "G4UIcmdWithABool.hh" << 39 #include "G4UIcmdWithADouble.hh" << 40 #include "G4UIcmdWithADoubleAndUnit.hh" 34 #include "G4UIcmdWithADoubleAndUnit.hh" >> 35 #include "G4UIcmdWith3VectorAndUnit.hh" 41 #include "G4UIcmdWithAnInteger.hh" 36 #include "G4UIcmdWithAnInteger.hh" 42 #include "G4UIcommand.hh" 37 #include "G4UIcommand.hh" 43 #include "G4UIdirectory.hh" 38 #include "G4UIdirectory.hh" >> 39 #include "G4UIcmdWithABool.hh" >> 40 #include "G4UIcmdWithADouble.hh" >> 41 #include "G4Scintillation.hh" >> 42 >> 43 #include "G4RunManager.hh" 44 44 45 //....oooOO0OOooo........oooOO0OOooo........oo 45 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 46 46 47 LXeDetectorMessenger::LXeDetectorMessenger(LXe 47 LXeDetectorMessenger::LXeDetectorMessenger(LXeDetectorConstruction* detector) 48 : fLXeDetector(detector) << 48 : fLXeDetector(detector) 49 { 49 { 50 // Setup a command directory for detector co << 50 //Setup a command directory for detector controls with guidance 51 fDetectorDir = new G4UIdirectory("/LXe/detec 51 fDetectorDir = new G4UIdirectory("/LXe/detector/"); 52 fDetectorDir->SetGuidance("Detector geometry 52 fDetectorDir->SetGuidance("Detector geometry control"); 53 53 54 fVolumesDir = new G4UIdirectory("/LXe/detect 54 fVolumesDir = new G4UIdirectory("/LXe/detector/volumes/"); 55 fVolumesDir->SetGuidance("Enable/disable vol 55 fVolumesDir->SetGuidance("Enable/disable volumes"); 56 << 56 57 // Various commands for modifying detector g << 57 //Various commands for modifying detector geometry 58 fDimensionsCmd = new G4UIcmdWith3VectorAndUn << 58 fDimensionsCmd = >> 59 new G4UIcmdWith3VectorAndUnit("/LXe/detector/dimensions",this); 59 fDimensionsCmd->SetGuidance("Set the dimensi 60 fDimensionsCmd->SetGuidance("Set the dimensions of the detector volume."); 60 fDimensionsCmd->SetParameterName("scint_x", << 61 fDimensionsCmd->SetParameterName("scint_x","scint_y","scint_z",false); 61 fDimensionsCmd->SetDefaultUnit("cm"); 62 fDimensionsCmd->SetDefaultUnit("cm"); 62 fDimensionsCmd->AvailableForStates(G4State_P << 63 fDimensionsCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 63 fDimensionsCmd->SetToBeBroadcasted(false); 64 fDimensionsCmd->SetToBeBroadcasted(false); 64 65 65 fHousingThicknessCmd = new G4UIcmdWithADoubl << 66 fHousingThicknessCmd = new G4UIcmdWithADoubleAndUnit >> 67 ("/LXe/detector/housingThickness",this); 66 fHousingThicknessCmd->SetGuidance("Set the t 68 fHousingThicknessCmd->SetGuidance("Set the thickness of the housing."); 67 fHousingThicknessCmd->SetParameterName("d_mt << 69 fHousingThicknessCmd->SetParameterName("d_mtl",false); 68 fHousingThicknessCmd->SetDefaultUnit("cm"); 70 fHousingThicknessCmd->SetDefaultUnit("cm"); 69 fHousingThicknessCmd->AvailableForStates(G4S << 71 fHousingThicknessCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 70 fHousingThicknessCmd->SetToBeBroadcasted(fal 72 fHousingThicknessCmd->SetToBeBroadcasted(false); 71 73 72 fPmtRadiusCmd = new G4UIcmdWithADoubleAndUni << 74 fPmtRadiusCmd = new G4UIcmdWithADoubleAndUnit >> 75 ("/LXe/detector/pmtRadius",this); 73 fPmtRadiusCmd->SetGuidance("Set the radius o 76 fPmtRadiusCmd->SetGuidance("Set the radius of the PMTs."); 74 fPmtRadiusCmd->SetParameterName("radius", fa << 77 fPmtRadiusCmd->SetParameterName("radius",false); 75 fPmtRadiusCmd->SetDefaultUnit("cm"); 78 fPmtRadiusCmd->SetDefaultUnit("cm"); 76 fPmtRadiusCmd->AvailableForStates(G4State_Pr << 79 fPmtRadiusCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 77 fPmtRadiusCmd->SetToBeBroadcasted(false); 80 fPmtRadiusCmd->SetToBeBroadcasted(false); 78 81 79 fNxCmd = new G4UIcmdWithAnInteger("/LXe/dete << 82 fNxCmd = new G4UIcmdWithAnInteger("/LXe/detector/nx",this); 80 fNxCmd->SetGuidance("Set the number of PMTs 83 fNxCmd->SetGuidance("Set the number of PMTs along the x-dimension."); 81 fNxCmd->SetParameterName("nx", false); << 84 fNxCmd->SetParameterName("nx",false); 82 fNxCmd->AvailableForStates(G4State_PreInit, << 85 fNxCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 83 fNxCmd->SetToBeBroadcasted(false); 86 fNxCmd->SetToBeBroadcasted(false); 84 87 85 fNyCmd = new G4UIcmdWithAnInteger("/LXe/dete << 88 fNyCmd = new G4UIcmdWithAnInteger("/LXe/detector/ny",this); 86 fNyCmd->SetGuidance("Set the number of PMTs 89 fNyCmd->SetGuidance("Set the number of PMTs along the y-dimension."); 87 fNyCmd->SetParameterName("ny", false); << 90 fNyCmd->SetParameterName("ny",false); 88 fNyCmd->AvailableForStates(G4State_PreInit, << 91 fNyCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 89 fNyCmd->SetToBeBroadcasted(false); 92 fNyCmd->SetToBeBroadcasted(false); 90 93 91 fNzCmd = new G4UIcmdWithAnInteger("/LXe/dete << 94 fNzCmd = new G4UIcmdWithAnInteger("/LXe/detector/nz",this); 92 fNzCmd->SetGuidance("Set the number of PMTs 95 fNzCmd->SetGuidance("Set the number of PMTs along the z-dimension."); 93 fNzCmd->SetParameterName("nz", false); << 96 fNzCmd->SetParameterName("nz",false); 94 fNzCmd->AvailableForStates(G4State_PreInit, << 97 fNzCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 95 fNzCmd->SetToBeBroadcasted(false); 98 fNzCmd->SetToBeBroadcasted(false); 96 99 97 fSphereCmd = new G4UIcmdWithABool("/LXe/dete << 100 fSphereCmd = new G4UIcmdWithABool("/LXe/detector/volumes/sphere",this); 98 fSphereCmd->SetGuidance("Enable/Disable the 101 fSphereCmd->SetGuidance("Enable/Disable the sphere."); 99 fSphereCmd->AvailableForStates(G4State_PreIn << 102 fSphereCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 100 fSphereCmd->SetToBeBroadcasted(false); 103 fSphereCmd->SetToBeBroadcasted(false); 101 104 102 fReflectivityCmd = new G4UIcmdWithADouble("/ << 105 fReflectivityCmd = new G4UIcmdWithADouble("/LXe/detector/reflectivity",this); 103 fReflectivityCmd->SetGuidance("Set the refle 106 fReflectivityCmd->SetGuidance("Set the reflectivity of the housing."); 104 fReflectivityCmd->AvailableForStates(G4State << 107 fReflectivityCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 105 fReflectivityCmd->SetToBeBroadcasted(false); 108 fReflectivityCmd->SetToBeBroadcasted(false); 106 109 107 fWlsCmd = new G4UIcmdWithABool("/LXe/detecto << 110 fWlsCmd = new G4UIcmdWithABool("/LXe/detector/volumes/wls",this); 108 fWlsCmd->SetGuidance("Enable/Disable the WLS 111 fWlsCmd->SetGuidance("Enable/Disable the WLS slab"); 109 fWlsCmd->AvailableForStates(G4State_PreInit, << 112 fWlsCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 110 fWlsCmd->SetToBeBroadcasted(false); 113 fWlsCmd->SetToBeBroadcasted(false); 111 114 112 fLxeCmd = new G4UIcmdWithABool("/LXe/detecto << 115 fLxeCmd = new G4UIcmdWithABool("/LXe/detector/volumes/lxe",this); 113 fLxeCmd->SetGuidance("Enable/Disable the mai 116 fLxeCmd->SetGuidance("Enable/Disable the main detector volume."); 114 fLxeCmd->AvailableForStates(G4State_PreInit, << 117 fLxeCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 115 fLxeCmd->SetToBeBroadcasted(false); 118 fLxeCmd->SetToBeBroadcasted(false); 116 119 117 fNFibersCmd = new G4UIcmdWithAnInteger("/LXe << 120 fNFibersCmd = new G4UIcmdWithAnInteger("/LXe/detector/nfibers",this); 118 fNFibersCmd->SetGuidance("Set the number of 121 fNFibersCmd->SetGuidance("Set the number of WLS fibers in the WLS slab."); 119 fNFibersCmd->AvailableForStates(G4State_PreI << 122 fNFibersCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 120 fNFibersCmd->SetToBeBroadcasted(false); 123 fNFibersCmd->SetToBeBroadcasted(false); 121 124 122 fMainScintYield = new G4UIcmdWithADouble("/L << 125 fMainScintYield=new G4UIcmdWithADouble("/LXe/detector/MainScintYield",this); 123 fMainScintYield->SetGuidance("Set scinitilla 126 fMainScintYield->SetGuidance("Set scinitillation yield of main volume."); 124 fMainScintYield->SetGuidance("Specified in p 127 fMainScintYield->SetGuidance("Specified in photons/MeV"); 125 fMainScintYield->AvailableForStates(G4State_ << 128 fMainScintYield->AvailableForStates(G4State_PreInit,G4State_Idle); 126 fMainScintYield->SetToBeBroadcasted(false); 129 fMainScintYield->SetToBeBroadcasted(false); 127 130 128 fWLSScintYield = new G4UIcmdWithADouble("/LX << 131 fWLSScintYield = new G4UIcmdWithADouble("/LXe/detector/WLSScintYield",this); 129 fWLSScintYield->SetGuidance("Set scintillati 132 fWLSScintYield->SetGuidance("Set scintillation yield of WLS Slab"); 130 fWLSScintYield->SetGuidance("Specified in ph 133 fWLSScintYield->SetGuidance("Specified in photons/MeV"); 131 fWLSScintYield->AvailableForStates(G4State_P << 134 fWLSScintYield->AvailableForStates(G4State_PreInit,G4State_Idle); 132 fWLSScintYield->SetToBeBroadcasted(false); 135 fWLSScintYield->SetToBeBroadcasted(false); 133 136 134 fSaveThresholdCmd = new G4UIcmdWithAnInteger << 137 fSaveThresholdCmd = new G4UIcmdWithAnInteger("/LXe/saveThreshold",this); 135 fSaveThresholdCmd->SetGuidance( << 138 fSaveThresholdCmd-> 136 "Set the photon count threshold for saving << 139 SetGuidance("Set the photon count threshold for saving the random number seed"); 137 fSaveThresholdCmd->SetParameterName("photons << 140 fSaveThresholdCmd->SetParameterName("photons",true); 138 fSaveThresholdCmd->SetDefaultValue(4500); 141 fSaveThresholdCmd->SetDefaultValue(4500); 139 fSaveThresholdCmd->AvailableForStates(G4Stat << 142 fSaveThresholdCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 140 143 141 fDefaultsCmd = new G4UIcommand("/LXe/detecto << 144 fDefaultsCmd = new G4UIcommand("/LXe/detector/defaults",this); 142 fDefaultsCmd->SetGuidance("Set all detector 145 fDefaultsCmd->SetGuidance("Set all detector geometry values to defaults."); 143 fDefaultsCmd->AvailableForStates(G4State_Pre << 146 fDefaultsCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 144 fDefaultsCmd->SetToBeBroadcasted(false); 147 fDefaultsCmd->SetToBeBroadcasted(false); 145 } 148 } 146 149 147 //....oooOO0OOooo........oooOO0OOooo........oo 150 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 148 151 149 LXeDetectorMessenger::~LXeDetectorMessenger() 152 LXeDetectorMessenger::~LXeDetectorMessenger() 150 { 153 { 151 delete fDimensionsCmd; 154 delete fDimensionsCmd; 152 delete fHousingThicknessCmd; 155 delete fHousingThicknessCmd; 153 delete fPmtRadiusCmd; 156 delete fPmtRadiusCmd; 154 delete fNxCmd; 157 delete fNxCmd; 155 delete fNyCmd; 158 delete fNyCmd; 156 delete fNzCmd; 159 delete fNzCmd; >> 160 delete fDetectorDir; >> 161 delete fVolumesDir; 157 delete fSphereCmd; 162 delete fSphereCmd; 158 delete fWlsCmd; 163 delete fWlsCmd; 159 delete fLxeCmd; 164 delete fLxeCmd; 160 delete fNFibersCmd; 165 delete fNFibersCmd; 161 delete fReflectivityCmd; 166 delete fReflectivityCmd; 162 delete fMainScintYield; 167 delete fMainScintYield; 163 delete fWLSScintYield; 168 delete fWLSScintYield; 164 delete fSaveThresholdCmd; 169 delete fSaveThresholdCmd; 165 delete fDefaultsCmd; 170 delete fDefaultsCmd; 166 delete fDetectorDir; << 167 delete fVolumesDir; << 168 } 171 } 169 172 170 //....oooOO0OOooo........oooOO0OOooo........oo 173 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 171 174 172 void LXeDetectorMessenger::SetNewValue(G4UIcom 175 void LXeDetectorMessenger::SetNewValue(G4UIcommand* command, G4String newValue) 173 { 176 { 174 if (command == fDimensionsCmd) { << 177 if( command == fDimensionsCmd ){ 175 fLXeDetector->SetDimensions(fDimensionsCmd 178 fLXeDetector->SetDimensions(fDimensionsCmd->GetNew3VectorValue(newValue)); 176 } 179 } 177 else if (command == fHousingThicknessCmd) { << 180 else if (command == fHousingThicknessCmd){ 178 fLXeDetector->SetHousingThickness(fHousing << 181 fLXeDetector->SetHousingThickness(fHousingThicknessCmd >> 182 ->GetNewDoubleValue(newValue)); 179 } 183 } 180 else if (command == fPmtRadiusCmd) { << 184 else if (command == fPmtRadiusCmd){ 181 fLXeDetector->SetPMTRadius(fPmtRadiusCmd-> 185 fLXeDetector->SetPMTRadius(fPmtRadiusCmd->GetNewDoubleValue(newValue)); 182 } 186 } 183 else if (command == fNxCmd) { << 187 else if (command == fNxCmd){ 184 fLXeDetector->SetNX(fNxCmd->GetNewIntValue 188 fLXeDetector->SetNX(fNxCmd->GetNewIntValue(newValue)); 185 } 189 } 186 else if (command == fNyCmd) { << 190 else if (command == fNyCmd){ 187 fLXeDetector->SetNY(fNyCmd->GetNewIntValue 191 fLXeDetector->SetNY(fNyCmd->GetNewIntValue(newValue)); 188 } 192 } 189 else if (command == fNzCmd) { << 193 else if (command == fNzCmd){ 190 fLXeDetector->SetNZ(fNzCmd->GetNewIntValue 194 fLXeDetector->SetNZ(fNzCmd->GetNewIntValue(newValue)); 191 } 195 } 192 else if (command == fSphereCmd) { << 196 else if (command == fSphereCmd){ 193 fLXeDetector->SetSphereOn(fSphereCmd->GetN 197 fLXeDetector->SetSphereOn(fSphereCmd->GetNewBoolValue(newValue)); 194 } 198 } 195 else if (command == fReflectivityCmd) { << 199 else if (command == fReflectivityCmd){ 196 fLXeDetector->SetHousingReflectivity(fRefl << 200 fLXeDetector >> 201 ->SetHousingReflectivity(fReflectivityCmd->GetNewDoubleValue(newValue)); 197 } 202 } 198 else if (command == fWlsCmd) { << 203 else if (command == fWlsCmd){ 199 fLXeDetector->SetWLSSlabOn(fWlsCmd->GetNew 204 fLXeDetector->SetWLSSlabOn(fWlsCmd->GetNewBoolValue(newValue)); 200 } 205 } 201 else if (command == fLxeCmd) { << 206 else if (command == fLxeCmd){ 202 fLXeDetector->SetMainVolumeOn(fLxeCmd->Get 207 fLXeDetector->SetMainVolumeOn(fLxeCmd->GetNewBoolValue(newValue)); 203 } 208 } 204 else if (command == fNFibersCmd) { << 209 else if (command == fNFibersCmd){ 205 fLXeDetector->SetNFibers(fNFibersCmd->GetN 210 fLXeDetector->SetNFibers(fNFibersCmd->GetNewIntValue(newValue)); 206 } 211 } 207 else if (command == fMainScintYield) { << 212 else if (command == fMainScintYield){ 208 fLXeDetector->SetMainScintYield(fMainScint << 213 fLXeDetector-> >> 214 SetMainScintYield(fMainScintYield->GetNewDoubleValue(newValue)); 209 } 215 } 210 else if (command == fWLSScintYield) { << 216 else if (command == fWLSScintYield){ 211 fLXeDetector->SetWLSScintYield(fWLSScintYi 217 fLXeDetector->SetWLSScintYield(fWLSScintYield->GetNewDoubleValue(newValue)); 212 } 218 } 213 else if (command == fSaveThresholdCmd) { << 219 else if( command == fSaveThresholdCmd ){ 214 fLXeDetector->SetSaveThreshold(fSaveThresh 220 fLXeDetector->SetSaveThreshold(fSaveThresholdCmd->GetNewIntValue(newValue)); 215 } 221 } 216 else if (command == fDefaultsCmd) { << 222 else if (command == fDefaultsCmd){ 217 fLXeDetector->SetDefaults(); 223 fLXeDetector->SetDefaults(); 218 G4RunManager::GetRunManager()->Reinitializ << 224 >> 225 G4RunManager::GetRunManager()->ReinitializeGeometry(); //Add here this line 219 } 226 } 220 } 227 } 221 228