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 // $Id: G4OpWLS.cc 71487 2013-06-17 08:19:40Z gcosmo $ 27 // 28 // 28 ////////////////////////////////////////////// 29 //////////////////////////////////////////////////////////////////////// 29 // Optical Photon WaveLength Shifting (WLS) Cl 30 // Optical Photon WaveLength Shifting (WLS) Class Implementation 30 ////////////////////////////////////////////// 31 //////////////////////////////////////////////////////////////////////// 31 // 32 // 32 // File: G4OpWLS.cc 33 // File: G4OpWLS.cc 33 // Description: Discrete Process -- Wavelength 34 // Description: Discrete Process -- Wavelength Shifting of Optical Photons 34 // Version: 1.0 35 // Version: 1.0 35 // Created: 2003-05-13 36 // Created: 2003-05-13 36 // Author: John Paul Archambault 37 // Author: John Paul Archambault 37 // (Adaptation of G4Scintillation 38 // (Adaptation of G4Scintillation and G4OpAbsorption) 38 // Updated: 2005-07-28 - add G4ProcessType 39 // Updated: 2005-07-28 - add G4ProcessType to constructor 39 // 2006-05-07 - add G4VWLSTimeGen 40 // 2006-05-07 - add G4VWLSTimeGeneratorProfile >> 41 // mail: gum@triumf.ca >> 42 // jparcham@phys.ualberta.ca 40 // 43 // 41 ////////////////////////////////////////////// 44 //////////////////////////////////////////////////////////////////////// 42 45 43 #include "G4OpWLS.hh" 46 #include "G4OpWLS.hh" >> 47 44 #include "G4ios.hh" 48 #include "G4ios.hh" 45 #include "G4PhysicalConstants.hh" 49 #include "G4PhysicalConstants.hh" 46 #include "G4SystemOfUnits.hh" 50 #include "G4SystemOfUnits.hh" 47 #include "G4OpProcessSubType.hh" 51 #include "G4OpProcessSubType.hh" 48 #include "G4Poisson.hh" << 52 49 #include "G4OpticalParameters.hh" << 50 #include "G4WLSTimeGeneratorProfileDelta.hh" 53 #include "G4WLSTimeGeneratorProfileDelta.hh" 51 #include "G4WLSTimeGeneratorProfileExponential 54 #include "G4WLSTimeGeneratorProfileExponential.hh" 52 55 53 //....oooOO0OOooo........oooOO0OOooo........oo << 56 ///////////////////////// >> 57 // Class Implementation >> 58 ///////////////////////// >> 59 >> 60 ///////////////// >> 61 // Constructors >> 62 ///////////////// >> 63 54 G4OpWLS::G4OpWLS(const G4String& processName, 64 G4OpWLS::G4OpWLS(const G4String& processName, G4ProcessType type) 55 : G4VDiscreteProcess(processName, type) 65 : G4VDiscreteProcess(processName, type) 56 { 66 { 57 WLSTimeGeneratorProfile = nullptr; << 58 Initialise(); << 59 SetProcessSubType(fOpWLS); 67 SetProcessSubType(fOpWLS); 60 theIntegralTable = nullptr; << 61 68 62 if(verboseLevel > 0) << 69 theIntegralTable = NULL; >> 70 >> 71 if (verboseLevel>0) { 63 G4cout << GetProcessName() << " is created 72 G4cout << GetProcessName() << " is created " << G4endl; >> 73 } >> 74 >> 75 WLSTimeGeneratorProfile = >> 76 new G4WLSTimeGeneratorProfileDelta("WLSTimeGeneratorProfileDelta"); >> 77 64 } 78 } 65 79 66 //....oooOO0OOooo........oooOO0OOooo........oo << 80 //////////////// >> 81 // Destructors >> 82 //////////////// >> 83 67 G4OpWLS::~G4OpWLS() 84 G4OpWLS::~G4OpWLS() 68 { 85 { 69 if(theIntegralTable) << 86 if (theIntegralTable != 0) { 70 { << 71 theIntegralTable->clearAndDestroy(); 87 theIntegralTable->clearAndDestroy(); 72 delete theIntegralTable; 88 delete theIntegralTable; 73 } 89 } 74 delete WLSTimeGeneratorProfile; 90 delete WLSTimeGeneratorProfile; 75 } 91 } 76 92 77 //....oooOO0OOooo........oooOO0OOooo........oo << 93 //////////// 78 void G4OpWLS::PreparePhysicsTable(const G4Part << 94 // Methods >> 95 //////////// 79 96 80 //....oooOO0OOooo........oooOO0OOooo........oo << 97 void G4OpWLS::BuildPhysicsTable(const G4ParticleDefinition&) 81 void G4OpWLS::Initialise() << 82 { 98 { 83 G4OpticalParameters* params = G4OpticalParam << 99 if (!theIntegralTable) BuildThePhysicsTable(); 84 SetVerboseLevel(params->GetWLSVerboseLevel() << 85 UseTimeProfile(params->GetWLSTimeProfile()); << 86 } 100 } 87 101 88 //....oooOO0OOooo........oooOO0OOooo........oo << 102 // PostStepDoIt 89 G4VParticleChange* G4OpWLS::PostStepDoIt(const << 103 // ------------- 90 const << 104 // >> 105 G4VParticleChange* >> 106 G4OpWLS::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep) 91 { 107 { 92 std::vector<G4Track*> proposedSecondaries; << 93 aParticleChange.Initialize(aTrack); 108 aParticleChange.Initialize(aTrack); >> 109 94 aParticleChange.ProposeTrackStatus(fStopAndK 110 aParticleChange.ProposeTrackStatus(fStopAndKill); 95 111 96 if(verboseLevel > 1) << 112 if (verboseLevel>0) { 97 { << 113 G4cout << "\n** Photon absorbed! **" << G4endl; 98 G4cout << "\n** G4OpWLS: Photon absorbed! << 99 } 114 } >> 115 >> 116 const G4Material* aMaterial = aTrack.GetMaterial(); 100 117 101 G4StepPoint* pPostStepPoint = aStep.GetPostS 118 G4StepPoint* pPostStepPoint = aStep.GetPostStepPoint(); 102 G4MaterialPropertiesTable* MPT = << 119 103 aTrack.GetMaterial()->GetMaterialPropertie << 120 G4MaterialPropertiesTable* aMaterialPropertiesTable = 104 if(!MPT) << 121 aMaterial->GetMaterialPropertiesTable(); 105 { << 122 if (!aMaterialPropertiesTable) 106 return G4VDiscreteProcess::PostStepDoIt(aT 123 return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep); 107 } << 124 108 if(!MPT->GetProperty(kWLSCOMPONENT)) << 125 const G4MaterialPropertyVector* WLS_Intensity = 109 { << 126 aMaterialPropertiesTable->GetProperty("WLSCOMPONENT"); >> 127 >> 128 if (!WLS_Intensity) 110 return G4VDiscreteProcess::PostStepDoIt(aT 129 return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep); 111 } << 112 130 113 G4int NumPhotons = 1; 131 G4int NumPhotons = 1; 114 if(MPT->ConstPropertyExists(kWLSMEANNUMBERPH << 132 115 { << 133 if (aMaterialPropertiesTable->ConstPropertyExists("WLSMEANNUMBERPHOTONS")) { 116 G4double MeanNumberOfPhotons = MPT->GetCon << 134 117 NumPhotons = G4int(G4Poi << 135 G4double MeanNumberOfPhotons = aMaterialPropertiesTable-> 118 if(NumPhotons <= 0) << 136 GetConstProperty("WLSMEANNUMBERPHOTONS"); 119 { << 137 120 // return unchanged particle and no seco << 138 NumPhotons = G4int(G4Poisson(MeanNumberOfPhotons)); 121 aParticleChange.SetNumberOfSecondaries(0 << 139 122 return G4VDiscreteProcess::PostStepDoIt( << 140 if (NumPhotons <= 0) { 123 } << 141 >> 142 // return unchanged particle and no secondaries >> 143 >> 144 aParticleChange.SetNumberOfSecondaries(0); >> 145 >> 146 return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep); >> 147 >> 148 } >> 149 124 } 150 } 125 151 126 // Retrieve the WLS Integral for this materi << 152 aParticleChange.SetNumberOfSecondaries(NumPhotons); 127 // new G4PhysicsFreeVector allocated to hold << 153 128 G4double primaryEnergy = aTrack.GetDynamicPa 154 G4double primaryEnergy = aTrack.GetDynamicParticle()->GetKineticEnergy(); 129 G4double WLSTime = 0.; << 130 G4PhysicsFreeVector* WLSIntegral = nullptr; << 131 155 132 WLSTime = MPT->GetConstProperty(kWLSTIME << 156 G4int materialIndex = aMaterial->GetIndex(); 133 WLSIntegral = (G4PhysicsFreeVector*) ((*theI << 134 aTrack.GetMaterial()->GetIndex())); << 135 157 >> 158 // Retrieve the WLS Integral for this material >> 159 // new G4PhysicsOrderedFreeVector allocated to hold CII's >> 160 >> 161 G4double WLSTime = 0.*ns; >> 162 G4PhysicsOrderedFreeVector* WLSIntegral = 0; >> 163 >> 164 WLSTime = aMaterialPropertiesTable-> >> 165 GetConstProperty("WLSTIMECONSTANT"); >> 166 WLSIntegral = >> 167 (G4PhysicsOrderedFreeVector*)((*theIntegralTable)(materialIndex)); >> 168 136 // Max WLS Integral 169 // Max WLS Integral 137 G4double CIImax = WLSIntegral->GetMaxV << 170 >> 171 G4double CIImax = WLSIntegral->GetMaxValue(); >> 172 138 G4int NumberOfPhotons = NumPhotons; 173 G4int NumberOfPhotons = NumPhotons; >> 174 >> 175 for (G4int i = 0; i < NumPhotons; i++) { 139 176 140 for(G4int i = 0; i < NumPhotons; ++i) << 141 { << 142 G4double sampledEnergy; 177 G4double sampledEnergy; >> 178 143 // Make sure the energy of the secondary i 179 // Make sure the energy of the secondary is less than that of the primary 144 for(G4int j = 1; j <= 100; ++j) << 180 145 { << 181 for (G4int j = 1; j <= 100; j++) { 146 // Determine photon energy << 182 147 G4double CIIvalue = G4UniformRand() * CI << 183 // Determine photon energy 148 sampledEnergy = WLSIntegral->GetEner << 184 149 if(sampledEnergy <= primaryEnergy) << 185 G4double CIIvalue = G4UniformRand()*CIImax; 150 break; << 186 sampledEnergy = WLSIntegral->GetEnergy(CIIvalue); 151 } << 187 152 // If no such energy can be sampled, retur << 188 if (verboseLevel>1) { 153 if(sampledEnergy > primaryEnergy) << 189 G4cout << "sampledEnergy = " << sampledEnergy << G4endl; 154 { << 190 G4cout << "CIIvalue = " << CIIvalue << G4endl; 155 if(verboseLevel > 1) << 156 { << 157 G4cout << " *** G4OpWLS: One less WLS << 158 << G4endl; << 159 } << 160 NumberOfPhotons--; << 161 if(NumberOfPhotons == 0) << 162 { << 163 if(verboseLevel > 1) << 164 { << 165 G4cout << 166 << " *** G4OpWLS: No WLS photon ca << 167 << G4endl; << 168 } 191 } 169 // return unchanged particle and no se << 192 170 aParticleChange.SetNumberOfSecondaries << 193 if (sampledEnergy <= primaryEnergy) break; 171 return G4VDiscreteProcess::PostStepDoI << 172 } << 173 continue; << 174 } 194 } 175 else if(verboseLevel > 1) << 195 176 { << 196 // If no such energy can be sampled, return one less secondary, or none 177 G4cout << "G4OpWLS: Created photon with << 197 178 << G4endl; << 198 if (sampledEnergy > primaryEnergy) { >> 199 if (verboseLevel>1) >> 200 G4cout << " *** One less WLS photon will be returned ***" << G4endl; >> 201 NumberOfPhotons--; >> 202 aParticleChange.SetNumberOfSecondaries(NumberOfPhotons); >> 203 if (NumberOfPhotons == 0) { >> 204 if (verboseLevel>1) >> 205 G4cout << " *** No WLS photon can be sampled for this primary ***" >> 206 << G4endl; >> 207 // return unchanged particle and no secondaries >> 208 return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep); >> 209 } >> 210 continue; 179 } 211 } 180 212 181 // Generate random photon direction 213 // Generate random photon direction 182 G4double cost = 1. - 2. * G4UniformRand(); << 214 183 G4double sint = std::sqrt((1. - cost) * (1 << 215 G4double cost = 1. - 2.*G4UniformRand(); 184 G4double phi = twopi * G4UniformRand(); << 216 G4double sint = std::sqrt((1.-cost)*(1.+cost)); >> 217 >> 218 G4double phi = twopi*G4UniformRand(); 185 G4double sinp = std::sin(phi); 219 G4double sinp = std::sin(phi); 186 G4double cosp = std::cos(phi); 220 G4double cosp = std::cos(phi); 187 G4ParticleMomentum photonMomentum(sint * c << 221 188 << 222 G4double px = sint*cosp; 189 G4ThreeVector photonPolarization(cost * co << 223 G4double py = sint*sinp; >> 224 G4double pz = cost; >> 225 >> 226 // Create photon momentum direction vector >> 227 >> 228 G4ParticleMomentum photonMomentum(px, py, pz); >> 229 >> 230 // Determine polarization of new photon >> 231 >> 232 G4double sx = cost*cosp; >> 233 G4double sy = cost*sinp; >> 234 G4double sz = -sint; >> 235 >> 236 G4ThreeVector photonPolarization(sx, sy, sz); >> 237 190 G4ThreeVector perp = photonMomentum.cross( 238 G4ThreeVector perp = photonMomentum.cross(photonPolarization); 191 << 239 192 phi = twopi * G4UniformRand << 240 phi = twopi*G4UniformRand(); 193 sinp = std::sin(phi); << 241 sinp = std::sin(phi); 194 cosp = std::cos(phi); << 242 cosp = std::cos(phi); 195 photonPolarization = (cosp * photonPolariz << 243 196 << 244 photonPolarization = cosp * photonPolarization + sinp * perp; >> 245 >> 246 photonPolarization = photonPolarization.unit(); >> 247 197 // Generate a new photon: 248 // Generate a new photon: 198 auto sec_dp = << 249 199 new G4DynamicParticle(G4OpticalPhoton::O << 250 G4DynamicParticle* aWLSPhoton = 200 sec_dp->SetPolarization(photonPolarization << 251 new G4DynamicParticle(G4OpticalPhoton::OpticalPhoton(), 201 sec_dp->SetKineticEnergy(sampledEnergy); << 252 photonMomentum); 202 << 253 aWLSPhoton->SetPolarization 203 G4double secTime = pPostStepPoint->GetGlob << 254 (photonPolarization.x(), 204 WLSTimeGeneratorProfile << 255 photonPolarization.y(), 205 G4ThreeVector secPos = pPostStepPoint->Get << 256 photonPolarization.z()); 206 G4Track* secTrack = new G4Track(sec_dp, << 257 207 << 258 aWLSPhoton->SetKineticEnergy(sampledEnergy); 208 secTrack->SetTouchableHandle(aTrack.GetTou << 259 209 secTrack->SetParentID(aTrack.GetTrackID()) << 260 // Generate new G4Track object: 210 << 261 211 proposedSecondaries.push_back(secTrack); << 262 // Must give position of WLS optical photon >> 263 >> 264 G4double TimeDelay = WLSTimeGeneratorProfile->GenerateTime(WLSTime); >> 265 G4double aSecondaryTime = (pPostStepPoint->GetGlobalTime()) + TimeDelay; >> 266 >> 267 G4ThreeVector aSecondaryPosition = pPostStepPoint->GetPosition(); >> 268 >> 269 G4Track* aSecondaryTrack = >> 270 new G4Track(aWLSPhoton,aSecondaryTime,aSecondaryPosition); >> 271 >> 272 aSecondaryTrack->SetTouchableHandle(aTrack.GetTouchableHandle()); >> 273 // aSecondaryTrack->SetTouchableHandle((G4VTouchable*)0); >> 274 >> 275 aSecondaryTrack->SetParentID(aTrack.GetTrackID()); >> 276 >> 277 aParticleChange.AddSecondary(aSecondaryTrack); >> 278 } >> 279 >> 280 if (verboseLevel>0) { >> 281 G4cout << "\n Exiting from G4OpWLS::DoIt -- NumberOfSecondaries = " >> 282 << aParticleChange.GetNumberOfSecondaries() << G4endl; 212 } 283 } 213 << 284 214 aParticleChange.SetNumberOfSecondaries((G4in << 215 for(auto sec : proposedSecondaries) << 216 { << 217 aParticleChange.AddSecondary(sec); << 218 } << 219 if(verboseLevel > 1) << 220 { << 221 G4cout << "\n Exiting from G4OpWLS::DoIt - << 222 << aParticleChange.GetNumberOfSecon << 223 } << 224 << 225 return G4VDiscreteProcess::PostStepDoIt(aTra 285 return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep); 226 } 286 } 227 287 228 //....oooOO0OOooo........oooOO0OOooo........oo << 288 // BuildThePhysicsTable for the wavelength shifting process 229 void G4OpWLS::BuildPhysicsTable(const G4Partic << 289 // -------------------------------------------------- 230 { << 290 // 231 if(theIntegralTable) << 232 { << 233 theIntegralTable->clearAndDestroy(); << 234 delete theIntegralTable; << 235 theIntegralTable = nullptr; << 236 } << 237 << 238 const G4MaterialTable* materialTable = G4Mat << 239 std::size_t numOfMaterials = G4Mat << 240 theIntegralTable = new G << 241 291 >> 292 void G4OpWLS::BuildThePhysicsTable() >> 293 { >> 294 if (theIntegralTable) return; >> 295 >> 296 const G4MaterialTable* theMaterialTable = >> 297 G4Material::GetMaterialTable(); >> 298 G4int numOfMaterials = G4Material::GetNumberOfMaterials(); >> 299 >> 300 // create new physics table >> 301 >> 302 if(!theIntegralTable)theIntegralTable = new G4PhysicsTable(numOfMaterials); >> 303 242 // loop for materials 304 // loop for materials 243 for(std::size_t i = 0; i < numOfMaterials; + << 305 244 { << 306 for (G4int i=0 ; i < numOfMaterials; i++) 245 auto physVector = new G4PhysicsFreeVector( << 246 << 247 // Retrieve vector of WLS wavelength inten << 248 // the material from the material's optica << 249 G4MaterialPropertiesTable* MPT = << 250 (*materialTable)[i]->GetMaterialProperti << 251 if(MPT) << 252 { 307 { 253 G4MaterialPropertyVector* wlsVector = MP << 308 G4PhysicsOrderedFreeVector* aPhysicsOrderedFreeVector = 254 if(wlsVector) << 309 new G4PhysicsOrderedFreeVector(); 255 { << 310 256 // Retrieve the first intensity point << 311 // Retrieve vector of WLS wavelength intensity for 257 // of (photon energy, intensity) pairs << 312 // the material from the material's optical properties table. 258 G4double currentIN = (*wlsVector)[0]; << 313 259 if(currentIN >= 0.0) << 314 G4Material* aMaterial = (*theMaterialTable)[i]; 260 { << 315 261 // Create first (photon energy) << 316 G4MaterialPropertiesTable* aMaterialPropertiesTable = 262 G4double currentPM = wlsVector->Ene << 317 aMaterial->GetMaterialPropertiesTable(); 263 G4double currentCII = 0.0; << 318 264 physVector->InsertValues(currentPM, << 319 if (aMaterialPropertiesTable) { 265 << 320 266 // Set previous values to current on << 321 G4MaterialPropertyVector* theWLSVector = 267 G4double prevPM = currentPM; << 322 aMaterialPropertiesTable->GetProperty("WLSCOMPONENT"); 268 G4double prevCII = currentCII; << 323 269 G4double prevIN = currentIN; << 324 if (theWLSVector) { 270 << 325 271 // loop over all (photon energy, int << 326 // Retrieve the first intensity point in vector 272 // pairs stored for this material << 327 // of (photon energy, intensity) pairs 273 for(std::size_t j = 1; j < wlsVector << 328 274 { << 329 G4double currentIN = (*theWLSVector)[0]; 275 currentPM = wlsVector->Energy(j); << 330 276 currentIN = (*wlsVector)[j]; << 331 if (currentIN >= 0.0) { 277 currentCII = << 332 278 prevCII + 0.5 * (currentPM - pre << 333 // Create first (photon energy) 279 << 334 280 physVector->InsertValues(currentPM << 335 G4double currentPM = theWLSVector->Energy(0); 281 << 336 282 prevPM = currentPM; << 337 G4double currentCII = 0.0; 283 prevCII = currentCII; << 338 284 prevIN = currentIN; << 339 aPhysicsOrderedFreeVector-> 285 } << 340 InsertValues(currentPM , currentCII); 286 } << 341 >> 342 // Set previous values to current ones prior to loop >> 343 >> 344 G4double prevPM = currentPM; >> 345 G4double prevCII = currentCII; >> 346 G4double prevIN = currentIN; >> 347 >> 348 // loop over all (photon energy, intensity) >> 349 // pairs stored for this material >> 350 >> 351 for (size_t j = 1; >> 352 j < theWLSVector->GetVectorLength(); >> 353 j++) >> 354 { >> 355 currentPM = theWLSVector->Energy(j); >> 356 currentIN = (*theWLSVector)[j]; >> 357 >> 358 currentCII = 0.5 * (prevIN + currentIN); >> 359 >> 360 currentCII = prevCII + >> 361 (currentPM - prevPM) * currentCII; >> 362 >> 363 aPhysicsOrderedFreeVector-> >> 364 InsertValues(currentPM, currentCII); >> 365 >> 366 prevPM = currentPM; >> 367 prevCII = currentCII; >> 368 prevIN = currentIN; >> 369 } >> 370 } >> 371 } 287 } 372 } >> 373 // The WLS integral for a given material >> 374 // will be inserted in the table according to the >> 375 // position of the material in the material table. >> 376 >> 377 theIntegralTable->insertAt(i,aPhysicsOrderedFreeVector); 288 } 378 } 289 theIntegralTable->insertAt(i, physVector); << 290 } << 291 } 379 } 292 380 293 //....oooOO0OOooo........oooOO0OOooo........oo << 381 // GetMeanFreePath 294 G4double G4OpWLS::GetMeanFreePath(const G4Trac << 382 // --------------- 295 G4ForceCondi << 383 // >> 384 G4double G4OpWLS::GetMeanFreePath(const G4Track& aTrack, >> 385 G4double , >> 386 G4ForceCondition* ) 296 { 387 { 297 G4double thePhotonEnergy = aTrack.GetDynamic << 388 const G4DynamicParticle* aParticle = aTrack.GetDynamicParticle(); 298 G4double attLength = DBL_MAX; << 389 const G4Material* aMaterial = aTrack.GetMaterial(); 299 G4MaterialPropertiesTable* MPT = << 390 300 aTrack.GetMaterial()->GetMaterialPropertie << 391 G4double thePhotonEnergy = aParticle->GetTotalEnergy(); 301 << 392 302 if(MPT) << 393 G4MaterialPropertiesTable* aMaterialPropertyTable; 303 { << 394 G4MaterialPropertyVector* AttenuationLengthVector; 304 G4MaterialPropertyVector* attVector = MPT- << 395 305 if(attVector) << 396 G4double AttenuationLength = DBL_MAX; 306 { << 397 307 attLength = attVector->Value(thePhotonEn << 398 aMaterialPropertyTable = aMaterial->GetMaterialPropertiesTable(); >> 399 >> 400 if ( aMaterialPropertyTable ) { >> 401 AttenuationLengthVector = aMaterialPropertyTable-> >> 402 GetProperty("WLSABSLENGTH"); >> 403 if ( AttenuationLengthVector ){ >> 404 AttenuationLength = AttenuationLengthVector-> >> 405 Value(thePhotonEnergy); >> 406 } >> 407 else { >> 408 // G4cout << "No WLS absorption length specified" << G4endl; 308 } 409 } 309 } 410 } 310 return attLength; << 411 else { >> 412 // G4cout << "No WLS absortion length specified" << G4endl; >> 413 } >> 414 >> 415 return AttenuationLength; 311 } 416 } 312 417 313 //....oooOO0OOooo........oooOO0OOooo........oo << 314 void G4OpWLS::UseTimeProfile(const G4String na 418 void G4OpWLS::UseTimeProfile(const G4String name) 315 { 419 { 316 if(WLSTimeGeneratorProfile) << 420 if (name == "delta") 317 { << 421 { 318 delete WLSTimeGeneratorProfile; << 422 delete WLSTimeGeneratorProfile; 319 WLSTimeGeneratorProfile = nullptr; << 423 WLSTimeGeneratorProfile = 320 } << 424 new G4WLSTimeGeneratorProfileDelta("delta"); 321 if(name == "delta") << 425 } 322 { << 426 else if (name == "exponential") 323 WLSTimeGeneratorProfile = new G4WLSTimeGen << 427 { 324 } << 428 delete WLSTimeGeneratorProfile; 325 else if(name == "exponential") << 429 WLSTimeGeneratorProfile = 326 { << 430 new G4WLSTimeGeneratorProfileExponential("exponential"); 327 WLSTimeGeneratorProfile = << 431 } 328 new G4WLSTimeGeneratorProfileExponential << 329 } << 330 else 432 else 331 { << 433 { 332 G4Exception("G4OpWLS::UseTimeProfile", "em << 434 G4Exception("G4OpWLS::UseTimeProfile", "em0202", 333 "generator does not exist"); << 435 FatalException, 334 } << 436 "generator does not exist"); 335 G4OpticalParameters::Instance()->SetWLSTimeP << 437 } 336 } << 337 << 338 //....oooOO0OOooo........oooOO0OOooo........oo << 339 void G4OpWLS::SetVerboseLevel(G4int verbose) << 340 { << 341 verboseLevel = verbose; << 342 G4OpticalParameters::Instance()->SetWLSVerbo << 343 } 438 } 344 439