Ignore:
Timestamp:
Jun 18, 2010, 11:42:07 AM (14 years ago)
Author:
garnier
Message:

update geant4-09-04-beta-cand-01 interfaces-V09-03-09 vis-V09-03-08

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/processes/electromagnetic/xrays/src/G4Scintillation.cc

    r1228 r1315  
    2525//
    2626//
    27 // $Id: G4Scintillation.cc,v 1.30 2008/10/22 01:19:11 gum Exp $
    28 // GEANT4 tag $Name: geant4-09-03 $
     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 $
    2929//
    3030////////////////////////////////////////////////////////////////////////
     
    3737// Created:     1998-11-07 
    3838// 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
    4043//              > change variable name MeanNumPhotons -> MeanNumberOfPhotons
    4144//              2005-07-28 by Peter Gumplinger
     
    9396
    9497        fTrackSecondariesFirst = false;
     98        fFiniteRiseTime = false;
    9599
    96100        YieldFactor = 1.0;
     
    248252
    249253            G4double ScintillationTime = 0.*ns;
     254            G4double ScintillationRiseTime = 0.*ns;
    250255            G4PhysicsOrderedFreeVector* ScintillationIntegral = NULL;
    251256
     
    255260                   ScintillationTime   = aMaterialPropertiesTable->
    256261                                           GetConstProperty("FASTTIMECONSTANT");
     262                   if (fFiniteRiseTime) {
     263                      ScintillationRiseTime = aMaterialPropertiesTable->
     264                                  GetConstProperty("FASTSCINTILLATIONRISETIME");
     265                   }
    257266                   ScintillationIntegral =
    258267                   (G4PhysicsOrderedFreeVector*)((*theFastIntegralTable)(materialIndex));
     
    261270                   ScintillationTime   = aMaterialPropertiesTable->
    262271                                           GetConstProperty("SLOWTIMECONSTANT");
     272                   if (fFiniteRiseTime) {
     273                      ScintillationRiseTime = aMaterialPropertiesTable->
     274                                  GetConstProperty("SLOWSCINTILLATIONRISETIME");                   }
    263275                   ScintillationIntegral =
    264276                   (G4PhysicsOrderedFreeVector*)((*theSlowIntegralTable)(materialIndex));
     
    276288                 ScintillationTime   = aMaterialPropertiesTable->
    277289                                          GetConstProperty("FASTTIMECONSTANT");
     290                 if (fFiniteRiseTime) {
     291                      ScintillationRiseTime = aMaterialPropertiesTable->
     292                                 GetConstProperty("FASTSCINTILLATIONRISETIME");
     293                 }
    278294                 ScintillationIntegral =
    279295                  (G4PhysicsOrderedFreeVector*)((*theFastIntegralTable)(materialIndex));
     
    284300               ScintillationTime   =   aMaterialPropertiesTable->
    285301                                          GetConstProperty("SLOWTIMECONSTANT");
     302               if (fFiniteRiseTime) {
     303                    ScintillationRiseTime = aMaterialPropertiesTable->
     304                                 GetConstProperty("SLOWSCINTILLATIONRISETIME");
     305               }
    286306               ScintillationIntegral =
    287307                  (G4PhysicsOrderedFreeVector*)((*theSlowIntegralTable)(materialIndex));
     
    369389                         pPostStepPoint->GetVelocity())/2.);
    370390
    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                }
    373399
    374400                G4double aSecondaryTime = t0 + deltaTime;
     
    592618
    593619}
     620
     621G4double 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.