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