Import Geant4 2.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 15:42:07 +02:00
parent 103bda00c8
commit e7d7193284
3106 changed files with 171117 additions and 90550 deletions
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4IMuBremsstrahlung.cc,v 1.2.8.1.2.2 1999/12/09 16:18:02 gcosmo Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4IMuBremsstrahlung.cc,v 1.4 2000/04/25 14:19:00 maire Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// --------------------------------------------------------------
@@ -26,7 +26,7 @@
// constructor
G4IMuBremsstrahlung::G4IMuBremsstrahlung(const G4String& processName)
: G4IMuEnergyLoss("IMuBremsstrahlung"), // initialization
: G4VIMuEnergyLoss("IMuBremsstrahlung"), // initialization
LowestKineticEnergy (1.*keV),
HighestKineticEnergy (1000000.*TeV),
TotBin(200),
@@ -82,7 +82,7 @@ void G4IMuBremsstrahlung::BuildPhysicsTable(const G4ParticleDefinition& aParticl
BuildLambdaTable(aParticleType) ;
G4IMuEnergyLoss::BuildDEDXTable(aParticleType) ;
G4VIMuEnergyLoss::BuildDEDXTable(aParticleType) ;
}
else
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4IMuIonisation.cc,v 1.2.8.1.2.2 1999/12/09 16:18:02 gcosmo Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4IMuIonisation.cc,v 1.4 2000/04/25 14:19:01 maire Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// --------------------------------------------------------------
@@ -31,7 +31,7 @@
// constructor and destructor
G4IMuIonisation::G4IMuIonisation(const G4String& processName)
: G4IMuEnergyLoss("IMuIonisation"),
: G4VIMuEnergyLoss("IMuIonisation"),
LowestKineticEnergy(1.00*keV),
HighestKineticEnergy(1000000.*TeV),
TotBin(200),
@@ -88,7 +88,7 @@ void G4IMuIonisation::BuildPhysicsTable(const G4ParticleDefinition& aParticleTyp
BuildLambdaTable(aParticleType) ;
}
G4IMuEnergyLoss::BuildDEDXTable(aParticleType) ;
G4VIMuEnergyLoss::BuildDEDXTable(aParticleType) ;
}
else
{
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4IMuPairProduction.cc,v 1.2.8.1.2.4 1999/12/12 12:31:20 gracia Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4IMuPairProduction.cc,v 1.5 2000/04/25 14:19:01 maire Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
// $Id:
// --------------------------------------------------------------
@@ -19,7 +19,7 @@
// -------- G4IMuPairProduction physics process ---------
// by Laszlo Urban, May 1998
// **************************************************************
// 04-06-98, in DoIt, secondary production condition: range>min(threshold,safety)
// 04-06-98, in DoIt, secondary production condition: range>G4std::min(threshold,safety)
// --------------------------------------------------------------
#include "G4IMuPairProduction.hh"
@@ -40,7 +40,7 @@ G4double G4IMuPairProduction::proba[5][8][1000]={0.};
// constructor
G4IMuPairProduction::G4IMuPairProduction(const G4String& processName)
: G4IMuEnergyLoss("IMuPairProduction"), // initialization
: G4VIMuEnergyLoss("IMuPairProduction"), // initialization
LowestKineticEnergy (1.*keV),
HighestKineticEnergy (1000000.*TeV),
TotBin(200),
@@ -53,13 +53,13 @@ G4IMuPairProduction::G4IMuPairProduction(const G4String& processName)
theMuonPlus ( G4MuonPlus::MuonPlus() )
{
theMeanFreePathTable = NULL ;
theMeanFreePathTable = NULL ;
G4cout << G4endl ;
G4cout << "****************************************************************" << G4endl;
G4cout << "****************************************************************" << G4endl;
G4cout << "** **" << G4endl;
G4cout << "** G4IMuPairProduction : **" << G4endl;
G4cout << "** G4IMuPairProduction : **" << G4endl;
G4cout << "** cross section/energy loss is calculated using **" << G4endl;
G4cout << "** the accurate cross section formula of R.Kokoulin, **" << G4endl;
G4cout << "** ( building the tables takes a lot of time, **" << G4endl;
@@ -115,7 +115,7 @@ void G4IMuPairProduction::BuildPhysicsTable(const G4ParticleDefinition& aParticl
MakeSamplingTables(&aParticleType) ;
G4IMuEnergyLoss::BuildDEDXTable(aParticleType) ;
G4VIMuEnergyLoss::BuildDEDXTable(aParticleType) ;
}
else
{
@@ -1411,6 +1411,6 @@ G4Element* G4IMuPairProduction::SelectRandomAtom(G4Material* aMaterial) const
if (rval <= (*PartialSumSigma(Index))(i)) return ((*theElementVector)(i));
}
G4cout << " WARNING !!! - The Material '"<< aMaterial->GetName()
<< "' has no elements, NULL pointer returned." << G4endl;
<< "' has no elements, NULL pointer returned." << G4endl;
return NULL;
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4MuBremsstrahlung.cc,v 1.5.8.1.2.1 1999/12/08 17:34:19 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4MuBremsstrahlung.cc,v 1.12 2000/05/23 09:58:48 urban Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// --------------------------------------------------------------
@@ -19,8 +19,9 @@
// -------- G4MuBremsstrahlung physics process ---------
// by Laszlo Urban, September 1997
//
// 08-04-98: remove 'tracking cut' of muon in DoIt, MMa
// 08-04-98: remove 'tracking cut' of muon in oIt, MMa
// 26/10/98: new cross section of R.Kokoulin,cleanup , L.Urban
// 10/02/00 modifications , new e.m. structure, L.Urban
// --------------------------------------------------------------
#include "G4MuBremsstrahlung.hh"
#include "G4UnitsTable.hh"
@@ -31,25 +32,29 @@ G4double G4MuBremsstrahlung::zdat[]={1.,4.,13.,29.,92.};
G4double G4MuBremsstrahlung::adat[]={1.01,9.01,26.98,63.55,238.03};
G4int G4MuBremsstrahlung::ntdat = 8 ;
G4double G4MuBremsstrahlung::tdat[]={1.e3,1.e4,1.e5,1.e6,1.e7,1.e8,1.e9,1.e10};
G4int G4MuBremsstrahlung::NBIN = 100 ; //500 ;
G4double G4MuBremsstrahlung::ya[1000]={0.};
G4double G4MuBremsstrahlung::proba[5][8][1000]={0.};
G4int G4MuBremsstrahlung::NBIN = 1000; // 100 ;
G4double G4MuBremsstrahlung::ya[1001]={0.};
G4double G4MuBremsstrahlung::proba[5][8][1001]={0.};
G4double G4MuBremsstrahlung::CutFixed=1.*keV ;
G4double G4MuBremsstrahlung::LowerBoundLambda = 1.*keV ;
G4double G4MuBremsstrahlung::UpperBoundLambda = 1000000.*TeV ;
G4int G4MuBremsstrahlung::NbinLambda = 150 ;
// constructor
G4MuBremsstrahlung::G4MuBremsstrahlung(const G4String& processName)
: G4MuEnergyLoss(processName),
theMeanFreePathTable(NULL),
LowestKineticEnergy (1.*GeV),
HighestKineticEnergy (1000000.*TeV),
TotBin(100)
: G4VMuEnergyLoss(processName),
theMeanFreePathTable(NULL)
{ }
G4MuBremsstrahlung::~G4MuBremsstrahlung()
{
if (theMeanFreePathTable) {
theMeanFreePathTable->clearAndDestroy();
delete theMeanFreePathTable;
}
if (&PartialSumSigma) {
@@ -57,15 +62,14 @@ G4MuBremsstrahlung::~G4MuBremsstrahlung()
}
}
void G4MuBremsstrahlung::SetPhysicsTableBining(G4double lowE, G4double highE,
G4int nBins)
{
LowestKineticEnergy = lowE; HighestKineticEnergy = highE ; TotBin = nBins ;
}
void G4MuBremsstrahlung::BuildPhysicsTable(
const G4ParticleDefinition& aParticleType)
{
// get bining from EnergyLoss
LowestKineticEnergy = GetLowerBoundEloss() ;
HighestKineticEnergy = GetUpperBoundEloss() ;
TotBin = GetNbinEloss() ;
BuildLossTable(aParticleType) ;
if(&aParticleType==theMuonMinus)
@@ -79,14 +83,14 @@ void G4MuBremsstrahlung::BuildPhysicsTable(
CounterOfmuplusProcess++;
}
if(theMeanFreePathTable == NULL)
if(theMeanFreePathTable == NULL)
MakeSamplingTables(&aParticleType) ;
G4double gammaCutInRange = G4Gamma::Gamma()->GetCuts();
if(gammaCutInRange != lastgammaCutInRange)
BuildLambdaTable(aParticleType) ;
G4MuEnergyLoss::BuildDEDXTable(aParticleType) ;
G4VMuEnergyLoss::BuildDEDXTable(aParticleType) ;
if(&aParticleType == theMuonPlus)
PrintInfoDefinition() ;
@@ -187,6 +191,8 @@ G4double G4MuBremsstrahlung::ComputeBremLoss(
}
}
loss *=hhh*TotalEnergy ;
return loss ;
}
@@ -209,11 +215,12 @@ void G4MuBremsstrahlung::BuildLambdaTable(
G4PhysicsLogVector* ptrVector;
for ( G4int J=0 ; J < G4Material::GetNumberOfMaterials(); J++ )
{
ptrVector=new G4PhysicsLogVector(LowestKineticEnergy, HighestKineticEnergy,
TotBin ) ;
ptrVector = new G4PhysicsLogVector(
LowerBoundLambda,UpperBoundLambda,NbinLambda);
const G4Material* material= (*theMaterialTable)[J];
for ( G4int i = 0 ; i < TotBin ; i++ )
for ( G4int i = 0 ; i < NbinLambda ; i++ )
{
LowEdgeEnergy = ptrVector->GetLowEdgeEnergy( i ) ;
Value = ComputeMeanFreePath( &ParticleType, LowEdgeEnergy,
@@ -296,9 +303,24 @@ G4double G4MuBremsstrahlung::ComputeMicroscopicCrossSection(
AtomicNumber,AtomicMass,ep) ;
}
}
CrossSection *= hhh ;
return CrossSection;
}
G4double G4MuBremsstrahlung::GetDMicroscopicCrossSection(
const G4ParticleDefinition* ParticleType,
G4double KineticEnergy,
G4double AtomicNumber,
G4double AtomicMass,
G4double GammaEnergy)
// get differential cross section
{
return ComputeDMicroscopicCrossSection(ParticleType,KineticEnergy,
AtomicNumber,AtomicMass,GammaEnergy) ;
}
G4double G4MuBremsstrahlung::ComputeDMicroscopicCrossSection(
const G4ParticleDefinition* ParticleType,
G4double KineticEnergy,
@@ -359,7 +381,6 @@ G4double G4MuBremsstrahlung::ComputeDMicroscopicCrossSection(
dxsection = coeff*(1.-v*(1.-0.75*v))*AtomicNumber*(fn*AtomicNumber+fe)/
GammaEnergy ;
return dxsection ;
}
@@ -367,8 +388,6 @@ G4double G4MuBremsstrahlung::ComputeDMicroscopicCrossSection(
void G4MuBremsstrahlung::MakeSamplingTables(
const G4ParticleDefinition* ParticleType)
{
G4double CutFixed = 1.*keV ;
G4double epbin[1000],xbin[1000],prbin[1000] ;
G4int nbin;
G4double AtomicNumber,AtomicWeight,KineticEnergy,
TotalEnergy,Maxep ;
@@ -388,7 +407,7 @@ void G4MuBremsstrahlung::MakeSamplingTables(
G4double CrossSection = 0.0 ;
G4double c,y,ymin,ymax,dy,yy,dx,x,ep ;
G4double c,y,ymin,ymax,dy,yy,dx,x,ep,ybin ;
G4int NbofIntervals ;
// calculate the differential cross section
@@ -417,9 +436,6 @@ void G4MuBremsstrahlung::MakeSamplingTables(
if(nbin<NBIN)
{
nbin += 1 ;
epbin[nbin]=ep;
xbin[nbin]=x;
prbin[nbin]=CrossSection ;
ya[nbin]=y ;
proba[iz][it][nbin] = CrossSection ;
}
@@ -431,8 +447,8 @@ void G4MuBremsstrahlung::MakeSamplingTables(
{
for(G4int ib=0; ib<=nbin; ib++)
{
prbin[ib] /= CrossSection ;
proba[iz][it][ib] /= CrossSection ;
}
}
}
@@ -468,6 +484,11 @@ G4VParticleChange* G4MuBremsstrahlung::PostStepDoIt(const G4Track& trackData,
G4double TotalEnergy=KineticEnergy+aDynamicParticle->
GetDefinition()->GetPDGMass() ;
G4double dy = 5./G4float(NBIN) ;
G4double ymin=log(log(GammaEnergyCut/CutFixed)/log(KineticEnergy/CutFixed)) ;
G4int iymin = G4int((ymin+5.)/dy+0.5) ;
// sampling using tables
G4double v,xc,x,yc,y ;
G4int iZ,iT,iy ;
@@ -500,20 +521,19 @@ G4VParticleChange* G4MuBremsstrahlung::PostStepDoIt(const G4Track& trackData,
G4double r = G4UniformRand() ;
iy = -1 ;
iy = iymin-1 ;
delmin = proba[izz][itt][NBINminus1]-proba[izz][itt][iymin] ;
do {
iy += 1 ;
} while ((proba[izz][itt][iy] < r)&&(iy < NBINminus1)) ;
} while ((r > (proba[izz][itt][iy]-proba[izz][itt][iymin])/delmin)
&&(iy < NBINminus1)) ;
//sampling is Done uniformly in y in the bin
if( iy < NBIN )
y = ya[iy] + G4UniformRand() * ( ya[iy+1] - ya[iy] ) ;
else
y = ya[iy] ;
x = exp(y) ;
v = GammaEnergyCut*exp(x*log(KineticEnergy/GammaEnergyCut)) ;
v = CutFixed*exp(x*log(KineticEnergy/CutFixed)) ;
if( v <= 0.)
return G4VContinuousDiscreteProcess::PostStepDoIt(trackData,stepData);
@@ -575,12 +595,12 @@ G4Element* G4MuBremsstrahlung::SelectRandomAtom(G4Material* aMaterial) const
void G4MuBremsstrahlung::PrintInfoDefinition()
{
G4String comments = "theoretical cross section \n ";
comments += " Good description up to 1000 TeV.";
comments += " Good description up to 1000 PeV.";
G4cout << G4endl << GetProcessName() << ": " << comments
<< "\n PhysicsTables from " << G4BestUnit(LowestKineticEnergy,
<< "\n PhysicsTables from " << G4BestUnit(LowerBoundLambda,
"Energy")
<< " to " << G4BestUnit(HighestKineticEnergy,"Energy")
<< " in " << TotBin << " bins. \n";
<< " to " << G4BestUnit(UpperBoundLambda,"Energy")
<< " in " << NbinLambda << " bins. \n";
}
File diff suppressed because it is too large Load Diff
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4MuIonisation.cc,v 1.4.8.1.2.1 1999/12/08 17:34:19 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4MuIonisation.cc,v 1.11 2000/05/23 09:58:47 urban Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// --------------------------------------------------------------
@@ -24,6 +24,7 @@
// **************************************************************
// 08-04-98: remove 'tracking cut' of the ionizing particle, MMa
// 26/10/98: new stuff from R.Kokoulin + cleanup , L.Urban
// 10/02/00 modifications , new e.m. structure, L.Urban
// --------------------------------------------------------------
@@ -32,14 +33,17 @@
#include "G4ios.hh"
G4double G4MuIonisation::LowerBoundLambda = 1.*keV ;
G4double G4MuIonisation::UpperBoundLambda = 1000000.*TeV ;
G4int G4MuIonisation::NbinLambda = 150 ;
// constructor and destructor
G4MuIonisation::G4MuIonisation(const G4String& processName)
: G4MuEnergyLoss(processName),
LowestKineticEnergy(1.00*keV),
HighestKineticEnergy(1000000.*TeV),
theMeanFreePathTable(NULL),
TotBin(100)
: G4VMuEnergyLoss(processName),
theMeanFreePathTable(NULL)
{ }
G4MuIonisation::~G4MuIonisation()
@@ -51,16 +55,14 @@ G4MuIonisation::~G4MuIonisation()
}
void G4MuIonisation::SetPhysicsTableBining(G4double lowE, G4double highE,
G4int nBins)
{
LowestKineticEnergy = lowE; HighestKineticEnergy = highE;
TotBin = nBins;
}
void G4MuIonisation::BuildPhysicsTable(const G4ParticleDefinition& aParticleType)
// just call BuildLossTable+BuildLambdaTable
{
// get bining from EnergyLoss
LowestKineticEnergy = GetLowerBoundEloss() ;
HighestKineticEnergy = GetUpperBoundEloss() ;
TotBin = GetNbinEloss() ;
BuildLossTable(aParticleType) ;
G4double Charge = aParticleType.GetPDGCharge();
@@ -79,7 +81,7 @@ void G4MuIonisation::BuildPhysicsTable(const G4ParticleDefinition& aParticleType
if(electronCutInRange != lastelectronCutInRange)
BuildLambdaTable(aParticleType) ;
G4MuEnergyLoss::BuildDEDXTable(aParticleType) ;
G4VMuEnergyLoss::BuildDEDXTable(aParticleType) ;
if(&aParticleType == theMuonPlus)
PrintInfoDefinition() ;
@@ -265,7 +267,8 @@ void G4MuIonisation::BuildLambdaTable(const G4ParticleDefinition& aParticleType)
for (G4int J=0 ; J < numOfMaterials; J++)
{
G4PhysicsLogVector* aVector = new G4PhysicsLogVector(
LowestKineticEnergy, HighestKineticEnergy, TotBin);
LowerBoundLambda,UpperBoundLambda,NbinLambda);
const G4Material* material= (*theMaterialTable)[J];
const G4ElementVector* theElementVector=
material->GetElementVector() ;
@@ -275,7 +278,7 @@ void G4MuIonisation::BuildLambdaTable(const G4ParticleDefinition& aParticleType)
material->GetNumberOfElements() ;
DeltaCutInKineticEnergyNow = DeltaCutInKineticEnergy[J] ;
for ( G4int i = 0 ; i < TotBin ; i++ )
for ( G4int i = 0 ; i < NbinLambda ; i++ )
{
LowEdgeEnergy = aVector->GetLowEdgeEnergy(i) ;
sigma = 0. ;
@@ -510,9 +513,9 @@ void G4MuIonisation::PrintInfoDefinition()
comments += " delta ray energy sampled from differential Xsection." ;
G4cout << G4endl << GetProcessName() << ": " << comments
<< "\n PhysicsTables from " << G4BestUnit(LowestKineticEnergy,
<< "\n PhysicsTables from " << G4BestUnit(LowerBoundLambda,
"Energy")
<< " to " << G4BestUnit(HighestKineticEnergy,"Energy")
<< " in " << TotBin << " bins. \n";
<< " to " << G4BestUnit(UpperBoundLambda,"Energy")
<< " in " << NbinLambda << " bins. \n";
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4MuPairProduction.cc,v 1.6.8.1.2.2 1999/12/09 16:18:03 gcosmo Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4MuPairProduction.cc,v 1.15 2000/05/23 09:58:49 urban Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
// --------------------------------------------------------------
// GEANT 4 class implementation file
@@ -18,9 +18,10 @@
// -------- G4MuPairProduction physics process ---------
// by Laszlo Urban, May 1998
// **************************************************************
// 04-06-98, in DoIt,secondary production condition:range>min(threshold,safety)
// 04-06-98, in DoIt,secondary production condition:range>G4std::min(threshold,safety)
// 26/10/98, new stuff from R. Kokoulin + cleanup , L.Urban
// 06/05/99 , bug fixed , L.Urban
// 10/02/00 modifications+bug fix , new e.m. structure, L.Urban
// --------------------------------------------------------------
#include "G4MuPairProduction.hh"
@@ -33,16 +34,19 @@ G4int G4MuPairProduction::nzdat = 5 ;
G4double G4MuPairProduction::zdat[]={1.,4.,13.,26.,92.};
G4int G4MuPairProduction::ntdat = 8 ;
G4double G4MuPairProduction::tdat[]={1.e3,1.e4,1.e5,1.e6,1.e7,1.e8,1.e9,1.e10};
G4int G4MuPairProduction::NBIN = 100 ; //500 ;
G4double G4MuPairProduction::ya[1000]={0.};
G4double G4MuPairProduction::proba[5][8][1000]={0.};
G4int G4MuPairProduction::NBIN = 1000 ; //100 ;
G4double G4MuPairProduction::ya[1001]={0.};
G4double G4MuPairProduction::proba[5][8][1001]={0.};
G4double G4MuPairProduction::MinPairEnergy = 4.*electron_mass_c2 ;
G4double G4MuPairProduction::LowerBoundLambda = 1.*keV ;
G4double G4MuPairProduction::UpperBoundLambda = 1000000.*TeV ;
G4int G4MuPairProduction::NbinLambda = 150 ;
G4MuPairProduction::G4MuPairProduction(const G4String& processName)
: G4MuEnergyLoss(processName),
theMeanFreePathTable(NULL),
LowestKineticEnergy (1.*GeV),
HighestKineticEnergy (1000000.*TeV),
TotBin(50)
: G4VMuEnergyLoss(processName),
theMeanFreePathTable(NULL)
{ }
@@ -58,16 +62,16 @@ G4MuPairProduction::~G4MuPairProduction()
}
}
void G4MuPairProduction::SetPhysicsTableBining(G4double lowE,G4double highE,
G4int nBins)
{
LowestKineticEnergy=lowE; HighestKineticEnergy=highE; TotBin=nBins;
}
void G4MuPairProduction::BuildPhysicsTable(
const G4ParticleDefinition& aParticleType)
// just call BuildLossTable+BuildLambdaTable
{
// get bining from EnergyLoss
LowestKineticEnergy = GetLowerBoundEloss() ;
HighestKineticEnergy = GetUpperBoundEloss() ;
TotBin = GetNbinEloss() ;
BuildLossTable(aParticleType) ;
if(&aParticleType==theMuonMinus)
@@ -89,7 +93,7 @@ void G4MuPairProduction::BuildPhysicsTable(
if(electronCutInRange != lastelectronCutInRange)
BuildLambdaTable(aParticleType) ;
G4MuEnergyLoss::BuildDEDXTable(aParticleType) ;
G4VMuEnergyLoss::BuildDEDXTable(aParticleType) ;
if(&aParticleType==theMuonPlus)
PrintInfoDefinition() ;
@@ -153,7 +157,6 @@ void G4MuPairProduction::BuildLossTable(
}
if(pairloss<0.)
pairloss = 0. ;
aVector->PutValue(i,pairloss);
}
@@ -183,13 +186,17 @@ G4double G4MuPairProduction::ComputePairLoss(
G4double CutInPairEnergy = ElectronEnergyCut+PositronEnergyCut
+2.*electron_mass_c2 ;
G4double MinPairEnergy = 4.*electron_mass_c2 ;
if( CutInPairEnergy <= MinPairEnergy ) return loss ;
G4double MaxPairEnergy = KineticEnergy+ParticleMass*(1.-0.75*sqrte*z13) ;
if(MaxPairEnergy < MinPairEnergy)
MaxPairEnergy = MinPairEnergy ;
if( CutInPairEnergy >= MaxPairEnergy )
CutInPairEnergy = MaxPairEnergy ;
if(CutInPairEnergy <= MinPairEnergy) return loss ;
G4double aaa,bbb,hhh,x,epln,ep ;
G4int kkk ;
// calculate the rectricted loss
@@ -235,13 +242,13 @@ void G4MuPairProduction::BuildLambdaTable(
G4PhysicsLogVector* ptrVector;
for ( G4int J=0 ; J < G4Material::GetNumberOfMaterials(); J++ )
{
ptrVector = new
G4PhysicsLogVector(LowestKineticEnergy, HighestKineticEnergy,
TotBin ) ;
ptrVector = new G4PhysicsLogVector(
LowerBoundLambda,UpperBoundLambda,NbinLambda);
const G4Material* material= (*theMaterialTable)[J];
for ( G4int i = 0 ; i < TotBin ; i++ )
for ( G4int i = 0 ; i < NbinLambda ; i++ )
{
LowEdgeEnergy = ptrVector->GetLowEdgeEnergy( i ) ;
Value = ComputeMeanFreePath( &ParticleType, LowEdgeEnergy,
@@ -313,6 +320,8 @@ G4double G4MuPairProduction::ComputeMicroscopicCrossSection(
CutInPairEnergy = 4.*electron_mass_c2 ;
G4double MaxPairEnergy = KineticEnergy+ParticleMass*(1.-0.75*sqrte*z13) ;
if(MaxPairEnergy < CutInPairEnergy)
MaxPairEnergy = CutInPairEnergy ;
if( CutInPairEnergy >= MaxPairEnergy ) return CrossSection ;
G4double aaa,bbb,hhh,x,epln,ep ;
@@ -345,13 +354,10 @@ G4double G4MuPairProduction::ComputeMicroscopicCrossSection(
void G4MuPairProduction::MakeSamplingTables(
const G4ParticleDefinition* ParticleType)
{
G4double epbin[1000],xbin[1000],prbin[1000] ;
G4int nbin;
G4double AtomicNumber,KineticEnergy,MinPairEnergy ;
G4double AtomicNumber,KineticEnergy ;
G4double c,y,ymin,ymax,dy,yy,dx,x,ep ;
MinPairEnergy = 4.*electron_mass_c2 ;
static const G4double sqrte = sqrt(exp(1.)) ;
for (G4int iz=0; iz<nzdat; iz++)
@@ -387,9 +393,6 @@ void G4MuPairProduction::MakeSamplingTables(
if(nbin<NBIN)
{
nbin += 1 ;
epbin[nbin]=ep;
xbin[nbin]=x;
prbin[nbin]=CrossSection ;
ya[nbin]=y ;
proba[iz][it][nbin] = CrossSection ;
}
@@ -400,8 +403,8 @@ void G4MuPairProduction::MakeSamplingTables(
{
for(G4int ib=0; ib<=nbin; ib++)
{
prbin[ib] /= CrossSection ;
proba[iz][it][ib] /= CrossSection ;
}
}
}
@@ -539,6 +542,15 @@ G4double G4MuPairProduction::ComputeDDMicroscopicCrossSection(
}
G4double G4MuPairProduction::GetDMicroscopicCrossSection(
const G4ParticleDefinition* ParticleType,
G4double KineticEnergy, G4double AtomicNumber,
G4double PairEnergy)
{
return ComputeDMicroscopicCrossSection(ParticleType,KineticEnergy,
AtomicNumber,PairEnergy) ;
}
G4double G4MuPairProduction::ComputeDMicroscopicCrossSection(
const G4ParticleDefinition* ParticleType,
G4double KineticEnergy, G4double AtomicNumber,
@@ -553,13 +565,18 @@ G4double G4MuPairProduction::ComputeDMicroscopicCrossSection(
static const G4double
wgi[] ={ 0.0506,0.1112,0.1569,0.1813,0.1813,0.1569,0.1112,0.0506 };
G4double DCrossSection = 0. ;
G4double TotalEnergy = KineticEnergy + ParticleMass ;
G4double EnergyLoss = TotalEnergy - PairEnergy ;
G4double a = 6.*ParticleMass*ParticleMass/(TotalEnergy*EnergyLoss) ;
G4double b = 4.*electron_mass_c2/PairEnergy ;
if((b+2.*a*(1.-b))/(1.+(1.-a)*sqrt(1.-b)) <= 0.) return DCrossSection ;
G4double tmn=log((b+2.*a*(1.-b))/(1.+(1.-a)*sqrt(1.-b))) ;
G4double DCrossSection = 0. ;
// G4double DCrossSection = 0. ;
G4double ro ;
// Gaussian integration in ln(1-ro) ( with 8 points)
for (G4int i=0; i<7; i++)
@@ -597,7 +614,6 @@ G4VParticleChange* G4MuPairProduction::PostStepDoIt(const G4Track& trackData,
((*G4Positron::Positron()).GetCutsInEnergy())[aMaterial->GetIndex()];
G4double CutInPairEnergy = ElectronEnergyCut + PositronEnergyCut ;
G4double MinPairEnergy = 4.*electron_mass_c2 ;
if (CutInPairEnergy < MinPairEnergy) CutInPairEnergy = MinPairEnergy ;
// check against insufficient energy
@@ -646,13 +662,19 @@ G4VParticleChange* G4MuPairProduction::PostStepDoIt(const G4Track& trackData,
}
}
xc = log(CutInPairEnergy/MinPairEnergy)/log(MaxPairEnergy/MinPairEnergy) ;
yc = log(xc) ;
if( CutInPairEnergy <= MinPairEnergy)
iy = 0 ;
else
{
xc = log(CutInPairEnergy/MinPairEnergy)/log(MaxPairEnergy/MinPairEnergy) ;
yc = log(xc) ;
iy = -1 ;
do {
iy += 1 ;
} while ((ya[iy] < yc )&&(iy < NBINminus1)) ;
iy = -1 ;
do {
iy += 1 ;
} while ((ya[iy] < yc )&&(iy < NBINminus1)) ;
}
G4double norm = proba[izz][itt][iy] ;
G4double r = norm+G4UniformRand()*(1.-norm) ;
@@ -787,19 +809,19 @@ G4Element* G4MuPairProduction::SelectRandomAtom(G4Material* aMaterial) const
if (rval <= (*PartialSumSigma(Index))(i)) return ((*theElementVector)(i));
}
G4cout << " WARNING !!! - The Material '"<< aMaterial->GetName()
<< "' has no elements, NULL pointer returned." << G4endl;
<< "' has no elements, NULL pointer returned." << G4endl;
return NULL;
}
void G4MuPairProduction::PrintInfoDefinition()
{
G4String comments = "theoretical cross sections \n ";
comments += " Good description up to 1000 TeV.";
comments += " Good description up to 1000 PeV.";
G4cout << G4endl << GetProcessName() << ": " << comments
<< "\n PhysicsTables from " << G4BestUnit(LowestKineticEnergy,
<< "\n PhysicsTables from " << G4BestUnit(LowerBoundLambda,
"Energy")
<< " to " << G4BestUnit(HighestKineticEnergy,"Energy")
<< " in " << TotBin << " bins. \n";
<< " to " << G4BestUnit(UpperBoundLambda,"Energy")
<< " in " << NbinLambda << " bins. \n";
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4IMuEnergyLoss.cc,v 1.3.6.1 1999/12/07 20:50:44 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4VIMuEnergyLoss.cc,v 1.1 2000/04/25 14:19:02 maire Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
// $Id:
// --------------------------------------------------------------
@@ -16,7 +16,7 @@
// CERN, CN Division, ASD group
// History: first implementation, based on object model of
// 2nd December 1995, G.Cosmo
// ---------- G4IMuEnergyLoss physics process -----------
// ---------- G4VIMuEnergyLoss physics process -----------
// by Laszlo Urban, September 1997
// **************************************************************
// It is the implementation of the NEW UNIFIED ENERGY LOSS PROCESS.
@@ -27,7 +27,7 @@
// --------------------------------------------------------------
#include "G4IMuEnergyLoss.hh"
#include "G4VIMuEnergyLoss.hh"
#include "G4EnergyLossTables.hh"
#include "G4Poisson.hh"
@@ -41,44 +41,44 @@
// NUMBEROFPROCESSES should be 4 in this case,
// or for debugging purposes.
// The NUMBEROFPROCESSES data member can be changed using the (public static)
// functions Get/Set/Plus/MinusNUMBEROFPROCESSES (see G4IMuEnergyLoss.hh)
// functions Get/Set/Plus/MinusNUMBEROFPROCESSES (see G4VIMuEnergyLoss.hh)
G4int G4IMuEnergyLoss::NUMBEROFPROCESSES = 3 ;
//G4int G4IMuEnergyLoss::NUMBEROFPROCESSES = 2 ;
G4PhysicsTable** G4IMuEnergyLoss::RecorderOfmuplusProcess =
G4int G4VIMuEnergyLoss::NUMBEROFPROCESSES = 3 ;
//G4int G4VIMuEnergyLoss::NUMBEROFPROCESSES = 2 ;
G4PhysicsTable** G4VIMuEnergyLoss::RecorderOfmuplusProcess =
new G4PhysicsTable*[10] ;
G4int G4IMuEnergyLoss::CounterOfmuplusProcess = 0 ;
G4int G4VIMuEnergyLoss::CounterOfmuplusProcess = 0 ;
G4PhysicsTable* G4IMuEnergyLoss::theDEDXmuplusTable = NULL ;
G4PhysicsTable* G4IMuEnergyLoss::theRangemuplusTable = NULL ;
G4PhysicsTable* G4IMuEnergyLoss::theInverseRangemuplusTable = NULL ;
G4PhysicsTable* G4IMuEnergyLoss::theLabTimemuplusTable = NULL ;
G4PhysicsTable* G4IMuEnergyLoss::theProperTimemuplusTable = NULL ;
G4PhysicsTable* G4VIMuEnergyLoss::theDEDXmuplusTable = NULL ;
G4PhysicsTable* G4VIMuEnergyLoss::theRangemuplusTable = NULL ;
G4PhysicsTable* G4VIMuEnergyLoss::theInverseRangemuplusTable = NULL ;
G4PhysicsTable* G4VIMuEnergyLoss::theLabTimemuplusTable = NULL ;
G4PhysicsTable* G4VIMuEnergyLoss::theProperTimemuplusTable = NULL ;
G4double G4IMuEnergyLoss::CutInmupluslossTable = 0. ;
G4double G4IMuEnergyLoss::CutInmuminuslossTable = 0. ;
G4double G4VIMuEnergyLoss::CutInmupluslossTable = 0. ;
G4double G4VIMuEnergyLoss::CutInmuminuslossTable = 0. ;
G4PhysicsTable* G4IMuEnergyLoss::themuplusRangeCoeffATable = NULL ;
G4PhysicsTable* G4IMuEnergyLoss::themuplusRangeCoeffBTable = NULL ;
G4PhysicsTable* G4IMuEnergyLoss::themuplusRangeCoeffCTable = NULL ;
G4PhysicsTable* G4VIMuEnergyLoss::themuplusRangeCoeffATable = NULL ;
G4PhysicsTable* G4VIMuEnergyLoss::themuplusRangeCoeffBTable = NULL ;
G4PhysicsTable* G4VIMuEnergyLoss::themuplusRangeCoeffCTable = NULL ;
G4PhysicsTable** G4IMuEnergyLoss::RecorderOfmuminusProcess =
G4PhysicsTable** G4VIMuEnergyLoss::RecorderOfmuminusProcess =
new G4PhysicsTable*[10] ;
G4int G4IMuEnergyLoss::CounterOfmuminusProcess = 0 ;
G4int G4VIMuEnergyLoss::CounterOfmuminusProcess = 0 ;
G4PhysicsTable* G4IMuEnergyLoss::theDEDXmuminusTable = NULL ;
G4PhysicsTable* G4IMuEnergyLoss::theRangemuminusTable = NULL ;
G4PhysicsTable* G4IMuEnergyLoss::theInverseRangemuminusTable = NULL ;
G4PhysicsTable* G4IMuEnergyLoss::theLabTimemuminusTable = NULL ;
G4PhysicsTable* G4IMuEnergyLoss::theProperTimemuminusTable = NULL ;
G4PhysicsTable* G4VIMuEnergyLoss::theDEDXmuminusTable = NULL ;
G4PhysicsTable* G4VIMuEnergyLoss::theRangemuminusTable = NULL ;
G4PhysicsTable* G4VIMuEnergyLoss::theInverseRangemuminusTable = NULL ;
G4PhysicsTable* G4VIMuEnergyLoss::theLabTimemuminusTable = NULL ;
G4PhysicsTable* G4VIMuEnergyLoss::theProperTimemuminusTable = NULL ;
G4PhysicsTable* G4IMuEnergyLoss::themuminusRangeCoeffATable = NULL ;
G4PhysicsTable* G4IMuEnergyLoss::themuminusRangeCoeffBTable = NULL ;
G4PhysicsTable* G4IMuEnergyLoss::themuminusRangeCoeffCTable = NULL ;
G4PhysicsTable* G4VIMuEnergyLoss::themuminusRangeCoeffATable = NULL ;
G4PhysicsTable* G4VIMuEnergyLoss::themuminusRangeCoeffBTable = NULL ;
G4PhysicsTable* G4VIMuEnergyLoss::themuminusRangeCoeffCTable = NULL ;
// constructor and destructor
G4IMuEnergyLoss::G4IMuEnergyLoss(const G4String& processName)
G4VIMuEnergyLoss::G4VIMuEnergyLoss(const G4String& processName)
: G4IVContinuousDiscreteProcess (processName),
dToverTini(0.20), // max.relative range loss in one Step = 20%
LowestKineticEnergy(1.00*keV),
@@ -102,7 +102,7 @@ G4IMuEnergyLoss::G4IMuEnergyLoss(const G4String& processName)
lastCutInRange = 0. ;
}
G4IMuEnergyLoss::~G4IMuEnergyLoss()
G4VIMuEnergyLoss::~G4VIMuEnergyLoss()
{
if(theLossTable) {
theLossTable->clearAndDestroy();
@@ -114,7 +114,7 @@ G4IMuEnergyLoss::~G4IMuEnergyLoss()
// methods.............................................
void G4IMuEnergyLoss::BuildDEDXTable(
void G4VIMuEnergyLoss::BuildDEDXTable(
const G4ParticleDefinition& aParticleType)
{
ParticleMass = aParticleType.GetPDGMass() ;
@@ -302,7 +302,7 @@ G4IMuEnergyLoss::~G4IMuEnergyLoss()
}
void G4IMuEnergyLoss::BuildRangeTable(
void G4VIMuEnergyLoss::BuildRangeTable(
const G4ParticleDefinition& aParticleType)
// Build range table from the energy loss table
{
@@ -355,7 +355,7 @@ G4IMuEnergyLoss::~G4IMuEnergyLoss()
}
void G4IMuEnergyLoss::BuildTimeTables(
void G4VIMuEnergyLoss::BuildTimeTables(
const G4ParticleDefinition& aParticleType)
// Build time tables from the energy loss table
{
@@ -436,7 +436,7 @@ G4IMuEnergyLoss::~G4IMuEnergyLoss()
void G4IMuEnergyLoss::BuildRangeVector(G4int materialIndex,
void G4VIMuEnergyLoss::BuildRangeVector(G4int materialIndex,
G4PhysicsLogVector* rangeVector)
// create range vector for a material
{
@@ -529,7 +529,7 @@ void G4IMuEnergyLoss::BuildRangeVector(G4int materialIndex,
}
void G4IMuEnergyLoss::BuildLabTimeVector(G4int materialIndex,
void G4VIMuEnergyLoss::BuildLabTimeVector(G4int materialIndex,
G4PhysicsLogVector* timeVector)
// create lab time vector for a material
{
@@ -601,7 +601,7 @@ void G4IMuEnergyLoss::BuildLabTimeVector(G4int materialIndex,
}
void G4IMuEnergyLoss::BuildProperTimeVector(G4int materialIndex,
void G4VIMuEnergyLoss::BuildProperTimeVector(G4int materialIndex,
G4PhysicsLogVector* timeVector)
// create proper time vector for a material
{
@@ -671,7 +671,7 @@ void G4IMuEnergyLoss::BuildProperTimeVector(G4int materialIndex,
}
G4double G4IMuEnergyLoss::RangeIntLin(G4PhysicsVector* physicsVector,
G4double G4VIMuEnergyLoss::RangeIntLin(G4PhysicsVector* physicsVector,
G4int nbin)
// num. integration, linear binning
{
@@ -707,7 +707,7 @@ G4double G4IMuEnergyLoss::RangeIntLin(G4PhysicsVector* physicsVector,
}
G4double G4IMuEnergyLoss::RangeIntLog(G4PhysicsVector* physicsVector,
G4double G4VIMuEnergyLoss::RangeIntLog(G4PhysicsVector* physicsVector,
G4int nbin)
// num. integration, logarithmic binning
{
@@ -744,7 +744,7 @@ G4double G4IMuEnergyLoss::RangeIntLog(G4PhysicsVector* physicsVector,
}
G4double G4IMuEnergyLoss::LabTimeIntLog(G4PhysicsVector* physicsVector,
G4double G4VIMuEnergyLoss::LabTimeIntLog(G4PhysicsVector* physicsVector,
G4int nbin)
// num. integration, logarithmic binning
{
@@ -781,7 +781,7 @@ G4double G4IMuEnergyLoss::LabTimeIntLog(G4PhysicsVector* physicsVector,
}
G4double G4IMuEnergyLoss::ProperTimeIntLog(G4PhysicsVector* physicsVector,
G4double G4VIMuEnergyLoss::ProperTimeIntLog(G4PhysicsVector* physicsVector,
G4int nbin)
// num. integration, logarithmic binning
{
@@ -819,7 +819,7 @@ G4double G4IMuEnergyLoss::ProperTimeIntLog(G4PhysicsVector* physicsVector,
}
void G4IMuEnergyLoss::BuildRangeCoeffATable(
void G4VIMuEnergyLoss::BuildRangeCoeffATable(
const G4ParticleDefinition& aParticleType)
// Build tables of coefficients for the energy loss calculation
{
@@ -906,7 +906,7 @@ void G4IMuEnergyLoss::BuildRangeCoeffATable(
}
void G4IMuEnergyLoss::BuildRangeCoeffBTable(
void G4VIMuEnergyLoss::BuildRangeCoeffBTable(
const G4ParticleDefinition& aParticleType)
// Build tables of coefficients for the energy loss calculation
{
@@ -993,7 +993,7 @@ void G4IMuEnergyLoss::BuildRangeCoeffBTable(
}
}
void G4IMuEnergyLoss::BuildRangeCoeffCTable(
void G4VIMuEnergyLoss::BuildRangeCoeffCTable(
const G4ParticleDefinition& aParticleType)
// Build tables of coefficients for the energy loss calculation
{
@@ -1079,7 +1079,7 @@ void G4IMuEnergyLoss::BuildRangeCoeffCTable(
}
}
void G4IMuEnergyLoss::BuildInverseRangeTable(
void G4VIMuEnergyLoss::BuildInverseRangeTable(
const G4ParticleDefinition& aParticleType)
// Build inverse table of the range table
{
@@ -1145,7 +1145,7 @@ void G4IMuEnergyLoss::BuildRangeCoeffCTable(
}
}
void G4IMuEnergyLoss::InvertRangeVector(G4int materialIndex,
void G4VIMuEnergyLoss::InvertRangeVector(G4int materialIndex,
G4PhysicsLogVector* aVector)
// invert range vector for a material
{
@@ -1197,7 +1197,7 @@ void G4IMuEnergyLoss::InvertRangeVector(G4int materialIndex,
G4VParticleChange* G4IMuEnergyLoss::AlongStepDoIt(
G4VParticleChange* G4VIMuEnergyLoss::AlongStepDoIt(
const G4Track& trackData,const G4Step& stepData)
// compute the energy loss after a Step
{
@@ -1337,7 +1337,7 @@ G4VParticleChange* G4IMuEnergyLoss::AlongStepDoIt(
}
G4double G4IMuEnergyLoss::GetLossWithFluct(const G4DynamicParticle *aParticle,
G4double G4VIMuEnergyLoss::GetLossWithFluct(const G4DynamicParticle *aParticle,
G4Material *aMaterial)
// calculate actual loss from the mean loss
// The model used to get the fluctuation is the same as in
@@ -0,0 +1,454 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VMuEnergyLoss.cc,v 1.5 2000/06/13 16:36:25 maire Exp $
// GEANT4 tag $Name: geant4-02-00 $
// --------------------------------------------------------------
// GEANT 4 class implementation file
//
// For information related to this code contact:
// CERN, CN Division, ASD group
// History: first implementation, based on object model of
// 2nd December 1995, G.Cosmo
// ---------- G4VMuEnergyLoss physics process -----------
// by Laszlo Urban, September 1997
// **************************************************************
// It is the implementation of the NEW UNIFIED ENERGY LOSS PROCESS.
// It calculates the energy loss of muons.
// **************************************************************
//
// corrections by L.Urban on 27/05/98 (other corrs come soon!)
// cleanup L.Urban on 23/10/98
// corrections due to new e.m. structure L.Urban 10/02/00
// --------------------------------------------------------------
#include "G4VMuEnergyLoss.hh"
#include "G4EnergyLossTables.hh"
#include "G4Poisson.hh"
// Initialisation of static members *******************************************
G4int G4VMuEnergyLoss::NbOfProcesses = 3 ;
G4PhysicsTable** G4VMuEnergyLoss::RecorderOfmuplusProcess =
new G4PhysicsTable*[10] ;
G4PhysicsTable** G4VMuEnergyLoss::RecorderOfmuminusProcess =
new G4PhysicsTable*[10] ;
G4int G4VMuEnergyLoss::CounterOfmuplusProcess = 0 ;
G4int G4VMuEnergyLoss::CounterOfmuminusProcess = 0 ;
G4PhysicsTable* G4VMuEnergyLoss::theDEDXmuplusTable = NULL ;
G4PhysicsTable* G4VMuEnergyLoss::theRangemuplusTable = NULL ;
G4PhysicsTable* G4VMuEnergyLoss::theInverseRangemuplusTable = NULL ;
G4PhysicsTable* G4VMuEnergyLoss::theLabTimemuplusTable = NULL ;
G4PhysicsTable* G4VMuEnergyLoss::theProperTimemuplusTable = NULL ;
G4PhysicsTable* G4VMuEnergyLoss::theDEDXmuminusTable = NULL ;
G4PhysicsTable* G4VMuEnergyLoss::theRangemuminusTable = NULL ;
G4PhysicsTable* G4VMuEnergyLoss::theInverseRangemuminusTable = NULL ;
G4PhysicsTable* G4VMuEnergyLoss::theLabTimemuminusTable = NULL ;
G4PhysicsTable* G4VMuEnergyLoss::theProperTimemuminusTable = NULL ;
G4PhysicsTable* G4VMuEnergyLoss::themuplusRangeCoeffATable = NULL ;
G4PhysicsTable* G4VMuEnergyLoss::themuplusRangeCoeffBTable = NULL ;
G4PhysicsTable* G4VMuEnergyLoss::themuplusRangeCoeffCTable = NULL ;
G4PhysicsTable* G4VMuEnergyLoss::themuminusRangeCoeffATable = NULL ;
G4PhysicsTable* G4VMuEnergyLoss::themuminusRangeCoeffBTable = NULL ;
G4PhysicsTable* G4VMuEnergyLoss::themuminusRangeCoeffCTable = NULL ;
G4double G4VMuEnergyLoss::LowerBoundEloss = 1.*keV ;
G4double G4VMuEnergyLoss::UpperBoundEloss = 1000000.*TeV ;
G4int G4VMuEnergyLoss::NbinEloss = 150 ;
G4double G4VMuEnergyLoss::RTable,G4VMuEnergyLoss::LOGRTable;
G4EnergyLossMessenger* G4VMuEnergyLoss::eLossMessenger = NULL ;
// constructor and destructor
G4VMuEnergyLoss::G4VMuEnergyLoss(const G4String& processName)
: G4VEnergyLoss (processName),
theLossTable(NULL),
theRangeCoeffATable(NULL),
theRangeCoeffBTable(NULL),
theRangeCoeffCTable(NULL),
lastgammaCutInRange(0.),
lastelectronCutInRange(0.),
theElectron ( G4Electron::Electron() ),
thePositron ( G4Positron::Positron() ),
theMuonPlus ( G4MuonPlus::MuonPlus() ),
theMuonMinus ( G4MuonMinus::MuonMinus() )
{
}
G4VMuEnergyLoss::~G4VMuEnergyLoss()
{
if(theLossTable) {
theLossTable->clearAndDestroy();
delete theLossTable; theLossTable = NULL;
}
}
void G4VMuEnergyLoss::BuildDEDXTable(
const G4ParticleDefinition& aParticleType)
{
// calculate data members LOGRTable,RTable first
G4double lrate = log(UpperBoundEloss/LowerBoundEloss);
LOGRTable=lrate/NbinEloss;
RTable =exp(LOGRTable);
G4bool MakeTable ;
ParticleMass = aParticleType.GetPDGMass() ;
G4double Charge = aParticleType.GetPDGCharge()/eplus ;
G4double gammaCutInRange = G4Gamma::Gamma()->GetCuts();
G4double electronCutInRange = G4Electron::Electron()->GetCuts();
MakeTable = false ;
// Create tables only if there are new cut values
if((gammaCutInRange == lastgammaCutInRange) &&
(electronCutInRange == lastelectronCutInRange))
{
;
}
else
{
if((Charge > 0.)&&(CounterOfmuplusProcess==NbOfProcesses))
MakeTable = true ;
if((Charge < 0.)&&(CounterOfmuminusProcess==NbOfProcesses))
MakeTable = true ;
}
if( MakeTable )
{
// Build energy loss table as a sum of the energy loss due to the
// different processes.
const G4MaterialTable* theMaterialTable=
G4Material::GetMaterialTable();
G4int numOfMaterials = theMaterialTable->length();
if( Charge >0.)
{
RecorderOfProcess=RecorderOfmuplusProcess;
CounterOfProcess=CounterOfmuplusProcess;
if(CounterOfProcess == NbOfProcesses)
{
if(theDEDXmuplusTable)
{ theDEDXmuplusTable->clearAndDestroy();
delete theDEDXmuplusTable; }
theDEDXmuplusTable = new G4PhysicsTable(numOfMaterials);
theDEDXTable = theDEDXmuplusTable;
}
}
else
{
RecorderOfProcess=RecorderOfmuminusProcess;
CounterOfProcess=CounterOfmuminusProcess;
if(CounterOfProcess == NbOfProcesses)
{
if(theDEDXmuminusTable)
{ theDEDXmuminusTable->clearAndDestroy();
delete theDEDXmuminusTable; }
theDEDXmuminusTable = new G4PhysicsTable(numOfMaterials);
theDEDXTable = theDEDXmuminusTable;
}
}
if(CounterOfProcess == NbOfProcesses)
{
// loop for materials
G4double LowEdgeEnergy , Value ;
G4bool isOutRange ;
G4int J;
G4PhysicsTable* pointer ;
for (J=0; J<numOfMaterials; J++)
{
// create physics vector and fill it
G4PhysicsLogVector* aVector = new G4PhysicsLogVector(
LowerBoundEloss, UpperBoundEloss, NbinEloss);
// loop for the kinetic energy
for (G4int i=0; i<NbinEloss; i++)
{
LowEdgeEnergy = aVector->GetLowEdgeEnergy(i) ;
Value = 0. ;
for (G4int process=0; process < NbOfProcesses; process++)
{
pointer= RecorderOfProcess[process];
Value += (*pointer)[J]->
GetValue(LowEdgeEnergy,isOutRange) ;
}
aVector->PutValue(i,Value) ;
}
theDEDXTable->insert(aVector) ;
}
}
// reset counter to zero ..................
if( Charge >0.)
CounterOfmuplusProcess=0 ;
else
CounterOfmuminusProcess=0 ;
ParticleMass = aParticleType.GetPDGMass() ;
if(Charge > 0.)
{
// Build range table
theRangemuplusTable = BuildRangeTable(
theDEDXmuplusTable,theRangemuplusTable,
LowerBoundEloss,UpperBoundEloss,NbinEloss);
// Build lab/proper time tables
theLabTimemuplusTable = BuildLabTimeTable(theDEDXmuplusTable,
theLabTimemuplusTable,
LowerBoundEloss,UpperBoundEloss,NbinEloss);
theProperTimemuplusTable = BuildProperTimeTable(theDEDXmuplusTable,
theProperTimemuplusTable,
LowerBoundEloss,UpperBoundEloss,NbinEloss);
// Build coeff tables for the energy loss calculation
themuplusRangeCoeffATable = BuildRangeCoeffATable(theRangemuplusTable,
themuplusRangeCoeffATable,
LowerBoundEloss,UpperBoundEloss,NbinEloss);
themuplusRangeCoeffBTable = BuildRangeCoeffBTable(theRangemuplusTable,
themuplusRangeCoeffBTable,
LowerBoundEloss,UpperBoundEloss,NbinEloss);
themuplusRangeCoeffCTable = BuildRangeCoeffCTable(theRangemuplusTable,
themuplusRangeCoeffCTable,
LowerBoundEloss,UpperBoundEloss,NbinEloss);
// invert the range table
theInverseRangemuplusTable = BuildInverseRangeTable(theRangemuplusTable,
themuplusRangeCoeffATable,
themuplusRangeCoeffBTable,
themuplusRangeCoeffCTable,
theInverseRangemuplusTable,
LowerBoundEloss,UpperBoundEloss,NbinEloss);
}
else
{
// Build range table
theRangemuminusTable = BuildRangeTable(
theDEDXmuminusTable,theRangemuminusTable,
LowerBoundEloss,UpperBoundEloss,NbinEloss);
// Build lab/proper time tables
theLabTimemuminusTable = BuildLabTimeTable(theDEDXmuminusTable,
theLabTimemuminusTable,
LowerBoundEloss,UpperBoundEloss,NbinEloss);
theProperTimemuminusTable = BuildProperTimeTable(theDEDXmuminusTable,
theProperTimemuminusTable,
LowerBoundEloss,UpperBoundEloss,NbinEloss);
// Build coeff tables for the energy loss calculation
themuminusRangeCoeffATable = BuildRangeCoeffATable(theRangemuminusTable,
themuminusRangeCoeffATable,
LowerBoundEloss,UpperBoundEloss,NbinEloss);
themuminusRangeCoeffBTable = BuildRangeCoeffBTable(theRangemuminusTable,
themuminusRangeCoeffBTable,
LowerBoundEloss,UpperBoundEloss,NbinEloss);
themuminusRangeCoeffCTable = BuildRangeCoeffCTable(theRangemuminusTable,
themuminusRangeCoeffCTable,
LowerBoundEloss,UpperBoundEloss,NbinEloss);
// invert the range table
theInverseRangemuminusTable = BuildInverseRangeTable(theRangemuminusTable,
themuminusRangeCoeffATable,
themuminusRangeCoeffBTable,
themuminusRangeCoeffCTable,
theInverseRangemuminusTable,
LowerBoundEloss,UpperBoundEloss,NbinEloss);
// invert the range table
}
}
// make the energy loss and the range table available
G4EnergyLossTables::Register(&aParticleType,
(Charge > 0)? theDEDXmuplusTable: theDEDXmuminusTable,
(Charge > 0)? theRangemuplusTable: theRangemuminusTable,
(Charge > 0)? theInverseRangemuplusTable: theInverseRangemuminusTable,
(Charge > 0)? theLabTimemuplusTable: theLabTimemuminusTable,
(Charge > 0)? theProperTimemuplusTable: theProperTimemuminusTable,
LowerBoundEloss, UpperBoundEloss, 1.,NbinEloss);
lastgammaCutInRange = gammaCutInRange ;
lastelectronCutInRange = electronCutInRange ;
}
G4double G4VMuEnergyLoss::GetConstraints(const G4DynamicParticle *aParticle,
G4Material *aMaterial)
{
// returns the Step limit
// dRoverRange is the max. allowed relative range loss in one Step
// it calculates dEdx and the range as well....
G4double KineticEnergy,StepLimit;
G4bool isOutRange ;
G4int index,bin ;
if(aParticle->GetDefinition()->GetPDGCharge()>0.)
{
theDEDXTable = theDEDXmuplusTable ;
theRangeTable = theRangemuplusTable ;
theRangeCoeffATable=themuplusRangeCoeffATable ;
theRangeCoeffBTable=themuplusRangeCoeffBTable ;
theRangeCoeffCTable=themuplusRangeCoeffCTable ;
}
else
{
theDEDXTable = theDEDXmuminusTable ;
theRangeTable = theRangemuminusTable ;
theRangeCoeffATable=themuminusRangeCoeffATable ;
theRangeCoeffBTable=themuminusRangeCoeffBTable ;
theRangeCoeffCTable=themuminusRangeCoeffCTable ;
}
G4double Thigh = UpperBoundEloss/RTable ;
KineticEnergy = aParticle->GetKineticEnergy();
bin = G4int(log(KineticEnergy/LowerBoundEloss)/LOGRTable) ;
EnergyBinNumber = bin ;
index = aMaterial->GetIndex() ;
if( KineticEnergy < LowerBoundEloss )
{
fdEdx = sqrt(KineticEnergy/LowerBoundEloss)*
(*theDEDXTable)(index)->GetValue(LowerBoundEloss,isOutRange) ;
fRangeNow = sqrt(KineticEnergy/LowerBoundEloss)*
(*theRangeTable)(index)->GetValue(LowerBoundEloss,isOutRange) ;
StepLimit = fRangeNow ;
}
else if (KineticEnergy > Thigh )
{
fdEdx = (*theDEDXTable)(index)->GetValue(Thigh,isOutRange);
fRangeNow = (*theRangeTable)(index)->GetValue(Thigh,isOutRange);
if (fdEdx > 0.) fRangeNow += (KineticEnergy-Thigh)/fdEdx;
StepLimit = c1lim*fRangeNow;
}
else
{
fdEdx = (*theDEDXTable)(index)->
GetValue(KineticEnergy,isOutRange) ;
RangeCoeffA = (*(*theRangeCoeffATable)(index))(EnergyBinNumber) ;
RangeCoeffB = (*(*theRangeCoeffBTable)(index))(EnergyBinNumber) ;
RangeCoeffC = (*(*theRangeCoeffCTable)(index))(EnergyBinNumber) ;
fRangeNow = (RangeCoeffA*KineticEnergy+RangeCoeffB)
*KineticEnergy+RangeCoeffC ;
// compute the (random) Step limit ..............
if(fRangeNow>finalRange)
{
StepLimit = c1lim*fRangeNow+c2lim+c3lim/fRangeNow ;
// randomise this value
if(rndmStepFlag) StepLimit = finalRange+(StepLimit-finalRange)*
G4UniformRand() ;
if(StepLimit > fRangeNow) StepLimit = fRangeNow ;
}
else
StepLimit = fRangeNow ;
}
return StepLimit ;
}
G4VParticleChange* G4VMuEnergyLoss::AlongStepDoIt(
const G4Track& trackData,const G4Step& stepData)
{
// compute the energy loss after a Step
static const G4double faclow = 1.5 ;
// get particle and material pointers from trackData
const G4DynamicParticle* aParticle = trackData.GetDynamicParticle();
G4double E = aParticle->GetKineticEnergy() ;
G4double charge = aParticle->GetDefinition()->GetPDGCharge();
G4Material* aMaterial = trackData.GetMaterial();
G4int index = aMaterial->GetIndex();
G4double Step = stepData.GetStepLength();
aParticleChange.Initialize(trackData);
// do not track further if kin.energy < 1. eV
const G4double MinKineticEnergy = 1.*eV;
const G4double linLossLimit = 0.05 ;
G4double MeanLoss, finalT;
if (E < MinKineticEnergy) finalT = 0.;
else if ( E< faclow*LowerBoundEloss)
{
if (Step >= fRangeNow) finalT = 0.;
else finalT = E*(1.-Step/fRangeNow) ;
}
else if (E>=UpperBoundEloss) finalT = E - Step*fdEdx;
else if (Step >= fRangeNow) finalT = 0.;
else
{
if(Step/fRangeNow < linLossLimit) finalT = E-Step*fdEdx ;
else
{
if (charge<0.) finalT = G4EnergyLossTables::GetPreciseEnergyFromRange(
theMuonMinus,fRangeNow-Step,aMaterial);
else finalT = G4EnergyLossTables::GetPreciseEnergyFromRange(
theMuonPlus,fRangeNow-Step,aMaterial);
}
}
if(finalT < MinKineticEnergy) finalT = 0. ;
MeanLoss = E-finalT ;
//now the loss with fluctuation
if ((EnlossFlucFlag) && (finalT > 0.) && (finalT < E)&&(E > LowerBoundEloss))
{
finalT = E-GetLossWithFluct(aParticle,aMaterial,MeanLoss);
if (finalT < 0.) finalT = 0. ;
}
// kill the particle if the kinetic energy <= 0
if (finalT <= 0. )
{
finalT = 0.;
aParticleChange.SetStatusChange(fStopButAlive);
}
aParticleChange.SetNumberOfSecondaries(0);
aParticleChange.SetEnergyChange(finalT);
aParticleChange.SetLocalEnergyDeposit(E-finalT);
return &aParticleChange;
}