Import Geant4 4.0.0 source tree
This commit is contained in:
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4eLowEnergyLoss.cc,v 1.9.2.2 2001/06/28 20:19:32 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
// $Id: G4eLowEnergyLoss.cc,v 1.23 2001/11/23 11:45:29 vnivanch Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
//
|
||||
// -----------------------------------------------------------
|
||||
// GEANT 4 class implementation file
|
||||
@@ -32,7 +32,6 @@
|
||||
// ---------- G4eLowEnergyLoss physics process -----------
|
||||
// by Laszlo Urban, 20 March 1997
|
||||
// **************************************************************
|
||||
// It is the first implementation of the NEW UNIFIED ENERGY LOSS PROCESS.
|
||||
// It calculates the energy loss of e+/e-.
|
||||
// --------------------------------------------------------------
|
||||
//
|
||||
@@ -48,7 +47,14 @@
|
||||
// 10/02/00 modifications , new e.m. structure, L.Urban
|
||||
// 11/04/00: Bug fix in dE/dx fluctuation simulation, Veronique Lefebure
|
||||
// 19-09-00 change of fluctuation sampling V.Ivanchenko
|
||||
// 20/09/00 update fluctuations V.Ivanchenko
|
||||
// 20/09/00 update fluctuations V.Ivanchenko
|
||||
// 18/10/01 add fluorescence AlongStepDoIt V.Ivanchenko
|
||||
// 18/10/01 Revision to improve code quality and consistency with design, MGP
|
||||
// 19/10/01 update according to new design, V.Ivanchenko
|
||||
// 24/10/01 MGP - Protection against negative energy loss in AlongStepDoIt
|
||||
// 26/10/01 VI Clean up access to deexcitation
|
||||
// 23/11/01 VI Move static member-functions from header to source
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
|
||||
#include "G4eLowEnergyLoss.hh"
|
||||
@@ -137,6 +143,55 @@ G4eLowEnergyLoss::~G4eLowEnergyLoss()
|
||||
}
|
||||
}
|
||||
|
||||
void G4eLowEnergyLoss::SetNbOfProcesses(G4int nb)
|
||||
{
|
||||
NbOfProcesses=nb;
|
||||
}
|
||||
|
||||
void G4eLowEnergyLoss::PlusNbOfProcesses()
|
||||
{
|
||||
NbOfProcesses++;
|
||||
}
|
||||
|
||||
void G4eLowEnergyLoss::MinusNbOfProcesses()
|
||||
{
|
||||
NbOfProcesses--;
|
||||
}
|
||||
|
||||
G4int G4eLowEnergyLoss::GetNbOfProcesses()
|
||||
{
|
||||
return NbOfProcesses;
|
||||
}
|
||||
|
||||
void G4eLowEnergyLoss::SetLowerBoundEloss(G4double val)
|
||||
{
|
||||
LowerBoundEloss=val;
|
||||
}
|
||||
|
||||
void G4eLowEnergyLoss::SetUpperBoundEloss(G4double val)
|
||||
{
|
||||
UpperBoundEloss=val;
|
||||
}
|
||||
|
||||
void G4eLowEnergyLoss::SetNbinEloss(G4int nb)
|
||||
{
|
||||
NbinEloss=nb;
|
||||
}
|
||||
|
||||
G4double G4eLowEnergyLoss::GetLowerBoundEloss()
|
||||
{
|
||||
return LowerBoundEloss;
|
||||
}
|
||||
|
||||
G4double G4eLowEnergyLoss::GetUpperBoundEloss()
|
||||
{
|
||||
return UpperBoundEloss;
|
||||
}
|
||||
|
||||
G4int G4eLowEnergyLoss::GetNbinEloss()
|
||||
{
|
||||
return NbinEloss;
|
||||
}
|
||||
//
|
||||
|
||||
void G4eLowEnergyLoss::BuildDEDXTable(
|
||||
@@ -154,8 +209,7 @@ void G4eLowEnergyLoss::BuildDEDXTable(
|
||||
// different processes.
|
||||
//
|
||||
|
||||
const G4MaterialTable* theMaterialTable=G4Material::GetMaterialTable();
|
||||
G4int numOfMaterials = theMaterialTable->length();
|
||||
G4int numOfMaterials = G4Material::GetNumberOfMaterials();
|
||||
|
||||
// create table for the total energy loss
|
||||
|
||||
@@ -334,15 +388,13 @@ G4VParticleChange* G4eLowEnergyLoss::AlongStepDoIt( const G4Track& trackData,
|
||||
// get particle and material pointers from trackData
|
||||
const G4DynamicParticle* aParticle = trackData.GetDynamicParticle();
|
||||
G4double E = aParticle->GetKineticEnergy() ;
|
||||
|
||||
// G4cout << "MGP -- Along eInit " << E/keV << " keV " << G4endl;
|
||||
|
||||
G4Material* aMaterial = trackData.GetMaterial();
|
||||
// G4int index = aMaterial->GetIndex();
|
||||
|
||||
G4double Step = stepData.GetStepLength();
|
||||
|
||||
fParticleChange.Initialize(trackData);
|
||||
aParticleChange.Initialize(trackData);
|
||||
//fParticleChange.Initialize(trackData);
|
||||
|
||||
G4double MeanLoss, finalT;
|
||||
|
||||
@@ -386,18 +438,64 @@ G4VParticleChange* G4eLowEnergyLoss::AlongStepDoIt( const G4Track& trackData,
|
||||
if (finalT <= 0. )
|
||||
{
|
||||
finalT = 0.;
|
||||
if (Charge < 0.) fParticleChange.SetStatusChange(fStopAndKill);
|
||||
else fParticleChange.SetStatusChange(fStopButAlive);
|
||||
if (Charge < 0.) aParticleChange.SetStatusChange(fStopAndKill);
|
||||
else aParticleChange.SetStatusChange(fStopButAlive);
|
||||
}
|
||||
|
||||
// MGP debug
|
||||
// G4cout << "MGP AlongStepDoIt finalT = " << finalT/keV << " keV" << G4endl;
|
||||
G4double edep = E - finalT;
|
||||
|
||||
aParticleChange.SetEnergyChange(finalT);
|
||||
|
||||
// Deexcitation of ionised atoms
|
||||
G4std::vector<G4DynamicParticle*>* deexcitationProducts =
|
||||
DeexciteAtom(aMaterial,E,edep);
|
||||
|
||||
|
||||
fParticleChange.SetEnergyChange(finalT);
|
||||
fParticleChange.SetLocalEnergyDeposit(E-finalT);
|
||||
size_t nSecondaries = deexcitationProducts->size();
|
||||
aParticleChange.SetNumberOfSecondaries(nSecondaries);
|
||||
|
||||
if (nSecondaries > 0) {
|
||||
|
||||
return &fParticleChange;
|
||||
const G4StepPoint* preStep = stepData.GetPreStepPoint();
|
||||
const G4StepPoint* postStep = stepData.GetPostStepPoint();
|
||||
G4ThreeVector r = preStep->GetPosition();
|
||||
G4ThreeVector deltaR = postStep->GetPosition();
|
||||
deltaR -= r;
|
||||
G4double t = preStep->GetGlobalTime();
|
||||
G4double deltaT = postStep->GetGlobalTime();
|
||||
deltaT -= t;
|
||||
G4double time, q;
|
||||
G4ThreeVector position;
|
||||
|
||||
for (size_t i=0; i<nSecondaries; i++) {
|
||||
|
||||
G4DynamicParticle* part = (*deexcitationProducts)[i];
|
||||
if (part != 0) {
|
||||
G4double eSecondary = part->GetKineticEnergy();
|
||||
edep -= eSecondary;
|
||||
if (edep > 0.)
|
||||
{
|
||||
q = G4UniformRand();
|
||||
time = deltaT*q + t;
|
||||
position = deltaR*q;
|
||||
position += r;
|
||||
G4Track* newTrack = new G4Track(part, time, position);
|
||||
aParticleChange.AddSecondary(newTrack);
|
||||
}
|
||||
else
|
||||
{
|
||||
edep += eSecondary;
|
||||
delete part;
|
||||
part = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
delete deexcitationProducts;
|
||||
|
||||
aParticleChange.SetLocalEnergyDeposit(edep);
|
||||
|
||||
return &aParticleChange;
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user