Changeset 1315 for trunk/source/processes/electromagnetic/xrays/src
- Timestamp:
- Jun 18, 2010, 11:42:07 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/processes/electromagnetic/xrays/src/G4Scintillation.cc
r1228 r1315 25 25 // 26 26 // 27 // $Id: G4Scintillation.cc,v 1.3 0 2008/10/22 01:19:11gum Exp $28 // GEANT4 tag $Name: geant4-09-0 3$27 // $Id: G4Scintillation.cc,v 1.31 2010/05/27 20:49:40 gum Exp $ 28 // GEANT4 tag $Name: geant4-09-04-beta-cand-01 $ 29 29 // 30 30 //////////////////////////////////////////////////////////////////////// … … 37 37 // Created: 1998-11-07 38 38 // Author: Peter Gumplinger 39 // Updated: 2005-08-17 by Peter Gumplinger 39 // Updated: 2010-92-22 by Peter Gumplinger 40 // > scintillation rise time included, thanks to 41 // > Martin Goettlich/DESY 42 // 2005-08-17 by Peter Gumplinger 40 43 // > change variable name MeanNumPhotons -> MeanNumberOfPhotons 41 44 // 2005-07-28 by Peter Gumplinger … … 93 96 94 97 fTrackSecondariesFirst = false; 98 fFiniteRiseTime = false; 95 99 96 100 YieldFactor = 1.0; … … 248 252 249 253 G4double ScintillationTime = 0.*ns; 254 G4double ScintillationRiseTime = 0.*ns; 250 255 G4PhysicsOrderedFreeVector* ScintillationIntegral = NULL; 251 256 … … 255 260 ScintillationTime = aMaterialPropertiesTable-> 256 261 GetConstProperty("FASTTIMECONSTANT"); 262 if (fFiniteRiseTime) { 263 ScintillationRiseTime = aMaterialPropertiesTable-> 264 GetConstProperty("FASTSCINTILLATIONRISETIME"); 265 } 257 266 ScintillationIntegral = 258 267 (G4PhysicsOrderedFreeVector*)((*theFastIntegralTable)(materialIndex)); … … 261 270 ScintillationTime = aMaterialPropertiesTable-> 262 271 GetConstProperty("SLOWTIMECONSTANT"); 272 if (fFiniteRiseTime) { 273 ScintillationRiseTime = aMaterialPropertiesTable-> 274 GetConstProperty("SLOWSCINTILLATIONRISETIME"); } 263 275 ScintillationIntegral = 264 276 (G4PhysicsOrderedFreeVector*)((*theSlowIntegralTable)(materialIndex)); … … 276 288 ScintillationTime = aMaterialPropertiesTable-> 277 289 GetConstProperty("FASTTIMECONSTANT"); 290 if (fFiniteRiseTime) { 291 ScintillationRiseTime = aMaterialPropertiesTable-> 292 GetConstProperty("FASTSCINTILLATIONRISETIME"); 293 } 278 294 ScintillationIntegral = 279 295 (G4PhysicsOrderedFreeVector*)((*theFastIntegralTable)(materialIndex)); … … 284 300 ScintillationTime = aMaterialPropertiesTable-> 285 301 GetConstProperty("SLOWTIMECONSTANT"); 302 if (fFiniteRiseTime) { 303 ScintillationRiseTime = aMaterialPropertiesTable-> 304 GetConstProperty("SLOWSCINTILLATIONRISETIME"); 305 } 286 306 ScintillationIntegral = 287 307 (G4PhysicsOrderedFreeVector*)((*theSlowIntegralTable)(materialIndex)); … … 369 389 pPostStepPoint->GetVelocity())/2.); 370 390 371 deltaTime = deltaTime - 372 ScintillationTime * log( G4UniformRand() ); 391 // emission time distribution 392 if (ScintillationRiseTime==0.0) { 393 deltaTime = deltaTime - 394 ScintillationTime * log( G4UniformRand() ); 395 } else { 396 deltaTime = deltaTime + 397 sample_time(ScintillationRiseTime, ScintillationTime); 398 } 373 399 374 400 G4double aSecondaryTime = t0 + deltaTime; … … 592 618 593 619 } 620 621 G4double G4Scintillation::sample_time(G4double tau1, G4double tau2) 622 { 623 // tau1: rise time and tau2: decay time 624 625 while(1) { 626 // two random numbers 627 G4double ran1 = G4UniformRand(); 628 G4double ran2 = G4UniformRand(); 629 // 630 // exponential distribution as envelope function: very efficient 631 // 632 G4double d = (tau1+tau2)/tau2; 633 // make sure the envelope function is 634 // always larger than the bi-exponential 635 G4double t = -1.0*tau2*log(1-ran1); 636 G4double g = d*single_exp(t,tau2); 637 if (ran2 <= bi_exp(t,tau1,tau2)/g) return t; 638 } 639 return -1.0; 640 }
Note: See TracChangeset
for help on using the changeset viewer.