Import Geant4 9.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 15:37:50 +02:00
parent a8e9364cea
commit 96c8bcd0af
6923 changed files with 198390 additions and 41849 deletions
@@ -24,19 +24,23 @@
// ********************************************************************
//
//
// $Id: G4Cerenkov.cc,v 1.21 2006/06/29 19:56:03 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// $Id: G4Cerenkov.cc,v 1.23 2007/10/15 20:05:23 gum Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
////////////////////////////////////////////////////////////////////////
// Cerenkov Radiation Class Implementation
////////////////////////////////////////////////////////////////////////
//
// File: G4Cerenkov.cc
// Description: Continuous Process -- Generation of Cerenkov Photons
// Description: Discrete Process -- Generation of Cerenkov Photons
// Version: 2.1
// Created: 1996-02-21
// Author: Juliet Armstrong
// Updated: 2005-08-17 by Peter Gumplinger
// Updated: 2007-09-30 by Peter Gumplinger
// > change inheritance to G4VDiscreteProcess
// GetContinuousStepLimit -> GetMeanFreePath (StronglyForced)
// AlongStepDoIt -> PostStepDoIt
// 2005-08-17 by Peter Gumplinger
// > change variable name MeanNumPhotons -> MeanNumberOfPhotons
// 2005-07-28 by Peter Gumplinger
// > add G4ProcessType to constructor
@@ -81,8 +85,15 @@ using namespace std;
/////////////////
G4Cerenkov::G4Cerenkov(const G4String& processName, G4ProcessType type)
: G4VContinuousProcess(processName, type)
: G4VDiscreteProcess(processName, type)
{
G4cout << "G4Cerenkov::G4Cerenkov constructor" << G4endl;
G4cout << "NOTE: this is now a G4VDiscreteProcess!" << G4endl;
G4cout << "Required change in UserPhysicsList: " << G4endl;
G4cout << "change: pmanager->AddContinuousProcess(theCerenkovProcess);" << G4endl;
G4cout << "to: pmanager->AddProcess(theCerenkovProcess);" << G4endl;
G4cout << " pmanager->SetProcessOrdering(theCerenkovProcess,idxPostStep);" << G4endl;
fTrackSecondariesFirst = false;
fMaxPhotons = 0;
@@ -115,11 +126,11 @@ G4Cerenkov::~G4Cerenkov()
// Methods
////////////
// AlongStepDoIt
// PostStepDoIt
// -------------
//
G4VParticleChange*
G4Cerenkov::AlongStepDoIt(const G4Track& aTrack, const G4Step& aStep)
G4Cerenkov::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep)
// This routine is called for each tracking Step of a charged particle
// in a radiator. A Poisson-distributed number of photons is generated
@@ -129,6 +140,7 @@ G4Cerenkov::AlongStepDoIt(const G4Track& aTrack, const G4Step& aStep)
// they are added to the particle change.
{
//////////////////////////////////////////////////////
// Should we ensure that the material is dispersive?
//////////////////////////////////////////////////////
@@ -148,15 +160,22 @@ G4Cerenkov::AlongStepDoIt(const G4Track& aTrack, const G4Step& aStep)
G4MaterialPropertiesTable* aMaterialPropertiesTable =
aMaterial->GetMaterialPropertiesTable();
if (!aMaterialPropertiesTable)
return G4VContinuousProcess::AlongStepDoIt(aTrack, aStep);
return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
const G4MaterialPropertyVector* Rindex =
aMaterialPropertiesTable->GetProperty("RINDEX");
if (!Rindex)
return G4VContinuousProcess::AlongStepDoIt(aTrack, aStep);
return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
// particle charge
const G4double charge = aParticle->GetDefinition()->GetPDGCharge();
// particle beta
const G4double beta = (pPreStepPoint ->GetBeta() +
pPostStepPoint->GetBeta())/2.;
G4double MeanNumberOfPhotons =
GetAverageNumberOfPhotons(aParticle,aMaterial,Rindex);
GetAverageNumberOfPhotons(charge,beta,aMaterial,Rindex);
if (MeanNumberOfPhotons <= 0.0) {
@@ -164,7 +183,7 @@ G4Cerenkov::AlongStepDoIt(const G4Track& aTrack, const G4Step& aStep)
aParticleChange.SetNumberOfSecondaries(0);
return G4VContinuousProcess::AlongStepDoIt(aTrack, aStep);
return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
}
@@ -181,7 +200,7 @@ G4Cerenkov::AlongStepDoIt(const G4Track& aTrack, const G4Step& aStep)
aParticleChange.SetNumberOfSecondaries(0);
return G4VContinuousProcess::AlongStepDoIt(aTrack, aStep);
return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
}
////////////////////////////////////////////////////////////////
@@ -201,8 +220,7 @@ G4Cerenkov::AlongStepDoIt(const G4Track& aTrack, const G4Step& aStep)
G4double nMax = Rindex->GetMaxProperty();
G4double BetaInverse = aParticle->GetTotalEnergy() /
aParticle->GetTotalMomentum();
G4double BetaInverse = 1./beta;
G4double maxCos = BetaInverse / nMax;
G4double maxSin2 = (1.0 - maxCos) * (1.0 + maxCos);
@@ -311,7 +329,7 @@ G4Cerenkov::AlongStepDoIt(const G4Track& aTrack, const G4Step& aStep)
<< aParticleChange.GetNumberOfSecondaries() << G4endl;
}
return G4VContinuousProcess::AlongStepDoIt(aTrack, aStep);
return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
}
// BuildThePhysicsTable for the Cerenkov process
@@ -418,16 +436,16 @@ void G4Cerenkov::BuildThePhysicsTable()
}
}
// GetContinuousStepLimit
// ----------------------
// GetMeanFreePath
// ---------------
//
G4double
G4Cerenkov::GetContinuousStepLimit(const G4Track& aTrack,
G4double ,
G4double ,
G4double& )
G4double G4Cerenkov::GetMeanFreePath(const G4Track& aTrack,
G4double,
G4ForceCondition* condition)
{
*condition = StronglyForced;
// If user has defined an average maximum number of photons to
// be generated in a Step, then return the Step length for that
// number of photons.
@@ -445,8 +463,15 @@ G4Cerenkov::GetContinuousStepLimit(const G4Track& aTrack,
aMaterialPropertiesTable->GetProperty("RINDEX");
if (!Rindex) return DBL_MAX;
// particle charge
const G4double charge = aParticle->GetDefinition()->GetPDGCharge();
// particle beta
const G4double beta = aParticle->GetTotalMomentum() /
aParticle->GetTotalEnergy();
G4double MeanNumberOfPhotons =
GetAverageNumberOfPhotons(aParticle,aMaterial,Rindex);
GetAverageNumberOfPhotons(charge,beta,aMaterial,Rindex);
if(MeanNumberOfPhotons <= 0.0) return DBL_MAX;
@@ -462,16 +487,16 @@ G4Cerenkov::GetContinuousStepLimit(const G4Track& aTrack,
// ^^^^^^^^^^
G4double
G4Cerenkov::GetAverageNumberOfPhotons(const G4DynamicParticle* aParticle,
G4Cerenkov::GetAverageNumberOfPhotons(const G4double charge,
const G4double beta,
const G4Material* aMaterial,
const G4MaterialPropertyVector* Rindex) const
{
const G4double Rfact = 369.81/(eV * cm);
if(aParticle->GetTotalMomentum() <= 0.0)return 0.0;
if(beta <= 0.0)return 0.0;
G4double BetaInverse = aParticle->GetTotalEnergy() /
aParticle->GetTotalMomentum();
G4double BetaInverse = 1./beta;
// Vectors used in computation of Cerenkov Angle Integral:
// - Refraction Indices for the current material
@@ -536,9 +561,6 @@ G4Cerenkov::GetAverageNumberOfPhotons(const G4DynamicParticle* aParticle,
}
}
// particle charge
G4double charge = aParticle->GetDefinition()->GetPDGCharge();
// Calculate number of photons
G4double NumPhotons = Rfact * charge/eplus * charge/eplus *
(dp - ge * BetaInverse*BetaInverse);
@@ -25,7 +25,7 @@
//
//
// $Id: G4ForwardXrayTR.cc,v 1.14 2007/05/11 14:23:04 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// G4ForwardXrayTR class -- implementation file
@@ -25,7 +25,7 @@
//
//
// $Id: G4GammaXTRadiator.cc,v 1.5 2006/06/29 19:56:07 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
#include <complex>
@@ -25,7 +25,7 @@
//
//
// $Id: G4RegularXTRadiator.cc,v 1.9 2006/06/29 19:56:09 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
#include <complex>
@@ -25,7 +25,7 @@
//
//
// $Id: G4Scintillation.cc,v 1.26 2006/06/29 19:56:11 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
////////////////////////////////////////////////////////////////////////
// Scintillation Light Class Implementation
@@ -24,15 +24,12 @@
// ********************************************************************
//
//
// $Id: G4StrawTubeXTRadiator.cc,v 1.4 2006/06/29 19:56:13 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// $Id: G4StrawTubeXTRadiator.cc,v 1.6 2007/09/29 17:49:34 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
#include <complex>
#include "G4StrawTubeXTRadiator.hh"
#include "Randomize.hh"
#include "G4Gamma.hh"
using namespace std;
@@ -48,42 +45,44 @@ G4StrawTubeXTRadiator::G4StrawTubeXTRadiator(G4LogicalVolume *anEnvelope,
const G4String& processName) :
G4VXTRenergyLoss(anEnvelope,foilMat,gasMat,a,b,1,processName)
{
G4cout<<"Straw tube X-ray TR radiator EM process is called"<<G4endl;
if(verboseLevel > 0)
G4cout<<"Straw tube X-ray TR radiator EM process is called"<<G4endl;
if( unishut )
{
fAlphaPlate = 1./3.;
fAlphaGas = 12.4;
G4cout<<"straw uniform shooting: "<<"fAlphaPlate = "
<<fAlphaPlate<<" ; fAlphaGas = "<<fAlphaGas<<G4endl;
if(verboseLevel > 0)
G4cout<<"straw uniform shooting: "<<"fAlphaPlate = "
<<fAlphaPlate<<" ; fAlphaGas = "<<fAlphaGas<<G4endl;
}
else
{
fAlphaPlate = 0.5;
fAlphaGas = 5.;
G4cout<<"straw isotropical shooting: "<<"fAlphaPlate = "
<<fAlphaPlate<<" ; fAlphaGas = "<<fAlphaGas<<G4endl;
if(verboseLevel > 0)
G4cout<<"straw isotropical shooting: "<<"fAlphaPlate = "
<<fAlphaPlate<<" ; fAlphaGas = "<<fAlphaGas<<G4endl;
}
// index of medium material
fMatIndex3 = mediumMat->GetIndex();
G4cout<<"medium material = "<<mediumMat->GetName()<<G4endl;
if(verboseLevel > 0)
G4cout<<"medium material = "<<mediumMat->GetName()<<G4endl;
// plasma energy squared for plate material
// plasma energy squared for plate material
fSigma3 = fPlasmaCof*mediumMat->GetElectronDensity();
G4cout<<"medium plasma energy = "<<sqrt(fSigma3)/eV<<" eV"<<G4endl;
if(verboseLevel > 0)
G4cout<<"medium plasma energy = "<<sqrt(fSigma3)/eV<<" eV"<<G4endl;
// Compute cofs for preparation of linear photo absorption in external medium
// Compute cofs for preparation of linear photo absorption in external medium
ComputeMediumPhotoAbsCof();
// Build energy and angular integral spectra of X-ray TR photons from
// a radiator
@@ -94,11 +93,8 @@ G4StrawTubeXTRadiator::G4StrawTubeXTRadiator(G4LogicalVolume *anEnvelope,
G4StrawTubeXTRadiator::~G4StrawTubeXTRadiator()
{
;
}
///////////////////////////////////////////////////////////////////////////
//
// Approximation for radiator interference factor for the case of
@@ -121,7 +117,6 @@ G4StrawTubeXTRadiator::GetStackFactor( G4double energy,
M2 = GetPlateLinearPhotoAbs(energy);
M3 = GetGasLinearPhotoAbs(energy);
G4complex C2(1.0 + 0.5*fPlateThick*M2/fAlphaPlate, fPlateThick/L2/fAlphaPlate);
G4complex C3(1.0 + 0.5*fGasThick*M3/fAlphaGas, fGasThick/L3/fAlphaGas);
@@ -189,47 +184,9 @@ G4complex G4StrawTubeXTRadiator::GetMediumComplexFZ( G4double omega ,
void G4StrawTubeXTRadiator::ComputeMediumPhotoAbsCof()
{
G4int i, j, numberOfElements;
static const G4MaterialTable*
theMaterialTable = G4Material::GetMaterialTable();
G4SandiaTable thisMaterialSandiaTable(fMatIndex3);
numberOfElements = (*theMaterialTable)[fMatIndex3]->GetNumberOfElements();
G4int* thisMaterialZ = new G4int[numberOfElements];
for(i=0;i<numberOfElements;i++)
{
thisMaterialZ[i] = (G4int)(*theMaterialTable)[fMatIndex3]->
GetElement(i)->GetZ() ;
}
fMediumIntervalNumber = thisMaterialSandiaTable.SandiaIntervals
(thisMaterialZ,numberOfElements) ;
fMediumIntervalNumber = thisMaterialSandiaTable.SandiaMixing
( thisMaterialZ ,
(*theMaterialTable)[fMatIndex3]->GetFractionVector() ,
numberOfElements,fMediumIntervalNumber);
fMediumPhotoAbsCof = new G4double*[fMediumIntervalNumber];
for(i=0;i<fMediumIntervalNumber;i++)
{
fMediumPhotoAbsCof[i] = new G4double[5];
}
for(i=0;i<fMediumIntervalNumber;i++)
{
fMediumPhotoAbsCof[i][0] = thisMaterialSandiaTable.
GetPhotoAbsorpCof(i+1,0);
for(j=1;j<5;j++)
{
fMediumPhotoAbsCof[i][j] = thisMaterialSandiaTable.
GetPhotoAbsorpCof(i+1,j)*
(*theMaterialTable)[fMatIndex3]->GetDensity();
}
}
delete[] thisMaterialZ;
return;
const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable();
const G4Material* mat = (*theMaterialTable)[fMatIndex3];
fMediumPhotoAbsCof = mat->GetSandiaTable();
}
//////////////////////////////////////////////////////////////////////
@@ -239,30 +196,19 @@ void G4StrawTubeXTRadiator::ComputeMediumPhotoAbsCof()
G4double G4StrawTubeXTRadiator::GetMediumLinearPhotoAbs(G4double omega)
{
G4int i ;
G4double omega2, omega3, omega4;
omega2 = omega*omega;
omega3 = omega2*omega;
omega4 = omega2*omega2;
for(i=0;i<fMediumIntervalNumber;i++)
{
if( omega < fMediumPhotoAbsCof[i][0] ) break;
}
if( i == 0 )
{
G4Exception("Invalid (<I1) energy in G4VXTRenergyLoss::GetMediumLinearPhotoAbs");
}
else i-- ;
return fMediumPhotoAbsCof[i][1]/omega + fMediumPhotoAbsCof[i][2]/omega2 +
fMediumPhotoAbsCof[i][3]/omega3 + fMediumPhotoAbsCof[i][4]/omega4 ;
G4double* SandiaCof = fMediumPhotoAbsCof->GetSandiaCofForMaterial(omega);
G4double cross = SandiaCof[0]/omega + SandiaCof[1]/omega2 +
SandiaCof[2]/omega3 + SandiaCof[3]/omega4;
return cross;
}
//
//
////////////////////////////////////////////////////////////////////////////
@@ -25,7 +25,7 @@
//
//
// $Id: G4SynchrotronRadiation.cc,v 1.5 2006/06/29 19:56:15 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// --------------------------------------------------------------
// GEANT 4 class implementation file
@@ -25,7 +25,7 @@
//
//
// $Id: G4SynchrotronRadiationInMat.cc,v 1.2 2006/06/29 19:56:17 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// --------------------------------------------------------------
// GEANT 4 class implementation file
@@ -25,7 +25,7 @@
//
//
// $Id: G4TransitionRadiation.cc,v 1.7 2006/06/29 19:56:19 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// G4TransitionRadiation class -- implementation file
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4TransparentRegXTRadiator.cc,v 1.10 2006/06/29 19:56:21 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// $Id: G4TransparentRegXTRadiator.cc,v 1.11 2007/09/29 17:49:34 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
#include <complex>
@@ -47,7 +47,8 @@ G4TransparentRegXTRadiator::G4TransparentRegXTRadiator(G4LogicalVolume *anEnvelo
const G4String& processName) :
G4VXTRenergyLoss(anEnvelope,foilMat,gasMat,a,b,n,processName)
{
G4cout<<"Regular transparent X-ray TR radiator EM process is called"<<G4endl;
if(verboseLevel > 0)
G4cout<<"Regular transparent X-ray TR radiator EM process is called"<<G4endl;
// Build energy and angular integral spectra of X-ray TR photons from
// a radiator
@@ -120,7 +121,7 @@ G4double G4TransparentRegXTRadiator::SpectralXTRdEdx(G4double energy)
{
sum += sin(tmp)*sin(tmp)*abs(k-cofMin)/result;
}
if(fVerbose > 2)
if(verboseLevel > 2)
{
G4cout<<"k = "<<k<<"; tmp = "<<sin(tmp)*sin(tmp)*abs(k-cofMin)/result
<<"; sum = "<<sum<<G4endl;
@@ -25,7 +25,7 @@
//
//
// $Id: G4VTransitionRadiation.cc,v 1.5 2006/06/29 19:56:23 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// G4VTransitionRadiation class -- implementation file
File diff suppressed because it is too large Load Diff