Import Geant4 7.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 12:11:21 +02:00
parent 516dbf1a58
commit d93e1e39a9
5384 changed files with 125662 additions and 82444 deletions
@@ -0,0 +1,402 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * 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: G4EnergyLossForExtrapolator.cc,v 1.5 2005/06/27 15:29:29 gunter Exp $
// GEANT4 tag $Name: geant4-07-01 $
//
//---------------------------------------------------------------------------
//
// ClassName: G4EnergyLossForExtrapolator
//
// 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
//
//----------------------------------------------------------------------------
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "G4EnergyLossForExtrapolator.hh"
#include "G4PhysicsTable.hh"
#include "G4PhysicsLogVector.hh"
#include "G4ParticleDefinition.hh"
#include "G4Material.hh"
#include "G4MaterialCutsCouple.hh"
#include "G4Electron.hh"
#include "G4Positron.hh"
#include "G4Proton.hh"
#include "G4ParticleTable.hh"
#include "G4LossTableBuilder.hh"
#include "G4MollerBhabhaModel.hh"
#include "G4BetheBlochModel.hh"
#include "G4eBremsstrahlungModel.hh"
#include "G4ProductionCuts.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4EnergyLossForExtrapolator::G4EnergyLossForExtrapolator()
{
Initialisation();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4EnergyLossForExtrapolator:: ~G4EnergyLossForExtrapolator()
{
for(G4int i=0; i<nmat; i++) {delete couples[i];}
delete dedxElectron;
delete dedxPositron;
delete dedxProton;
delete rangeElectron;
delete rangePositron;
delete rangeProton;
delete invRangeElectron;
delete invRangePositron;
delete invRangeProton;
delete cuts;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EnergyLossForExtrapolator::EnergyAfterStep(G4double kinEnergy,
G4double step,
const G4Material* mat,
const G4ParticleDefinition* part)
{
G4double kinEnergyFinal = kinEnergy;
if(mat && part) {
G4double r = ComputeRange(kinEnergy,mat,part);
if(r <= step) {
kinEnergyFinal = 0.0;
} else if(step < linLossLimit*r) {
kinEnergyFinal -= step*ComputeDEDX(kinEnergy,mat,part);
} else {
G4double r1 = r - step;
kinEnergyFinal = ComputeEnergy(r1,mat,part);
}
}
return kinEnergyFinal;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EnergyLossForExtrapolator::EnergyBeforeStep(G4double kinEnergy,
G4double step,
const G4Material* mat,
const G4ParticleDefinition* part)
{
G4double kinEnergyFinal = kinEnergy;
if(mat && part) {
G4double r = ComputeRange(kinEnergy,mat,part);
if(step < linLossLimit*r) {
kinEnergyFinal += step*ComputeDEDX(kinEnergy,mat,part);
} else {
G4double r1 = r + step;
kinEnergyFinal = ComputeEnergy(r1,mat,part);
}
}
return kinEnergyFinal;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EnergyLossForExtrapolator::AverageScatteringAngle(G4double kinEnergy,
G4double step,
const G4Material* mat,
const G4ParticleDefinition* part)
{
G4double theta = 0.0;
if(mat && part && kinEnergy > 0.0) {
G4double t = step/mat->GetRadlen();
G4double M = part->GetPDGMass();
G4double z = std::abs(part->GetPDGCharge()/eplus);
G4double bpc = kinEnergy*(kinEnergy + 2.0*M)/(kinEnergy+M);
theta = 13.6*MeV*z*std::sqrt(t)/bpc;
}
return theta;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EnergyLossForExtrapolator::EnergyDispersion(G4double kinEnergy,
G4double step,
const G4Material* mat,
const G4ParticleDefinition* part)
{
G4double sig2 = 0.0;
if(part) {
G4double tmax = kinEnergy;
G4double mass = part->GetPDGMass();
G4double tau = kinEnergy/mass;
G4double gam = tau + 1.0;
G4double bg2 = tau * (tau+2.0);
G4double beta2 = bg2/(gam*gam);
if(part == electron) tmax *= 0.5;
else if(part != positron) {
G4double r = electron_mass_c2/mass;
tmax = 2.0*bg2*electron_mass_c2/(1.0 + 2.0*gam*r + r*r);
}
G4double electronDensity = mat->GetElectronDensity();
G4double q = part->GetPDGCharge()/eplus;
sig2 = (1.0/beta2 - 0.5)* twopi_mc2_rcl2 * tmax*step * electronDensity * q *q;
}
return sig2;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EnergyLossForExtrapolator::Initialisation()
{
currentParticle = 0;
electron = G4Electron::Electron();
positron = G4Positron::Positron();
proton = G4Proton::Proton();
currentParticleName = "";
linLossLimit = 0.05;
emin = 1.*MeV;
emax = 100.*GeV;
nbins = 50;
verbose = 1;
nmat = G4Material::GetNumberOfMaterials();
const G4MaterialTable* mtable = G4Material::GetMaterialTable();
cuts = new G4ProductionCuts();
const G4MaterialCutsCouple* couple;
for(G4int i=0; i<nmat; i++) {
couple = new G4MaterialCutsCouple((*mtable)[i],cuts);
couples.push_back(couple);
}
dedxElectron = PrepareTable();
dedxPositron = PrepareTable();
dedxProton = PrepareTable();
rangeElectron = PrepareTable();
rangePositron = PrepareTable();
rangeProton = PrepareTable();
invRangeElectron = PrepareTable();
invRangePositron = PrepareTable();
invRangeProton = PrepareTable();
G4LossTableBuilder builder;
ComputeElectronDEDX(electron, dedxElectron);
builder.BuildRangeTable(dedxElectron,rangeElectron);
builder.BuildInverseRangeTable(rangeElectron, invRangeElectron);
ComputeElectronDEDX(positron, dedxPositron);
builder.BuildRangeTable(dedxPositron, rangePositron);
builder.BuildInverseRangeTable(rangePositron, invRangePositron);
ComputeProtonDEDX(proton, dedxProton);
builder.BuildRangeTable(dedxProton, rangeProton);
builder.BuildInverseRangeTable(rangeProton, invRangeProton);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4PhysicsTable* G4EnergyLossForExtrapolator::PrepareTable()
{
G4PhysicsTable* table = new G4PhysicsTable();
for(G4int i=0; i<nmat; i++) {
G4PhysicsVector* v = new G4PhysicsLogVector(emin, emax, nbins);
table->push_back(v);
}
return table;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
const G4ParticleDefinition* G4EnergyLossForExtrapolator::FindParticle(const G4String& name)
{
if(name != currentParticleName) {
currentParticle = G4ParticleTable::GetParticleTable()->FindParticle(name);
if(!currentParticle) {
G4cout << "### WARNING: G4EmCalculator::FindParticle fails to find " << name << G4endl;
}
currentParticleName = name;
}
return currentParticle;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EnergyLossForExtrapolator::ComputeDEDX(G4double kinEnergy,
const G4Material* mat,
const G4ParticleDefinition* part)
{
G4double x = 0.0;
if(part == electron) x = ComputeValue(kinEnergy, mat, dedxElectron);
else if(part == positron) x = ComputeValue(kinEnergy, mat, dedxPositron);
else {
G4double e = kinEnergy*proton_mass_c2/part->GetPDGMass();
G4double z = part->GetPDGCharge()/eplus;
x = ComputeValue(e, mat, dedxProton)*z*z;
}
return x;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EnergyLossForExtrapolator::ComputeRange(G4double kinEnergy,
const G4Material* mat,
const G4ParticleDefinition* part)
{
G4double x = 0.0;
if(part == electron) x = ComputeValue(kinEnergy, mat, rangeElectron);
else if(part == positron) x = ComputeValue(kinEnergy, mat, rangePositron);
else {
G4double massratio = proton_mass_c2/part->GetPDGMass();
G4double e = kinEnergy*massratio;
G4double z = part->GetPDGCharge()/eplus;
x = ComputeValue(e, mat, rangeProton)/(z*z*massratio);
}
return x;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EnergyLossForExtrapolator::ComputeEnergy(G4double range,
const G4Material* mat,
const G4ParticleDefinition* part)
{
G4double x = 0.0;
if(part == electron) x = ComputeValue(range, mat, invRangeElectron);
else if(part == positron) x = ComputeValue(range, mat, invRangePositron);
else {
G4double massratio = proton_mass_c2/part->GetPDGMass();
G4double z = part->GetPDGCharge()/eplus;
G4double r = range*massratio*z*z;
x = ComputeValue(r, mat, invRangeProton)/massratio;
}
return x;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EnergyLossForExtrapolator::ComputeValue(G4double x,
const G4Material* mat,
const G4PhysicsTable* table)
{
G4double res = 0.0;
bool b;
G4int i = mat->GetIndex();
if(i<nmat) res = ((*table)[i])->GetValue(x, b);
return res;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EnergyLossForExtrapolator::ComputeElectronDEDX(const G4ParticleDefinition* part,
G4PhysicsTable* table)
{
G4DataVector v;
G4MollerBhabhaModel* ioni = new G4MollerBhabhaModel();
G4eBremsstrahlungModel* brem = new G4eBremsstrahlungModel();
ioni->Initialise(part, v);
brem->Initialise(part, v);
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->GetLowEdgeEnergy(j);
G4double dedx = ioni->ComputeDEDX(couple,part,e,e) + brem->ComputeDEDX(couple,part,e,e);
dedx /= (MeV/cm);
if(1<verbose) {
G4cout << "j= " << j
<< " e(MeV)= " << e/MeV
<< " dedx(Mev/cm)= " << dedx
<< " dedx(Mev.cm2/g)= " << dedx/((mat->GetDensity())/(g/cm3)) << G4endl;
}
aVector->PutValue(j,dedx);
}
}
delete ioni;
delete brem;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EnergyLossForExtrapolator::ComputeProtonDEDX(const G4ParticleDefinition* part,
G4PhysicsTable* table)
{
G4DataVector v;
G4BetheBlochModel* ioni = new G4BetheBlochModel();
ioni->Initialise(part, v);
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->GetLowEdgeEnergy(j);
G4double dedx = ioni->ComputeDEDX(couple,part,e,e);
dedx /= (MeV/cm);
aVector->PutValue(j,dedx);
if(1<verbose) {
G4cout << "j= " << j
<< " e(MeV)= " << e/MeV
<< " dedx(Mev/cm)= " << dedx
<< " dedx(Mev.cm2/g)= " << dedx/((mat->GetDensity())/(g/cm3)) << G4endl;
}
}
}
delete ioni;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -20,8 +20,8 @@
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: G4MuBetheBlochModel.cc,v 1.14 2004/12/03 17:32:03 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
// $Id: G4MuBetheBlochModel.cc,v 1.18 2005/04/12 13:31:16 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-01 $
//
// -------------------------------------------------------------------
//
@@ -41,6 +41,8 @@
// 27-01-03 Make models region aware (V.Ivanchenko)
// 13-02-03 Add name (V.Ivanchenko)
// 10-02-04 Calculation of radiative corrections using R.Kokoulin model (V.Ivanchenko)
// 08-04-05 Major optimisation of internal interfaces (V.Ivantchenko)
// 12-04-05 Add usage of G4EmCorrections (V.Ivanchenko)
//
//
@@ -54,6 +56,9 @@
#include "G4MuBetheBlochModel.hh"
#include "Randomize.hh"
#include "G4Electron.hh"
#include "G4LossTableManager.hh"
#include "G4EmCorrections.hh"
#include "G4ParticleChangeForLoss.hh"
G4double G4MuBetheBlochModel::xgi[]={ 0.0199,0.1017,0.2372,0.4083,0.5917,0.7628,0.8983,0.9801 };
G4double G4MuBetheBlochModel::wgi[]={ 0.0506,0.1112,0.1569,0.1813,0.1813,0.1569,0.1112,0.0506 };
@@ -68,8 +73,6 @@ G4MuBetheBlochModel::G4MuBetheBlochModel(const G4ParticleDefinition* p,
particle(0),
limitKinEnergy(100.*keV),
logLimitKinEnergy(log(limitKinEnergy)),
highKinEnergy(100.*TeV),
lowKinEnergy(1.0*GeV),
twoln10(2.0*log(10.0)),
bg2lim(0.0169),
taulim(8.4146e-3),
@@ -95,22 +98,6 @@ void G4MuBetheBlochModel::SetParticle(const G4ParticleDefinition* p)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4MuBetheBlochModel::HighEnergyLimit(const G4ParticleDefinition* p)
{
if(!particle) SetParticle(p);
return highKinEnergy;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4MuBetheBlochModel::LowEnergyLimit(const G4ParticleDefinition* p)
{
if(!particle) SetParticle(p);
return lowKinEnergy;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4MuBetheBlochModel::MinEnergyCut(const G4ParticleDefinition*,
const G4MaterialCutsCouple* couple)
{
@@ -119,27 +106,27 @@ G4double G4MuBetheBlochModel::MinEnergyCut(const G4ParticleDefinition*,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4bool G4MuBetheBlochModel::IsInCharge(const G4ParticleDefinition* p)
{
if(!particle) SetParticle(p);
return (p->GetPDGCharge() != 0.0 && p->GetPDGMass() > 10.*MeV
&& p->GetPDGSpin() == 0.5);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4MuBetheBlochModel::Initialise(const G4ParticleDefinition* p,
const G4DataVector&)
{
if(!particle) SetParticle(p);
theElectron = G4Electron::Electron();
if(pParticleChange)
fParticleChange = reinterpret_cast<G4ParticleChangeForLoss*>(pParticleChange);
else
fParticleChange = new G4ParticleChangeForLoss();
corr = G4LossTableManager::Instance()->EmCorrections();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4MuBetheBlochModel::ComputeDEDX(const G4MaterialCutsCouple* couple,
const G4ParticleDefinition* p,
G4double kineticEnergy,
G4double cut)
G4double G4MuBetheBlochModel::ComputeDEDXPerVolume(const G4Material* material,
const G4ParticleDefinition* p,
G4double kineticEnergy,
G4double cut)
{
G4double tmax = MaxSecondaryEnergy(p, kineticEnergy);
G4double tau = kineticEnergy/mass;
@@ -148,17 +135,14 @@ G4double G4MuBetheBlochModel::ComputeDEDX(const G4MaterialCutsCouple* couple,
G4double bg2 = tau * (tau+2.0);
G4double beta2 = bg2/(gam*gam);
const G4Material* material = couple->GetMaterial();
G4double eexc = material->GetIonisation()->GetMeanExcitationEnergy();
G4double eexc2 = eexc*eexc;
G4double taul = material->GetIonisation()->GetTaul();
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* shellCorrectionVector =
material->GetIonisation()->GetShellCorrectionVector();
G4double eDensity = material->GetElectronDensity();
G4double dedx = log(2.0*electron_mass_c2*bg2*cutEnergy/eexc2)-(1.0 + cutEnergy/tmax)*beta2;
@@ -175,23 +159,7 @@ G4double G4MuBetheBlochModel::ComputeDEDX(const G4MaterialCutsCouple* couple,
}
// shell correction
G4double sh = 0.0;
x = 1.0;
if ( bg2 > bg2lim ) {
for (G4int k=0; k<3; k++) {
x *= bg2 ;
sh += shellCorrectionVector[k]/x;
}
} else {
for (G4int k=0; k<3; k++) {
x *= bg2lim ;
sh += shellCorrectionVector[k]/x;
}
sh *= log(tau/taul)/log(taulim/taul);
}
dedx -= sh;
dedx -= 2.0*corr->ShellCorrection(p,material,kineticEnergy);
// now compute the total ionization loss
@@ -217,16 +185,19 @@ G4double G4MuBetheBlochModel::ComputeDEDX(const G4MaterialCutsCouple* couple,
dedx *= twopi_mc2_rcl2*eDensity/beta2;
//High order corrections
dedx += corr->HighOrderCorrections(p,material,kineticEnergy);
return dedx;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4MuBetheBlochModel::CrossSection(const G4MaterialCutsCouple* couple,
const G4ParticleDefinition* p,
G4double kineticEnergy,
G4double cutEnergy,
G4double maxKinEnergy)
G4double G4MuBetheBlochModel::CrossSectionPerVolume(const G4Material* material,
const G4ParticleDefinition* p,
G4double kineticEnergy,
G4double cutEnergy,
G4double maxKinEnergy)
{
G4double cross = 0.0;
G4double tmax = MaxSecondaryEnergy(p, kineticEnergy);
@@ -259,7 +230,7 @@ G4double G4MuBetheBlochModel::CrossSection(const G4MaterialCutsCouple* couple,
cross += dcross*logstep*alphaprime;
}
cross *= twopi_mc2_rcl2*(couple->GetMaterial()->GetElectronDensity())/beta2;
cross *= twopi_mc2_rcl2*(material->GetElectronDensity())/beta2;
}
@@ -270,13 +241,13 @@ G4double G4MuBetheBlochModel::CrossSection(const G4MaterialCutsCouple* couple,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4DynamicParticle* G4MuBetheBlochModel::SampleSecondary(
vector<G4DynamicParticle*>* G4MuBetheBlochModel::SampleSecondaries(
const G4MaterialCutsCouple*,
const G4DynamicParticle* dp,
G4double minEnergy,
G4double maxEnergy)
{
G4double tmax = MaxSecondaryEnergy(dp);
G4double tmax = MaxSecondaryKinEnergy(dp);
G4double maxKinEnergy = min(maxEnergy,tmax);
G4double minKinEnergy = min(minEnergy,maxKinEnergy);
@@ -320,9 +291,9 @@ G4DynamicParticle* G4MuBetheBlochModel::SampleSecondary(
G4double deltaMomentum =
sqrt(deltaKinEnergy * (deltaKinEnergy + 2.0*electron_mass_c2));
G4double totMomentum = totEnergy*sqrt(beta2);
G4double totalMomentum = totEnergy*sqrt(beta2);
G4double cost = deltaKinEnergy * (totEnergy + electron_mass_c2) /
(deltaMomentum * totMomentum);
(deltaMomentum * totalMomentum);
G4double sint = sqrt(1.0 - cost*cost);
@@ -332,23 +303,17 @@ G4DynamicParticle* G4MuBetheBlochModel::SampleSecondary(
G4ThreeVector direction = dp->GetMomentumDirection();
deltaDirection.rotateUz(direction);
// primary change
kineticEnergy -= deltaKinEnergy;
G4ThreeVector dir = totalMomentum*direction - deltaMomentum*deltaDirection;
direction = dir.unit();
fParticleChange->SetProposedKineticEnergy(kineticEnergy);
fParticleChange->SetProposedMomentumDirection(direction);
// create G4DynamicParticle object for delta ray
G4DynamicParticle* delta = new G4DynamicParticle(G4Electron::Electron(),
G4DynamicParticle* delta = new G4DynamicParticle(theElectron,
deltaDirection,deltaKinEnergy);
return delta;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
vector<G4DynamicParticle*>* G4MuBetheBlochModel::SampleSecondaries(
const G4MaterialCutsCouple* couple,
const G4DynamicParticle* dp,
G4double tmin,
G4double maxEnergy)
{
vector<G4DynamicParticle*>* vdp = new vector<G4DynamicParticle*>;
G4DynamicParticle* delta = SampleSecondary(couple,dp,tmin,maxEnergy);
vdp->push_back(delta);
return vdp;
@@ -20,8 +20,8 @@
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: G4MuBremsstrahlung.cc,v 1.35 2004/12/02 08:20:37 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
// $Id: G4MuBremsstrahlung.cc,v 1.36 2005/04/08 15:18:12 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-01 $
//
// -------------------------------------------------------------------
//
@@ -54,6 +54,7 @@
// 10-02-04 Add lowestKinEnergy (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)
// 08-04-05 Major optimisation of internal interfaces (V.Ivantchenko)
//
// -------------------------------------------------------------------
//
@@ -114,16 +115,11 @@ void G4MuBremsstrahlung::InitialiseEnergyLossProcess(const G4ParticleDefinition*
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4MuBremsstrahlung::PrintInfoDefinition()
void G4MuBremsstrahlung::PrintInfo()
{
G4VEnergyLossProcess::PrintInfoDefinition();
G4cout << " Parametrised model "
<< G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -22,7 +22,7 @@
//
//
// $Id: G4MuBremsstrahlung52.cc,v 1.4 2004/12/02 08:20:38 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
// GEANT4 tag $Name: geant4-07-01 $
//
//
//--------------- G4MuBremsstrahlung52 physics process ---------------------------
@@ -20,8 +20,8 @@
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: G4MuBremsstrahlungModel.cc,v 1.13 2004/12/02 08:20:38 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
// $Id: G4MuBremsstrahlungModel.cc,v 1.16 2005/05/18 16:06:18 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-01 $
//
// -------------------------------------------------------------------
//
@@ -42,6 +42,7 @@
// 27-01-03 Make models region aware (V.Ivanchenko)
// 13-02-03 Add name (V.Ivanchenko)
// 10-02-04 Add lowestKinEnergy (V.Ivanchenko)
// 08-04-05 Major optimisation of internal interfaces (V.Ivantchenko)
//
//
@@ -62,6 +63,7 @@
#include "G4Element.hh"
#include "G4ElementVector.hh"
#include "G4ProductionCutsTable.hh"
#include "G4ParticleChangeForLoss.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -78,8 +80,6 @@ using namespace std;
G4MuBremsstrahlungModel::G4MuBremsstrahlungModel(const G4ParticleDefinition*,
const G4String& nam)
: G4VEmModel(nam),
highKinEnergy(100.*TeV),
lowKinEnergy(1.0*keV),
lowestKinEnergy(1.0*GeV),
minThreshold(1.0*keV),
nzdat(5),
@@ -87,7 +87,9 @@ G4MuBremsstrahlungModel::G4MuBremsstrahlungModel(const G4ParticleDefinition*,
NBIN(1000),
cutFixed(0.98*keV),
samplingTablesAreFilled(false)
{}
{
highKinEnergy = HighEnergyLimit();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -103,20 +105,6 @@ G4MuBremsstrahlungModel::~G4MuBremsstrahlungModel()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4MuBremsstrahlungModel::HighEnergyLimit(const G4ParticleDefinition*)
{
return highKinEnergy;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4MuBremsstrahlungModel::LowEnergyLimit(const G4ParticleDefinition*)
{
return lowKinEnergy;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4MuBremsstrahlungModel::MinEnergyCut(const G4ParticleDefinition*,
const G4MaterialCutsCouple*)
{
@@ -125,16 +113,11 @@ G4double G4MuBremsstrahlungModel::MinEnergyCut(const G4ParticleDefinition*,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4bool G4MuBremsstrahlungModel::IsInCharge(const G4ParticleDefinition* p)
{
return (p == G4MuonMinus::MuonMinus() || p == G4MuonPlus::MuonPlus());
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4MuBremsstrahlungModel::Initialise(const G4ParticleDefinition*,
const G4DataVector& cuts)
{
theGamma = G4Gamma::Gamma();
const G4ProductionCutsTable* theCoupleTable=
G4ProductionCutsTable::GetProductionCutsTable();
size_t numOfCouples = theCoupleTable->GetTableSize();
@@ -153,12 +136,16 @@ void G4MuBremsstrahlungModel::Initialise(const G4ParticleDefinition*,
partialSumSigma.push_back(dv);
}
if(!samplingTablesAreFilled) MakeSamplingTables();
if(pParticleChange)
fParticleChange = reinterpret_cast<G4ParticleChangeForLoss*>(pParticleChange);
else
fParticleChange = new G4ParticleChangeForLoss();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4MuBremsstrahlungModel::ComputeDEDX(const G4MaterialCutsCouple* couple,
G4double G4MuBremsstrahlungModel::ComputeDEDXPerVolume(
const G4Material* material,
const G4ParticleDefinition*,
G4double kineticEnergy,
G4double cutEnergy)
@@ -169,7 +156,6 @@ G4double G4MuBremsstrahlungModel::ComputeDEDX(const G4MaterialCutsCouple* couple
G4double tmax = kineticEnergy;
G4double cut = min(cutEnergy,tmax);
const G4Material* material = couple->GetMaterial();
const G4ElementVector* theElementVector = material->GetElementVector();
const G4double* theAtomicNumDensityVector = material->GetAtomicNumDensityVector();
@@ -333,7 +319,8 @@ G4double G4MuBremsstrahlungModel::ComputeDMicroscopicCrossSection(
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4MuBremsstrahlungModel::CrossSection(const G4MaterialCutsCouple* couple,
G4double G4MuBremsstrahlungModel::CrossSectionPerVolume(
const G4Material* material,
const G4ParticleDefinition*,
G4double kineticEnergy,
G4double cutEnergy,
@@ -345,7 +332,6 @@ G4double G4MuBremsstrahlungModel::CrossSection(const G4MaterialCutsCouple* coupl
G4double tmax = min(maxEnergy, kineticEnergy);
G4double cut = min(cutEnergy, tmax);
const G4Material* material = couple->GetMaterial();
const G4ElementVector* theElementVector = material->GetElementVector() ;
const G4double* theAtomNumDensityVector = material->GetAtomicNumDensityVector();
@@ -462,13 +448,13 @@ void G4MuBremsstrahlungModel::MakeSamplingTables()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4DynamicParticle* G4MuBremsstrahlungModel::SampleSecondary(
vector<G4DynamicParticle*>* G4MuBremsstrahlungModel::SampleSecondaries(
const G4MaterialCutsCouple* couple,
const G4DynamicParticle* dp,
G4double minEnergy,
G4double maxEnergy)
{
G4double kineticEnergy = dp->GetKineticEnergy();
G4double kineticEnergy = dp->GetKineticEnergy();
// check against insufficient energy
G4double tmax = min(kineticEnergy, maxEnergy);
G4double tmin = min(tmax, minEnergy);
@@ -504,7 +490,7 @@ G4DynamicParticle* G4MuBremsstrahlungModel::SampleSecondary(
NBINminus1 = NBIN-1 ;
for (G4int iz=0; iz<nzdat; iz++)
{
del = fabs(lnZ-log(zdat[iz])) ;
del = std::abs(lnZ-log(zdat[iz])) ;
if(del<delmin)
{
delmin=del ;
@@ -515,7 +501,7 @@ G4DynamicParticle* G4MuBremsstrahlungModel::SampleSecondary(
delmin = 1.e10 ;
for (G4int it=0; it<ntdat; it++)
{
del = fabs(log(tmax)-log(tdat[it])) ;
del = std::abs(log(tmax)-log(tdat[it])) ;
if(del<delmin)
{
delmin=del;
@@ -564,24 +550,13 @@ G4DynamicParticle* G4MuBremsstrahlungModel::SampleSecondary(
G4ThreeVector GammaDirection ( dirx, diry, dirz);
GammaDirection.rotateUz(ParticleDirection);
G4DynamicParticle* aGamma = new G4DynamicParticle();
aGamma->SetDefinition(G4Gamma::Gamma());
aGamma->SetKineticEnergy(GammaEnergy);
aGamma->SetMomentumDirection(GammaDirection);
// primary change
kineticEnergy -= GammaEnergy;
fParticleChange->SetProposedKineticEnergy(kineticEnergy);
return aGamma;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
vector<G4DynamicParticle*>* G4MuBremsstrahlungModel::SampleSecondaries(
const G4MaterialCutsCouple* couple,
const G4DynamicParticle* dp,
G4double tmin,
G4double maxEnergy)
{
// save secondary
G4DynamicParticle* aGamma = new G4DynamicParticle(theGamma,GammaDirection,GammaEnergy);
vector<G4DynamicParticle*>* vdp = new vector<G4DynamicParticle*>;
G4DynamicParticle* aGamma = SampleSecondary(couple,dp,tmin,maxEnergy);
vdp->push_back(aGamma);
return vdp;
@@ -20,8 +20,8 @@
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: G4MuIonisation.cc,v 1.46 2004/12/02 08:20:38 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
// $Id: G4MuIonisation.cc,v 1.47 2005/04/08 15:18:12 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-01 $
//
// -------------------------------------------------------------------
//
@@ -63,6 +63,7 @@
// 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)
// 08-04-05 Major optimisation of internal interfaces (V.Ivantchenko)
//
// -------------------------------------------------------------------
//
@@ -88,7 +89,6 @@ G4MuIonisation::G4MuIonisation(const G4String& name)
: G4VEnergyLossProcess(name),
theParticle(0),
theBaseParticle(0),
subCutoff(false),
isInitialised(false)
{
SetDEDXBinning(120);
@@ -139,10 +139,8 @@ void G4MuIonisation::InitialiseEnergyLossProcess(const G4ParticleDefinition* par
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4MuIonisation::PrintInfoDefinition()
void G4MuIonisation::PrintInfo()
{
G4VEnergyLossProcess::PrintInfoDefinition();
G4cout << " Bether-Bloch model for E > 0.2 MeV, "
<< "parametrisation of Bragg peak below, "
<< G4endl;
@@ -151,13 +149,6 @@ void G4MuIonisation::PrintInfoDefinition()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4MuIonisation::SetSubCutoff(G4bool val)
{
subCutoff = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -22,7 +22,7 @@
//
//
// $Id: G4MuIonisation52.cc,v 1.4 2004/12/02 08:20:38 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
// GEANT4 tag $Name: geant4-07-01 $
//
// --------------- G4MuIonisation52 physics process ------------------------------
// by Laszlo Urban, September 1997
@@ -20,8 +20,8 @@
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: G4MuPairProduction.cc,v 1.45 2004/12/02 08:20:38 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
// $Id: G4MuPairProduction.cc,v 1.46 2005/04/08 15:18:12 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-01 $
//
// -------------------------------------------------------------------
//
@@ -60,6 +60,7 @@
// 10-02-04 Add lowestKinEnergy (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)
// 08-04-05 Major optimisation of internal interfaces (V.Ivantchenko)
//
// -------------------------------------------------------------------
//
@@ -83,7 +84,6 @@ G4MuPairProduction::G4MuPairProduction(const G4String& name)
theParticle(0),
theBaseParticle(0),
lowestKinEnergy(1.*GeV),
subCutoff(false),
isInitialised(false)
{
SetDEDXBinning(120);
@@ -120,23 +120,14 @@ void G4MuPairProduction::InitialiseEnergyLossProcess(const G4ParticleDefinition*
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4MuPairProduction::PrintInfoDefinition()
void G4MuPairProduction::PrintInfo()
{
G4VEnergyLossProcess::PrintInfoDefinition();
G4cout << " Parametrised model "
<< G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4MuPairProduction::SetSubCutoff(G4bool val)
{
subCutoff = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -22,7 +22,7 @@
//
//
// $Id: G4MuPairProduction52.cc,v 1.4 2004/12/02 08:20:38 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
// GEANT4 tag $Name: geant4-07-01 $
//
//--------------- G4MuPairProduction52 physics process ---------------------------
// by Laszlo Urban, May 1998
@@ -20,8 +20,8 @@
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: G4MuPairProductionModel.cc,v 1.21 2004/12/02 08:20:38 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
// $Id: G4MuPairProductionModel.cc,v 1.25 2005/04/12 18:12:33 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-01 $
//
// -------------------------------------------------------------------
//
@@ -49,6 +49,7 @@
// 28-04-04 For complex materials repeat calculation of max energy for each
// material (V.Ivanchenko)
// 01-11-04 Fix bug in expression inside ComputeDMicroscopicCrossSection (R.Kokoulin)
// 08-04-05 Major optimisation of internal interfaces (V.Ivantchenko)
//
// Class Description:
@@ -69,6 +70,7 @@
#include "G4Element.hh"
#include "G4ElementVector.hh"
#include "G4ProductionCutsTable.hh"
#include "G4ParticleChangeForLoss.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -88,8 +90,6 @@ G4MuPairProductionModel::G4MuPairProductionModel(const G4ParticleDefinition*,
const G4String& nam)
: G4VEmModel(nam),
minPairEnergy(4.*electron_mass_c2),
highKinEnergy(1000000.*TeV),
lowKinEnergy(minPairEnergy),
lowestKinEnergy(1.*GeV),
factorForCross(4.*fine_structure_const*fine_structure_const
*classic_electr_radius*classic_electr_radius/(3.*pi)),
@@ -105,7 +105,9 @@ G4MuPairProductionModel::G4MuPairProductionModel(const G4ParticleDefinition*,
ymax(0.),
dy((ymax-ymin)/nbiny),
samplingTablesAreFilled(false)
{}
{
SetLowEnergyLimit(minPairEnergy);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -114,20 +116,6 @@ G4MuPairProductionModel::~G4MuPairProductionModel()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4MuPairProductionModel::HighEnergyLimit(const G4ParticleDefinition*)
{
return highKinEnergy;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4MuPairProductionModel::LowEnergyLimit(const G4ParticleDefinition*)
{
return lowKinEnergy;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4MuPairProductionModel::MinEnergyCut(const G4ParticleDefinition*,
const G4MaterialCutsCouple* )
{
@@ -136,22 +124,24 @@ G4double G4MuPairProductionModel::MinEnergyCut(const G4ParticleDefinition*,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4bool G4MuPairProductionModel::IsInCharge(const G4ParticleDefinition* p)
{
return (p == G4MuonMinus::MuonMinus() || p == G4MuonPlus::MuonPlus());
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4MuPairProductionModel::Initialise(const G4ParticleDefinition*,
const G4DataVector&)
{
if (!samplingTablesAreFilled) MakeSamplingTables();
theElectron = G4Electron::Electron();
thePositron = G4Positron::Positron();
if(pParticleChange)
fParticleChange = reinterpret_cast<G4ParticleChangeForLoss*>(pParticleChange);
else
fParticleChange = new G4ParticleChangeForLoss();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4MuPairProductionModel::ComputeDEDX(const G4MaterialCutsCouple* couple,
G4double G4MuPairProductionModel::ComputeDEDXPerVolume(
const G4Material* material,
const G4ParticleDefinition*,
G4double kineticEnergy,
G4double cutEnergy)
@@ -159,7 +149,6 @@ G4double G4MuPairProductionModel::ComputeDEDX(const G4MaterialCutsCouple* couple
G4double dedx = 0.0;
if (cutEnergy <= minPairEnergy || kineticEnergy <= lowestKinEnergy) return dedx;
const G4Material* material = couple->GetMaterial();
const G4ElementVector* theElementVector = material->GetElementVector();
const G4double* theAtomicNumDensityVector =
material->GetAtomicNumDensityVector();
@@ -169,8 +158,7 @@ G4double G4MuPairProductionModel::ComputeDEDX(const G4MaterialCutsCouple* couple
G4double Z = (*theElementVector)[i]->GetZ();
SetCurrentElement(Z);
G4double tmax = MaxSecondaryEnergy(particle, kineticEnergy);
G4double cut = min(cutEnergy,tmax);
G4double loss = ComputMuPairLoss(Z, kineticEnergy, cut, tmax);
G4double loss = ComputMuPairLoss(Z, kineticEnergy, cutEnergy, tmax);
dedx += loss*theAtomicNumDensityVector[i];
}
if (dedx < 0.) dedx = 0.;
@@ -186,8 +174,8 @@ G4double G4MuPairProductionModel::ComputMuPairLoss(G4double Z,
SetCurrentElement(Z);
G4double loss = 0.0;
G4double cut = cutEnergy;
if(tmax <= cutEnergy || cut <= minPairEnergy) return loss;
G4double cut = min(cutEnergy,tmax);
if(cut <= minPairEnergy) return loss;
// calculate the rectricted loss
// numerical integration in log(PairEnergy)
@@ -365,7 +353,8 @@ G4double G4MuPairProductionModel::ComputeDMicroscopicCrossSection(
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4MuPairProductionModel::CrossSection(const G4MaterialCutsCouple* couple,
G4double G4MuPairProductionModel::CrossSectionPerVolume(
const G4Material* material,
const G4ParticleDefinition*,
G4double kineticEnergy,
G4double cutEnergy,
@@ -376,9 +365,8 @@ G4double G4MuPairProductionModel::CrossSection(const G4MaterialCutsCouple* coupl
maxEnergy += particleMass;
const G4Material* material = couple->GetMaterial();
const G4ElementVector* theElementVector = material->GetElementVector();
const G4double* theAtomNumDensityVector=material->GetAtomicNumDensityVector();
const G4double* theAtomNumDensityVector = material->GetAtomicNumDensityVector();
for (size_t i=0; i<material->GetNumberOfElements(); i++) {
G4double Z = (*theElementVector)[i]->GetZ();
@@ -444,17 +432,6 @@ void G4MuPairProductionModel::MakeSamplingTables()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4DynamicParticle* G4MuPairProductionModel::SampleSecondary(
const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double,
G4double)
{
return 0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
vector<G4DynamicParticle*>* G4MuPairProductionModel::SampleSecondaries(
const G4MaterialCutsCouple* couple,
const G4DynamicParticle* aDynamicParticle,
@@ -543,7 +520,7 @@ vector<G4DynamicParticle*>* G4MuPairProductionModel::SampleSecondaries(
ElectDirection.rotateUz(ParticleDirection);
// create G4DynamicParticle object for the particle1
G4DynamicParticle* aParticle1= new G4DynamicParticle(G4Electron::Electron(),
G4DynamicParticle* aParticle1= new G4DynamicParticle(theElectron,
ElectDirection,
ElectKineEnergy);
@@ -553,10 +530,13 @@ vector<G4DynamicParticle*>* G4MuPairProductionModel::SampleSecondaries(
PositDirection.rotateUz(ParticleDirection);
// create G4DynamicParticle object for the particle2
G4DynamicParticle* aParticle2= new G4DynamicParticle(G4Positron::Positron(),
G4DynamicParticle* aParticle2= new G4DynamicParticle(thePositron,
PositDirection,
PositKineEnergy);
// primary change
kineticEnergy -= (ElectKineEnergy + PositKineEnergy + 2.0*electron_mass_c2);
fParticleChange->SetProposedKineticEnergy(kineticEnergy);
vector<G4DynamicParticle*>* vdp = new vector<G4DynamicParticle*>;
vdp->push_back(aParticle1);
@@ -22,7 +22,7 @@
//
//
// $Id: G4VMuEnergyLoss.cc,v 1.31 2004/12/02 08:20:38 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
// GEANT4 tag $Name: geant4-07-01 $
// --------------------------------------------------------------
// GEANT 4 class implementation file
//