Import Geant4 7.1.0 source tree
This commit is contained in:
@@ -20,8 +20,8 @@
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4VEmProcess.cc,v 1.15 2004/11/10 14:37:25 vnivanch Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
// $Id: G4VEmProcess.cc,v 1.30 2005/05/30 08:22:38 vnivanch Exp $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
//
|
||||
@@ -37,12 +37,15 @@
|
||||
// Modifications:
|
||||
// 30-06-04 make it to be pure discrete process (V.Ivanchenko)
|
||||
// 30-09-08 optimise integral option (V.Ivanchenko)
|
||||
// 08-11-04 Migration to new interface of Store/Retrieve tables (V.Ivantchenko)
|
||||
// 08-11-04 Migration to new interface of Store/Retrieve tables (V.Ivanchenko)
|
||||
// 11-03-05 Shift verbose level by 1, add applyCuts and killPrimary flags (V.Ivanchenko)
|
||||
// 14-03-05 Update logic PostStepDoIt (V.Ivanchenko)
|
||||
// 08-04-05 Major optimisation of internal interfaces (V.Ivantchenko)
|
||||
// 18-04-05 Use G4ParticleChangeForGamma (V.Ivantchenko)
|
||||
//
|
||||
//
|
||||
// Class Description:
|
||||
//
|
||||
// It is the unified process for e+ annililation at rest and in fly.
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
//
|
||||
@@ -66,6 +69,7 @@
|
||||
#include "G4Electron.hh"
|
||||
#include "G4Positron.hh"
|
||||
#include "G4PhysicsTableHelper.hh"
|
||||
#include "G4NistManager.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
@@ -82,11 +86,17 @@ G4VEmProcess::G4VEmProcess(const G4String& name, G4ProcessType type):
|
||||
integral(false),
|
||||
meanFreePath(true),
|
||||
aboveCSmax(true),
|
||||
buildLambdaTable(true)
|
||||
buildLambdaTable(true),
|
||||
applyCuts(false),
|
||||
startFromNull(true),
|
||||
nRegions(0)
|
||||
{
|
||||
|
||||
minKinEnergy = 0.1*keV;
|
||||
maxKinEnergy = 100.0*GeV;
|
||||
SetVerboseLevel(1);
|
||||
minKinEnergy = 0.1*keV;
|
||||
maxKinEnergy = 100.0*GeV;
|
||||
theGamma = G4Gamma::Gamma();
|
||||
theElectron = G4Electron::Electron();
|
||||
thePositron = G4Positron::Positron();
|
||||
|
||||
pParticleChange = &fParticleChange;
|
||||
|
||||
@@ -99,6 +109,7 @@ G4VEmProcess::G4VEmProcess(const G4String& name, G4ProcessType type):
|
||||
G4VEmProcess::~G4VEmProcess()
|
||||
{
|
||||
Clear();
|
||||
if(theLambdaTable) theLambdaTable->clearAndDestroy();
|
||||
delete modelManager;
|
||||
(G4LossTableManager::Instance())->DeRegister(this);
|
||||
}
|
||||
@@ -108,9 +119,17 @@ G4VEmProcess::~G4VEmProcess()
|
||||
void G4VEmProcess::PreparePhysicsTable(const G4ParticleDefinition& part)
|
||||
{
|
||||
if(!particle) particle = ∂
|
||||
if(1 < verboseLevel) {
|
||||
G4cout << "G4VEmProcess::PreparePhysicsTable() for "
|
||||
<< GetProcessName()
|
||||
<< " and particle " << part.GetParticleName()
|
||||
<< " local particle " << particle->GetParticleName()
|
||||
<< G4endl;
|
||||
}
|
||||
|
||||
if(particle == &part) {
|
||||
Clear();
|
||||
InitialiseProcess(particle);
|
||||
theCutsGamma =
|
||||
modelManager->Initialise(particle,secondaryParticle,2.,verboseLevel);
|
||||
const G4ProductionCutsTable* theCoupleTable=
|
||||
@@ -142,10 +161,11 @@ void G4VEmProcess::Clear()
|
||||
|
||||
void G4VEmProcess::BuildPhysicsTable(const G4ParticleDefinition& part)
|
||||
{
|
||||
if(0 < verboseLevel) {
|
||||
if(1 < verboseLevel) {
|
||||
G4cout << "G4VEmProcess::BuildPhysicsTable() for "
|
||||
<< GetProcessName()
|
||||
<< " and particle " << part.GetParticleName()
|
||||
<< " buildLambdaTable= " << buildLambdaTable
|
||||
<< G4endl;
|
||||
}
|
||||
|
||||
@@ -153,9 +173,9 @@ void G4VEmProcess::BuildPhysicsTable(const G4ParticleDefinition& part)
|
||||
BuildLambdaTable();
|
||||
FindLambdaMax();
|
||||
}
|
||||
if(-1 < verboseLevel) PrintInfoDefinition();
|
||||
if(0 < verboseLevel) PrintInfoDefinition();
|
||||
|
||||
if(0 < verboseLevel) {
|
||||
if(1 < verboseLevel) {
|
||||
G4cout << "G4VEmProcess::BuildPhysicsTable() done for "
|
||||
<< GetProcessName()
|
||||
<< " and particle " << part.GetParticleName()
|
||||
@@ -167,7 +187,7 @@ void G4VEmProcess::BuildPhysicsTable(const G4ParticleDefinition& part)
|
||||
|
||||
void G4VEmProcess::BuildLambdaTable()
|
||||
{
|
||||
if(0 < verboseLevel) {
|
||||
if(1 < verboseLevel) {
|
||||
G4cout << "G4VEnergyLossSTD::BuildLambdaTable() for process "
|
||||
<< GetProcessName() << " and particle "
|
||||
<< particle->GetParticleName()
|
||||
@@ -178,7 +198,6 @@ void G4VEmProcess::BuildLambdaTable()
|
||||
const G4ProductionCutsTable* theCoupleTable=
|
||||
G4ProductionCutsTable::GetProductionCutsTable();
|
||||
size_t numOfCouples = theCoupleTable->GetTableSize();
|
||||
|
||||
for(size_t i=0; i<numOfCouples; i++) {
|
||||
|
||||
if (theLambdaTable->GetFlag(i)) {
|
||||
@@ -186,12 +205,12 @@ void G4VEmProcess::BuildLambdaTable()
|
||||
// create physics vector and fill it
|
||||
const G4MaterialCutsCouple* couple = theCoupleTable->GetMaterialCutsCouple(i);
|
||||
G4PhysicsVector* aVector = LambdaPhysicsVector(couple);
|
||||
modelManager->FillLambdaVector(aVector, couple);
|
||||
modelManager->FillLambdaVector(aVector, couple, startFromNull);
|
||||
G4PhysicsTableHelper::SetPhysicsVector(theLambdaTable, i, aVector);
|
||||
}
|
||||
}
|
||||
|
||||
if(0 < verboseLevel) {
|
||||
if(1 < verboseLevel) {
|
||||
G4cout << "Lambda table is built for "
|
||||
<< particle->GetParticleName()
|
||||
<< G4endl;
|
||||
@@ -220,6 +239,7 @@ void G4VEmProcess::SetSecondaryParticle(const G4ParticleDefinition* p)
|
||||
void G4VEmProcess::AddEmModel(G4int order, G4VEmModel* p, const G4Region* region)
|
||||
{
|
||||
modelManager->AddEmModel(order, p, 0, region);
|
||||
if(p) p->SetParticleChange(pParticleChange);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
@@ -245,7 +265,7 @@ G4VParticleChange* G4VEmProcess::PostStepDoIt(const G4Track& track,
|
||||
// Integral approach
|
||||
if (integral) {
|
||||
G4double lx = GetLambda(finalT, currentCouple);
|
||||
if(preStepLambda<lx && 0 < verboseLevel) {
|
||||
if(preStepLambda<lx && 1 < verboseLevel) {
|
||||
G4cout << "WARING: for " << particle->GetParticleName()
|
||||
<< " and " << GetProcessName()
|
||||
<< " E(MeV)= " << finalT/MeV
|
||||
@@ -258,79 +278,89 @@ G4VParticleChange* G4VEmProcess::PostStepDoIt(const G4Track& track,
|
||||
}
|
||||
|
||||
G4VEmModel* currentModel = SelectModel(finalT);
|
||||
const G4DynamicParticle* dynParticle = track.GetDynamicParticle();
|
||||
|
||||
/*
|
||||
/*
|
||||
if(0 < verboseLevel) {
|
||||
const G4ParticleDefinition* pd = dynParticle->GetDefinition();
|
||||
G4cout << "G4VEmProcess::PostStepDoIt: Sample secondary; E= "
|
||||
<< finalT/MeV
|
||||
<< " MeV; model= (" << currentModel->LowEnergyLimit(pd)
|
||||
<< ", " << currentModel->HighEnergyLimit(pd) << ")"
|
||||
<< " MeV; model= (" << currentModel->LowEnergyLimit()
|
||||
<< ", " << currentModel->HighEnergyLimit() << ")"
|
||||
<< G4endl;
|
||||
}
|
||||
*/
|
||||
|
||||
std::vector<G4DynamicParticle*>* newp = SecondariesPostStep(currentModel,
|
||||
currentCouple,
|
||||
dynParticle);
|
||||
G4double edep = fParticleChange.GetLocalEnergyDeposit();
|
||||
|
||||
std::vector<G4DynamicParticle*>* newp =
|
||||
SecondariesPostStep(currentModel,currentCouple,track.GetDynamicParticle());
|
||||
|
||||
if (newp) {
|
||||
G4int num = newp->size();
|
||||
if(num > 0) {
|
||||
fParticleChange.SetNumberOfSecondaries(num);
|
||||
G4double gcut = (*theCutsGamma)[currentMaterialIndex];
|
||||
G4double ecut = (*theCutsElectron)[currentMaterialIndex];
|
||||
G4double pcut = (*theCutsPositron)[currentMaterialIndex];
|
||||
for (G4int i=0; i<num; i++) {
|
||||
G4DynamicParticle* dp = (*newp)[i];
|
||||
const G4ParticleDefinition* p = dp->GetDefinition();
|
||||
G4double e = dp->GetKineticEnergy();
|
||||
G4bool good = true;
|
||||
if (p == G4Gamma::Gamma()) {
|
||||
if (e < gcut) {
|
||||
good = false;
|
||||
edep += e;
|
||||
}
|
||||
} else if (p == G4Electron::Electron()) {
|
||||
if (e < ecut) {
|
||||
good = false;
|
||||
edep += e;
|
||||
}
|
||||
} else if (p == G4Positron::Positron()) {
|
||||
if (e < pcut) {
|
||||
good = false;
|
||||
edep += e + electron_mass_c2;
|
||||
}
|
||||
}
|
||||
if (good) fParticleChange.AddSecondary(dp);
|
||||
else delete dp;
|
||||
fParticleChange.SetNumberOfSecondaries(num);
|
||||
G4double edep = fParticleChange.GetLocalEnergyDeposit();
|
||||
|
||||
for (G4int i=0; i<num; i++) {
|
||||
G4DynamicParticle* dp = (*newp)[i];
|
||||
const G4ParticleDefinition* p = dp->GetDefinition();
|
||||
G4double e = dp->GetKineticEnergy();
|
||||
G4bool good = true;
|
||||
if (p == theGamma) {
|
||||
if (e < (*theCutsGamma)[currentMaterialIndex]) good = false;
|
||||
|
||||
} else if (p == theElectron) {
|
||||
if (e < (*theCutsElectron)[currentMaterialIndex]) good = false;
|
||||
|
||||
} else if (p == thePositron) {
|
||||
if (e < (*theCutsPositron)[currentMaterialIndex]) {
|
||||
good = false;
|
||||
e += 2.0*electron_mass_c2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (good || !applyCuts) {
|
||||
fParticleChange.AddSecondary(dp);
|
||||
|
||||
} else {
|
||||
delete dp;
|
||||
edep += e;
|
||||
}
|
||||
}
|
||||
fParticleChange.ProposeLocalEnergyDeposit(edep);
|
||||
delete newp;
|
||||
}
|
||||
fParticleChange.ProposeLocalEnergyDeposit(edep);
|
||||
|
||||
return &fParticleChange;
|
||||
return G4VDiscreteProcess::PostStepDoIt(track,step);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void G4VEmProcess::PrintInfoDefinition()
|
||||
{
|
||||
G4cout << G4endl << GetProcessName() << ": " << G4endl
|
||||
<< " Lambda tables from threshold to "
|
||||
<< G4BestUnit(maxKinEnergy,"Energy")
|
||||
<< " in " << nLambdaBins << " bins."
|
||||
<< G4endl;
|
||||
if(verboseLevel > 0) {
|
||||
G4cout << G4endl << GetProcessName() << ": " ;
|
||||
PrintInfo();
|
||||
}
|
||||
|
||||
if(0 < verboseLevel) {
|
||||
if (!buildLambdaTable) return;
|
||||
|
||||
if(verboseLevel > 0) {
|
||||
G4cout << " tables are built for "
|
||||
<< particle->GetParticleName()
|
||||
<< G4endl
|
||||
<< " Lambda tables from "
|
||||
<< G4BestUnit(minKinEnergy,"Energy")
|
||||
<< " to "
|
||||
<< G4BestUnit(maxKinEnergy,"Energy")
|
||||
<< " in " << nLambdaBins << " bins."
|
||||
<< G4endl;
|
||||
}
|
||||
|
||||
if(verboseLevel > 1) {
|
||||
G4cout << "Tables are built for " << particle->GetParticleName()
|
||||
<< G4endl;
|
||||
|
||||
if(2 < verboseLevel) {
|
||||
G4cout << "LambdaTable address= " << theLambdaTable << G4endl;
|
||||
if(theLambdaTable) G4cout << (*theLambdaTable) << G4endl;
|
||||
if(verboseLevel > 2) {
|
||||
G4cout << "LambdaTable address= " << theLambdaTable << G4endl;
|
||||
if(theLambdaTable) G4cout << (*theLambdaTable) << G4endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -349,6 +379,9 @@ G4double G4VEmProcess::MicroscopicCrossSection(G4double kineticEnergy,
|
||||
GetValue(kineticEnergy, b));
|
||||
|
||||
cross /= currentMaterial->GetTotNbOfAtomsPerVolume();
|
||||
} else {
|
||||
G4VEmModel* model = SelectModel(kineticEnergy);
|
||||
cross = model->CrossSectionPerVolume(currentMaterial,particle,kineticEnergy);
|
||||
}
|
||||
|
||||
return cross;
|
||||
@@ -356,6 +389,16 @@ G4double G4VEmProcess::MicroscopicCrossSection(G4double kineticEnergy,
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4double G4VEmProcess::ComputeCrossSectionPerAtom(G4double kineticEnergy, G4double Z)
|
||||
{
|
||||
G4VEmModel* model = SelectModel(kineticEnergy);
|
||||
G4double A = G4NistManager::Instance()->FindOrBuildElement(G4int(Z), false)->GetN();
|
||||
G4double cross = model->ComputeCrossSectionPerAtom(particle,kineticEnergy,Z,A);
|
||||
return cross;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4double G4VEmProcess::MeanFreePath(const G4Track& track,
|
||||
G4double s,
|
||||
G4ForceCondition* cond)
|
||||
@@ -396,7 +439,7 @@ G4bool G4VEmProcess::RetrievePhysicsTable(const G4ParticleDefinition* part,
|
||||
const G4String& directory,
|
||||
G4bool ascii)
|
||||
{
|
||||
if(0 < verboseLevel) {
|
||||
if(1 < verboseLevel) {
|
||||
G4cout << "G4VEmProcess::RetrievePhysicsTable() for "
|
||||
<< part->GetParticleName() << " and process "
|
||||
<< GetProcessName() << G4endl;
|
||||
@@ -411,13 +454,13 @@ G4bool G4VEmProcess::RetrievePhysicsTable(const G4ParticleDefinition* part,
|
||||
filename = GetPhysicsTableFileName(part,directory,"Lambda",ascii);
|
||||
yes = G4PhysicsTableHelper::RetrievePhysicsTable(theLambdaTable,filename,ascii);
|
||||
if ( yes ) {
|
||||
if (-1 < verboseLevel) {
|
||||
if (0 < verboseLevel) {
|
||||
G4cout << "Lambda table for " << particleName << " is Retrieved from <"
|
||||
<< filename << ">"
|
||||
<< G4endl;
|
||||
}
|
||||
} else {
|
||||
if (-1 < verboseLevel) {
|
||||
if (1 < verboseLevel) {
|
||||
G4cout << "Lambda table for " << particleName << " in file <"
|
||||
<< filename << "> is not exist"
|
||||
<< G4endl;
|
||||
@@ -432,27 +475,31 @@ G4bool G4VEmProcess::RetrievePhysicsTable(const G4ParticleDefinition* part,
|
||||
void G4VEmProcess::FindLambdaMax()
|
||||
{
|
||||
if(1 < verboseLevel) {
|
||||
G4cout << "### FindLambdaMax: " << particle->GetParticleName()
|
||||
G4cout << "### G4VEmProcess::FindLambdaMax: " << particle->GetParticleName()
|
||||
<< " and process " << GetProcessName() << G4endl;
|
||||
}
|
||||
size_t n = theLambdaTable->length();
|
||||
G4PhysicsVector* pv = (*theLambdaTable)[0];
|
||||
size_t nb = pv->GetVectorLength();
|
||||
G4double emax = pv->GetLowEdgeEnergy(nb);
|
||||
G4double e, s, smax = 0.0;
|
||||
G4double e, s, emax, smax;
|
||||
theEnergyOfCrossSectionMax = new G4double [n];
|
||||
theCrossSectionMax = new G4double [n];
|
||||
G4bool b;
|
||||
|
||||
for (size_t i=0; i<n; i++) {
|
||||
pv = (*theLambdaTable)[i];
|
||||
emax = DBL_MAX;
|
||||
smax = 0.0;
|
||||
for (size_t j=0; j<nb; j++) {
|
||||
e = pv->GetLowEdgeEnergy(j);
|
||||
s = pv->GetValue(e,b);
|
||||
if(s > smax) {
|
||||
smax = s;
|
||||
emax = e;
|
||||
if(pv) {
|
||||
size_t nb = pv->GetVectorLength();
|
||||
emax = pv->GetLowEdgeEnergy(nb);
|
||||
smax = 0.0;
|
||||
for (size_t j=0; j<nb; j++) {
|
||||
e = pv->GetLowEdgeEnergy(j);
|
||||
s = pv->GetValue(e,b);
|
||||
if(s > smax) {
|
||||
smax = s;
|
||||
emax = e;
|
||||
}
|
||||
}
|
||||
}
|
||||
theEnergyOfCrossSectionMax[i] = emax;
|
||||
@@ -509,12 +556,7 @@ G4double G4VEmProcess::MaxKinEnergy() const
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void G4VEmProcess::ActivateFluorescence(G4bool, const G4Region*)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void G4VEmProcess::ActivateAugerElectronProduction(G4bool, const G4Region*)
|
||||
void G4VEmProcess::ActivateDeexcitation(G4bool, const G4Region*)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
@@ -529,6 +571,7 @@ const G4PhysicsTable* G4VEmProcess::LambdaTable() const
|
||||
void G4VEmProcess::SetIntegral(G4bool val)
|
||||
{
|
||||
integral = val;
|
||||
if(integral) buildLambdaTable = true;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
@@ -539,3 +582,32 @@ G4bool G4VEmProcess::IsIntegral() const
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4PhysicsVector* G4VEmProcess::LambdaPhysicsVector(const G4MaterialCutsCouple*)
|
||||
{
|
||||
G4PhysicsVector* v = new G4PhysicsLogVector(minKinEnergy, maxKinEnergy, nLambdaBins);
|
||||
return v;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void G4VEmProcess::SetBuildTableFlag(G4bool val)
|
||||
{
|
||||
buildLambdaTable = val;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void G4VEmProcess::SetStartFromNullFlag(G4bool val)
|
||||
{
|
||||
startFromNull = val;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void G4VEmProcess::SetApplyCuts(G4bool val)
|
||||
{
|
||||
applyCuts = val;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Reference in New Issue
Block a user