Import Geant4 5.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 16:57:27 +02:00
parent 330b82b769
commit 37fff30d2e
5733 changed files with 263867 additions and 74574 deletions
@@ -22,7 +22,7 @@
//
//
// $Id: G4Cerenkov.cc,v 1.13 2002/05/16 21:21:14 gum Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
////////////////////////////////////////////////////////////////////////
// Cerenkov Radiation Class Implementation
@@ -22,7 +22,7 @@
//
//
// $Id: G4ForwardXrayTR.cc,v 1.7 2001/10/24 16:40:54 maire Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
// G4ForwardXrayTR class -- implementation file
@@ -22,7 +22,7 @@
//
//
// $Id: G4GammaXTRadiator.cc,v 1.1 2002/01/22 15:22:53 grichine Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
#include "g4std/complex"
@@ -22,7 +22,7 @@
//
//
// $Id: G4RegularXTRadiator.cc,v 1.2 2002/01/18 17:26:21 grichine Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
#include "g4std/complex"
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4Scintillation.cc,v 1.10 2002/05/16 21:20:11 gum Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4Scintillation.cc,v 1.16 2002/11/26 00:52:13 gum Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
////////////////////////////////////////////////////////////////////////
// Scintillation Light Class Implementation
@@ -33,7 +33,13 @@
// Version: 1.0
// Created: 1998-11-07
// Author: Peter Gumplinger
// Updated: 2002-05-09 by Peter Gumplinger
// Updated: 2002-11-21 by Peter Gumplinger
// > change to use G4Poisson for small MeanNumPhotons
// 2002-11-07 by Peter Gumplinger
// > now allow for fast and slow scintillation component
// 2002-11-05 by Peter Gumplinger
// > now use scintillation constants from G4Material
// 2002-05-09 by Peter Gumplinger
// > use only the PostStepPoint location for the origin of
// scintillation photons when energy is lost to the medium
// by a neutral particle
@@ -70,11 +76,11 @@ G4Scintillation::G4Scintillation(const G4String& processName)
{
fTrackSecondariesFirst = false;
ScintillationYield = 0.0;
ScintillationTime = 0.0;
ResolutionScale = 1.0;
YieldFactor = 1.0;
ExcitationRatio = 1.0;
thePhysicsTable = NULL;
theFastIntegralTable = NULL;
theSlowIntegralTable = NULL;
if (verboseLevel>0) {
G4cout << GetProcessName() << " is created " << G4endl;
@@ -83,20 +89,20 @@ G4Scintillation::G4Scintillation(const G4String& processName)
BuildThePhysicsTable();
}
// G4Scintillation::G4Scintillation(const G4Scintillation &right)
// {
// }
////////////////
// Destructors
////////////////
G4Scintillation::~G4Scintillation()
{
if (thePhysicsTable != NULL) {
thePhysicsTable->clearAndDestroy();
delete thePhysicsTable;
if (theFastIntegralTable != NULL) {
theFastIntegralTable->clearAndDestroy();
delete theFastIntegralTable;
}
if (theSlowIntegralTable != NULL) {
theSlowIntegralTable->clearAndDestroy();
delete theSlowIntegralTable;
}
}
////////////
@@ -123,9 +129,9 @@ G4VParticleChange*
G4Scintillation::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep)
// This routine is called for each tracking step of a charged particle
// in a scintillator. A Gaussian-distributed number of photons is generated
// according to the scintillation yield formula, distributed evenly along
// the track segment and uniformly into 4pi.
// in a scintillator. A Poisson/Gauss-distributed number of photons is
// generated according to the scintillation yield formula, distributed
// evenly along the track segment and uniformly into 4pi.
{
aParticleChange.Initialize(aTrack);
@@ -147,23 +153,42 @@ G4Scintillation::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep)
if (!aMaterialPropertiesTable)
return G4VRestDiscreteProcess::PostStepDoIt(aTrack, aStep);
const G4MaterialPropertyVector* Intensity =
aMaterialPropertiesTable->GetProperty("SCINTILLATION");
if (!Intensity)
return G4VRestDiscreteProcess::PostStepDoIt(aTrack, aStep);
const G4MaterialPropertyVector* Fast_Intensity =
aMaterialPropertiesTable->GetProperty("FASTCOMPONENT");
const G4MaterialPropertyVector* Slow_Intensity =
aMaterialPropertiesTable->GetProperty("SLOWCOMPONENT");
if (!Fast_Intensity && !Slow_Intensity )
return G4VRestDiscreteProcess::PostStepDoIt(aTrack, aStep);
G4int nscnt = 1;
if (Fast_Intensity && Slow_Intensity) nscnt = 2;
G4double ScintillationYield = aMaterialPropertiesTable->
GetConstProperty("SCINTILLATIONYIELD");
G4double ResolutionScale = aMaterialPropertiesTable->
GetConstProperty("RESOLUTIONSCALE");
ScintillationYield = YieldFactor * ScintillationYield;
G4double MeanNumPhotons = ScintillationYield * TotalEnergyDeposit;
G4int NumPhotons = (G4int) MeanNumPhotons +
int( ResolutionScale * G4RandGauss::shoot(0.0,sqrt(MeanNumPhotons)));
G4int NumPhotons;
if (MeanNumPhotons > 10.) {
G4double sigma = ResolutionScale * sqrt(MeanNumPhotons);
NumPhotons = G4int(G4RandGauss::shoot(MeanNumPhotons,sigma)+0.5);
}
else {
NumPhotons = G4int(G4Poisson(MeanNumPhotons));
}
if (NumPhotons <= 0) {
// return unchanged particle and no secondaries
// return unchanged particle and no secondaries
aParticleChange.SetNumberOfSecondaries(0);
return G4VRestDiscreteProcess::PostStepDoIt(aTrack, aStep);
aParticleChange.SetNumberOfSecondaries(0);
return G4VRestDiscreteProcess::PostStepDoIt(aTrack, aStep);
}
////////////////////////////////////////////////////////////////
@@ -182,14 +207,58 @@ G4Scintillation::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep)
// Retrieve the Scintillation Integral for this material
// new G4PhysicsOrderedFreeVector allocated to hold CII's
G4PhysicsOrderedFreeVector* ScintillationIntegral =
(G4PhysicsOrderedFreeVector*)((*thePhysicsTable)(materialIndex));
G4int Num = NumPhotons;
for (G4int scnt = 1; scnt <= nscnt; scnt++) {
G4double ScintillationTime = 0.*ns;
G4PhysicsOrderedFreeVector* ScintillationIntegral = NULL;
if (scnt == 1) {
if (nscnt == 1) {
if(Fast_Intensity){
ScintillationTime = aMaterialPropertiesTable->
GetConstProperty("FASTTIMECONSTANT");
ScintillationIntegral =
(G4PhysicsOrderedFreeVector*)((*theFastIntegralTable)(materialIndex));
}
if(Slow_Intensity){
ScintillationTime = aMaterialPropertiesTable->
GetConstProperty("SLOWTIMECONSTANT");
ScintillationIntegral =
(G4PhysicsOrderedFreeVector*)((*theSlowIntegralTable)(materialIndex));
}
}
else {
G4double YieldRatio = aMaterialPropertiesTable->
GetConstProperty("YIELDRATIO");
if ( ExcitationRatio == 1.0 ) {
Num = G4int (G4std::min(YieldRatio,1.0) * NumPhotons);
}
else {
Num = G4int (G4std::min(ExcitationRatio,1.0) * NumPhotons);
}
ScintillationTime = aMaterialPropertiesTable->
GetConstProperty("FASTTIMECONSTANT");
ScintillationIntegral =
(G4PhysicsOrderedFreeVector*)((*theFastIntegralTable)(materialIndex));
}
}
else {
Num = NumPhotons - Num;
ScintillationTime = aMaterialPropertiesTable->
GetConstProperty("SLOWTIMECONSTANT");
ScintillationIntegral =
(G4PhysicsOrderedFreeVector*)((*theSlowIntegralTable)(materialIndex));
}
if (!ScintillationIntegral) continue;
// Max Scintillation Integral
// Max Scintillation Integral
G4double CIImax = ScintillationIntegral->GetMaxValue();
G4double CIImax = ScintillationIntegral->GetMaxValue();
for (G4int i = 0; i < NumPhotons; i++) {
for (G4int i = 0; i < Num; i++) {
// Determine photon momentum
@@ -281,7 +350,8 @@ G4Scintillation::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep)
aParticleChange.AddSecondary(aSecondaryTrack);
}
}
}
if (verboseLevel>0) {
G4cout << "\n Exiting from G4Scintillation::DoIt -- NumberOfSecondaries = "
@@ -297,7 +367,7 @@ G4Scintillation::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep)
void G4Scintillation::BuildThePhysicsTable()
{
if (thePhysicsTable) return;
if (theFastIntegralTable && theSlowIntegralTable) return;
const G4MaterialTable* theMaterialTable =
G4Material::GetMaterialTable();
@@ -305,7 +375,8 @@ void G4Scintillation::BuildThePhysicsTable()
// create new physics table
thePhysicsTable = new G4PhysicsTable(numOfMaterials);
if(!theFastIntegralTable)theFastIntegralTable = new G4PhysicsTable(numOfMaterials);
if(!theSlowIntegralTable)theSlowIntegralTable = new G4PhysicsTable(numOfMaterials);
// loop for materials
@@ -313,10 +384,11 @@ void G4Scintillation::BuildThePhysicsTable()
{
G4PhysicsOrderedFreeVector* aPhysicsOrderedFreeVector =
new G4PhysicsOrderedFreeVector();
G4PhysicsOrderedFreeVector* bPhysicsOrderedFreeVector =
new G4PhysicsOrderedFreeVector();
// Retrieve vector of scintillation wavelength intensity
// for the material from the material's optical
// properties table
// Retrieve vector of scintillation wavelength intensity for
// the material from the material's optical properties table.
G4Material* aMaterial = (*theMaterialTable)[i];
@@ -325,18 +397,18 @@ void G4Scintillation::BuildThePhysicsTable()
if (aMaterialPropertiesTable) {
G4MaterialPropertyVector* theScintillationLightVector =
aMaterialPropertiesTable->GetProperty("SCINTILLATION");
G4MaterialPropertyVector* theFastLightVector =
aMaterialPropertiesTable->GetProperty("FASTCOMPONENT");
if (theScintillationLightVector) {
if (theFastLightVector) {
// Retrieve the first intensity point in vector
// of (photon momentum, intensity) pairs
theScintillationLightVector->ResetIterator();
++(*theScintillationLightVector); // advance to 1st entry
theFastLightVector->ResetIterator();
++(*theFastLightVector); // advance to 1st entry
G4double currentIN = theScintillationLightVector->
G4double currentIN = theFastLightVector->
GetProperty();
if (currentIN >= 0.0) {
@@ -344,7 +416,7 @@ void G4Scintillation::BuildThePhysicsTable()
// Create first (photon momentum, Scintillation
// Integral pair
G4double currentPM = theScintillationLightVector->
G4double currentPM = theFastLightVector->
GetPhotonMomentum();
G4double currentCII = 0.0;
@@ -361,12 +433,12 @@ void G4Scintillation::BuildThePhysicsTable()
// loop over all (photon momentum, intensity)
// pairs stored for this material
while(++(*theScintillationLightVector))
while(++(*theFastLightVector))
{
currentPM = theScintillationLightVector->
currentPM = theFastLightVector->
GetPhotonMomentum();
currentIN=theScintillationLightVector->
currentIN=theFastLightVector->
GetProperty();
currentCII = 0.5 * (prevIN + currentIN);
@@ -384,14 +456,74 @@ void G4Scintillation::BuildThePhysicsTable()
}
}
G4MaterialPropertyVector* theSlowLightVector =
aMaterialPropertiesTable->GetProperty("SLOWCOMPONENT");
if (theSlowLightVector) {
// Retrieve the first intensity point in vector
// of (photon momentum, intensity) pairs
theSlowLightVector->ResetIterator();
++(*theSlowLightVector); // advance to 1st entry
G4double currentIN = theSlowLightVector->
GetProperty();
if (currentIN >= 0.0) {
// Create first (photon momentum, Scintillation
// Integral pair
G4double currentPM = theSlowLightVector->
GetPhotonMomentum();
G4double currentCII = 0.0;
bPhysicsOrderedFreeVector->
InsertValues(currentPM , currentCII);
// Set previous values to current ones prior to loop
G4double prevPM = currentPM;
G4double prevCII = currentCII;
G4double prevIN = currentIN;
// loop over all (photon momentum, intensity)
// pairs stored for this material
while(++(*theSlowLightVector))
{
currentPM = theSlowLightVector->
GetPhotonMomentum();
currentIN=theSlowLightVector->
GetProperty();
currentCII = 0.5 * (prevIN + currentIN);
currentCII = prevCII +
(currentPM - prevPM) * currentCII;
bPhysicsOrderedFreeVector->
InsertValues(currentPM, currentCII);
prevPM = currentPM;
prevCII = currentCII;
prevIN = currentIN;
}
}
}
}
// The scintillation integral for a given material
// will be inserted in thePhysicsTable
// according to the position of the material in
// the material table.
// The scintillation integral(s) for a given material
// will be inserted in the table(s) according to the
// position of the material in the material table.
thePhysicsTable->insertAt(i,aPhysicsOrderedFreeVector);
theFastIntegralTable->insertAt(i,aPhysicsOrderedFreeVector);
theSlowIntegralTable->insertAt(i,bPhysicsOrderedFreeVector);
}
}
@@ -404,7 +536,7 @@ G4double G4Scintillation::GetMeanFreePath(const G4Track& aTrack,
G4double ,
G4ForceCondition* condition)
{
*condition = Forced;
*condition = StronglyForced;
return DBL_MAX;
@@ -417,7 +549,7 @@ G4double G4Scintillation::GetMeanFreePath(const G4Track& aTrack,
G4double G4Scintillation::GetMeanLifeTime(const G4Track& aTrack,
G4ForceCondition* condition)
{
*condition = Forced;
*condition = StronglyForced;
return DBL_MAX;
@@ -22,7 +22,7 @@
//
//
// $Id: G4TransitionRadiation.cc,v 1.3 2001/07/11 10:03:42 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
// G4TransitionRadiation class -- implementation file
@@ -22,7 +22,7 @@
//
//
// $Id: G4VXTRenergyLoss.cc,v 1.5 2002/03/28 07:58:29 gcosmo Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
#include "G4Timer.hh"