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 // 27 // 28 // GEANT4 Class header file 28 // GEANT4 Class header file 29 // 29 // 30 // File name: G4OpticalParameters 30 // File name: G4OpticalParameters 31 // 31 // 32 // Author: Daren Sawkey based on G4EmPa 32 // Author: Daren Sawkey based on G4EmParameters 33 // 33 // 34 // Creation date: 14.07.2020 34 // Creation date: 14.07.2020 35 // 35 // 36 // Modifications: 36 // Modifications: 37 // 37 // 38 // 38 // 39 // Class Description: 39 // Class Description: 40 // 40 // 41 // A utility static class, responsable for kee 41 // A utility static class, responsable for keeping parameters 42 // for all optical physics processes and model 42 // for all optical physics processes and models. 43 // 43 // 44 // It is initialized by the master thread but << 44 // It is initialized by the master thread but can be updated 45 // at any moment. Parameters may be used in ru << 45 // at any moment. Parameters may be used in run time or at 46 // initialisation 46 // initialisation 47 // 47 // 48 // ------------------------------------------- 48 // ------------------------------------------------------------------- 49 // 49 // 50 50 51 #ifndef G4OpticalParameters_h 51 #ifndef G4OpticalParameters_h 52 #define G4OpticalParameters_h 1 52 #define G4OpticalParameters_h 1 53 53 54 #include "globals.hh" 54 #include "globals.hh" 55 #include "G4ios.hh" 55 #include "G4ios.hh" 56 #include "G4ThreeVector.hh" 56 #include "G4ThreeVector.hh" 57 #include "G4Threading.hh" 57 #include "G4Threading.hh" 58 #include <vector> 58 #include <vector> 59 59 60 class G4OpticalParametersMessenger; 60 class G4OpticalParametersMessenger; 61 class G4StateManager; 61 class G4StateManager; 62 62 63 enum G4OpticalProcessIndex << 63 enum G4OpticalProcessIndex { 64 { << 64 kCerenkov, ///< Cerenkov process index 65 kCerenkov, ///< Cerenkov process index << 65 kScintillation, ///< Scintillation process index 66 kScintillation, ///< Scintillation process << 66 kAbsorption, ///< Absorption process index 67 kAbsorption, ///< Absorption process ind << 67 kRayleigh, ///< Rayleigh scattering process index 68 kRayleigh, ///< Rayleigh scattering pr << 68 kMieHG, ///< Mie scattering process index 69 kMieHG, ///< Mie scattering process << 69 kBoundary, ///< Boundary process index 70 kBoundary, ///< Boundary process index << 70 kWLS, ///< Wave Length Shifting process index 71 kWLS, ///< Wave Length Shifting p << 71 kWLS2, ///< Second Wave Length Shifting process index 72 kWLS2, ///< Second Wave Length Shi << 72 kNoProcess ///< Number of processes, no selected process 73 kNoProcess ///< Number of processes, n << 74 }; 73 }; 75 74 76 /// Return the name for a given optical proces 75 /// Return the name for a given optical process index 77 G4String G4OpticalProcessName(G4int); << 76 G4String G4OpticalProcessName(G4int ); 78 77 79 inline G4String G4OpticalProcessName(G4int pro << 78 inline >> 79 G4String G4OpticalProcessName(G4int processNumber) 80 { 80 { 81 switch(processNumber) << 81 switch ( processNumber ) { 82 { << 82 case kCerenkov: return "Cerenkov"; 83 case kCerenkov: << 83 case kScintillation: return "Scintillation"; 84 return "Cerenkov"; << 84 case kAbsorption: return "OpAbsorption"; 85 case kScintillation: << 85 case kRayleigh: return "OpRayleigh"; 86 return "Scintillation"; << 86 case kMieHG: return "OpMieHG"; 87 case kAbsorption: << 87 case kBoundary: return "OpBoundary"; 88 return "OpAbsorption"; << 88 case kWLS: return "OpWLS"; 89 case kRayleigh: << 89 case kWLS2: return "OpWLS2"; 90 return "OpRayleigh"; << 90 default: return "NoProcess"; 91 case kMieHG: << 92 return "OpMieHG"; << 93 case kBoundary: << 94 return "OpBoundary"; << 95 case kWLS: << 96 return "OpWLS"; << 97 case kWLS2: << 98 return "OpWLS2"; << 99 default: << 100 return "NoProcess"; << 101 } 91 } 102 } 92 } 103 93 >> 94 >> 95 104 class G4OpticalParameters 96 class G4OpticalParameters 105 { 97 { 106 public: << 98 public: >> 99 107 static G4OpticalParameters* Instance(); 100 static G4OpticalParameters* Instance(); 108 101 109 ~G4OpticalParameters(); 102 ~G4OpticalParameters(); 110 103 111 void SetDefaults(); 104 void SetDefaults(); 112 105 113 // printing 106 // printing 114 void StreamInfo(std::ostream& os) const; 107 void StreamInfo(std::ostream& os) const; 115 void Dump() const; 108 void Dump() const; 116 friend std::ostream& operator<<(std::ostream << 109 friend std::ostream& operator<< (std::ostream& os, const G4OpticalParameters&); 117 110 118 void SetVerboseLevel(G4int); 111 void SetVerboseLevel(G4int); 119 G4int GetVerboseLevel() const; 112 G4int GetVerboseLevel() const; 120 113 121 void SetProcessActivation(const G4String&, 114 void SetProcessActivation(const G4String&, G4bool); 122 G4bool GetProcessActivation(const G4String&) 115 G4bool GetProcessActivation(const G4String&) const; 123 116 >> 117 // DEPRECATED, use Set/GetProcessActivation instead >> 118 void Configure(G4OpticalProcessIndex, G4bool); >> 119 G4bool GetConfiguration(G4OpticalProcessIndex); >> 120 >> 121 // DEPRECATED, use Set/GetCerenkovTrackSecondariesFirst and >> 122 // Set/GetScintTrackSecondariesFirst instead >> 123 void SetTrackSecondariesFirst(G4OpticalProcessIndex, G4bool); >> 124 G4bool GetTrackSecondariesFirst(G4OpticalProcessIndex); >> 125 124 // Cerenkov 126 // Cerenkov 125 void SetCerenkovMaxPhotonsPerStep(G4int); << 127 void SetCerenkovMaxPhotonsPerStep(G4int); 126 G4int GetCerenkovMaxPhotonsPerStep() const; << 128 G4int GetCerenkovMaxPhotonsPerStep() const; 127 void SetCerenkovVerboseLevel(G4int); << 129 void SetCerenkovVerboseLevel(G4int); 128 G4int GetCerenkovVerboseLevel() const; << 130 G4int GetCerenkovVerboseLevel() const; 129 void SetCerenkovMaxBetaChange(G4double); 131 void SetCerenkovMaxBetaChange(G4double); 130 G4double GetCerenkovMaxBetaChange() const; 132 G4double GetCerenkovMaxBetaChange() const; 131 void SetCerenkovTrackSecondariesFirst(G4bo << 133 void SetCerenkovTrackSecondariesFirst(G4bool); 132 G4bool GetCerenkovTrackSecondariesFirst() co << 134 G4bool GetCerenkovTrackSecondariesFirst() const; 133 void SetCerenkovStackPhotons(G4bool); << 135 void SetCerenkovStackPhotons(G4bool); 134 G4bool GetCerenkovStackPhotons() const; << 136 G4bool GetCerenkovStackPhotons() const; 135 137 136 // Scintillation 138 // Scintillation 137 void SetScintByParticleType(G4bool); << 139 void SetScintYieldFactor(G4double); 138 G4bool GetScintByParticleType() const; << 140 G4double GetScintYieldFactor() const; 139 void SetScintTrackInfo(G4bool); << 141 void SetScintExcitationRatio(G4double); 140 G4bool GetScintTrackInfo() const; << 142 G4double GetScintExcitationRatio() const; 141 void SetScintTrackSecondariesFirst(G4bool) << 143 void SetScintByParticleType(G4bool); 142 G4bool GetScintTrackSecondariesFirst() const << 144 G4bool GetScintByParticleType() const; 143 void SetScintFiniteRiseTime(G4bool); << 145 void SetScintTrackInfo(G4bool); 144 G4bool GetScintFiniteRiseTime() const; << 146 G4bool GetScintTrackInfo() const; 145 void SetScintStackPhotons(G4bool); << 147 void SetScintTrackSecondariesFirst(G4bool); 146 G4bool GetScintStackPhotons() const; << 148 G4bool GetScintTrackSecondariesFirst() const; 147 void SetScintVerboseLevel(G4int); << 149 void SetScintFiniteRiseTime(G4bool); 148 G4int GetScintVerboseLevel() const; << 150 G4bool GetScintFiniteRiseTime() const; >> 151 void SetScintStackPhotons(G4bool); >> 152 G4bool GetScintStackPhotons() const; >> 153 void SetScintVerboseLevel(G4int); >> 154 G4int GetScintVerboseLevel() const; >> 155 void SetScintEnhancedTimeConstants(G4bool); >> 156 G4bool GetScintEnhancedTimeConstants() const; 149 157 150 // WLS 158 // WLS 151 void SetWLSTimeProfile(const G4String&); 159 void SetWLSTimeProfile(const G4String&); 152 G4String GetWLSTimeProfile() const; 160 G4String GetWLSTimeProfile() const; 153 void SetWLSVerboseLevel(G4int); << 161 void SetWLSVerboseLevel(G4int); 154 G4int GetWLSVerboseLevel() const; << 162 G4int GetWLSVerboseLevel() const; 155 163 156 // WLS2 164 // WLS2 157 void SetWLS2TimeProfile(const G4String&) 165 void SetWLS2TimeProfile(const G4String&); 158 G4String GetWLS2TimeProfile() const; 166 G4String GetWLS2TimeProfile() const; 159 void SetWLS2VerboseLevel(G4int); << 167 void SetWLS2VerboseLevel(G4int); 160 G4int GetWLS2VerboseLevel() const; << 168 G4int GetWLS2VerboseLevel() const; 161 169 162 // boundary 170 // boundary 163 void SetBoundaryVerboseLevel(G4int); << 171 void SetBoundaryVerboseLevel(G4int); 164 G4int GetBoundaryVerboseLevel() const; << 172 G4int GetBoundaryVerboseLevel() const; 165 void SetBoundaryInvokeSD(G4bool); 173 void SetBoundaryInvokeSD(G4bool); 166 G4bool GetBoundaryInvokeSD() const; 174 G4bool GetBoundaryInvokeSD() const; 167 175 168 // absorption 176 // absorption 169 void SetAbsorptionVerboseLevel(G4int); << 177 void SetAbsorptionVerboseLevel(G4int); 170 G4int GetAbsorptionVerboseLevel() const; << 178 G4int GetAbsorptionVerboseLevel() const; 171 179 172 // rayleigh 180 // rayleigh 173 void SetRayleighVerboseLevel(G4int); << 181 void SetRayleighVerboseLevel(G4int); 174 G4int GetRayleighVerboseLevel() const; << 182 G4int GetRayleighVerboseLevel() const; 175 183 176 // mie 184 // mie 177 void SetMieVerboseLevel(G4int); << 185 void SetMieVerboseLevel(G4int); 178 G4int GetMieVerboseLevel() const; << 186 G4int GetMieVerboseLevel() const; >> 187 >> 188 private: 179 189 180 private: << 181 G4OpticalParameters(); 190 G4OpticalParameters(); 182 void Initialise(); 191 void Initialise(); 183 G4bool IsLocked() const; 192 G4bool IsLocked() const; 184 void PrintWarning(G4ExceptionDescription& ed 193 void PrintWarning(G4ExceptionDescription& ed) const; 185 << 186 static G4OpticalParameters* theInstance; 194 static G4OpticalParameters* theInstance; 187 195 188 G4OpticalParametersMessenger* theMessenger; 196 G4OpticalParametersMessenger* theMessenger; 189 G4StateManager* fStateManager; << 197 G4StateManager* fStateManager; 190 198 191 G4int verboseLevel; 199 G4int verboseLevel; 192 200 193 // Whether to activate each process 201 // Whether to activate each process 194 std::map<G4String, G4bool> processActivation << 202 std::map<G4String, G4bool> processActivation; 195 203 196 // cerenkov///////////////// 204 // cerenkov///////////////// 197 G4bool cerenkovStackPhotons; << 205 G4bool cerenkovStackPhotons; 198 G4bool cerenkovTrackSecondariesFirst; << 206 G4bool cerenkovTrackSecondariesFirst; 199 G4int cerenkovVerboseLevel; << 207 G4int cerenkovVerboseLevel; 200 G4int cerenkovMaxPhotons; << 208 G4int cerenkovMaxPhotons; 201 G4double cerenkovMaxBetaChange; 209 G4double cerenkovMaxBetaChange; 202 210 203 // scintillation ///////////////// 211 // scintillation ///////////////// >> 212 G4double scintYieldFactor; >> 213 >> 214 /// Note: this is to be removed in the next major release. >> 215 /// Use material properties SCINTILLATIONYIELD1, 2, 3 instead >> 216 G4double scintExcitationRatio; 204 217 205 /// option to set a finite rise-time; Note: 218 /// option to set a finite rise-time; Note: the G4Scintillation 206 /// process expects the user to have set the 219 /// process expects the user to have set the constant material 207 /// property SCINTILLATIONRISETIME{1,2,3} << 220 /// property FAST/SLOWSCINTILLATIONRISETIME 208 G4bool scintFiniteRiseTime; << 221 G4bool scintFiniteRiseTime; 209 222 210 /// option to allow for the light yield to 223 /// option to allow for the light yield to be a function of 211 /// particle type and deposited energy in ca 224 /// particle type and deposited energy in case of non-linear 212 /// light emission in scintillators 225 /// light emission in scintillators 213 G4bool scintByParticleType; << 226 G4bool scintByParticleType; 214 227 215 /// option to allow for G4ScintillationTrack 228 /// option to allow for G4ScintillationTrackInformation 216 /// to be attached to a scintillation photon 229 /// to be attached to a scintillation photon's track 217 G4bool scintTrackInfo; << 230 G4bool scintTrackInfo; 218 231 219 /// option to allow stacking of secondary Sc 232 /// option to allow stacking of secondary Scintillation photons 220 G4bool scintStackPhotons; << 233 G4bool scintStackPhotons; 221 234 222 G4int scintVerboseLevel; << 235 /// new in version 10.7; allow > 2 time constants, and > 1 time 223 G4bool scintTrackSecondariesFirst; << 236 /// constant for scintillation by particle type >> 237 G4bool scintEnhancedTimeConstants; >> 238 >> 239 G4int scintVerboseLevel; >> 240 G4bool scintTrackSecondariesFirst; 224 241 225 ///////////////// WLS 242 ///////////////// WLS 226 G4String wlsTimeProfileName; 243 G4String wlsTimeProfileName; 227 G4int wlsVerboseLevel; << 244 G4int wlsVerboseLevel; 228 245 229 ///////////////// WLS2 246 ///////////////// WLS2 230 G4String wls2TimeProfileName; 247 G4String wls2TimeProfileName; 231 G4int wls2VerboseLevel; << 248 G4int wls2VerboseLevel; 232 249 233 //////////////// absorption 250 //////////////// absorption 234 G4int absorptionVerboseLevel; << 251 G4int absorptionVerboseLevel; 235 252 236 //////////////// rayleigh 253 //////////////// rayleigh 237 G4int rayleighVerboseLevel; << 254 G4int rayleighVerboseLevel; 238 255 239 //////////////// mie << 256 //////////////// mie 240 G4int mieVerboseLevel; << 257 G4int mieVerboseLevel; 241 258 242 //////////////// boundary 259 //////////////// boundary 243 /// G4OpBoundaryProcess to call InvokeSD met 260 /// G4OpBoundaryProcess to call InvokeSD method 244 G4bool boundaryInvokeSD; << 261 G4bool boundaryInvokeSD; 245 G4int boundaryVerboseLevel; << 262 G4int boundaryVerboseLevel; >> 263 246 264 247 #ifdef G4MULTITHREADED 265 #ifdef G4MULTITHREADED 248 static G4Mutex opticalParametersMutex; 266 static G4Mutex opticalParametersMutex; 249 #endif 267 #endif 250 }; 268 }; 251 269 252 //....oooOO0OOooo........oooOO0OOooo........oo 270 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 253 271 254 #endif 272 #endif 255 273