Import Geant4 10.1.0 source tree
This commit is contained in:
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4EnergyLossForExtrapolator.cc 75168 2013-10-29 09:20:52Z gcosmo $
|
||||
// $Id: G4EnergyLossForExtrapolator.cc 87062 2014-11-24 11:45:21Z gcosmo $
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
@@ -50,7 +50,6 @@
|
||||
#include "G4EnergyLossForExtrapolator.hh"
|
||||
#include "G4PhysicalConstants.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4PhysicsLogVector.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4Material.hh"
|
||||
#include "G4MaterialCutsCouple.hh"
|
||||
@@ -60,20 +59,13 @@
|
||||
#include "G4MuonPlus.hh"
|
||||
#include "G4MuonMinus.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4LossTableBuilder.hh"
|
||||
#include "G4MollerBhabhaModel.hh"
|
||||
#include "G4BetheBlochModel.hh"
|
||||
#include "G4eBremsstrahlungRelModel.hh"
|
||||
#include "G4MuPairProductionModel.hh"
|
||||
#include "G4MuBremsstrahlungModel.hh"
|
||||
#include "G4ProductionCuts.hh"
|
||||
#include "G4LossTableManager.hh"
|
||||
#include "G4WentzelVIModel.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4TablesForExtrapolator* G4EnergyLossForExtrapolator::tables = 0;
|
||||
|
||||
G4EnergyLossForExtrapolator::G4EnergyLossForExtrapolator(G4int verb)
|
||||
:maxEnergyTransfer(DBL_MAX),verbose(verb),isInitialised(false)
|
||||
: maxEnergyTransfer(DBL_MAX), verbose(verb)
|
||||
{
|
||||
currentParticle = 0;
|
||||
currentMaterial = 0;
|
||||
@@ -84,49 +76,28 @@ G4EnergyLossForExtrapolator::G4EnergyLossForExtrapolator(G4int verb)
|
||||
nbins = 70;
|
||||
|
||||
nmat = index = 0;
|
||||
pcuts = 0;
|
||||
|
||||
mass = charge2 = electronDensity = radLength = bg2 = beta2
|
||||
= kineticEnergy = tmax = 0;
|
||||
= kineticEnergy = tmax = 0.0;
|
||||
gam = 1.0;
|
||||
|
||||
dedxElectron = dedxPositron = dedxProton = rangeElectron
|
||||
= rangePositron = rangeProton = invRangeElectron = invRangePositron
|
||||
= invRangeProton = mscElectron = dedxMuon = rangeMuon = invRangeMuon = 0;
|
||||
idxDedxElectron = idxDedxPositron = idxDedxMuon = idxDedxProton
|
||||
= idxRangeElectron = idxRangePositron = idxRangeMuon = idxRangeProton
|
||||
= idxInvRangeElectron = idxInvRangePositron = idxInvRangeMuon
|
||||
= idxInvRangeProton = idxMscElectron = 0;
|
||||
|
||||
electron = positron = proton = muonPlus = muonMinus = 0;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4EnergyLossForExtrapolator:: ~G4EnergyLossForExtrapolator()
|
||||
{
|
||||
for(G4int i=0; i<nmat; i++) {delete couples[i];}
|
||||
delete dedxElectron;
|
||||
delete dedxPositron;
|
||||
delete dedxProton;
|
||||
delete dedxMuon;
|
||||
delete rangeElectron;
|
||||
delete rangePositron;
|
||||
delete rangeProton;
|
||||
delete rangeMuon;
|
||||
delete invRangeElectron;
|
||||
delete invRangePositron;
|
||||
delete invRangeProton;
|
||||
delete invRangeMuon;
|
||||
delete mscElectron;
|
||||
delete pcuts;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4double
|
||||
G4EnergyLossForExtrapolator::EnergyAfterStep(G4double kinEnergy,
|
||||
G4double stepLength,
|
||||
const G4Material* mat,
|
||||
const G4ParticleDefinition* part)
|
||||
{
|
||||
if(!isInitialised) Initialisation();
|
||||
if(0 == nmat) { Initialisation(); }
|
||||
G4double kinEnergyFinal = kinEnergy;
|
||||
if(SetupKinematics(part, mat, kinEnergy)) {
|
||||
G4double step = TrueStepLength(kinEnergy,stepLength,mat,part);
|
||||
@@ -151,7 +122,8 @@ G4EnergyLossForExtrapolator::EnergyBeforeStep(G4double kinEnergy,
|
||||
const G4Material* mat,
|
||||
const G4ParticleDefinition* part)
|
||||
{
|
||||
if(!isInitialised) { Initialisation(); }
|
||||
//G4cout << "G4EnergyLossForExtrapolator::EnergyBeforeStep" << G4endl;
|
||||
if(0 == nmat) { Initialisation(); }
|
||||
G4double kinEnergyFinal = kinEnergy;
|
||||
|
||||
if(SetupKinematics(part, mat, kinEnergy)) {
|
||||
@@ -177,14 +149,17 @@ G4EnergyLossForExtrapolator::TrueStepLength(G4double kinEnergy,
|
||||
const G4ParticleDefinition* part)
|
||||
{
|
||||
G4double res = stepLength;
|
||||
if(!isInitialised) Initialisation();
|
||||
if(0 == nmat) { Initialisation(); }
|
||||
//G4cout << "## G4EnergyLossForExtrapolator::TrueStepLength L= " << res
|
||||
// << " " << part->GetParticleName() << G4endl;
|
||||
if(SetupKinematics(part, mat, kinEnergy)) {
|
||||
if(part == electron || part == positron) {
|
||||
G4double x = stepLength*ComputeValue(kinEnergy, mscElectron);
|
||||
G4double x = stepLength*
|
||||
ComputeValue(kinEnergy, GetPhysicsTable(fMscElectron), idxMscElectron);
|
||||
//G4cout << " x= " << x << G4endl;
|
||||
if(x < 0.2) { res *= (1.0 + 0.5*x + x*x/3.0); }
|
||||
else if(x < 0.9999) { res = -G4Log(1.0 - x)*stepLength/x; }
|
||||
else { res = ComputeRange(kinEnergy,part); }
|
||||
|
||||
} else {
|
||||
res = ComputeTrueStep(mat,part,kinEnergy,stepLength);
|
||||
}
|
||||
@@ -199,8 +174,8 @@ G4EnergyLossForExtrapolator::SetupKinematics(const G4ParticleDefinition* part,
|
||||
const G4Material* mat,
|
||||
G4double kinEnergy)
|
||||
{
|
||||
if(!part || !mat || kinEnergy < keV) return false;
|
||||
if(!isInitialised) Initialisation();
|
||||
if(0 == nmat) { Initialisation(); }
|
||||
if(!part || !mat || kinEnergy < keV) { return false; }
|
||||
G4bool flag = false;
|
||||
if(part != currentParticle) {
|
||||
flag = true;
|
||||
@@ -235,16 +210,100 @@ G4EnergyLossForExtrapolator::SetupKinematics(const G4ParticleDefinition* part,
|
||||
G4double r = electron_mass_c2/mass;
|
||||
tmax = 2.0*bg2*electron_mass_c2/(1.0 + 2.0*gam*r + r*r);
|
||||
}
|
||||
if(tmax > maxEnergyTransfer) tmax = maxEnergyTransfer;
|
||||
if(tmax > maxEnergyTransfer) { tmax = maxEnergyTransfer; }
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
const G4ParticleDefinition*
|
||||
G4EnergyLossForExtrapolator::FindParticle(const G4String& name)
|
||||
{
|
||||
const G4ParticleDefinition* p = 0;
|
||||
if(name != currentParticleName) {
|
||||
p = G4ParticleTable::GetParticleTable()->FindParticle(name);
|
||||
if(!p) {
|
||||
G4cout << "### G4EnergyLossForExtrapolator WARNING: "
|
||||
<< "FindParticle() fails to find "
|
||||
<< name << G4endl;
|
||||
}
|
||||
} else {
|
||||
p = currentParticle;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4double
|
||||
G4EnergyLossForExtrapolator::ComputeDEDX(G4double ekin,
|
||||
const G4ParticleDefinition* part)
|
||||
{
|
||||
G4double x = 0.0;
|
||||
if(part == electron) {
|
||||
x = ComputeValue(ekin, GetPhysicsTable(fDedxElectron), idxDedxElectron);
|
||||
} else if(part == positron) {
|
||||
x = ComputeValue(ekin, GetPhysicsTable(fDedxPositron), idxDedxPositron);
|
||||
} else if(part == muonPlus || part == muonMinus) {
|
||||
x = ComputeValue(ekin, GetPhysicsTable(fDedxMuon), idxDedxMuon);
|
||||
} else {
|
||||
G4double e = ekin*proton_mass_c2/mass;
|
||||
x = ComputeValue(e, GetPhysicsTable(fDedxProton), idxDedxProton)*charge2;
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4double
|
||||
G4EnergyLossForExtrapolator::ComputeRange(G4double ekin,
|
||||
const G4ParticleDefinition* part)
|
||||
{
|
||||
G4double x = 0.0;
|
||||
if(part == electron) {
|
||||
x = ComputeValue(ekin, GetPhysicsTable(fRangeElectron), idxRangeElectron);
|
||||
} else if(part == positron) {
|
||||
x = ComputeValue(ekin, GetPhysicsTable(fRangePositron), idxRangePositron);
|
||||
} else if(part == muonPlus || part == muonMinus) {
|
||||
x = ComputeValue(ekin, GetPhysicsTable(fRangeMuon), idxRangeMuon);
|
||||
} else {
|
||||
G4double massratio = proton_mass_c2/mass;
|
||||
G4double e = ekin*massratio;
|
||||
x = ComputeValue(e, GetPhysicsTable(fRangeProton), idxRangeProton)
|
||||
/(charge2*massratio);
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4double
|
||||
G4EnergyLossForExtrapolator::ComputeEnergy(G4double range,
|
||||
const G4ParticleDefinition* part)
|
||||
{
|
||||
G4double x = 0.0;
|
||||
if(part == electron) {
|
||||
x = ComputeValue(range, GetPhysicsTable(fInvRangeElectron),
|
||||
idxInvRangeElectron);
|
||||
} else if(part == positron) {
|
||||
x = ComputeValue(range, GetPhysicsTable(fInvRangePositron),
|
||||
idxInvRangePositron);
|
||||
} else if(part == muonPlus || part == muonMinus) {
|
||||
x = ComputeValue(range, GetPhysicsTable(fInvRangeMuon), idxInvRangeMuon);
|
||||
} else {
|
||||
G4double massratio = proton_mass_c2/mass;
|
||||
G4double r = range*massratio*charge2;
|
||||
x = ComputeValue(r, GetPhysicsTable(fInvRangeProton),
|
||||
idxInvRangeProton)/massratio;
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void G4EnergyLossForExtrapolator::Initialisation()
|
||||
{
|
||||
isInitialised = true;
|
||||
if(verbose>1) {
|
||||
G4cout << "### G4EnergyLossForExtrapolator::Initialisation" << G4endl;
|
||||
}
|
||||
@@ -258,345 +317,37 @@ void G4EnergyLossForExtrapolator::Initialisation()
|
||||
muonPlus = G4MuonPlus::MuonPlus();
|
||||
muonMinus= G4MuonMinus::MuonMinus();
|
||||
|
||||
currentParticleName = "";
|
||||
|
||||
nmat = G4Material::GetNumberOfMaterials();
|
||||
const G4MaterialTable* mtable = G4Material::GetMaterialTable();
|
||||
pcuts = new G4ProductionCuts();
|
||||
|
||||
couples.resize(nmat,0);
|
||||
cuts.resize(nmat,DBL_MAX);
|
||||
|
||||
for(G4int i=0; i<nmat; i++) {
|
||||
couples[i] = new G4MaterialCutsCouple((*mtable)[i],pcuts);
|
||||
}
|
||||
|
||||
dedxElectron = PrepareTable();
|
||||
dedxPositron = PrepareTable();
|
||||
dedxMuon = PrepareTable();
|
||||
dedxProton = PrepareTable();
|
||||
rangeElectron = PrepareTable();
|
||||
rangePositron = PrepareTable();
|
||||
rangeMuon = PrepareTable();
|
||||
rangeProton = PrepareTable();
|
||||
invRangeElectron = PrepareTable();
|
||||
invRangePositron = PrepareTable();
|
||||
invRangeMuon = PrepareTable();
|
||||
invRangeProton = PrepareTable();
|
||||
mscElectron = PrepareTable();
|
||||
|
||||
G4LossTableBuilder builder;
|
||||
|
||||
if(verbose>1) {
|
||||
G4cout << "### G4EnergyLossForExtrapolator Builds electron tables"
|
||||
<< G4endl;
|
||||
}
|
||||
ComputeElectronDEDX(electron, dedxElectron);
|
||||
builder.BuildRangeTable(dedxElectron,rangeElectron);
|
||||
builder.BuildInverseRangeTable(rangeElectron, invRangeElectron);
|
||||
|
||||
if(verbose>1) {
|
||||
G4cout << "### G4EnergyLossForExtrapolator Builds positron tables"
|
||||
<< G4endl;
|
||||
}
|
||||
ComputeElectronDEDX(positron, dedxPositron);
|
||||
builder.BuildRangeTable(dedxPositron, rangePositron);
|
||||
builder.BuildInverseRangeTable(rangePositron, invRangePositron);
|
||||
|
||||
if(verbose>1) {
|
||||
G4cout << "### G4EnergyLossForExtrapolator Builds muon tables" << G4endl;
|
||||
}
|
||||
ComputeMuonDEDX(muonPlus, dedxMuon);
|
||||
builder.BuildRangeTable(dedxMuon, rangeMuon);
|
||||
builder.BuildInverseRangeTable(rangeMuon, invRangeMuon);
|
||||
|
||||
if(verbose>1) {
|
||||
G4cout << "### G4EnergyLossForExtrapolator Builds proton tables"
|
||||
<< G4endl;
|
||||
}
|
||||
ComputeProtonDEDX(proton, dedxProton);
|
||||
builder.BuildRangeTable(dedxProton, rangeProton);
|
||||
builder.BuildInverseRangeTable(rangeProton, invRangeProton);
|
||||
|
||||
ComputeTrasportXS(electron, mscElectron);
|
||||
currentParticleName = "";
|
||||
BuildTables();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4PhysicsTable* G4EnergyLossForExtrapolator::PrepareTable()
|
||||
#include "G4AutoLock.hh"
|
||||
namespace { G4Mutex G4EnergyLossForExtrapolatorMutex = G4MUTEX_INITIALIZER; }
|
||||
|
||||
void G4EnergyLossForExtrapolator::BuildTables()
|
||||
{
|
||||
G4PhysicsTable* table = new G4PhysicsTable();
|
||||
G4AutoLock l(&G4EnergyLossForExtrapolatorMutex);
|
||||
|
||||
for(G4int i=0; i<nmat; i++) {
|
||||
|
||||
G4PhysicsVector* v = new G4PhysicsLogVector(emin, emax, nbins);
|
||||
v->SetSpline(G4LossTableManager::Instance()->SplineFlag());
|
||||
table->push_back(v);
|
||||
}
|
||||
return table;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
const G4ParticleDefinition*
|
||||
G4EnergyLossForExtrapolator::FindParticle(const G4String& name)
|
||||
{
|
||||
const G4ParticleDefinition* p = 0;
|
||||
if(name != currentParticleName) {
|
||||
p = G4ParticleTable::GetParticleTable()->FindParticle(name);
|
||||
if(!p) {
|
||||
G4cout << "### G4EnergyLossForExtrapolator WARNING:FindParticle fails to find "
|
||||
<< name << G4endl;
|
||||
if(!tables) {
|
||||
if(verbose > 0) {
|
||||
G4cout << "### G4EnergyLossForExtrapolator::BuildTables for "
|
||||
<< nmat << " materials Nbins= " << nbins
|
||||
<< " Emin(MeV)= " << emin << " Emax(MeV)= " << emax << G4endl;
|
||||
}
|
||||
} else {
|
||||
p = currentParticle;
|
||||
tables = new G4TablesForExtrapolator(verbose, nbins, emin, emax);
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4double
|
||||
G4EnergyLossForExtrapolator::ComputeDEDX(G4double kinEnergy,
|
||||
const G4ParticleDefinition* part)
|
||||
G4EnergyLossForExtrapolator::~G4EnergyLossForExtrapolator()
|
||||
{
|
||||
G4double x = 0.0;
|
||||
if(part == electron) x = ComputeValue(kinEnergy, dedxElectron);
|
||||
else if(part == positron) x = ComputeValue(kinEnergy, dedxPositron);
|
||||
else if(part == muonPlus || part == muonMinus) {
|
||||
x = ComputeValue(kinEnergy, dedxMuon);
|
||||
} else {
|
||||
G4double e = kinEnergy*proton_mass_c2/mass;
|
||||
x = ComputeValue(e, dedxProton)*charge2;
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4double
|
||||
G4EnergyLossForExtrapolator::ComputeRange(G4double kinEnergy,
|
||||
const G4ParticleDefinition* part)
|
||||
{
|
||||
G4double x = 0.0;
|
||||
if(part == electron) x = ComputeValue(kinEnergy, rangeElectron);
|
||||
else if(part == positron) x = ComputeValue(kinEnergy, rangePositron);
|
||||
else if(part == muonPlus || part == muonMinus)
|
||||
x = ComputeValue(kinEnergy, rangeMuon);
|
||||
else {
|
||||
G4double massratio = proton_mass_c2/mass;
|
||||
G4double e = kinEnergy*massratio;
|
||||
x = ComputeValue(e, rangeProton)/(charge2*massratio);
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4double
|
||||
G4EnergyLossForExtrapolator::ComputeEnergy(G4double range,
|
||||
const G4ParticleDefinition* part)
|
||||
{
|
||||
G4double x = 0.0;
|
||||
if(part == electron) x = ComputeValue(range, invRangeElectron);
|
||||
else if(part == positron) x = ComputeValue(range, invRangePositron);
|
||||
else if(part == muonPlus || part == muonMinus)
|
||||
x = ComputeValue(range, invRangeMuon);
|
||||
else {
|
||||
G4double massratio = proton_mass_c2/mass;
|
||||
G4double r = range*massratio*charge2;
|
||||
x = ComputeValue(r, invRangeProton)/massratio;
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void G4EnergyLossForExtrapolator::ComputeElectronDEDX(
|
||||
const G4ParticleDefinition* part,
|
||||
G4PhysicsTable* table)
|
||||
{
|
||||
G4MollerBhabhaModel* ioni = new G4MollerBhabhaModel();
|
||||
G4eBremsstrahlungRelModel* brem = new G4eBremsstrahlungRelModel();
|
||||
ioni->Initialise(part, cuts);
|
||||
brem->Initialise(part, cuts);
|
||||
|
||||
mass = electron_mass_c2;
|
||||
charge2 = 1.0;
|
||||
currentParticle = part;
|
||||
|
||||
const G4MaterialTable* mtable = G4Material::GetMaterialTable();
|
||||
if(0<verbose) {
|
||||
G4cout << "G4EnergyLossForExtrapolator::ComputeElectronDEDX for "
|
||||
<< part->GetParticleName()
|
||||
<< G4endl;
|
||||
}
|
||||
for(G4int i=0; i<nmat; i++) {
|
||||
|
||||
const G4Material* mat = (*mtable)[i];
|
||||
if(1<verbose)
|
||||
G4cout << "i= " << i << " mat= " << mat->GetName() << G4endl;
|
||||
const G4MaterialCutsCouple* couple = couples[i];
|
||||
G4PhysicsVector* aVector = (*table)[i];
|
||||
|
||||
for(G4int j=0; j<=nbins; j++) {
|
||||
|
||||
G4double e = aVector->Energy(j);
|
||||
G4double dedx = ioni->ComputeDEDX(couple,part,e,e)
|
||||
+ brem->ComputeDEDX(couple,part,e,e);
|
||||
if(1<verbose) {
|
||||
G4cout << "j= " << j
|
||||
<< " e(MeV)= " << e/MeV
|
||||
<< " dedx(Mev/cm)= " << dedx*cm/MeV
|
||||
<< " dedx(Mev.cm2/g)= "
|
||||
<< dedx/((MeV*mat->GetDensity())/(g/cm2))
|
||||
<< G4endl;
|
||||
}
|
||||
aVector->PutValue(j,dedx);
|
||||
}
|
||||
}
|
||||
delete ioni;
|
||||
delete brem;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void
|
||||
G4EnergyLossForExtrapolator::ComputeMuonDEDX(const G4ParticleDefinition* part,
|
||||
G4PhysicsTable* table)
|
||||
{
|
||||
G4BetheBlochModel* ioni = new G4BetheBlochModel();
|
||||
G4MuPairProductionModel* pair = new G4MuPairProductionModel();
|
||||
G4MuBremsstrahlungModel* brem = new G4MuBremsstrahlungModel();
|
||||
ioni->Initialise(part, cuts);
|
||||
pair->Initialise(part, cuts);
|
||||
brem->Initialise(part, cuts);
|
||||
|
||||
mass = part->GetPDGMass();
|
||||
charge2 = 1.0;
|
||||
currentParticle = part;
|
||||
|
||||
const G4MaterialTable* mtable = G4Material::GetMaterialTable();
|
||||
|
||||
if(0<verbose) {
|
||||
G4cout << "G4EnergyLossForExtrapolator::ComputeMuonDEDX for "
|
||||
<< part->GetParticleName()
|
||||
<< G4endl;
|
||||
}
|
||||
|
||||
for(G4int i=0; i<nmat; i++) {
|
||||
|
||||
const G4Material* mat = (*mtable)[i];
|
||||
if(1<verbose) {
|
||||
G4cout << "i= " << i << " mat= " << mat->GetName() << G4endl;
|
||||
}
|
||||
const G4MaterialCutsCouple* couple = couples[i];
|
||||
G4PhysicsVector* aVector = (*table)[i];
|
||||
for(G4int j=0; j<=nbins; j++) {
|
||||
|
||||
G4double e = aVector->Energy(j);
|
||||
G4double dedx = ioni->ComputeDEDX(couple,part,e,e) +
|
||||
pair->ComputeDEDX(couple,part,e,e) +
|
||||
brem->ComputeDEDX(couple,part,e,e);
|
||||
aVector->PutValue(j,dedx);
|
||||
if(1<verbose) {
|
||||
G4cout << "j= " << j
|
||||
<< " e(MeV)= " << e/MeV
|
||||
<< " dedx(Mev/cm)= " << dedx*cm/MeV
|
||||
<< " dedx(Mev/(g/cm2)= " << dedx/((MeV*mat->GetDensity())/(g/cm2))
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
delete ioni;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void
|
||||
G4EnergyLossForExtrapolator::ComputeProtonDEDX(const G4ParticleDefinition* part,
|
||||
G4PhysicsTable* table)
|
||||
{
|
||||
G4BetheBlochModel* ioni = new G4BetheBlochModel();
|
||||
ioni->Initialise(part, cuts);
|
||||
|
||||
mass = part->GetPDGMass();
|
||||
charge2 = 1.0;
|
||||
currentParticle = part;
|
||||
|
||||
const G4MaterialTable* mtable = G4Material::GetMaterialTable();
|
||||
|
||||
if(0<verbose) {
|
||||
G4cout << "G4EnergyLossForExtrapolator::ComputeProtonDEDX for "
|
||||
<< part->GetParticleName()
|
||||
<< G4endl;
|
||||
}
|
||||
|
||||
for(G4int i=0; i<nmat; i++) {
|
||||
|
||||
const G4Material* mat = (*mtable)[i];
|
||||
if(1<verbose)
|
||||
G4cout << "i= " << i << " mat= " << mat->GetName() << G4endl;
|
||||
const G4MaterialCutsCouple* couple = couples[i];
|
||||
G4PhysicsVector* aVector = (*table)[i];
|
||||
for(G4int j=0; j<=nbins; j++) {
|
||||
|
||||
G4double e = aVector->Energy(j);
|
||||
G4double dedx = ioni->ComputeDEDX(couple,part,e,e);
|
||||
aVector->PutValue(j,dedx);
|
||||
if(1<verbose) {
|
||||
G4cout << "j= " << j
|
||||
<< " e(MeV)= " << e/MeV
|
||||
<< " dedx(Mev/cm)= " << dedx*cm/MeV
|
||||
<< " dedx(Mev.cm2/g)= " << dedx/((mat->GetDensity())/(g/cm2))
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
delete ioni;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void
|
||||
G4EnergyLossForExtrapolator::ComputeTrasportXS(const G4ParticleDefinition* part,
|
||||
G4PhysicsTable* table)
|
||||
{
|
||||
G4WentzelVIModel* msc = new G4WentzelVIModel();
|
||||
msc->SetPolarAngleLimit(CLHEP::pi);
|
||||
msc->Initialise(part, cuts);
|
||||
|
||||
mass = part->GetPDGMass();
|
||||
charge2 = 1.0;
|
||||
currentParticle = part;
|
||||
|
||||
const G4MaterialTable* mtable = G4Material::GetMaterialTable();
|
||||
|
||||
if(0<verbose) {
|
||||
G4cout << "G4EnergyLossForExtrapolator::ComputeProtonDEDX for "
|
||||
<< part->GetParticleName()
|
||||
<< G4endl;
|
||||
}
|
||||
|
||||
for(G4int i=0; i<nmat; i++) {
|
||||
|
||||
const G4Material* mat = (*mtable)[i];
|
||||
msc->SetCurrentCouple(couples[i]);
|
||||
if(1<verbose)
|
||||
G4cout << "i= " << i << " mat= " << mat->GetName() << G4endl;
|
||||
G4PhysicsVector* aVector = (*table)[i];
|
||||
for(G4int j=0; j<=nbins; j++) {
|
||||
|
||||
G4double e = aVector->Energy(j);
|
||||
G4double xs = msc->CrossSectionPerVolume(mat,part,e);
|
||||
aVector->PutValue(j,xs);
|
||||
if(1<verbose) {
|
||||
G4cout << "j= " << j << " e(MeV)= " << e/MeV
|
||||
<< " xs(1/mm)= " << xs*mm << G4endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
delete msc;
|
||||
G4AutoLock l(&G4EnergyLossForExtrapolatorMutex);
|
||||
delete tables;
|
||||
tables = 0;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4MuBetheBlochModel.cc 74019 2013-09-19 13:35:34Z gcosmo $
|
||||
// $Id: G4MuBetheBlochModel.cc 85023 2014-10-23 09:56:39Z gcosmo $
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
//
|
||||
@@ -225,11 +225,6 @@ G4double G4MuBetheBlochModel::ComputeDEDXPerVolume(const G4Material* material,
|
||||
|
||||
G4double eexc = material->GetIonisation()->GetMeanExcitationEnergy();
|
||||
G4double eexc2 = eexc*eexc;
|
||||
//G4double cden = material->GetIonisation()->GetCdensity();
|
||||
//G4double mden = material->GetIonisation()->GetMdensity();
|
||||
//G4double aden = material->GetIonisation()->GetAdensity();
|
||||
//G4double x0den = material->GetIonisation()->GetX0density();
|
||||
//G4double x1den = material->GetIonisation()->GetX1density();
|
||||
|
||||
G4double eDensity = material->GetElectronDensity();
|
||||
|
||||
@@ -242,10 +237,6 @@ G4double G4MuBetheBlochModel::ComputeDEDXPerVolume(const G4Material* material,
|
||||
|
||||
// density correction
|
||||
G4double x = G4Log(bg2)/twoln10;
|
||||
//if ( x >= x0den ) {
|
||||
// dedx -= twoln10*x - cden ;
|
||||
// if ( x < x1den ) dedx -= aden*pow((x1den-x),mden) ;
|
||||
//}
|
||||
dedx -= material->GetIonisation()->DensityCorrection(x);
|
||||
|
||||
// shell correction
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4MuBremsstrahlung.cc 72942 2013-08-14 13:37:37Z gcosmo $
|
||||
// $Id: G4MuBremsstrahlung.cc 85023 2014-10-23 09:56:39Z gcosmo $
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
//
|
||||
@@ -67,6 +67,7 @@
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4Gamma.hh"
|
||||
#include "G4MuBremsstrahlungModel.hh"
|
||||
#include "G4EmParameters.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
@@ -116,8 +117,9 @@ void G4MuBremsstrahlung::InitialiseEnergyLossProcess(
|
||||
if (!EmModel()) { SetEmModel(new G4MuBremsstrahlungModel()); }
|
||||
|
||||
G4VEmFluctuationModel* fm = 0;
|
||||
EmModel()->SetLowEnergyLimit(MinKinEnergy());
|
||||
EmModel()->SetHighEnergyLimit(MaxKinEnergy());
|
||||
G4EmParameters* param = G4EmParameters::Instance();
|
||||
EmModel()->SetLowEnergyLimit(param->MinKinEnergy());
|
||||
EmModel()->SetHighEnergyLimit(param->MaxKinEnergy());
|
||||
AddEmModel(1, EmModel(), fm);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4MuBremsstrahlungModel.cc 75168 2013-10-29 09:20:52Z gcosmo $
|
||||
// $Id: G4MuBremsstrahlungModel.cc 85023 2014-10-23 09:56:39Z gcosmo $
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
//
|
||||
@@ -74,7 +74,7 @@
|
||||
#include "G4ElementVector.hh"
|
||||
#include "G4ProductionCutsTable.hh"
|
||||
#include "G4ParticleChangeForLoss.hh"
|
||||
#include "G4LossTableManager.hh"
|
||||
//#include "G4LossTableManager.hh"
|
||||
#include "G4Log.hh"
|
||||
#include "G4Exp.hh"
|
||||
|
||||
@@ -151,10 +151,12 @@ void G4MuBremsstrahlungModel::Initialise(const G4ParticleDefinition* p,
|
||||
{
|
||||
if(p) { SetParticle(p); }
|
||||
|
||||
if(IsMaster() && p == particle) { InitialiseElementSelectors(p, cuts); }
|
||||
|
||||
// define pointer to G4ParticleChange
|
||||
if(!fParticleChange) { fParticleChange = GetParticleChangeForLoss(); }
|
||||
|
||||
if(IsMaster() && p == particle && lowestKinEnergy < HighEnergyLimit()) {
|
||||
InitialiseElementSelectors(p, cuts);
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
@@ -162,7 +164,7 @@ void G4MuBremsstrahlungModel::Initialise(const G4ParticleDefinition* p,
|
||||
void G4MuBremsstrahlungModel::InitialiseLocal(const G4ParticleDefinition* p,
|
||||
G4VEmModel* masterModel)
|
||||
{
|
||||
if(p == particle) {
|
||||
if(p == particle && lowestKinEnergy < HighEnergyLimit()) {
|
||||
SetElementSelectors(masterModel->GetElementSelectors());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4MuIonisation.cc 68035 2013-03-13 14:12:34Z gcosmo $
|
||||
// $Id: G4MuIonisation.cc 85023 2014-10-23 09:56:39Z gcosmo $
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
//
|
||||
@@ -61,7 +61,7 @@
|
||||
// 04-08-03 Set integral=false to be default (V.Ivanchenko)
|
||||
// 08-08-03 STD substitute standard (V.Ivanchenko)
|
||||
// 12-11-03 G4EnergyLossSTD -> G4EnergyLossProcess (V.Ivanchenko)
|
||||
// 10-02-04 Calculation of radiative corrections using R.Kokoulin model (V.Ivanchenko)
|
||||
// 10-02-04 Calculation of radiative corrections using R.Kokoulin model (V.I.)
|
||||
// 27-05-04 Set integral to be a default regime (V.Ivanchenko)
|
||||
// 17-08-04 Utilise mu+ tables for mu- (V.Ivanchenko)
|
||||
// 08-11-04 Migration to new interface of Store/Retrieve tables (V.Ivantchenko)
|
||||
@@ -90,6 +90,7 @@
|
||||
#include "G4BohrFluctuations.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4ICRU73QOModel.hh"
|
||||
#include "G4EmParameters.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
@@ -102,9 +103,6 @@ G4MuIonisation::G4MuIonisation(const G4String& name)
|
||||
isInitialised(false)
|
||||
{
|
||||
mass = ratio = 0;
|
||||
// SetStepFunction(0.2, 1*mm);
|
||||
//SetIntegral(true);
|
||||
//SetVerboseLevel(1);
|
||||
SetProcessSubType(fIonisation);
|
||||
SetSecondaryParticle(G4Electron::Electron());
|
||||
}
|
||||
@@ -144,14 +142,18 @@ void G4MuIonisation::InitialiseEnergyLossProcess(const G4ParticleDefinition* par
|
||||
|
||||
mass = theParticle->GetPDGMass();
|
||||
G4double q = theParticle->GetPDGCharge();
|
||||
|
||||
G4EmParameters* param = G4EmParameters::Instance();
|
||||
G4double elow = 0.2*MeV;
|
||||
G4double emax = param->MaxKinEnergy();
|
||||
G4double ehigh = std::min(1*GeV, emax);
|
||||
|
||||
// Bragg peak model
|
||||
if (!EmModel(1)) {
|
||||
if(q > 0.0) { SetEmModel(new G4BraggModel(),1); }
|
||||
else { SetEmModel(new G4ICRU73QOModel(),1); }
|
||||
}
|
||||
EmModel(1)->SetLowEnergyLimit(MinKinEnergy());
|
||||
EmModel(1)->SetLowEnergyLimit(param->MinKinEnergy());
|
||||
EmModel(1)->SetHighEnergyLimit(elow);
|
||||
AddEmModel(1, EmModel(1), new G4IonFluctuations());
|
||||
|
||||
@@ -161,15 +163,16 @@ void G4MuIonisation::InitialiseEnergyLossProcess(const G4ParticleDefinition* par
|
||||
// moderate energy model
|
||||
if (!EmModel(2)) { SetEmModel(new G4BetheBlochModel(),2); }
|
||||
EmModel(2)->SetLowEnergyLimit(elow);
|
||||
EmModel(2)->SetHighEnergyLimit(1.0*GeV);
|
||||
EmModel(2)->SetHighEnergyLimit(ehigh);
|
||||
AddEmModel(2, EmModel(2), FluctModel());
|
||||
|
||||
// high energy model
|
||||
if (!EmModel(3)) { SetEmModel(new G4MuBetheBlochModel(),3); }
|
||||
EmModel(3)->SetLowEnergyLimit(1.0*GeV);
|
||||
EmModel(3)->SetHighEnergyLimit(MaxKinEnergy());
|
||||
AddEmModel(3, EmModel(3), FluctModel());
|
||||
|
||||
if(ehigh < emax) {
|
||||
if (!EmModel(3)) { SetEmModel(new G4MuBetheBlochModel(),3); }
|
||||
EmModel(3)->SetLowEnergyLimit(ehigh);
|
||||
EmModel(3)->SetHighEnergyLimit(emax);
|
||||
AddEmModel(3, EmModel(3), FluctModel());
|
||||
}
|
||||
ratio = electron_mass_c2/mass;
|
||||
isInitialised = true;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4MuPairProduction.cc 72942 2013-08-14 13:37:37Z gcosmo $
|
||||
// $Id: G4MuPairProduction.cc 85023 2014-10-23 09:56:39Z gcosmo $
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
//
|
||||
@@ -75,6 +75,7 @@
|
||||
#include "G4VEmModel.hh"
|
||||
#include "G4MuPairProductionModel.hh"
|
||||
#include "G4ElementData.hh"
|
||||
#include "G4EmParameters.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
@@ -129,8 +130,9 @@ void G4MuPairProduction::InitialiseEnergyLossProcess(
|
||||
if(limit > lowestKinEnergy) { lowestKinEnergy = limit; }
|
||||
|
||||
G4VEmFluctuationModel* fm = 0;
|
||||
EmModel()->SetLowEnergyLimit(MinKinEnergy());
|
||||
EmModel()->SetHighEnergyLimit(MaxKinEnergy());
|
||||
G4EmParameters* param = G4EmParameters::Instance();
|
||||
EmModel()->SetLowEnergyLimit(param->MinKinEnergy());
|
||||
EmModel()->SetHighEnergyLimit(param->MaxKinEnergy());
|
||||
AddEmModel(1, EmModel(), fm);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4MuPairProductionModel.cc 74544 2013-10-14 12:40:29Z gcosmo $
|
||||
// $Id: G4MuPairProductionModel.cc 83686 2014-09-09 12:40:23Z gcosmo $
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
//
|
||||
@@ -156,11 +156,15 @@ void G4MuPairProductionModel::Initialise(const G4ParticleDefinition* p,
|
||||
const G4DataVector& cuts)
|
||||
{
|
||||
SetParticle(p);
|
||||
if(!fParticleChange) { fParticleChange = GetParticleChangeForLoss(); }
|
||||
|
||||
// for low-energy application this process should not work
|
||||
if(lowestKinEnergy >= HighEnergyLimit()) { return; }
|
||||
|
||||
// define scale of internal table for each thread only once
|
||||
if(0 == nbine) {
|
||||
emax = HighEnergyLimit();
|
||||
emin = std::max(lowestKinEnergy, LowEnergyLimit());
|
||||
emax = std::max(HighEnergyLimit(), emin*2);
|
||||
nbine = size_t(nYBinPerDecade*std::log10(emax/emin));
|
||||
if(nbine < 3) { nbine = 3; }
|
||||
|
||||
@@ -176,8 +180,6 @@ void G4MuPairProductionModel::Initialise(const G4ParticleDefinition* p,
|
||||
}
|
||||
InitialiseElementSelectors(p, cuts);
|
||||
}
|
||||
|
||||
if(!fParticleChange) { fParticleChange = GetParticleChangeForLoss(); }
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
@@ -185,7 +187,7 @@ void G4MuPairProductionModel::Initialise(const G4ParticleDefinition* p,
|
||||
void G4MuPairProductionModel::InitialiseLocal(const G4ParticleDefinition* p,
|
||||
G4VEmModel* masterModel)
|
||||
{
|
||||
if(p == particle) {
|
||||
if(p == particle && lowestKinEnergy < HighEnergyLimit()) {
|
||||
SetElementSelectors(masterModel->GetElementSelectors());
|
||||
fElementData = masterModel->GetElementData();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,465 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4TablesForExtrapolator.cc 75145 2013-10-28 18:34:48Z vnivanch $
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// ClassName: G4TablesForExtrapolator
|
||||
//
|
||||
// Description: This class provide calculation of energy loss, fluctuation,
|
||||
// and msc angle
|
||||
//
|
||||
// Author: 09.12.04 V.Ivanchenko
|
||||
//
|
||||
// Modification:
|
||||
// 08-04-05 Rename Propogator -> Extrapolator (V.Ivanchenko)
|
||||
// 16-03-06 Add muon tables and fix bug in units (V.Ivanchenko)
|
||||
// 21-03-06 Add verbosity defined in the constructor and Initialisation
|
||||
// start only when first public method is called (V.Ivanchenko)
|
||||
// 03-05-06 Remove unused pointer G4Material* from number of methods (VI)
|
||||
// 12-05-06 SEt linLossLimit=0.001 (VI)
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
#include "G4TablesForExtrapolator.hh"
|
||||
#include "G4PhysicalConstants.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4PhysicsLogVector.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4Material.hh"
|
||||
#include "G4MaterialCutsCouple.hh"
|
||||
#include "G4Electron.hh"
|
||||
#include "G4Positron.hh"
|
||||
#include "G4Proton.hh"
|
||||
#include "G4MuonPlus.hh"
|
||||
#include "G4MuonMinus.hh"
|
||||
#include "G4EmParameters.hh"
|
||||
#include "G4MollerBhabhaModel.hh"
|
||||
#include "G4BetheBlochModel.hh"
|
||||
#include "G4eBremsstrahlungRelModel.hh"
|
||||
#include "G4MuPairProductionModel.hh"
|
||||
#include "G4MuBremsstrahlungModel.hh"
|
||||
#include "G4ProductionCuts.hh"
|
||||
#include "G4LossTableBuilder.hh"
|
||||
#include "G4WentzelVIModel.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4TablesForExtrapolator::G4TablesForExtrapolator(G4int verb, G4int bins,
|
||||
G4double e1, G4double e2)
|
||||
: verbose(verb), nbins(bins), emin(e1), emax(e2)
|
||||
{
|
||||
Initialisation();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4TablesForExtrapolator:: ~G4TablesForExtrapolator()
|
||||
{
|
||||
for(G4int i=0; i<nmat; i++) {delete couples[i];}
|
||||
|
||||
dedxElectron->clearAndDestroy();
|
||||
dedxPositron->clearAndDestroy();
|
||||
dedxProton->clearAndDestroy();
|
||||
dedxMuon->clearAndDestroy();
|
||||
rangeElectron->clearAndDestroy();
|
||||
rangePositron->clearAndDestroy();
|
||||
rangeProton->clearAndDestroy();
|
||||
rangeMuon->clearAndDestroy();
|
||||
invRangeElectron->clearAndDestroy();
|
||||
invRangePositron->clearAndDestroy();
|
||||
invRangeProton->clearAndDestroy();
|
||||
invRangeMuon->clearAndDestroy();
|
||||
mscElectron->clearAndDestroy();
|
||||
|
||||
delete dedxElectron;
|
||||
delete dedxPositron;
|
||||
delete dedxProton;
|
||||
delete dedxMuon;
|
||||
delete rangeElectron;
|
||||
delete rangePositron;
|
||||
delete rangeProton;
|
||||
delete rangeMuon;
|
||||
delete invRangeElectron;
|
||||
delete invRangePositron;
|
||||
delete invRangeProton;
|
||||
delete invRangeMuon;
|
||||
delete mscElectron;
|
||||
delete pcuts;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
const G4PhysicsTable*
|
||||
G4TablesForExtrapolator::GetPhysicsTable(ExtTableType type) const
|
||||
{
|
||||
const G4PhysicsTable* table = 0;
|
||||
switch (type)
|
||||
{
|
||||
case fDedxElectron:
|
||||
table = dedxElectron;
|
||||
break;
|
||||
case fDedxPositron:
|
||||
table = dedxPositron;
|
||||
break;
|
||||
case fDedxProton:
|
||||
table = dedxProton;
|
||||
break;
|
||||
case fDedxMuon:
|
||||
table = dedxMuon;
|
||||
break;
|
||||
case fRangeElectron:
|
||||
table = rangeElectron;
|
||||
break;
|
||||
case fRangePositron:
|
||||
table = rangePositron;
|
||||
break;
|
||||
case fRangeProton:
|
||||
table = rangeProton;
|
||||
break;
|
||||
case fRangeMuon:
|
||||
table = rangeMuon;
|
||||
break;
|
||||
case fInvRangeElectron:
|
||||
table = invRangeElectron;
|
||||
break;
|
||||
case fInvRangePositron:
|
||||
table = invRangePositron;
|
||||
break;
|
||||
case fInvRangeProton:
|
||||
table = invRangeProton;
|
||||
break;
|
||||
case fInvRangeMuon:
|
||||
table = invRangeMuon;
|
||||
break;
|
||||
case fMscElectron:
|
||||
table = mscElectron;
|
||||
}
|
||||
return table;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void G4TablesForExtrapolator::Initialisation()
|
||||
{
|
||||
if(verbose>1) {
|
||||
G4cout << "### G4TablesForExtrapolator::Initialisation" << G4endl;
|
||||
}
|
||||
currentParticle = 0;
|
||||
|
||||
electron = G4Electron::Electron();
|
||||
positron = G4Positron::Positron();
|
||||
proton = G4Proton::Proton();
|
||||
muonPlus = G4MuonPlus::MuonPlus();
|
||||
muonMinus= G4MuonMinus::MuonMinus();
|
||||
|
||||
mass = charge2 = 0.0;
|
||||
|
||||
nmat = G4Material::GetNumberOfMaterials();
|
||||
const G4MaterialTable* mtable = G4Material::GetMaterialTable();
|
||||
pcuts = new G4ProductionCuts();
|
||||
|
||||
couples.resize(nmat,0);
|
||||
cuts.resize(nmat,DBL_MAX);
|
||||
|
||||
for(G4int i=0; i<nmat; ++i) {
|
||||
couples[i] = new G4MaterialCutsCouple((*mtable)[i],pcuts);
|
||||
}
|
||||
|
||||
splineFlag = G4EmParameters::Instance()->Spline();
|
||||
|
||||
dedxElectron = PrepareTable();
|
||||
dedxPositron = PrepareTable();
|
||||
dedxMuon = PrepareTable();
|
||||
dedxProton = PrepareTable();
|
||||
rangeElectron = PrepareTable();
|
||||
rangePositron = PrepareTable();
|
||||
rangeMuon = PrepareTable();
|
||||
rangeProton = PrepareTable();
|
||||
invRangeElectron = PrepareTable();
|
||||
invRangePositron = PrepareTable();
|
||||
invRangeMuon = PrepareTable();
|
||||
invRangeProton = PrepareTable();
|
||||
mscElectron = PrepareTable();
|
||||
|
||||
G4LossTableBuilder builder;
|
||||
|
||||
if(verbose>1) {
|
||||
G4cout << "### G4TablesForExtrapolator Builds electron tables"
|
||||
<< G4endl;
|
||||
}
|
||||
ComputeElectronDEDX(electron, dedxElectron);
|
||||
builder.BuildRangeTable(dedxElectron,rangeElectron);
|
||||
builder.BuildInverseRangeTable(rangeElectron, invRangeElectron);
|
||||
|
||||
if(verbose>1) {
|
||||
G4cout << "### G4TablesForExtrapolator Builds positron tables"
|
||||
<< G4endl;
|
||||
}
|
||||
ComputeElectronDEDX(positron, dedxPositron);
|
||||
builder.BuildRangeTable(dedxPositron, rangePositron);
|
||||
builder.BuildInverseRangeTable(rangePositron, invRangePositron);
|
||||
|
||||
if(verbose>1) {
|
||||
G4cout << "### G4TablesForExtrapolator Builds muon tables" << G4endl;
|
||||
}
|
||||
ComputeMuonDEDX(muonPlus, dedxMuon);
|
||||
builder.BuildRangeTable(dedxMuon, rangeMuon);
|
||||
builder.BuildInverseRangeTable(rangeMuon, invRangeMuon);
|
||||
/*
|
||||
G4cout << "DEDX MUON" << G4endl
|
||||
G4cout << *dedxMuon << G4endl;
|
||||
G4cout << "RANGE MUON" << G4endl
|
||||
G4cout << *rangeMuon << G4endl;
|
||||
G4cout << "INVRANGE MUON" << G4endl
|
||||
G4cout << *invRangeMuon << G4endl;
|
||||
*/
|
||||
if(verbose>1) {
|
||||
G4cout << "### G4TablesForExtrapolator Builds proton tables"
|
||||
<< G4endl;
|
||||
}
|
||||
ComputeProtonDEDX(proton, dedxProton);
|
||||
builder.BuildRangeTable(dedxProton, rangeProton);
|
||||
builder.BuildInverseRangeTable(rangeProton, invRangeProton);
|
||||
|
||||
ComputeTrasportXS(electron, mscElectron);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4PhysicsTable* G4TablesForExtrapolator::PrepareTable()
|
||||
{
|
||||
G4PhysicsTable* table = new G4PhysicsTable();
|
||||
|
||||
for(G4int i=0; i<nmat; ++i) {
|
||||
|
||||
G4PhysicsVector* v = new G4PhysicsLogVector(emin, emax, nbins);
|
||||
v->SetSpline(splineFlag);
|
||||
table->push_back(v);
|
||||
}
|
||||
return table;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void G4TablesForExtrapolator::ComputeElectronDEDX(
|
||||
const G4ParticleDefinition* part,
|
||||
G4PhysicsTable* table)
|
||||
{
|
||||
G4MollerBhabhaModel* ioni = new G4MollerBhabhaModel();
|
||||
G4eBremsstrahlungRelModel* brem = new G4eBremsstrahlungRelModel();
|
||||
ioni->Initialise(part, cuts);
|
||||
brem->Initialise(part, cuts);
|
||||
|
||||
mass = electron_mass_c2;
|
||||
charge2 = 1.0;
|
||||
currentParticle = part;
|
||||
|
||||
const G4MaterialTable* mtable = G4Material::GetMaterialTable();
|
||||
if(0<verbose) {
|
||||
G4cout << "G4TablesForExtrapolator::ComputeElectronDEDX for "
|
||||
<< part->GetParticleName()
|
||||
<< G4endl;
|
||||
}
|
||||
for(G4int i=0; i<nmat; ++i) {
|
||||
|
||||
const G4Material* mat = (*mtable)[i];
|
||||
if(1<verbose) {
|
||||
G4cout << "i= " << i << " mat= " << mat->GetName() << G4endl;
|
||||
}
|
||||
const G4MaterialCutsCouple* couple = couples[i];
|
||||
G4PhysicsVector* aVector = (*table)[i];
|
||||
|
||||
for(G4int j=0; j<=nbins; ++j) {
|
||||
|
||||
G4double e = aVector->Energy(j);
|
||||
G4double dedx = ioni->ComputeDEDX(couple,part,e,e)
|
||||
+ brem->ComputeDEDX(couple,part,e,e);
|
||||
if(1<verbose) {
|
||||
G4cout << "j= " << j
|
||||
<< " e(MeV)= " << e/MeV
|
||||
<< " dedx(Mev/cm)= " << dedx*cm/MeV
|
||||
<< " dedx(Mev.cm2/g)= "
|
||||
<< dedx/((MeV*mat->GetDensity())/(g/cm2))
|
||||
<< G4endl;
|
||||
}
|
||||
aVector->PutValue(j,dedx);
|
||||
}
|
||||
if(splineFlag) { aVector->FillSecondDerivatives(); }
|
||||
}
|
||||
delete ioni;
|
||||
delete brem;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void
|
||||
G4TablesForExtrapolator::ComputeMuonDEDX(const G4ParticleDefinition* part,
|
||||
G4PhysicsTable* table)
|
||||
{
|
||||
G4BetheBlochModel* ioni = new G4BetheBlochModel();
|
||||
G4MuPairProductionModel* pair = new G4MuPairProductionModel();
|
||||
G4MuBremsstrahlungModel* brem = new G4MuBremsstrahlungModel();
|
||||
ioni->Initialise(part, cuts);
|
||||
pair->Initialise(part, cuts);
|
||||
brem->Initialise(part, cuts);
|
||||
|
||||
mass = part->GetPDGMass();
|
||||
charge2 = 1.0;
|
||||
currentParticle = part;
|
||||
|
||||
const G4MaterialTable* mtable = G4Material::GetMaterialTable();
|
||||
|
||||
if(0<verbose) {
|
||||
G4cout << "G4TablesForExtrapolator::ComputeMuonDEDX for "
|
||||
<< part->GetParticleName()
|
||||
<< G4endl;
|
||||
}
|
||||
|
||||
for(G4int i=0; i<nmat; ++i) {
|
||||
|
||||
const G4Material* mat = (*mtable)[i];
|
||||
if(1<verbose) {
|
||||
G4cout << "i= " << i << " mat= " << mat->GetName() << G4endl;
|
||||
}
|
||||
const G4MaterialCutsCouple* couple = couples[i];
|
||||
G4PhysicsVector* aVector = (*table)[i];
|
||||
for(G4int j=0; j<=nbins; j++) {
|
||||
|
||||
G4double e = aVector->Energy(j);
|
||||
G4double dedx = ioni->ComputeDEDX(couple,part,e,e) +
|
||||
pair->ComputeDEDX(couple,part,e,e) +
|
||||
brem->ComputeDEDX(couple,part,e,e);
|
||||
aVector->PutValue(j,dedx);
|
||||
if(1<verbose) {
|
||||
G4cout << "j= " << j
|
||||
<< " e(MeV)= " << e/MeV
|
||||
<< " dedx(Mev/cm)= " << dedx*cm/MeV
|
||||
<< " dedx(Mev/(g/cm2)= "
|
||||
<< dedx/((MeV*mat->GetDensity())/(g/cm2))
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
if(splineFlag) { aVector->FillSecondDerivatives(); }
|
||||
}
|
||||
delete ioni;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void
|
||||
G4TablesForExtrapolator::ComputeProtonDEDX(const G4ParticleDefinition* part,
|
||||
G4PhysicsTable* table)
|
||||
{
|
||||
G4BetheBlochModel* ioni = new G4BetheBlochModel();
|
||||
ioni->Initialise(part, cuts);
|
||||
|
||||
mass = part->GetPDGMass();
|
||||
charge2 = 1.0;
|
||||
currentParticle = part;
|
||||
|
||||
const G4MaterialTable* mtable = G4Material::GetMaterialTable();
|
||||
|
||||
if(0<verbose) {
|
||||
G4cout << "G4TablesForExtrapolator::ComputeProtonDEDX for "
|
||||
<< part->GetParticleName()
|
||||
<< G4endl;
|
||||
}
|
||||
|
||||
for(G4int i=0; i<nmat; ++i) {
|
||||
|
||||
const G4Material* mat = (*mtable)[i];
|
||||
if(1<verbose)
|
||||
G4cout << "i= " << i << " mat= " << mat->GetName() << G4endl;
|
||||
const G4MaterialCutsCouple* couple = couples[i];
|
||||
G4PhysicsVector* aVector = (*table)[i];
|
||||
for(G4int j=0; j<=nbins; j++) {
|
||||
|
||||
G4double e = aVector->Energy(j);
|
||||
G4double dedx = ioni->ComputeDEDX(couple,part,e,e);
|
||||
aVector->PutValue(j,dedx);
|
||||
if(1<verbose) {
|
||||
G4cout << "j= " << j
|
||||
<< " e(MeV)= " << e/MeV
|
||||
<< " dedx(Mev/cm)= " << dedx*cm/MeV
|
||||
<< " dedx(Mev.cm2/g)= " << dedx/((mat->GetDensity())/(g/cm2))
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
if(splineFlag) { aVector->FillSecondDerivatives(); }
|
||||
}
|
||||
delete ioni;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void
|
||||
G4TablesForExtrapolator::ComputeTrasportXS(const G4ParticleDefinition* part,
|
||||
G4PhysicsTable* table)
|
||||
{
|
||||
G4WentzelVIModel* msc = new G4WentzelVIModel();
|
||||
msc->SetPolarAngleLimit(CLHEP::pi);
|
||||
msc->Initialise(part, cuts);
|
||||
|
||||
mass = part->GetPDGMass();
|
||||
charge2 = 1.0;
|
||||
currentParticle = part;
|
||||
|
||||
const G4MaterialTable* mtable = G4Material::GetMaterialTable();
|
||||
|
||||
if(0<verbose) {
|
||||
G4cout << "G4TablesForExtrapolator::ComputeProtonDEDX for "
|
||||
<< part->GetParticleName()
|
||||
<< G4endl;
|
||||
}
|
||||
|
||||
for(G4int i=0; i<nmat; ++i) {
|
||||
|
||||
const G4Material* mat = (*mtable)[i];
|
||||
msc->SetCurrentCouple(couples[i]);
|
||||
if(1<verbose)
|
||||
G4cout << "i= " << i << " mat= " << mat->GetName() << G4endl;
|
||||
G4PhysicsVector* aVector = (*table)[i];
|
||||
for(G4int j=0; j<=nbins; j++) {
|
||||
|
||||
G4double e = aVector->Energy(j);
|
||||
G4double xs = msc->CrossSectionPerVolume(mat,part,e);
|
||||
aVector->PutValue(j,xs);
|
||||
if(1<verbose) {
|
||||
G4cout << "j= " << j << " e(MeV)= " << e/MeV
|
||||
<< " xs(1/mm)= " << xs*mm << G4endl;
|
||||
}
|
||||
}
|
||||
if(splineFlag) { aVector->FillSecondDerivatives(); }
|
||||
}
|
||||
delete msc;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Reference in New Issue
Block a user