Import Geant4 4.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 16:18:25 +02:00
parent 36c080dca6
commit 921d3b1cda
3990 changed files with 185376 additions and 82884 deletions
+55 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.20 2001/05/18 15:14:11 maire Exp $
$Id: History,v 1.38 2001/11/08 15:56:51 maire Exp $
-------------------------------------------------------------------
=========================================================
@@ -16,6 +16,60 @@ committal in the CVS repository !
----------------------------------------------------------
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
08 nov 01: mma (utils-V03-02-11)
- G4VEnergyLoss: some data members and functions are no more static
07 nov 01: mma (utils-V03-02-10)
- bug fixe in G4MultipleScattering::PostStepDoIt()
29 oct 01: mma (utils-V03-02-09)
- static functions no more inlined
24 oct 01: mma (utils-V03-02-08)
- cut per material: G4VEnergyLoss
28 sep 01: mma (utils-V03-02-07)
- StorePhysicsTable: ParticleName included in FileName
27 sep 01: L.Urban (utils-V03-02-06)
- bug fixed in G4EnergyLossTables.icc,.cc:
this bug caused sometime negative energy deposit
(it was a very-very old bug)
- value of data member factlim in msc has been changed
19 sep 01: mma (utils-V03-02-05)
- come back to previous process name: "msc"
17 sep 01: mma (utils-V03-02-04)
- modifs in muls and VEnergyLoss for the migration of Materials to pure STL,
but backward compatible with g4rw
13 sep 01: L.Urban (utils-V03-02-03)
- Unused TrueToGeomTransformation method deleted. Class description
- corr. in ComputeTransportCrossSection
11 sep 01: L.Urban (utils-V03-02-02)
- G4MultipleScatteringx put as the default: G4MultipleScattering
11 sep 01: L.Urban (utils-V03-02-01)
- last tag with G4MultipleScatteringx file.
03 sep 01: L.Urban (utils-V03-02-00)
- value of data member factlim has been changed.
28 aug 01: mma
- G4MultipleScatteringx: small modifs in BuildPhysicsTable,
ComputeTransportCrossSection, PostStepDoIt.
GetContinuousStepLimit and AlongStepDoIt moved to .cc file
23 aug 01: L. Urban
- new angle and z(geom. pathlength) distributions,
energy (step) dependence has been reduced,
Store/Retrieve methods have been commented out temporarily
8 aug 01: mma
- G4MultipleScatteringx: methods to store/retrieve PhysicsTable
18 may 01: V.Ivanchenko (utils-V03-01-01)
- clean up againist Linux ANSI strict compilation mode.
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4EnergyLossMessenger.hh,v 1.3.4.1 2001/06/28 19:12:47 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4EnergyLossMessenger.hh,v 1.4 2001/07/11 10:03:40 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// Class Description:
@@ -21,12 +21,12 @@
// ********************************************************************
//
//
// $Id: G4EnergyLossTables.hh,v 1.10.4.1 2001/06/28 19:12:47 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4EnergyLossTables.hh,v 1.12 2001/10/29 09:40:51 maire Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
// $Id:
//
// -------------------------------------------------------------------
// -----------------------------------------------------------------------------
#ifndef included_G4EnergyLossTables
#define included_G4EnergyLossTables
@@ -39,14 +39,14 @@
#include "G4Material.hh"
#include "G4ios.hh"
// -------------------------------------------------------------------
//------------------------------------------------------------------------------
// A utility class, containing the energy loss tables
// for each particle
//
// Energy loss processes have to register their tables with this
// class. The responsibility of creating and deleting the tables
// remains with the energy loss classes.
// -------------------------------------------------------------------
// -----------------------------------------------------------------------------
//
// P. Urban, 06/04/1998
// L. Urban, 27/05/1988 , modifications + new functions added
@@ -56,8 +56,10 @@
// L.Urban , 12/04/99 , bug fixed
// don't use the helper class.
// It can't be hidden for Rogue Wave uses it.
// 10/11/99: moved from RWT hash dictionary to STL map, G.Barrand, M.Maire
// -------------------------------------------------------------------
// 10.11.99: moved from RWT hash dictionary to STL map, G.Barrand, M.Maire
// 26.10.01: all static functions movev from .icc to .cc file (mma)
//
// -----------------------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -184,6 +186,4 @@ private:
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4EnergyLossTables.icc"
#endif
@@ -1,529 +0,0 @@
//
// ********************************************************************
// * 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: G4EnergyLossTables.icc,v 1.13.2.1 2001/06/28 19:12:47 gunter Exp $
// GEANT4 tag $Name: $
//
// $Id:
// Inline members of the G4EnergyLossTables class
//
// -------------------------------------------------------------------
// first version created by P.Urban , 06/04/1998
// modified by L.Urban , 27/05/98
// cache mechanism , L.Urban , 11/02/99
// bug fixed , L.Urban , 12/04/99
// 10/11/99: moved from RWT hash dictionary to STL map, G.Barrand, M.Maire
// 18/05/01 V.Ivanchenko Clean up againist Linux ANSI compilation
//
// -------------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4EnergyLossTablesHelper::G4EnergyLossTablesHelper(
const G4PhysicsTable* aDEDXTable,
const G4PhysicsTable* aRangeTable,
const G4PhysicsTable* anInverseRangeTable,
const G4PhysicsTable* aLabTimeTable,
const G4PhysicsTable* aProperTimeTable,
G4double aLowestKineticEnergy,
G4double aHighestKineticEnergy,
G4double aMassRatio,
G4int aNumberOfBins)
:
theDEDXTable(aDEDXTable), theRangeTable(aRangeTable),
theInverseRangeTable(anInverseRangeTable),
theLabTimeTable(aLabTimeTable),
theProperTimeTable(aProperTimeTable),
theLowestKineticEnergy(aLowestKineticEnergy),
theHighestKineticEnergy(aHighestKineticEnergy),
theMassRatio(aMassRatio),
theNumberOfBins(aNumberOfBins)
{
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4EnergyLossTablesHelper::G4EnergyLossTablesHelper()
{
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline const G4PhysicsTable* G4EnergyLossTables::GetDEDXTable(
const G4ParticleDefinition* p)
{
helper_map::iterator it;
if((it=dict.find(p))==dict.end()) return 0;
return (*it).second.theDEDXTable;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline const G4PhysicsTable* G4EnergyLossTables::GetRangeTable(
const G4ParticleDefinition* p)
{
helper_map::iterator it;
if((it=dict.find(p))==dict.end()) return 0;
return (*it).second.theRangeTable;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline const G4PhysicsTable* G4EnergyLossTables::GetInverseRangeTable(
const G4ParticleDefinition* p)
{
helper_map::iterator it;
if((it=dict.find(p))==dict.end()) return 0;
return (*it).second.theInverseRangeTable;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline const G4PhysicsTable* G4EnergyLossTables::GetLabTimeTable(
const G4ParticleDefinition* p)
{
helper_map::iterator it;
if((it=dict.find(p))==dict.end()) return 0;
return (*it).second.theLabTimeTable;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline const G4PhysicsTable* G4EnergyLossTables::GetProperTimeTable(
const G4ParticleDefinition* p)
{
helper_map::iterator it;
if((it=dict.find(p))==dict.end()) return 0;
return (*it).second.theProperTimeTable;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4EnergyLossTablesHelper G4EnergyLossTables::GetTables(
const G4ParticleDefinition* p)
{
helper_map::iterator it;
if((it=dict.find(p))==dict.end()) {
G4Exception("G4EnergyLossTables::GetTables: table not found!");
exit(1);
}
return (*it).second;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double G4EnergyLossTables::GetDEDX(
const G4ParticleDefinition *aParticle,
G4double KineticEnergy,
const G4Material *aMaterial)
{
if(aParticle != lastParticle)
{
t= GetTables(aParticle);
lastParticle = aParticle ;
Chargesquare = (aParticle->GetPDGCharge())*
(aParticle->GetPDGCharge())/
QQPositron ;
}
const G4PhysicsTable* dEdxTable= t.theDEDXTable;
G4int materialIndex = aMaterial->GetIndex();
G4double scaledKineticEnergy = KineticEnergy*t.theMassRatio;
G4double dEdx;
G4bool isOut;
if (scaledKineticEnergy<t.theLowestKineticEnergy) {
dEdx =(*dEdxTable)(materialIndex)->GetValue(
t.theLowestKineticEnergy,isOut)
*sqrt(scaledKineticEnergy/t.theLowestKineticEnergy);
} else if (scaledKineticEnergy>t.theHighestKineticEnergy) {
dEdx = (*dEdxTable)(materialIndex)->GetValue(
t.theHighestKineticEnergy,isOut);
} else {
dEdx = (*dEdxTable)(materialIndex)->GetValue(
scaledKineticEnergy,isOut);
}
return dEdx*Chargesquare;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double G4EnergyLossTables::GetLabTime(
const G4ParticleDefinition *aParticle,
G4double KineticEnergy,
const G4Material *aMaterial)
{
if(aParticle != lastParticle)
{
t= GetTables(aParticle);
lastParticle = aParticle ;
}
const G4PhysicsTable* labtimeTable= t.theLabTimeTable;
const G4double parlowen=0.4 , ppar=0.5-parlowen ;
G4int materialIndex = aMaterial->GetIndex();
G4double scaledKineticEnergy = KineticEnergy*t.theMassRatio;
G4double time;
G4bool isOut;
if (scaledKineticEnergy<t.theLowestKineticEnergy) {
time = exp(ppar*log(scaledKineticEnergy/t.theLowestKineticEnergy))*
(*labtimeTable)(materialIndex)->GetValue(
t.theLowestKineticEnergy,isOut);
} else if (scaledKineticEnergy>t.theHighestKineticEnergy) {
time = (*labtimeTable)(materialIndex)->GetValue(
t.theHighestKineticEnergy,isOut);
} else {
time = (*labtimeTable)(materialIndex)->GetValue(
scaledKineticEnergy,isOut);
}
return time/t.theMassRatio ;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double G4EnergyLossTables::GetDeltaLabTime(
const G4ParticleDefinition *aParticle,
G4double KineticEnergyStart,
G4double KineticEnergyEnd,
const G4Material *aMaterial)
{
if(aParticle != lastParticle)
{
t= GetTables(aParticle);
lastParticle = aParticle ;
}
const G4PhysicsTable* labtimeTable= t.theLabTimeTable;
const G4double parlowen=0.4 , ppar=0.5-parlowen ;
const G4double dToverT = 0.05 , facT = 1. -dToverT ;
G4double timestart,timeend,deltatime,dTT;
G4bool isOut;
G4int materialIndex = aMaterial->GetIndex();
G4double scaledKineticEnergy = KineticEnergyStart*t.theMassRatio;
if (scaledKineticEnergy<t.theLowestKineticEnergy) {
timestart = exp(ppar*log(scaledKineticEnergy/t.theLowestKineticEnergy))*
(*labtimeTable)(materialIndex)->GetValue(
t.theLowestKineticEnergy,isOut);
} else if (scaledKineticEnergy>t.theHighestKineticEnergy) {
timestart = (*labtimeTable)(materialIndex)->GetValue(
t.theHighestKineticEnergy,isOut);
} else {
timestart = (*labtimeTable)(materialIndex)->GetValue(
scaledKineticEnergy,isOut);
}
dTT = (KineticEnergyStart - KineticEnergyEnd)/KineticEnergyStart ;
if( dTT < dToverT )
scaledKineticEnergy = facT*KineticEnergyStart*t.theMassRatio;
else
scaledKineticEnergy = KineticEnergyEnd*t.theMassRatio;
if (scaledKineticEnergy<t.theLowestKineticEnergy) {
timeend = exp(ppar*log(scaledKineticEnergy/t.theLowestKineticEnergy))*
(*labtimeTable)(materialIndex)->GetValue(
t.theLowestKineticEnergy,isOut);
} else if (scaledKineticEnergy>t.theHighestKineticEnergy) {
timeend = (*labtimeTable)(materialIndex)->GetValue(
t.theHighestKineticEnergy,isOut);
} else {
timeend = (*labtimeTable)(materialIndex)->GetValue(
scaledKineticEnergy,isOut);
}
deltatime = timestart - timeend ;
if( dTT < dToverT )
deltatime *= dTT/dToverT;
return deltatime/t.theMassRatio ;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double G4EnergyLossTables::GetProperTime(
const G4ParticleDefinition *aParticle,
G4double KineticEnergy,
const G4Material *aMaterial)
{
if(aParticle != lastParticle)
{
t= GetTables(aParticle);
lastParticle = aParticle ;
}
const G4PhysicsTable* propertimeTable= t.theProperTimeTable;
const G4double parlowen=0.4 , ppar=0.5-parlowen ;
G4int materialIndex = aMaterial->GetIndex();
G4double scaledKineticEnergy = KineticEnergy*t.theMassRatio;
G4double time;
G4bool isOut;
if (scaledKineticEnergy<t.theLowestKineticEnergy) {
time = exp(ppar*log(scaledKineticEnergy/t.theLowestKineticEnergy))*
(*propertimeTable)(materialIndex)->GetValue(
t.theLowestKineticEnergy,isOut);
} else if (scaledKineticEnergy>t.theHighestKineticEnergy) {
time = (*propertimeTable)(materialIndex)->GetValue(
t.theHighestKineticEnergy,isOut);
} else {
time = (*propertimeTable)(materialIndex)->GetValue(
scaledKineticEnergy,isOut);
}
return time/t.theMassRatio ;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double G4EnergyLossTables::GetDeltaProperTime(
const G4ParticleDefinition *aParticle,
G4double KineticEnergyStart,
G4double KineticEnergyEnd,
const G4Material *aMaterial)
{
if(aParticle != lastParticle)
{
t= GetTables(aParticle);
lastParticle = aParticle ;
}
const G4PhysicsTable* propertimeTable= t.theProperTimeTable;
const G4double parlowen=0.4 , ppar=0.5-parlowen ;
const G4double dToverT = 0.05 , facT = 1. -dToverT ;
G4double timestart,timeend,deltatime,dTT;
G4bool isOut;
G4int materialIndex = aMaterial->GetIndex();
G4double scaledKineticEnergy = KineticEnergyStart*t.theMassRatio;
if (scaledKineticEnergy<t.theLowestKineticEnergy) {
timestart = exp(ppar*log(scaledKineticEnergy/t.theLowestKineticEnergy))*
(*propertimeTable)(materialIndex)->GetValue(
t.theLowestKineticEnergy,isOut);
} else if (scaledKineticEnergy>t.theHighestKineticEnergy) {
timestart = (*propertimeTable)(materialIndex)->GetValue(
t.theHighestKineticEnergy,isOut);
} else {
timestart = (*propertimeTable)(materialIndex)->GetValue(
scaledKineticEnergy,isOut);
}
dTT = (KineticEnergyStart - KineticEnergyEnd)/KineticEnergyStart ;
if( dTT < dToverT )
scaledKineticEnergy = facT*KineticEnergyStart*t.theMassRatio;
else
scaledKineticEnergy = KineticEnergyEnd*t.theMassRatio;
if (scaledKineticEnergy<t.theLowestKineticEnergy) {
timeend = exp(ppar*log(scaledKineticEnergy/t.theLowestKineticEnergy))*
(*propertimeTable)(materialIndex)->GetValue(
t.theLowestKineticEnergy,isOut);
} else if (scaledKineticEnergy>t.theHighestKineticEnergy) {
timeend = (*propertimeTable)(materialIndex)->GetValue(
t.theHighestKineticEnergy,isOut);
} else {
timeend = (*propertimeTable)(materialIndex)->GetValue(
scaledKineticEnergy,isOut);
}
deltatime = timestart - timeend ;
if( dTT < dToverT )
deltatime *= dTT/dToverT ;
return deltatime/t.theMassRatio ;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double G4EnergyLossTables::GetRange(
const G4ParticleDefinition *aParticle,
G4double KineticEnergy,
const G4Material *aMaterial)
{
if(aParticle != lastParticle)
{
t= GetTables(aParticle);
lastParticle = aParticle ;
Chargesquare = (aParticle->GetPDGCharge())*
(aParticle->GetPDGCharge())/
QQPositron ;
}
const G4PhysicsTable* rangeTable= t.theRangeTable;
const G4PhysicsTable* dEdxTable= t.theDEDXTable;
G4int materialIndex = aMaterial->GetIndex();
G4double scaledKineticEnergy = KineticEnergy*t.theMassRatio;
G4double Range;
G4bool isOut;
if (scaledKineticEnergy<t.theLowestKineticEnergy) {
Range = sqrt(scaledKineticEnergy/t.theLowestKineticEnergy)*
(*rangeTable)(materialIndex)->GetValue(
t.theLowestKineticEnergy,isOut);
} else if (scaledKineticEnergy>t.theHighestKineticEnergy) {
Range = (*rangeTable)(materialIndex)->GetValue(
t.theHighestKineticEnergy,isOut)+
(scaledKineticEnergy-t.theHighestKineticEnergy)/
(*dEdxTable)(materialIndex)->GetValue(
t.theHighestKineticEnergy,isOut);
} else {
Range = (*rangeTable)(materialIndex)->GetValue(
scaledKineticEnergy,isOut);
}
return Range/(Chargesquare*t.theMassRatio);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double G4EnergyLossTables::GetPreciseEnergyFromRange(
const G4ParticleDefinition *aParticle,
G4double range,
const G4Material *aMaterial)
// it returns the value of the kinetic energy for a given range
{
if( aParticle != lastParticle)
{
t= GetTables(aParticle);
lastParticle = aParticle;
Chargesquare = (aParticle->GetPDGCharge())*
(aParticle->GetPDGCharge())/
QQPositron ;
oldIndex = -1 ;
}
const G4PhysicsTable* dEdxTable= t.theDEDXTable;
const G4PhysicsTable* inverseRangeTable= t.theInverseRangeTable;
G4double scaledrange,scaledKineticEnergy ;
G4bool isOut ;
G4int materialIndex = aMaterial->GetIndex() ;
if(materialIndex != oldIndex)
{
oldIndex = materialIndex ;
rmin = (*inverseRangeTable)(materialIndex)->
GetLowEdgeEnergy(0) ;
rmax = (*inverseRangeTable)(materialIndex)->
GetLowEdgeEnergy(t.theNumberOfBins-2) ;
Thigh = (*inverseRangeTable)(materialIndex)->
GetValue(rmax,isOut) ;
}
scaledrange = range*Chargesquare*t.theMassRatio ;
if(scaledrange < rmin)
{
scaledKineticEnergy = t.theLowestKineticEnergy*
scaledrange*scaledrange/(rmin*rmin) ;
}
else
{
if(scaledrange < rmax)
{
scaledKineticEnergy = (*inverseRangeTable)(materialIndex)->
GetValue( scaledrange,isOut) ;
}
else
{
scaledKineticEnergy = Thigh +
(scaledrange-rmax)*
(*dEdxTable)(materialIndex)->
GetValue(Thigh,isOut) ;
}
}
return scaledKineticEnergy/t.theMassRatio ;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -21,148 +21,213 @@
// ********************************************************************
//
//
// $Id: G4MultipleScattering.hh,v 1.1.4.2 2001/06/28 20:19:51 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4MultipleScattering.hh,v 1.5 2001/09/19 13:16:06 maire Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//------------- G4MultipleScattering physics process --------------------------
// by Laszlo Urban, March 2001
//
// $Id:
// --------------------------------------------------------------
// GEANT 4 class header file
//
// History: based on object model of
// 2nd December 1995, G.Cosmo
// --------- G4MultipleScattering physics process --------
// by Laszlo Urban, October 1997
// **************************************************************
// UNIVERSAL: for arbitrary single charged particle
// 09/12/98: charge can be != +- 1 !!!! L.Urban
// 30/09/99: nuclear size effect correction L.Urban
// --------------------------------------------------------------
// 22/10/98: cleanup , L.Urban
// 07-08-01 new methods Store/Retrieve PhysicsTable
// 23-08-01 new angle and z distribution,energy dependence reduced,
// Store,Retrieve methods commented out temporarily, L.Urban
// 11-09-01 G4MultipleScatteringx put as default: G4MultipleScattering
// Store,Retrieve methods reactived (mma)
// 13-09-01 Unused TrueToGeomTransformation method deleted,
// class description (L.Urban)
// 19-09-01 come back to previous process name msc
//
//------------------------------------------------------------------------------
// class description
//
// The class simulates the multiple scattering for any kind
// of charged particle.
//
// class description - end
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef G4MultipleScattering_h
#define G4MultipleScattering_h 1
#include "G4ios.hh"
#include "globals.hh"
#include "Randomize.hh"
#include "G4EnergyLossTables.hh"
#include "G4Electron.hh"
#include "G4Positron.hh"
#include "G4MuonPlus.hh"
#include "G4PionPlus.hh"
#include "G4Proton.hh"
#include "G4PhysicsLogVector.hh"
#include "G4GPILSelection.hh"
#include "G4VContinuousDiscreteProcess.hh"
#include "G4Step.hh"
#include "G4Track.hh"
#include "G4Material.hh"
#include "G4EnergyLossTables.hh"
#include "G4GPILSelection.hh"
#include "G4PhysicsLogVector.hh"
#include "G4ParticleChangeForMSC.hh"
#include "G4UnitsTable.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class G4MultipleScattering : public G4VContinuousDiscreteProcess
{
public:
public: // with description
G4MultipleScattering(const G4String& processName="msc") ;
G4MultipleScattering(const G4String& processName="msc");
~G4MultipleScattering() ;
~G4MultipleScattering();
G4bool IsApplicable ( const G4ParticleDefinition& ) ;
G4bool IsApplicable ( const G4ParticleDefinition& );
// returns true for charged particles, false otherwise
void SetPhysicsTableBining(G4double lowE,G4double highE,G4int nBins);
void BuildPhysicsTable(const G4ParticleDefinition& aParticleType) ;
void BuildPhysicsTable(const G4ParticleDefinition& aParticleType);
// This function overloads the corresponding virtual function
// of the base class G4VContinuousDiscreteProcess.
// It is invoked by the G4ParticleWithCuts()::SetCut() method.
// It prepares the table of the transport mean free paths
// for every material.
void PrintInfoDefinition();
// Print few lines of informations about the process: validity range,
// origine ..etc..
// Invoked by BuildPhysicsTable().
G4bool StorePhysicsTable(G4ParticleDefinition* ,
const G4String& directory, G4bool);
// store TransportMeanFreePath tables into an external file
// specified by 'directory' (must exist before invokation)
G4bool RetrievePhysicsTable(G4ParticleDefinition* ,
const G4String& directory, G4bool);
// retrieve TransportMeanFreePath tables from an external file
// specified by 'directory'
G4double AlongStepGetPhysicalInteractionLength(const G4Track&,
G4double previousStepSize,
G4double currentMinimumStep,
G4double& currentSafety,
G4GPILSelection* selection);
// The function overloads the corresponding function of the base
// class.It limits the step near to boundaries only
// and invokes the method GetContinuousStepLimit at every step.
G4double GetContinuousStepLimit(const G4Track& aTrack,
G4double previousStepSize,
G4double currentMinimumStep,
G4double& currentSafety) ;
G4double& currentSafety);
// It performs the true step length --> geometrical step length
// transformation. It is invoked by the
// AlongStepGetPhysicalInteractionLength method.
G4double GetMeanFreePath(const G4Track& aTrack,
G4double previousStepSize,
G4ForceCondition* condition) ;
G4ForceCondition* condition);
// It sets the force condition to true only
// in order to have the PostStepDoIt called at every step.
// This function overloads a virtual function of the base class.
// It is invoked by the ProcessManager of the Particle.
G4VParticleChange* AlongStepDoIt(const G4Track& aTrack,const G4Step& aStep);
G4VParticleChange* PostStepDoIt(const G4Track& aTrack,const G4Step& aStep) ;
G4double GetLambda(G4double KineticEnergy,G4Material* material);
void SetScatteringParameter(G4double value)
{ scatteringparameter = value ; } ;
void SetTuning(G4double value) { tuning = value ; };
void SetCpar (G4double value) { cpar = value ; };
void SetTlimitmsc (G4double value) { Tlimit = value ; };
void SetLateralDisplacementFlag(G4bool flag) {fLatDisplFlag = flag;};
G4double GetTransportMeanFreePath(
G4double KineticEnergy,G4Material* material);
// Just a utility method to get the values of the transport
// mean free path . (It is not used inside the class.)
void SetNuclCorrPar(G4double val) { NuclCorrPar = val; } ;
void SetFactPar(G4double val) { FactPar = val ; } ;
G4VParticleChange* AlongStepDoIt(const G4Track& aTrack,const G4Step& aStep);
// The geometrical step length --> true path length transformation
// is performed here (the inverse of the transformation done
// by GetContinuousStepLimit).
protected:
G4VParticleChange* PostStepDoIt(const G4Track& aTrack,const G4Step& aStep);
// It computes the final state of the particle: samples the
// scattering angle and computes the lateral displacement.
// The final state is returned as a ParticleChange object.
// This function overloads a virtual function of the base class.
// It is invoked by the ProcessManager of the Particle.
G4double ComputeTransportCrossSection(
// Set functions for the different model parameters:
void Setpalfa(G4double value) {palfa = value;};
void Setpbeta(G4double value) {pbeta = value;};
void Setpgamma(G4double value) {pgamma = value;};
void Setpq0(G4double value) {pq0 = value;};
void Setpq1(G4double value) {pq1 = value;};
void Setpc0(G4double value) {pc0 = value;};
// angle distribution parameters
void Setpcz(G4double value) {pcz = value;};
// geom. step length distribution
void Setdtrl(G4double value) {dtrl = value;};
// to reduce the energy/step dependence
void SetBoundary(G4bool value) {boundary = value;};
void SetFactlim(G4double val) {factlim=val;};
// parameters needed near to boundary
void SetTuning(G4double value) {tuning = value;};
void SetCparm (G4double value) {cparm = value;};
// tuning of the transport mean free path
void SetLateralDisplacementFlag(G4bool flag) {fLatDisplFlag = flag;};
// lateral displacement to be/not to be computed
void SetNuclCorrPar(G4double val) {NuclCorrPar = val;};
void SetFactPar(G4double val) {FactPar = val;};
// corrs to transport cross section for high energy
protected: // with description
virtual G4double ComputeTransportCrossSection(
const G4ParticleDefinition& aParticleType,
G4double KineticEnergy,
G4double AtomicNumber,
G4double AtomicWeight) ;
G4double TrueToGeomTransformation(const G4DynamicParticle* aParticle,
G4Material* aMaterial,
G4double truePathLength) ;
G4double AtomicWeight);
// It computes the transport cross section.
// The transport mean free path is 1/(transport cross section).
private:
// hide assignment operator as private
G4MultipleScattering & operator = (const G4MultipleScattering &right) ;
G4MultipleScattering ( const G4MultipleScattering &) ;
G4MultipleScattering & operator = (const G4MultipleScattering &right);
G4MultipleScattering ( const G4MultipleScattering &);
private: // data members
// data members ...................................................
private:
G4PhysicsTable* theTransportMeanFreePathTable;
G4PhysicsTable* theTransportMeanFreePathTable ;
G4double fTransportMeanFreePath;
G4double fTransportMeanFreePath ;
G4double range,alpha1 ;
G4int stepFlag ;
G4double biglambda,taubig,tausmall,taulim;
G4double biglambda ;
G4double LowestKineticEnergy ;
G4double HighestKineticEnergy ;
G4int TotBin ;
const G4Electron* theElectron ;
const G4Positron* thePositron ;
G4double LowestKineticEnergy;
G4double HighestKineticEnergy;
G4int TotBin;
G4Material* lastMaterial;
G4double lastKineticEnergy;
G4int materialIndex ;
G4double lastKineticEnergy;
G4int materialIndex;
G4double tLast ;
G4double zLast ;
G4double Tlimit ;
G4double tLast;
G4double zLast;
// model parameters
G4double scatteringparameter;
G4double tuning;
G4double cpar;
G4bool boundary; // spec. handling near boundaries
G4double factlim;
G4GPILSelection valueGPILSelectionMSC;
G4double pcz,zmean; // z(geom.step length)
// distribution
G4double palfa,pbeta,pgamma,pq0,pq1,pc0; // parameters of angle
// disrtibution
G4double range,T1,lambda1,cth1,z1,t1,dtrl; // used to reduce the energy
// (or step length) dependence
G4double tuning; // param. for lambda tuning
G4double cparm; // "
// with/without lateral displacement
G4bool fLatDisplFlag ;
G4bool fLatDisplFlag;
// nuclear size effect correction
G4double NuclCorrPar ;
G4double FactPar ;
G4double NuclCorrPar;
G4double FactPar;
//New ParticleChange
G4ParticleChangeForMSC fParticleChange ;
G4ParticleChangeForMSC fParticleChange;
};
#include "G4MultipleScattering.icc"
@@ -21,100 +21,49 @@
// ********************************************************************
//
//
// $Id: G4MultipleScattering.icc,v 1.3.2.2 2001/06/28 20:19:51 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4MultipleScattering.icc,v 1.6 2001/09/13 11:00:19 urban Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
// $Id:
// -------------------------------------------------------------
// GEANT 4 class inlined methods file
//------------ G4MultipleScattering physics process ---------------------------
// by Laszlo Urban, March 2001
//
// History: based on object model of
// 2nd December 1995, G.Cosmo
// ------- G4MultipleScattering physics process ------
// by Laszlo Urban, October 1997
// **************************************************************
// 25/11/97: mods for KinEnergy > HighestLimit
// 22/10/98: cleanup , L.Urban
// 15/10/99: bugfix, some accuracy problems fixed , L.Urban
// 18/05/01 V.Ivanchenko Clean up againist Linux ANSI compilation
//---------------------------------------------------------------
// Modified:
//
// 18-05-01 V.Ivanchenko Clean up against Linux ANSI compilation
// 23-08-01 new angle and z distribution,energy dependence reduced,
// Store,Retrieve methods commented out temporarily, L.Urban
// 27-08-01 bugfix in AlongStepDoIt, L.Urban
// 28-08-01 GetContinuousStepLimit and AlongStepDoIt moved to .cc file (mma)
// 11-09-01 G4MultipleScatteringx put as default: G4MultipleScattering (mma)
//
//------------------------------------------------------------------------------
inline G4double G4MultipleScattering::GetContinuousStepLimit(
const G4Track& track,
G4double,
G4double currentMinimumStep,
G4double&)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline
G4bool G4MultipleScattering::IsApplicable(const G4ParticleDefinition& particle)
{
G4double zPathLength,tPathLength ;
const G4DynamicParticle* aParticle ;
G4Material* aMaterial ;
G4double KineticEnergy,tau ;
G4bool isOut ;
// this process is not a candidate for selection!!!!!!!!!
SetGPILSelection(NotCandidateForSelection) ;
if(track.GetCurrentStepNumber() == 1)
stepFlag = 0 ;
tPathLength = currentMinimumStep ;
aMaterial = track.GetMaterial() ;
materialIndex = aMaterial->GetIndex() ;
aParticle = track.GetDynamicParticle() ;
KineticEnergy = aParticle->GetKineticEnergy() ;
if((lastMaterial != aMaterial) || (lastKineticEnergy != KineticEnergy))
{
lastKineticEnergy = KineticEnergy ;
materialIndex = aMaterial->GetIndex() ;
if((lastMaterial != aMaterial)||(KineticEnergy >= Tlimit)||(stepFlag != 1))
fTransportMeanFreePath = (*theTransportMeanFreePathTable)
(materialIndex)->GetValue(KineticEnergy,isOut);
lastMaterial = aMaterial;
if(KineticEnergy < Tlimit)
{
stepFlag = 1 ;
range = G4EnergyLossTables::GetRange(aParticle->GetDefinition(),
KineticEnergy,aMaterial) ;
alpha1 = range/fTransportMeanFreePath+1 ;
}
}
// do the true -> geom transformation
if( fTransportMeanFreePath > biglambda )
{
zPathLength = tPathLength ;
}
else if(stepFlag == 0)
{
tau = tPathLength/fTransportMeanFreePath ;
if(tau < perMillion)
zPathLength = tPathLength ;
else
zPathLength = fTransportMeanFreePath*(1.-exp(-tau)) ;
}
else
{
tau = tPathLength/range ;
if(tau<perMillion)
zPathLength = range*(1.-exp(-alpha1*tau))/alpha1 ;
else if(tau<0.99)
zPathLength = range*(1.-exp(alpha1*log(1.-tau)))/alpha1 ;
else
zPathLength = range/alpha1 ;
}
tLast = tPathLength ;
zLast = zPathLength ;
return zPathLength ;
return(particle.GetPDGCharge() != 0.);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double G4MultipleScattering::AlongStepGetPhysicalInteractionLength(
const G4Track& track,
G4double previousStepSize,
G4double currentMinimumStep,
G4double& currentSafety,
G4GPILSelection* selection)
{
// get Step limit proposed by the process
G4double steplength = GetContinuousStepLimit(track,previousStepSize,
currentMinimumStep,currentSafety);
// set return value for G4GPILSelection
*selection = valueGPILSelectionMSC;
return steplength;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double G4MultipleScattering::GetMeanFreePath(
const G4Track& track,
@@ -124,71 +73,21 @@ inline G4double G4MultipleScattering::GetMeanFreePath(
// it does not limit the Step size , but it sets condition to
// Forced , because the PostStepDoIt always has to be called
{
*condition = Forced ;
return DBL_MAX ;
}
inline G4VParticleChange* G4MultipleScattering::AlongStepDoIt(
const G4Track& track,const G4Step& Step)
// only a geom path->true path transformation is performed
{
static const G4double tfacmx = 10. ;
G4double tau,geomPathLength, truePathLength ;
fParticleChange.Initialize(track);
geomPathLength = track.GetStepLength() ;
if(geomPathLength == zLast)
{
truePathLength = tLast ;
}
else if( fTransportMeanFreePath > biglambda )
{
truePathLength = geomPathLength ;
}
else if(stepFlag == 0)
{
tau = geomPathLength/fTransportMeanFreePath ;
if(tau<perMillion)
truePathLength = fTransportMeanFreePath*tau ;
else if(tau < 1.)
truePathLength = -fTransportMeanFreePath*log(1.-tau) ;
else
truePathLength = tfacmx*fTransportMeanFreePath ;
}
else
{
if(geomPathLength/range < perMillion)
truePathLength = range*(1.-exp(-geomPathLength/range)) ;
else
truePathLength = range*(1.-exp(log(1.-alpha1*geomPathLength/range)/
alpha1)) ;
}
fParticleChange.SetTrueStepLength(truePathLength) ;
return &fParticleChange ;
*condition = Forced;
return DBL_MAX;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4bool G4MultipleScattering::IsApplicable(
const G4ParticleDefinition& particle)
{
return(particle.GetPDGCharge() != 0.);
}
inline G4double G4MultipleScattering::GetLambda(
G4double KineticEnergy,
G4Material* material)
inline
G4double G4MultipleScattering::GetTransportMeanFreePath(G4double KineticEnergy,
G4Material* material)
{
G4bool isOut;
G4double lambda = (*theTransportMeanFreePathTable)
(material->GetIndex())->
GetValue(KineticEnergy,isOut);
return lambda;
return (*theTransportMeanFreePathTable)
(material->GetIndex())->GetValue(KineticEnergy,isOut);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -1,189 +0,0 @@
//
// ********************************************************************
// * 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: G4MultipleScatteringx.hh,v 1.1.2.2 2001/06/28 20:19:51 gunter Exp $
// GEANT4 tag $Name: $
//
// $Id:
// --------------------------------------------------------------
// GEANT 4 class header file
//
// History: based on object model of
// 2nd December 1995, G.Cosmo
// --------- G4MultipleScatteringx physics process --------
// by Laszlo Urban, March 2001
// **************************************************************
// New version of MSC model
// --------------------------------------------------------------
#ifndef G4MultipleScatteringx_h
#define G4MultipleScatteringx_h 1
#include "G4ios.hh"
#include "globals.hh"
#include "Randomize.hh"
#include "G4EnergyLossTables.hh"
#include "G4Electron.hh"
#include "G4Positron.hh"
#include "G4MuonPlus.hh"
#include "G4PionPlus.hh"
#include "G4Proton.hh"
#include "G4PhysicsLogVector.hh"
#include "G4GPILSelection.hh"
#include "G4VContinuousDiscreteProcess.hh"
#include "G4Step.hh"
#include "G4Track.hh"
#include "G4Material.hh"
#include "G4ParticleChangeForMSC.hh"
#include "G4UnitsTable.hh"
class G4MultipleScatteringx : public G4VContinuousDiscreteProcess
{
public:
G4MultipleScatteringx(const G4String& processName="mscx") ;
~G4MultipleScatteringx() ;
G4bool IsApplicable ( const G4ParticleDefinition& ) ;
void BuildPhysicsTable(const G4ParticleDefinition& aParticleType) ;
void PrintInfoDefinition();
G4double GetContinuousStepLimit(const G4Track& aTrack,
G4double previousStepSize,
G4double currentMinimumStep,
G4double& currentSafety) ;
G4double GetMeanFreePath(const G4Track& aTrack,
G4double previousStepSize,
G4ForceCondition* condition) ;
G4VParticleChange* AlongStepDoIt(const G4Track& aTrack,const G4Step& aStep);
G4VParticleChange* PostStepDoIt(const G4Track& aTrack,const G4Step& aStep) ;
G4double AlongStepGetPhysicalInteractionLength(
const G4Track&,
G4double previousStepSize,
G4double currentMinimumStep,
G4double& currentSafety,
G4GPILSelection* selection
);
G4double GetLambda(G4double KineticEnergy,G4Material* material);
void SetScatteringParameter1(G4double value)
{ scatteringparameter1 = value ; } ;
void SetScatteringParameter2(G4double value)
{ scatteringparameter2 = value ; } ;
void SetScatteringParameter3(G4double value)
{ scatteringparameter3 = value ; } ;
void SetBoundary(G4bool value) { boundary = value ;} ;
void SetTuning(G4double value) { tuning = value ; };
void SetCparm (G4double value) { cparm = value ; };
void SetTlimitmsc (G4double value) { Tlimit = value ; };
void SetLateralDisplacementFlag(G4bool flag) {fLatDisplFlag = flag;};
void SetNuclCorrPar(G4double val) { NuclCorrPar = val; } ;
void SetFactPar(G4double val) { FactPar = val ; } ;
protected:
G4double ComputeTransportCrossSection(
const G4ParticleDefinition& aParticleType,
G4double KineticEnergy,
G4double AtomicNumber,
G4double AtomicWeight) ;
G4double TrueToGeomTransformation(const G4DynamicParticle* aParticle,
G4Material* aMaterial,
G4double truePathLength) ;
private:
// hide assignment operator as private
G4MultipleScatteringx & operator = (const G4MultipleScatteringx &right) ;
G4MultipleScatteringx ( const G4MultipleScatteringx &) ;
// data members ...................................................
private:
G4PhysicsTable* theTransportMeanFreePathTable ;
G4double fTransportMeanFreePath ;
G4double range,alpha1 ;
G4int stepFlag ;
G4double biglambda ;
G4double LowestKineticEnergy ;
G4double HighestKineticEnergy ;
G4int TotBin ;
const G4Electron* theElectron ;
const G4Positron* thePositron ;
G4Material* lastMaterial;
G4double lastKineticEnergy;
G4int materialIndex ;
G4double tLast ;
G4double zLast ;
G4double Tlimit ;
// model parameters
G4double scatteringparameter1; // for low energy scattering
G4double scatteringparameter2; // alfamax in scattering
G4double scatteringparameter3; // param. for z/t distr.
G4bool boundary ; // spec. handling near boundaries
G4GPILSelection valueGPILSelectionMSC ;
G4double tuning; // param. for lambda tuning
G4double cparm; // "
// with/without lateral displacement
G4bool fLatDisplFlag ;
// nuclear size effect correction
G4double NuclCorrPar ;
G4double FactPar ;
//New ParticleChange
G4ParticleChangeForMSC fParticleChange ;
};
#include "G4MultipleScatteringx.icc"
#endif
@@ -1,290 +0,0 @@
//
// ********************************************************************
// * 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: G4MultipleScatteringx.icc,v 1.2.2.2 2001/06/28 20:19:51 gunter Exp $
// GEANT4 tag $Name: $
//
// $Id:
// -------------------------------------------------------------
// GEANT 4 class inlined methods file
//
// History: based on object model of
// 2nd December 1995, G.Cosmo
// ------- G4MultipleScatteringx physics process ------
// by Laszlo Urban, March 2001
//---------------------------------------------------------------
// New version of MSC model
//---------------------------------------------------------------
// Modified:
// 18/05/01 V.Ivanchenko Clean up againist Linux ANSI compilation
//
//---------------------------------------------------------------
inline G4double G4MultipleScatteringx::AlongStepGetPhysicalInteractionLength(
const G4Track& track,
G4double previousStepSize,
G4double currentMinimumStep,
G4double& currentSafety,
G4GPILSelection* selection
)
{
// get Step limit proposed by the process
G4double steplength =
GetContinuousStepLimit(track,previousStepSize,currentMinimumStep, currentSafety);
// set return value for G4GPILSelection
*selection = valueGPILSelectionMSC;
return steplength ;
}
inline G4double G4MultipleScatteringx::GetContinuousStepLimit(
const G4Track& track,
G4double,
G4double currentMinimumStep,
G4double&)
{
G4double zPathLength,tPathLength ;
const G4DynamicParticle* aParticle ;
G4Material* aMaterial ;
G4double KineticEnergy,tau ;
G4bool isOut ;
static const G4double toler = 1.0e-6*mm ;
static const G4double factlim = 0.10 ;
G4double tlimit ;
static G4double tausmall = 1.e-20 ;
static G4double taulow = 1.e-10 ;
static G4double clim=1./3. ;
G4double etau,beta2,cc,ccc,u ;
// this process is not a candidate for selection by default !!!!!!!!
valueGPILSelectionMSC = NotCandidateForSelection;
if(track.GetCurrentStepNumber() == 1)
stepFlag = 0 ;
tPathLength = currentMinimumStep ;
aMaterial = track.GetMaterial() ;
materialIndex = aMaterial->GetIndex() ;
aParticle = track.GetDynamicParticle() ;
KineticEnergy = aParticle->GetKineticEnergy() ;
if((lastMaterial != aMaterial) || (lastKineticEnergy != KineticEnergy))
{
lastKineticEnergy = KineticEnergy ;
materialIndex = aMaterial->GetIndex() ;
if((lastMaterial != aMaterial)||(KineticEnergy >= Tlimit)||(stepFlag != 1))
fTransportMeanFreePath = (*theTransportMeanFreePathTable)
(materialIndex)->GetValue(KineticEnergy,isOut);
lastMaterial = aMaterial;
if(KineticEnergy < Tlimit)
{
stepFlag = 1 ;
range = G4EnergyLossTables::GetRange(aParticle->GetDefinition(),
KineticEnergy,aMaterial) ;
alpha1 = range/fTransportMeanFreePath+1 ;
}
}
// special treatment near boundaries ?
if(boundary)
{
// step limitation at boundary ?
if(track.GetCurrentStepNumber() > 1)
{
if(track.GetStep()->GetPreStepPoint()->GetSafety() < toler)
{
tlimit = factlim*fTransportMeanFreePath ;
if(tPathLength > tlimit)
{
tPathLength = tlimit*G4UniformRand() ;
valueGPILSelectionMSC = CandidateForSelection;
}
}
}
}
// do the true -> geom transformation
if( fTransportMeanFreePath > biglambda )
{
zPathLength = tPathLength ;
}
else if(stepFlag == 0)
{
tau = tPathLength/fTransportMeanFreePath ;
if(tau < tausmall)
zPathLength = tPathLength*(1.-0.5*tau) ;
else
{
// sample zPathLength
etau = exp(-tau) ;
if(scatteringparameter3 <= clim)
{
ccc = 1.-scatteringparameter3 ;
}
else
{
cc=0.5/scatteringparameter3-1.5 ;
ccc=2.*scatteringparameter3*exp(cc) ;
}
if(tau < taulow)
beta2 = (1.+scatteringparameter3)*(1.-2.*tau/3.)/tau ;
else
beta2 = 0.5*(1.+scatteringparameter3)*(1.-etau)/(tau-1+etau) ;
do {
u = -log(1.-G4UniformRand())/beta2 ;
} while (G4UniformRand() > (1.-scatteringparameter3+
2.*scatteringparameter3*beta2*u)*exp(-beta2*u)/ccc ) ;
zPathLength = tPathLength/(1.+u) ;
}
}
else
{
tau = tPathLength/range ;
if(tau<perMillion)
zPathLength = range*(1.-exp(-alpha1*tau))/alpha1 ;
else if(tau<0.99)
zPathLength = range*(1.-exp(alpha1*log(1.-tau)))/alpha1 ;
else
zPathLength = range/alpha1 ;
}
tLast = tPathLength ;
zLast = zPathLength ;
return zPathLength ;
}
inline G4double G4MultipleScatteringx::GetMeanFreePath(
const G4Track& track,
G4double,
G4ForceCondition* condition)
// it does not limit the Step size , but it sets condition to
// Forced , because the PostStepDoIt always has to be called
{
*condition = Forced ;
return DBL_MAX ;
}
inline G4VParticleChange* G4MultipleScatteringx::AlongStepDoIt(
const G4Track& track,const G4Step& Step)
// only a geom path->true path transformation is performed
{
static const G4double tfacmx = 10. ;
G4double tau,geomPathLength, truePathLength ;
static G4double tausmall = 1.e-20 ;
static G4double taulow = 1.e-10 ;
static G4double clim=1./3. ;
G4double ltau,cc,ccc,beta2,u ;
fParticleChange.Initialize(track);
geomPathLength = track.GetStepLength() ;
if(geomPathLength == zLast)
{
truePathLength = tLast ;
}
else if( fTransportMeanFreePath > biglambda )
{
truePathLength = geomPathLength ;
}
else if(stepFlag == 0)
{
tau = geomPathLength/fTransportMeanFreePath ;
if(tau < tausmall)
truePathLength = geomPathLength*(1.+0.5*tau) ;
else if(tau < 1.)
{
// sample tPathLength
ltau = -log(1.-tau) ;
if(scatteringparameter3 <= clim)
{
ccc = 1.-scatteringparameter3 ;
}
else
{
cc=0.5/scatteringparameter3-1.5 ;
ccc=2.*scatteringparameter3*exp(cc) ;
}
if(tau < taulow)
beta2 = (1.+scatteringparameter3)*(1.-2.*tau/3.)/tau ;
else
beta2 = (1.+scatteringparameter3)*tau/(2.*(ltau-tau)) ;
do {
u = -log(1.-G4UniformRand())/beta2 ;
} while (G4UniformRand() > (1.-scatteringparameter3+
2.*scatteringparameter3*beta2*u)*exp(-beta2*u)/ccc ) ;
truePathLength = geomPathLength*(1.+u) ;
}
else
truePathLength = tfacmx*fTransportMeanFreePath ;
}
else
{
if(geomPathLength/range < perMillion)
truePathLength = range*(1.-exp(-geomPathLength/range)) ;
else
truePathLength = range*(1.-exp(log(1.-alpha1*geomPathLength/range)/
alpha1)) ;
}
fParticleChange.SetTrueStepLength(truePathLength) ;
return &fParticleChange ;
}
inline G4bool G4MultipleScatteringx::IsApplicable(
const G4ParticleDefinition& particle)
{
return(particle.GetPDGCharge() != 0.);
}
inline G4double G4MultipleScatteringx::GetLambda(
G4double KineticEnergy,
G4Material* material)
{
G4bool isOut;
G4double lambda = (*theTransportMeanFreePathTable)
(material->GetIndex())->
GetValue(KineticEnergy,isOut);
return lambda;
}
@@ -21,13 +21,14 @@
// ********************************************************************
//
//
// $Id: G4VEnergyLoss.hh,v 1.9.4.2 2001/06/28 20:19:51 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4VEnergyLoss.hh,v 1.13 2001/11/08 08:09:57 urban Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// ------------------------------------------------------------
// GEANT 4 class header file
//
// 26.10.01 static inline functions moved to .cc file (mma)
// 08.11.01 some static methods,data members are not static L.Urban
// ------------------------------------------------------------
//
// Class Description
//
@@ -41,6 +42,7 @@
// All the EnergyLoss classes are inherited from G4VEnergyLoss
// class.
//
// -----------------------------------------------------------
// created on 28 January 2000 by L. Urban
// -----------------------------------------------------------
@@ -96,6 +98,45 @@ class G4VEnergyLoss : public G4VContinuousDiscreteProcess
G4double MeanLoss,
G4double step);
// Build range table starting from the DEDXtable
G4PhysicsTable*
BuildRangeTable(G4PhysicsTable* theDEDXTable,
G4PhysicsTable* theRangeTable,
G4double Tmin,G4double Tmax,G4int nbin);
// Build time tables starting from the DEDXtable
G4PhysicsTable*
BuildLabTimeTable(G4PhysicsTable* theDEDXTable,
G4PhysicsTable* theLabTimeTable,
G4double Tmin,G4double Tmax,G4int nbin);
G4PhysicsTable*
BuildProperTimeTable(G4PhysicsTable* theDEDXTable,
G4PhysicsTable* ProperTimeTable,
G4double Tmin,G4double Tmax,G4int nbin);
// Build tables of coefficients needed for inverting the range table
G4PhysicsTable*
BuildRangeCoeffATable(G4PhysicsTable* theRangeTable,
G4PhysicsTable* theCoeffATable,
G4double Tmin,G4double Tmax,G4int nbin);
G4PhysicsTable*
BuildRangeCoeffBTable(G4PhysicsTable* theRangeTable,
G4PhysicsTable* theCoeffBTable,
G4double Tmin,G4double Tmax,G4int nbin);
G4PhysicsTable*
BuildRangeCoeffCTable(G4PhysicsTable* theRangeTable,
G4PhysicsTable* theCoeffCTable,
G4double Tmin,G4double Tmax,G4int nbin);
// Invert range table
G4PhysicsTable*
BuildInverseRangeTable(G4PhysicsTable* theRangeTable,
G4PhysicsTable* theRangeCoeffATable,
G4PhysicsTable* theRangeCoeffBTable,
G4PhysicsTable* theRangeCoeffCTable,
G4PhysicsTable* theInverseRangeTable,
G4double Tmin,G4double Tmax,G4int nbin);
private:
@@ -103,8 +144,40 @@ class G4VEnergyLoss : public G4VContinuousDiscreteProcess
G4VEnergyLoss();
G4VEnergyLoss & operator=(const G4VEnergyLoss &right);
void BuildRangeVector(G4PhysicsTable* theDEDXTable,
G4double Tmin,G4double Tmax,G4int nbin,
G4int materialIndex,G4PhysicsLogVector* rangeVector);
G4double RangeIntLin(G4PhysicsVector* physicsVector,G4int nbin);
G4double RangeIntLog(G4PhysicsVector* physicsVector,G4int nbin);
void BuildLabTimeVector(G4PhysicsTable* theDEDXTable,
G4double Tmin,G4double Tmax,G4int nbin,
G4int materialIndex,G4PhysicsLogVector* rangeVector);
void BuildProperTimeVector(G4PhysicsTable* theDEDXTable,
G4double Tmin,G4double Tmax,G4int nbin,
G4int materialIndex,G4PhysicsLogVector* rangeVector);
G4double LabTimeIntLog(G4PhysicsVector* physicsVector,G4int nbin);
G4double ProperTimeIntLog(G4PhysicsVector* physicsVector,G4int nbin);
void InvertRangeVector(G4PhysicsTable* theRangeTable,
G4PhysicsTable* theRangeCoeffATable,
G4PhysicsTable* theRangeCoeffBTable,
G4PhysicsTable* theRangeCoeffCTable,
G4double Tmin,G4double Tmax,G4int nbin,
G4int materialIndex,G4PhysicsLogVector* rangeVector);
protected:
G4double ParticleMass;
private:
// data members to speed up the fluctuation calculation
G4Material* lastMaterial;
G4int imat;
@@ -113,36 +186,32 @@ class G4VEnergyLoss : public G4VContinuousDiscreteProcess
const G4int nmaxCont1,nmaxCont2 ;
// for some integration routines
G4double taulow,tauhigh,ltaulow,ltauhigh;
// static part of the class
public: // With description
static void SetRndmStep (G4bool value) {rndmStepFlag = value;}
static void SetRndmStep(G4bool value);
// use / do not use randomisation in energy loss steplimit
// ( default = no randomisation)
static void SetEnlossFluc (G4bool value) {EnlossFlucFlag = value;}
static void SetEnlossFluc(G4bool value);
// compute energy loss with/without fluctuation
// ( default : with fluctuation)
static void SetSubSec (G4bool value) {subSecFlag = value ; }
static void SetSubSec(G4bool value);
// switch on/off the generation of the subcutoff secondaries
// ( default = subcutoff secondary generation )
static void SetMinDeltaCutInRange(G4double value)
{MinDeltaCutInRange = value;
setMinDeltaCutInRange = true ;}
static void SetMinDeltaCutInRange(G4double value);
// sets minimal cut value for the subcutoff secondaries
// (i.e. the kinetic energy of these secondaries can not be
// smaller than the energy corresponds to MinDeltaCutInRange).
static void SetStepFunction (G4double c1, G4double c2)
{dRoverRange = c1; finalRange = c2;
c1lim=dRoverRange ;
c2lim=2.*(1-dRoverRange)*finalRange;
c3lim=-(1.-dRoverRange)*finalRange*finalRange;
}
static void SetStepFunction (G4double c1, G4double c2);
// sets values for data members used to compute the step limit:
// dRoverRange : max. relative range change in one step,
// finalRange : if range <= finalRange --> last step for the particle.
@@ -150,87 +219,12 @@ class G4VEnergyLoss : public G4VContinuousDiscreteProcess
protected: // With description
// Build range table starting from the DEDXtable
static G4PhysicsTable*
BuildRangeTable(G4PhysicsTable* theDEDXTable,
G4PhysicsTable* theRangeTable,
G4double Tmin,G4double Tmax,G4int nbin);
// Build time tables starting from the DEDXtable
static G4PhysicsTable*
BuildLabTimeTable(G4PhysicsTable* theDEDXTable,
G4PhysicsTable* theLabTimeTable,
G4double Tmin,G4double Tmax,G4int nbin);
static G4PhysicsTable*
BuildProperTimeTable(G4PhysicsTable* theDEDXTable,
G4PhysicsTable* ProperTimeTable,
G4double Tmin,G4double Tmax,G4int nbin);
// Build tables of coefficients needed for inverting the range table
static G4PhysicsTable*
BuildRangeCoeffATable(G4PhysicsTable* theRangeTable,
G4PhysicsTable* theCoeffATable,
G4double Tmin,G4double Tmax,G4int nbin);
static G4PhysicsTable*
BuildRangeCoeffBTable(G4PhysicsTable* theRangeTable,
G4PhysicsTable* theCoeffBTable,
G4double Tmin,G4double Tmax,G4int nbin);
static G4PhysicsTable*
BuildRangeCoeffCTable(G4PhysicsTable* theRangeTable,
G4PhysicsTable* theCoeffCTable,
G4double Tmin,G4double Tmax,G4int nbin);
// Invert range table
static G4PhysicsTable*
BuildInverseRangeTable(G4PhysicsTable* theRangeTable,
G4PhysicsTable* theRangeCoeffATable,
G4PhysicsTable* theRangeCoeffBTable,
G4PhysicsTable* theRangeCoeffCTable,
G4PhysicsTable* theInverseRangeTable,
G4double Tmin,G4double Tmax,G4int nbin);
private:
static void BuildRangeVector(G4PhysicsTable* theDEDXTable,
G4double Tmin,G4double Tmax,G4int nbin,
G4int materialIndex,G4PhysicsLogVector* rangeVector);
static G4double RangeIntLin(G4PhysicsVector* physicsVector
,G4int nbin);
static G4double RangeIntLog(G4PhysicsVector* physicsVector
,G4int nbin);
static void BuildLabTimeVector(G4PhysicsTable* theDEDXTable,
G4double Tmin,G4double Tmax,G4int nbin,
G4int materialIndex,G4PhysicsLogVector* rangeVector);
static void BuildProperTimeVector(G4PhysicsTable* theDEDXTable,
G4double Tmin,G4double Tmax,G4int nbin,
G4int materialIndex,G4PhysicsLogVector* rangeVector);
static G4double LabTimeIntLog(G4PhysicsVector* physicsVector
,G4int nbin);
static G4double ProperTimeIntLog(G4PhysicsVector* physicsVector,
G4int nbin);
static void InvertRangeVector(G4PhysicsTable* theRangeTable,
G4PhysicsTable* theRangeCoeffATable,
G4PhysicsTable* theRangeCoeffBTable,
G4PhysicsTable* theRangeCoeffCTable,
G4double Tmin,G4double Tmax,G4int nbin,
G4int materialIndex,G4PhysicsLogVector* rangeVector);
static G4bool EqualCutVectors( G4double* vec1, G4double* vec2 );
static G4double* CopyCutVectors( G4double* dest, G4double* source );
// data members
protected:
// variables for the integration routines
static G4double ParticleMass,taulow,tauhigh,ltaulow,ltauhigh;
static G4double dRoverRange; // dRoverRange is the maximum allowed
// deltarange/range in one Step
static G4double finalRange; // final step before stopping
@@ -238,7 +232,7 @@ class G4VEnergyLoss : public G4VContinuousDiscreteProcess
static G4bool rndmStepFlag; // control the randomization of the step
static G4bool EnlossFlucFlag; // control the energy loss fluctuation
static G4bool subSecFlag; // control the generation of subcutoff secondaries
static G4bool subSecFlag; // control the generation of subcutoff delta
static G4double MinDeltaCutInRange; // minimum cut for delta rays
static G4double* MinDeltaEnergy ;
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4EnergyLossMessenger.cc,v 1.3.4.1 2001/06/28 19:12:48 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4EnergyLossMessenger.cc,v 1.4 2001/07/11 10:03:41 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4EnergyLossTables.cc,v 1.14.2.1 2001/06/28 19:12:48 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4EnergyLossTables.cc,v 1.17 2001/10/29 09:40:52 maire Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
// -------------------------------------------------------------------
// first version created by P.Urban , 06/04/1998
@@ -30,7 +30,9 @@
// modifications , TOF functions , 26/10/98, L.Urban
// cache mechanism in order to gain time, 11/02/99, L.Urban
// bug fixed , 12/04/99 , L.Urban
// 10/11/99: moved from RWT hash dictionary to STL map, G.Barrand, M.Maire
// 10.11.99: moved from RWT hash dictionary to STL map, G.Barrand, M.Maire
// 27.09.01 L.Urban , bug fixed (negative energy deposit)
// 26.10.01 all static functions moved from .icc files (mma)
// -------------------------------------------------------------------
#include "G4EnergyLossTables.hh"
@@ -38,7 +40,7 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4EnergyLossTablesHelper G4EnergyLossTables::t ;
const G4ParticleDefinition* G4EnergyLossTables::lastParticle = NULL ;
const G4ParticleDefinition* G4EnergyLossTables::lastParticle = 0;
G4double G4EnergyLossTables::QQPositron = eplus*eplus ;
G4double G4EnergyLossTables::Chargesquare ;
G4int G4EnergyLossTables::oldIndex = -1 ;
@@ -50,6 +52,34 @@ G4EnergyLossTables::helper_map G4EnergyLossTables::dict;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4EnergyLossTablesHelper::G4EnergyLossTablesHelper(
const G4PhysicsTable* aDEDXTable,
const G4PhysicsTable* aRangeTable,
const G4PhysicsTable* anInverseRangeTable,
const G4PhysicsTable* aLabTimeTable,
const G4PhysicsTable* aProperTimeTable,
G4double aLowestKineticEnergy,
G4double aHighestKineticEnergy,
G4double aMassRatio,
G4int aNumberOfBins)
:
theDEDXTable(aDEDXTable), theRangeTable(aRangeTable),
theInverseRangeTable(anInverseRangeTable),
theLabTimeTable(aLabTimeTable),
theProperTimeTable(aProperTimeTable),
theLowestKineticEnergy(aLowestKineticEnergy),
theHighestKineticEnergy(aHighestKineticEnergy),
theMassRatio(aMassRatio),
theNumberOfBins(aNumberOfBins)
{ }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4EnergyLossTablesHelper::G4EnergyLossTablesHelper()
{ }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4EnergyLossTables::Register(
const G4ParticleDefinition* p,
const G4PhysicsTable* tDEDX,
@@ -74,10 +104,406 @@ void G4EnergyLossTables::Register(
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4EnergyLossTables::GetPreciseDEDX(
const G4PhysicsTable* G4EnergyLossTables::GetDEDXTable(
const G4ParticleDefinition* p)
{
helper_map::iterator it;
if((it=dict.find(p))==dict.end()) return 0;
return (*it).second.theDEDXTable;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
const G4PhysicsTable* G4EnergyLossTables::GetRangeTable(
const G4ParticleDefinition* p)
{
helper_map::iterator it;
if((it=dict.find(p))==dict.end()) return 0;
return (*it).second.theRangeTable;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
const G4PhysicsTable* G4EnergyLossTables::GetInverseRangeTable(
const G4ParticleDefinition* p)
{
helper_map::iterator it;
if((it=dict.find(p))==dict.end()) return 0;
return (*it).second.theInverseRangeTable;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
const G4PhysicsTable* G4EnergyLossTables::GetLabTimeTable(
const G4ParticleDefinition* p)
{
helper_map::iterator it;
if((it=dict.find(p))==dict.end()) return 0;
return (*it).second.theLabTimeTable;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
const G4PhysicsTable* G4EnergyLossTables::GetProperTimeTable(
const G4ParticleDefinition* p)
{
helper_map::iterator it;
if((it=dict.find(p))==dict.end()) return 0;
return (*it).second.theProperTimeTable;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4EnergyLossTablesHelper G4EnergyLossTables::GetTables(
const G4ParticleDefinition* p)
{
helper_map::iterator it;
if((it=dict.find(p))==dict.end()) {
G4Exception("G4EnergyLossTables::GetTables: table not found!");
exit(1);
}
return (*it).second;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4EnergyLossTables::GetDEDX(
const G4ParticleDefinition *aParticle,
G4double KineticEnergy,
const G4Material *aMaterial)
{
if(aParticle != lastParticle)
{
t= GetTables(aParticle);
lastParticle = aParticle ;
Chargesquare = (aParticle->GetPDGCharge())*
(aParticle->GetPDGCharge())/
QQPositron ;
oldIndex = -1 ;
}
const G4PhysicsTable* dEdxTable= t.theDEDXTable;
G4int materialIndex = aMaterial->GetIndex();
G4double scaledKineticEnergy = KineticEnergy*t.theMassRatio;
G4double dEdx;
G4bool isOut;
if (scaledKineticEnergy<t.theLowestKineticEnergy) {
dEdx =(*dEdxTable)(materialIndex)->GetValue(
t.theLowestKineticEnergy,isOut)
*sqrt(scaledKineticEnergy/t.theLowestKineticEnergy);
} else if (scaledKineticEnergy>t.theHighestKineticEnergy) {
dEdx = (*dEdxTable)(materialIndex)->GetValue(
t.theHighestKineticEnergy,isOut);
} else {
dEdx = (*dEdxTable)(materialIndex)->GetValue(
scaledKineticEnergy,isOut);
}
return dEdx*Chargesquare;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4EnergyLossTables::GetLabTime(
const G4ParticleDefinition *aParticle,
G4double KineticEnergy,
const G4Material *aMaterial)
{
if(aParticle != lastParticle)
{
t= GetTables(aParticle);
lastParticle = aParticle ;
oldIndex = -1 ;
}
const G4PhysicsTable* labtimeTable= t.theLabTimeTable;
const G4double parlowen=0.4 , ppar=0.5-parlowen ;
G4int materialIndex = aMaterial->GetIndex();
G4double scaledKineticEnergy = KineticEnergy*t.theMassRatio;
G4double time;
G4bool isOut;
if (scaledKineticEnergy<t.theLowestKineticEnergy) {
time = exp(ppar*log(scaledKineticEnergy/t.theLowestKineticEnergy))*
(*labtimeTable)(materialIndex)->GetValue(
t.theLowestKineticEnergy,isOut);
} else if (scaledKineticEnergy>t.theHighestKineticEnergy) {
time = (*labtimeTable)(materialIndex)->GetValue(
t.theHighestKineticEnergy,isOut);
} else {
time = (*labtimeTable)(materialIndex)->GetValue(
scaledKineticEnergy,isOut);
}
return time/t.theMassRatio ;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4EnergyLossTables::GetDeltaLabTime(
const G4ParticleDefinition *aParticle,
G4double KineticEnergyStart,
G4double KineticEnergyEnd,
const G4Material *aMaterial)
{
if(aParticle != lastParticle)
{
t= GetTables(aParticle);
lastParticle = aParticle ;
oldIndex = -1 ;
}
const G4PhysicsTable* labtimeTable= t.theLabTimeTable;
const G4double parlowen=0.4 , ppar=0.5-parlowen ;
const G4double dToverT = 0.05 , facT = 1. -dToverT ;
G4double timestart,timeend,deltatime,dTT;
G4bool isOut;
G4int materialIndex = aMaterial->GetIndex();
G4double scaledKineticEnergy = KineticEnergyStart*t.theMassRatio;
if (scaledKineticEnergy<t.theLowestKineticEnergy) {
timestart = exp(ppar*log(scaledKineticEnergy/t.theLowestKineticEnergy))*
(*labtimeTable)(materialIndex)->GetValue(
t.theLowestKineticEnergy,isOut);
} else if (scaledKineticEnergy>t.theHighestKineticEnergy) {
timestart = (*labtimeTable)(materialIndex)->GetValue(
t.theHighestKineticEnergy,isOut);
} else {
timestart = (*labtimeTable)(materialIndex)->GetValue(
scaledKineticEnergy,isOut);
}
dTT = (KineticEnergyStart - KineticEnergyEnd)/KineticEnergyStart ;
if( dTT < dToverT )
scaledKineticEnergy = facT*KineticEnergyStart*t.theMassRatio;
else
scaledKineticEnergy = KineticEnergyEnd*t.theMassRatio;
if (scaledKineticEnergy<t.theLowestKineticEnergy) {
timeend = exp(ppar*log(scaledKineticEnergy/t.theLowestKineticEnergy))*
(*labtimeTable)(materialIndex)->GetValue(
t.theLowestKineticEnergy,isOut);
} else if (scaledKineticEnergy>t.theHighestKineticEnergy) {
timeend = (*labtimeTable)(materialIndex)->GetValue(
t.theHighestKineticEnergy,isOut);
} else {
timeend = (*labtimeTable)(materialIndex)->GetValue(
scaledKineticEnergy,isOut);
}
deltatime = timestart - timeend ;
if( dTT < dToverT )
deltatime *= dTT/dToverT;
return deltatime/t.theMassRatio ;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4EnergyLossTables::GetProperTime(
const G4ParticleDefinition *aParticle,
G4double KineticEnergy,
const G4Material *aMaterial)
{
if(aParticle != lastParticle)
{
t= GetTables(aParticle);
lastParticle = aParticle ;
oldIndex = -1 ;
}
const G4PhysicsTable* propertimeTable= t.theProperTimeTable;
const G4double parlowen=0.4 , ppar=0.5-parlowen ;
G4int materialIndex = aMaterial->GetIndex();
G4double scaledKineticEnergy = KineticEnergy*t.theMassRatio;
G4double time;
G4bool isOut;
if (scaledKineticEnergy<t.theLowestKineticEnergy) {
time = exp(ppar*log(scaledKineticEnergy/t.theLowestKineticEnergy))*
(*propertimeTable)(materialIndex)->GetValue(
t.theLowestKineticEnergy,isOut);
} else if (scaledKineticEnergy>t.theHighestKineticEnergy) {
time = (*propertimeTable)(materialIndex)->GetValue(
t.theHighestKineticEnergy,isOut);
} else {
time = (*propertimeTable)(materialIndex)->GetValue(
scaledKineticEnergy,isOut);
}
return time/t.theMassRatio ;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4EnergyLossTables::GetDeltaProperTime(
const G4ParticleDefinition *aParticle,
G4double KineticEnergyStart,
G4double KineticEnergyEnd,
const G4Material *aMaterial)
{
if(aParticle != lastParticle)
{
t= GetTables(aParticle);
lastParticle = aParticle ;
oldIndex = -1 ;
}
const G4PhysicsTable* propertimeTable= t.theProperTimeTable;
const G4double parlowen=0.4 , ppar=0.5-parlowen ;
const G4double dToverT = 0.05 , facT = 1. -dToverT ;
G4double timestart,timeend,deltatime,dTT;
G4bool isOut;
G4int materialIndex = aMaterial->GetIndex();
G4double scaledKineticEnergy = KineticEnergyStart*t.theMassRatio;
if (scaledKineticEnergy<t.theLowestKineticEnergy) {
timestart = exp(ppar*log(scaledKineticEnergy/t.theLowestKineticEnergy))*
(*propertimeTable)(materialIndex)->GetValue(
t.theLowestKineticEnergy,isOut);
} else if (scaledKineticEnergy>t.theHighestKineticEnergy) {
timestart = (*propertimeTable)(materialIndex)->GetValue(
t.theHighestKineticEnergy,isOut);
} else {
timestart = (*propertimeTable)(materialIndex)->GetValue(
scaledKineticEnergy,isOut);
}
dTT = (KineticEnergyStart - KineticEnergyEnd)/KineticEnergyStart ;
if( dTT < dToverT )
scaledKineticEnergy = facT*KineticEnergyStart*t.theMassRatio;
else
scaledKineticEnergy = KineticEnergyEnd*t.theMassRatio;
if (scaledKineticEnergy<t.theLowestKineticEnergy) {
timeend = exp(ppar*log(scaledKineticEnergy/t.theLowestKineticEnergy))*
(*propertimeTable)(materialIndex)->GetValue(
t.theLowestKineticEnergy,isOut);
} else if (scaledKineticEnergy>t.theHighestKineticEnergy) {
timeend = (*propertimeTable)(materialIndex)->GetValue(
t.theHighestKineticEnergy,isOut);
} else {
timeend = (*propertimeTable)(materialIndex)->GetValue(
scaledKineticEnergy,isOut);
}
deltatime = timestart - timeend ;
if( dTT < dToverT )
deltatime *= dTT/dToverT ;
return deltatime/t.theMassRatio ;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4EnergyLossTables::GetRange(
const G4ParticleDefinition *aParticle,
G4double KineticEnergy,
const G4Material *aMaterial)
{
if(aParticle != lastParticle)
{
t= GetTables(aParticle);
lastParticle = aParticle ;
Chargesquare = (aParticle->GetPDGCharge())*
(aParticle->GetPDGCharge())/
QQPositron ;
oldIndex = -1 ;
}
const G4PhysicsTable* rangeTable= t.theRangeTable;
const G4PhysicsTable* dEdxTable= t.theDEDXTable;
G4int materialIndex = aMaterial->GetIndex();
G4double scaledKineticEnergy = KineticEnergy*t.theMassRatio;
G4double Range;
G4bool isOut;
if (scaledKineticEnergy<t.theLowestKineticEnergy) {
Range = sqrt(scaledKineticEnergy/t.theLowestKineticEnergy)*
(*rangeTable)(materialIndex)->GetValue(
t.theLowestKineticEnergy,isOut);
} else if (scaledKineticEnergy>t.theHighestKineticEnergy) {
Range = (*rangeTable)(materialIndex)->GetValue(
t.theHighestKineticEnergy,isOut)+
(scaledKineticEnergy-t.theHighestKineticEnergy)/
(*dEdxTable)(materialIndex)->GetValue(
t.theHighestKineticEnergy,isOut);
} else {
Range = (*rangeTable)(materialIndex)->GetValue(
scaledKineticEnergy,isOut);
}
return Range/(Chargesquare*t.theMassRatio);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4EnergyLossTables::GetPreciseEnergyFromRange(
const G4ParticleDefinition *aParticle,
G4double range,
const G4Material *aMaterial)
// it returns the value of the kinetic energy for a given range
{
if( aParticle != lastParticle)
{
@@ -86,6 +512,69 @@ void G4EnergyLossTables::Register(
Chargesquare = (aParticle->GetPDGCharge())*
(aParticle->GetPDGCharge())/
QQPositron ;
oldIndex = -1 ;
}
const G4PhysicsTable* dEdxTable= t.theDEDXTable;
const G4PhysicsTable* inverseRangeTable= t.theInverseRangeTable;
G4double scaledrange,scaledKineticEnergy ;
G4bool isOut ;
G4int materialIndex = aMaterial->GetIndex() ;
if(materialIndex != oldIndex)
{
oldIndex = materialIndex ;
rmin = (*inverseRangeTable)(materialIndex)->
GetLowEdgeEnergy(0) ;
rmax = (*inverseRangeTable)(materialIndex)->
GetLowEdgeEnergy(t.theNumberOfBins-2) ;
Thigh = (*inverseRangeTable)(materialIndex)->
GetValue(rmax,isOut) ;
}
scaledrange = range*Chargesquare*t.theMassRatio ;
if(scaledrange < rmin)
{
scaledKineticEnergy = t.theLowestKineticEnergy*
scaledrange*scaledrange/(rmin*rmin) ;
}
else
{
if(scaledrange < rmax)
{
scaledKineticEnergy = (*inverseRangeTable)(materialIndex)->
GetValue( scaledrange,isOut) ;
}
else
{
scaledKineticEnergy = Thigh +
(scaledrange-rmax)*
(*dEdxTable)(materialIndex)->
GetValue(Thigh,isOut) ;
}
}
return scaledKineticEnergy/t.theMassRatio ;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4EnergyLossTables::GetPreciseDEDX(
const G4ParticleDefinition *aParticle,
G4double KineticEnergy,
const G4Material *aMaterial)
{
if( aParticle != lastParticle)
{
t= GetTables(aParticle);
lastParticle = aParticle;
Chargesquare = (aParticle->GetPDGCharge())*
(aParticle->GetPDGCharge())/
QQPositron ;
oldIndex = -1 ;
}
const G4PhysicsTable* dEdxTable= t.theDEDXTable;
@@ -129,6 +618,7 @@ void G4EnergyLossTables::Register(
Chargesquare = (aParticle->GetPDGCharge())*
(aParticle->GetPDGCharge())/
QQPositron ;
oldIndex = -1 ;
}
const G4PhysicsTable* rangeTable= t.theRangeTable;
const G4PhysicsTable* dEdxTable= t.theDEDXTable;
@@ -21,173 +21,166 @@
// ********************************************************************
//
//
// $Id: G4MultipleScattering.cc,v 1.8.2.2 2001/06/28 20:19:51 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4MultipleScattering.cc,v 1.16 2001/10/31 07:27:25 urban Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
// $Id:
// --------------------------------------------------------------
// GEANT 4 class implementation file
// -----------------------------------------------------------------------------
// 16/05/01 value of cparm changed , L.Urban
// 18/05/01 V.Ivanchenko Clean up against Linux ANSI compilation
// 07/08/01 new methods Store/Retrieve PhysicsTable (mma)
// 23-08-01 new angle and z distribution,energy dependence reduced,
// Store,Retrieve methods commented out temporarily, L.Urban
// 27-08-01 in BuildPhysicsTable:aParticleType.GetParticleName()=="mu+" (mma)
// 28-08-01 GetContinuousStepLimit and AlongStepDoIt moved from .icc file (mma)
// 03-09-01 value of data member factlim changed, L.Urban
// 10-09-01 small change in GetContinuousStepLimit, L.Urban
// 11-09-01 G4MultipleScatteringx put as default G4MultipleScattering
// store/retrieve physics table reactivated (mma)
// 13-09-01 corr. in ComputeTransportCrossSection, L.Urban
// 14-09-01 protection in GetContinuousStepLimit, L.Urban
// 17-09-01 migration of Materials to pure STL (mma)
// 27-09-01 value of data member factlim changed, L.Urban
// 31-10-01 big fixed in PostStepDoIt,L.Urban
// -----------------------------------------------------------------------------
//
// History: based on object model of
// 2nd December 1995, G.Cosmo
// -------- G4MultipleScattering physics process ------------
// by Laszlo Urban, October 1997
// **************************************************************
// 24/10/97 correction in PostStepDoIt for tau << 1. L.Urban
// 09/12/98: charge can be different from +-1 !!!! L.Urban
// 29/07/99: corr. for low energy , L.Urban
// 17/09/99: corr. for high energy and/or small step , L.Urban
// 30/09/99: nuclear size effect correction, L.Urban
// 22/03/00: value of member cpar has changed! , L.Urban
// 20/06/00: nuclear size correction for particles other than e+/e- only , L.Urban
// 10/08/00 values of some data members has been changed, L.Urban
// 09/11/00 bug corrected in sigma computation, L.Urban
// 16/05/01 value of cpar changed back to the old value, L.Urban
// 18/05/01 V.Ivanchenko Clean up againist Linux ANSI compilation
// --------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4MultipleScattering.hh"
#include "G4Navigator.hh"
#include "G4TransportationManager.hh"
#include "Randomize.hh"
G4MultipleScattering::G4MultipleScattering(const G4String& processName)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4MultipleScattering::G4MultipleScattering(const G4String& processName)
: G4VContinuousDiscreteProcess(processName),
theTransportMeanFreePathTable(0),
fTransportMeanFreePath (1.e12),
range(1.e10*mm),
alpha1(5.),
stepFlag(0),
biglambda (1.e10*mm),
biglambda(1.e10),taubig(10.),tausmall(1.e-12),taulim(1.e-6),
LowestKineticEnergy(0.1*keV),
HighestKineticEnergy(100.*TeV),
TotBin(100),
theElectron(G4Electron::Electron()),
thePositron(G4Positron::Positron()),
lastMaterial(0),
lastKineticEnergy(0.),
materialIndex(0),
tLast (0.0),
zLast (0.0),
Tlimit(1.*keV),
scatteringparameter(0.9),
boundary(true),
factlim(1.00),
valueGPILSelectionMSC(NotCandidateForSelection),
pcz(0.17),zmean(0.),
palfa(0.9698),pbeta(0.4138),pgamma(2.0001),
pq0(0.272),pq1(50.14),pc0(4.024),
range(1.0),T1(1.0),lambda1(-1.),cth1(1.),z1(1.e10),dtrl(0.15),
tuning (1.00),
cpar (1.50),
fLatDisplFlag(true),
cparm (1.5),
fLatDisplFlag(true),
NuclCorrPar (0.0615),
FactPar(0.40)
{ }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4MultipleScattering::~G4MultipleScattering()
{
if(theTransportMeanFreePathTable)
G4MultipleScattering::~G4MultipleScattering()
{
if(theTransportMeanFreePathTable)
{
theTransportMeanFreePathTable->clearAndDestroy() ;
delete theTransportMeanFreePathTable ;
theTransportMeanFreePathTable->clearAndDestroy();
delete theTransportMeanFreePathTable;
}
}
}
// .........methods..............................
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4MultipleScattering::BuildPhysicsTable(
void G4MultipleScattering::BuildPhysicsTable(
const G4ParticleDefinition& aParticleType)
// tables are built for MATERIALS
{
{
// tables are built for MATERIALS
const G4double sigmafactor = twopi*classic_electr_radius*
classic_electr_radius ;
G4double KineticEnergy,AtomicNumber,AtomicWeight,
sigma,lambda ;
G4double density ;
classic_electr_radius;
G4double KineticEnergy,AtomicNumber,AtomicWeight,sigma,lambda;
G4double density;
// destroy old tables if any
if(theTransportMeanFreePathTable)
{
theTransportMeanFreePathTable->clearAndDestroy() ;
delete theTransportMeanFreePathTable ;
}
if (theTransportMeanFreePathTable)
{
theTransportMeanFreePathTable->clearAndDestroy();
delete theTransportMeanFreePathTable;
}
// create table
const G4MaterialTable* theMaterialTable=
G4Material::GetMaterialTable();
G4int numOfMaterials = theMaterialTable->length() ;
// create table
const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable();
G4int numOfMaterials = G4Material::GetNumberOfMaterials();
theTransportMeanFreePathTable = new G4PhysicsTable(numOfMaterials) ;
theTransportMeanFreePathTable = new G4PhysicsTable(numOfMaterials);
// loop for materials
// loop for materials
for (G4int J=0; J<numOfMaterials; J++)
{
// create physics vector and fill it
// create physics vector and fill it
G4PhysicsLogVector* aVector = new G4PhysicsLogVector(
LowestKineticEnergy,HighestKineticEnergy,TotBin) ;
LowestKineticEnergy,HighestKineticEnergy,TotBin);
// get elements in the material
const G4Material* material = (*theMaterialTable)(J) ;
const G4ElementVector* theElementVector =
material->GetElementVector() ;
const G4double* theAtomicNumDensityVector =
material->GetAtomicNumDensityVector() ;
const G4int NumberOfElements =
material->GetNumberOfElements() ;
density = material->GetDensity() ;
// get elements in the material
const G4Material* material = (*theMaterialTable)[J];
const G4ElementVector* theElementVector = material->GetElementVector();
const G4double* NbOfAtomsPerVolume =
material->GetVecNbOfAtomsPerVolume();
const G4int NumberOfElements = material->GetNumberOfElements();
density = material->GetDensity();
// loop for kinetic energy values
// loop for kinetic energy values
for (G4int i=0; i<TotBin; i++)
{
KineticEnergy = aVector->GetLowEdgeEnergy(i) ;
sigma = 0. ;
KineticEnergy = aVector->GetLowEdgeEnergy(i);
sigma = 0.;
// loop for element in the material
// loop for element in the material
for (G4int iel=0; iel<NumberOfElements; iel++)
{
AtomicNumber = (*theElementVector)(iel)->GetZ() ;
AtomicWeight = (*theElementVector)(iel)->GetA() ;
sigma += theAtomicNumDensityVector[iel]*
ComputeTransportCrossSection(aParticleType,
KineticEnergy,
AtomicNumber,AtomicWeight) ;
AtomicNumber = (*theElementVector)[iel]->GetZ();
AtomicWeight = (*theElementVector)[iel]->GetA();
sigma += NbOfAtomsPerVolume[iel]*
ComputeTransportCrossSection(aParticleType,KineticEnergy,
AtomicNumber,AtomicWeight);
}
sigma *= sigmafactor ;
lambda = 1./sigma ;
aVector->PutValue(i,lambda) ;
sigma *= sigmafactor;
lambda = 1./sigma;
aVector->PutValue(i,lambda);
}
theTransportMeanFreePathTable->insert(aVector) ;
theTransportMeanFreePathTable->insert(aVector);
}
if( (&aParticleType == G4Electron::Electron()) ||
(&aParticleType == G4MuonPlus::MuonPlus()) ||
(&aParticleType == G4Proton::Proton()) )
{
PrintInfoDefinition() ;
}
}
if((aParticleType.GetParticleName() == "e-" ) ||
(aParticleType.GetParticleName() == "mu+" ) ||
(aParticleType.GetParticleName() == "proton") ) PrintInfoDefinition();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4MultipleScattering::ComputeTransportCrossSection(
G4double G4MultipleScattering::ComputeTransportCrossSection(
const G4ParticleDefinition& aParticleType,
G4double KineticEnergy,
G4double AtomicNumber,G4double AtomicWeight)
{
const G4double epsfactor = 2.*electron_mass_c2*electron_mass_c2*
Bohr_radius*Bohr_radius/(hbarc*hbarc) ;
const G4double epsmin = 1.e-4 , epsmax = 1.e10 ;
{
const G4double epsfactor = 2.*electron_mass_c2*electron_mass_c2*
Bohr_radius*Bohr_radius/(hbarc*hbarc);
const G4double epsmin = 1.e-4 , epsmax = 1.e10;
const G4double Zdat[15] = { 4., 6.,13.,20.,26.,29.,32.,38.,47.,
50.,56.,64.,74.,79.,82. };
const G4double Zdat[15] = {4.,6.,13.,20.,26.,29.,32.,38.,47.,
50.,56.,64.,74.,79.,82. } ;
const G4double Tdat[22] = {0.0001*MeV,0.0002*MeV,0.0004*MeV,0.0007*MeV,
0.001*MeV,0.002*MeV,0.004*MeV,0.007*MeV,
0.01*MeV,0.02*MeV,0.04*MeV,0.07*MeV,
0.1*MeV,0.2*MeV,0.4*MeV,0.7*MeV,
1.*MeV,2.*MeV,4.*MeV,7.*MeV,10.*MeV,20.*MeV};
const G4double Tdat[22] =
{ 0.0001*MeV,0.0002*MeV,0.0004*MeV,0.0007*MeV,
0.001*MeV,0.002*MeV,0.004*MeV,0.007*MeV,0.01*MeV,
0.02*MeV,0.04*MeV,0.07*MeV,0.1*MeV,0.2*MeV,
0.4*MeV,0.7*MeV,1.*MeV,2.*MeV,4.*MeV,
7.*MeV,10.*MeV,20.*MeV} ;
// corr. factors for e-/e+ lambda
// corr. factors for e-/e+ lambda
const G4double celectron[15][22] =
{{1.125,1.072,1.051,1.047,1.047,1.050,1.052,1.054,
@@ -284,304 +277,426 @@
3.752,2.724,2.116,1.817,1.692,1.554,1.499,1.474,
1.456,1.412,1.364,1.328,1.307,1.282 }};
G4double Z23,ParticleMass,rat2,Charge,TotalEnergy,beta2,bg2,
eps,Z1,Z2,ratZ,T,E,b2small,b2big,ratb2,c1,c2,cc1,cc2,
corr,sigma,corrfactor,ChargeSquare ;
G4int iZ,iT ;
G4double sigma;
Z23 = 2.*log(AtomicNumber)/3. ;
Z23 = exp(Z23) ;
G4double Z23 = 2.*log(AtomicNumber)/3.; Z23 = exp(Z23);
ParticleMass = aParticleType.GetPDGMass() ;
G4double ParticleMass = aParticleType.GetPDGMass();
rat2 = ParticleMass/electron_mass_c2 ;
rat2 = rat2*rat2 ;
G4double rat2 = ParticleMass/electron_mass_c2; rat2 = rat2*rat2;
Charge = aParticleType.GetPDGCharge() ;
ChargeSquare = Charge*Charge/(eplus*eplus) ;
G4double Charge = aParticleType.GetPDGCharge();
G4double ChargeSquare = Charge*Charge/(eplus*eplus);
TotalEnergy = KineticEnergy + ParticleMass ;
G4double TotalEnergy = KineticEnergy + ParticleMass ;
G4double beta2 = KineticEnergy*(TotalEnergy+ParticleMass)
/(TotalEnergy*TotalEnergy);
G4double bg2 = KineticEnergy*(TotalEnergy+ParticleMass)
/(ParticleMass*ParticleMass);
beta2 = KineticEnergy*(TotalEnergy+ParticleMass)/
(TotalEnergy*TotalEnergy) ;
bg2 = KineticEnergy*(TotalEnergy+ParticleMass)/
(ParticleMass*ParticleMass) ;
G4double eps = rat2*epsfactor*bg2/Z23;
eps = rat2*epsfactor*bg2/Z23 ;
if (eps<epsmin) sigma = 2.*eps*eps;
else if(eps<epsmax) sigma = log(1.+2.*eps)-2.*eps/(1.+2.*eps);
else sigma = log(2.*eps)-1.+1./eps;
if(eps<epsmin)
sigma = 2.*eps*eps ;
else if(eps<epsmax)
sigma = log(1.+2.*eps)-2.*eps/(1.+2.*eps) ;
else
sigma = log(2.*eps)-1.+1./eps ;
sigma *=ChargeSquare*AtomicNumber*AtomicNumber/rat2 ;
sigma /= beta2*bg2 ;
sigma *= ChargeSquare*AtomicNumber*AtomicNumber/(rat2*beta2*bg2);
// nuclear size effect correction for high energy
// ( a simple approximation at present)
G4double corrnuclsize,a,x0,w1,w2,w ;
G4double corrnuclsize,a,x0,w1,w2,w;
x0 = 1. - NuclCorrPar*ParticleMass/(KineticEnergy*
exp(log(AtomicWeight/(g/mole))/3.)) ;
if((x0 < -1.) || (KineticEnergy <= 10.*MeV))
{
x0=-1. ;
corrnuclsize = 1. ;
}
else
{
a = 1.+1./eps ;
if(eps > epsmax)
w1=log(2.*eps)+1./eps-3./(8.*eps*eps) ;
else
w1=log((a+1.)/(a-1.))-2./(a+1.) ;
x0 = 1. - NuclCorrPar*ParticleMass/(KineticEnergy*
exp(log(AtomicWeight/(g/mole))/3.));
if ( (x0 < -1.) || (KineticEnergy <= 10.*MeV))
{ x0 = -1.; corrnuclsize = 1.;}
else
{ a = 1.+1./eps;
if (eps > epsmax) w1=log(2.*eps)+1./eps-3./(8.*eps*eps);
else w1=log((a+1.)/(a-1.))-2./(a+1.);
w = 1./((1.-x0)*eps);
if (w < epsmin) w2=-log(w)-1.+2.*w-1.5*w*w;
else w2 = log((a-x0)/(a-1.))-(1.-x0)/(a-x0);
corrnuclsize = w1/w2;
corrnuclsize = exp(-FactPar*proton_mass_c2/KineticEnergy)*
(corrnuclsize-1.)+1.;
}
w = 1./((1.-x0)*eps) ;
if(w < epsmin)
w2=-log(w)-1.+2.*w-1.5*w*w ;
else
w2 = log((a-x0)/(a-1.))-(1.-x0)/(a-x0) ;
// correct this value using the corrections computed for e+/e-
KineticEnergy *= electron_mass_c2/ParticleMass;
// interpolate in AtomicNumber and beta2
// get bin number in Z
G4int iZ = 14;
while ((iZ>=0)&&(Zdat[iZ]>=AtomicNumber)) iZ -= 1;
if (iZ==14) iZ = 13;
if (iZ==-1) iZ = 0 ;
G4double Z1 = Zdat[iZ];
G4double Z2 = Zdat[iZ+1];
G4double ratZ = (AtomicNumber-Z1)/(Z2-Z1);
// get bin number in T (beta2)
G4int iT = 21;
while ((iT>=0)&&(Tdat[iT]>=KineticEnergy)) iT -= 1;
if(iT==21) iT = 20;
if(iT==-1) iT = 0 ;
// calculate betasquare values
G4double T = Tdat[iT], E = T + electron_mass_c2;
G4double b2small = T*(E+electron_mass_c2)/(E*E);
T = Tdat[iT+1]; E = T + electron_mass_c2;
G4double b2big = T*(E+electron_mass_c2)/(E*E);
G4double ratb2 = (beta2-b2small)/(b2big-b2small);
corrnuclsize = w1/w2 ;
G4double corrfactor = tuning*(1.+cparm)/(1.+cparm*beta2);
G4double c1,c2,cc1,cc2,corr;
if (Charge < 0.)
{
c1 = celectron[iZ][iT];
c2 = celectron[iZ+1][iT];
cc1 = c1+ratZ*(c2-c1);
// ####################################################
corrnuclsize = exp(-FactPar*proton_mass_c2/KineticEnergy)*
(corrnuclsize-1.)+1. ;
}
c1 = celectron[iZ][iT+1];
c2 = celectron[iZ+1][iT+1];
cc2 = c1+ratZ*(c2-c1);
// correct this value using the corrections computed for e+/e-
KineticEnergy *= electron_mass_c2/ParticleMass ;
corr = cc1+ratb2*(cc2-cc1);
sigma /= corr;
}
// interpolate in AtomicNumber and beta2
// get bin number in Z
iZ = 14 ;
while ((iZ>=0)&&(Zdat[iZ]>=AtomicNumber)) iZ -= 1 ;
if (iZ==14) iZ = 13 ;
if (iZ==-1) iZ = 0 ;
Z1 = Zdat[iZ] ;
Z2 = Zdat[iZ+1] ;
ratZ = (AtomicNumber-Z1)/(Z2-Z1) ;
// get bin number in T (beta2)
iT = 21 ;
while ((iT>=0)&&(Tdat[iT]>=KineticEnergy))
iT -= 1 ;
if(iT==21)
iT = 20 ;
if(iT==-1)
iT = 0 ;
// calculate betasquare values
T = Tdat[iT] ;
E = T + electron_mass_c2 ;
b2small = T*(E+electron_mass_c2)/(E*E) ;
T = Tdat[iT+1] ;
E = T + electron_mass_c2 ;
b2big = T*(E+electron_mass_c2)/(E*E) ;
ratb2 = (beta2-b2small)/(b2big-b2small) ;
corrfactor = tuning*(1.+cpar)/(1.+cpar*beta2) ;
if(Charge < 0.)
{
c1 = celectron[iZ][iT] ;
c2 = celectron[iZ+1][iT] ;
cc1 = c1+ratZ*(c2-c1) ;
c1 = celectron[iZ][iT+1] ;
c2 = celectron[iZ+1][iT+1] ;
cc2 = c1+ratZ*(c2-c1) ;
corr = cc1+ratb2*(cc2-cc1) ;
sigma /= corr ;
}
if(Charge > 0.)
{
c1 = cpositron[iZ][iT] ;
c2 = cpositron[iZ+1][iT] ;
cc1 = c1+ratZ*(c2-c1) ;
c1 = cpositron[iZ][iT+1] ;
c2 = cpositron[iZ+1][iT+1] ;
cc2 = c1+ratZ*(c2-c1) ;
corr = cc1+ratb2*(cc2-cc1) ;
sigma /= corr ;
}
sigma *= corrfactor ;
// nucl. size correction for particles other than e+/e- only at present !!!!
if((&aParticleType != G4Electron::Electron()) &&
(&aParticleType != G4Positron::Positron()) )
sigma /= corrnuclsize ;
return sigma ;
}
G4VParticleChange* G4MultipleScattering::PostStepDoIt(
const G4Track& trackData,
const G4Step& stepData)
{
static G4double taulim=1.e-6 , randlim = 0.25*taulim*taulim ;
static const G4double tausmall = 5.e-5,taubig =50.,
kappa = 2.5, kappapl1 = kappa+1., kappami1 = kappa-1. ;
const G4DynamicParticle* aParticle ;
G4double KineticEnergy,truestep,tau,prob,cth,sth,phi,
dirx,diry,dirz,w,w1,etau,rmean,safetyminustolerance;
G4double rand ;
G4bool isOut;
fParticleChange.Initialize(trackData) ;
truestep = stepData.GetStepLength() ;
aParticle = trackData.GetDynamicParticle() ;
KineticEnergy = aParticle->GetKineticEnergy() ;
if(stepFlag == 0)
if (Charge > 0.)
{
fTransportMeanFreePath = (*theTransportMeanFreePathTable)
c1 = cpositron[iZ][iT];
c2 = cpositron[iZ+1][iT];
cc1 = c1+ratZ*(c2-c1);
c1 = cpositron[iZ][iT+1];
c2 = cpositron[iZ+1][iT+1];
cc2 = c1+ratZ*(c2-c1);
corr = cc1+ratb2*(cc2-cc1);
sigma /= corr;
}
sigma *= corrfactor;
// nucl. size correction for particles other than e+/e- only at present !!!!
if((aParticleType.GetParticleName() != "e-") &&
(aParticleType.GetParticleName() != "e+") )
sigma /= corrnuclsize;
return sigma;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4MultipleScattering::GetContinuousStepLimit(
const G4Track& track,
G4double,
G4double currentMinimumStep,
G4double&)
{
G4double zPathLength,tPathLength;
const G4DynamicParticle* aParticle;
G4Material* aMaterial;
G4double KineticEnergy,tau,z0,kz;
G4bool isOut;
// this process is not a candidate for selection by default
valueGPILSelectionMSC = NotCandidateForSelection;
tPathLength = currentMinimumStep;
aMaterial = track.GetMaterial();
materialIndex = aMaterial->GetIndex();
aParticle = track.GetDynamicParticle();
KineticEnergy = aParticle->GetKineticEnergy();
if ((lastMaterial != aMaterial) || (lastKineticEnergy != KineticEnergy))
{
lastKineticEnergy = KineticEnergy ;
materialIndex = aMaterial->GetIndex() ;
fTransportMeanFreePath = (*theTransportMeanFreePathTable)
(materialIndex)->GetValue(KineticEnergy,isOut);
}
// change direction first ( scattering ) ..........................
if(stepFlag == 0)
{
tau = truestep/fTransportMeanFreePath ;
if(tau > taulim)
prob = exp(-tau)*(1.+scatteringparameter*tau) ;
else
prob=1.-(1.-scatteringparameter)*tau ;
}
else
{
tau = truestep/range ;
if(tau < taulim)
prob = exp(-(alpha1-1.)*tau)*(1.+scatteringparameter*tau) ;
else if(tau < 1.)
prob = exp((alpha1-1.)*log(1.-tau))*(1.+scatteringparameter*tau) ;
else
prob = 0. ;
lastMaterial = aMaterial;
}
if(G4UniformRand()<prob)
// special treatment near boundaries ?
if (boundary)
{
// step limitation at boundary ?
if (track.GetCurrentStepNumber() > 1)
{
if(tau<taulim)
if((track.GetStep()->GetPreStepPoint()->GetSafety()<fTransportMeanFreePath)
&& (tPathLength > fTransportMeanFreePath))
{
rand = G4UniformRand() ;
if(rand > randlim)
{
cth = 1.-scatteringparameter*tau*(1./sqrt(rand)-1.) ;
if(cth < -1.) cth = -1. ;
}
else
cth = -1. ;
tPathLength = factlim*fTransportMeanFreePath ;
valueGPILSelectionMSC = CandidateForSelection;
}
else
{
w = 1.+scatteringparameter*tau ;
w1 = w-1. ;
cth = w-w1*(w+1.)/sqrt(w1*w1+4.*w*G4UniformRand()) ;
}
}
else
cth = -1.+2.*G4UniformRand() ;
sth = sqrt(1.-cth*cth) ;
phi = twopi*G4UniformRand() ;
dirx = sth*cos(phi) ;
diry = sth*sin(phi) ;
dirz = cth ;
G4ParticleMomentum ParticleDirection = aParticle->GetMomentumDirection();
G4ThreeVector newDirection(dirx,diry,dirz) ;
newDirection.rotateUz(ParticleDirection) ;
fParticleChange.SetMomentumChange(newDirection.x(),
newDirection.y(),
newDirection.z()) ;
if(fLatDisplFlag)
{
// compute mean lateral displacement ...............
// only for safety > tolerance !!!!!!!!!
safetyminustolerance = stepData.GetPostStepPoint()->GetSafety();
if(safetyminustolerance > 0.)
{
if(tau<tausmall)
rmean = 5.*tau*tau*tau/12. ;
else
{
if(tau<taubig)
etau = exp(-tau) ;
else
etau = 0. ;
rmean = -kappa*tau ;
rmean = -exp(rmean)/(kappa*kappami1) ;
rmean += tau-kappapl1/kappa+kappa*etau/kappami1 ;
}
if(rmean>0.)
rmean = 2.*fTransportMeanFreePath*sqrt(rmean/3.) ;
else
rmean = 0. ;
// for rmean > 0) only
if(rmean>0.)
{
if(rmean>safetyminustolerance)
rmean = safetyminustolerance ;
// sample direction of lateral displacement
phi = twopi*G4UniformRand() ;
dirx = cos(phi) ;
diry = sin(phi) ;
dirz = 0. ;
G4ThreeVector latDirection(dirx,diry,dirz);
latDirection.rotateUz(ParticleDirection) ;
// compute new endpoint of the Step
G4ThreeVector newPosition=
stepData.GetPostStepPoint()->GetPosition()+
rmean*latDirection;
G4Navigator *navigator=
G4TransportationManager::GetTransportationManager()
->GetNavigatorForTracking();
navigator->LocateGlobalPointWithinVolume( newPosition );
fParticleChange.SetPositionChange(newPosition) ;
}
}
}
return &fParticleChange ;
}
}
// do the true -> geom transformation
lambda1 = -1.;
z1 = 1.e10;
if (fTransportMeanFreePath > biglambda) zPathLength = tPathLength;
else
{
range = G4EnergyLossTables::GetRange(aParticle->GetDefinition(),
KineticEnergy,aMaterial);
tau = tPathLength/fTransportMeanFreePath ;
if (tPathLength/range < dtrl) zmean = fTransportMeanFreePath*(1.-exp(-tau));
else
{
T1 = G4EnergyLossTables::GetPreciseEnergyFromRange(
aParticle->GetDefinition(),range-0.5*tPathLength,aMaterial);
lambda1 = (*theTransportMeanFreePathTable)
(materialIndex)->GetValue(T1,isOut);
z1 = fTransportMeanFreePath*(1.-exp(-0.5*tau));
cth1 = exp(-0.5*tau);
zmean = z1 + lambda1*(1.-exp(-0.5*tPathLength/lambda1))*cth1;
}
// sample z
if ((pcz > 0.) && (2.*zmean > tPathLength))
{
z0 = zmean+pcz*(tPathLength-zmean);
kz = (2.*zmean-tPathLength)/(z0-zmean);
if (G4UniformRand() < z0/tPathLength)
zPathLength = z0*exp(log(G4UniformRand())/(kz+1.));
else zPathLength = tPathLength-(tPathLength-z0)
*exp(log(1.-G4UniformRand())/(kz+1.));
}
else zPathLength = zmean;
}
tLast = tPathLength;
zLast = zPathLength;
return zPathLength;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VParticleChange* G4MultipleScattering::AlongStepDoIt(
const G4Track& track,const G4Step& Step)
{
// only a geom path->true path transformation is performed
fParticleChange.Initialize(track);
G4double geomPathLength = track.GetStepLength();
G4double truePathLength;
if (fTransportMeanFreePath > biglambda) truePathLength = geomPathLength;
else if(geomPathLength == zLast) truePathLength = tLast;
else
{
if (geomPathLength <= z1)
{
if (geomPathLength < fTransportMeanFreePath)
truePathLength = -fTransportMeanFreePath
*log(1.-geomPathLength/fTransportMeanFreePath);
else truePathLength = range;
lambda1 = -1.;
}
else
{
if ((geomPathLength-z1)/(cth1*lambda1) < 1.)
truePathLength = 0.5*tLast-lambda1
*log(1.-(geomPathLength-z1)/(cth1*lambda1));
else truePathLength = range;
}
}
fParticleChange.SetTrueStepLength(truePathLength);
return &fParticleChange;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VParticleChange* G4MultipleScattering::PostStepDoIt(
const G4Track& trackData,
const G4Step& stepData)
{
const G4double kappa = 2.5, kappapl1 = kappa+1., kappami1 = kappa-1. ;
G4bool isOut;
fParticleChange.Initialize(trackData);
G4double truestep = stepData.GetStepLength();
const G4DynamicParticle* aParticle = trackData.GetDynamicParticle();
G4double KineticEnergy = aParticle->GetKineticEnergy();
fTransportMeanFreePath = (*theTransportMeanFreePathTable)
(materialIndex)->GetValue(KineticEnergy,isOut);
// change direction first ( scattering )
G4double tau = truestep/fTransportMeanFreePath;
G4double cth;
if (tau < tausmall) cth = 1.;
else if(tau > taubig) cth = -1.+2.*G4UniformRand();
else
{
if(lambda1 > 0.) tau = 0.5*tLast/lambda1
+(truestep-0.5*tLast)/fTransportMeanFreePath;
if(tau > taubig) cth = -1.+2.*G4UniformRand();
else
{
G4double e=exp(-tau);
if (palfa < 0.) cth = e;
else
{
G4double a = exp( palfa*tau), ap1=a+1., am1=a-1., aw1 = 1./a;
G4double w = exp(-pbeta*tau), b = 2.*w/(1.-w), bw1=w;
G4double c = 1.+pc0*tau, cp1=c+1., cm1=c-1.;
G4double gamma1 = pgamma-1.;
G4double w1 = exp(log(cp1)*gamma1), w2=exp(log(cm1)*gamma1);
G4double cw1 = c-gamma1*(w1*cm1-w2*cp1)/((gamma1-1.)*(w1-w2));
G4double q = 1.-exp(-pq0-pq1*tau);
G4double prob = (e-cw1)/(q*aw1+(1.-q)*bw1-cw1);
if (G4UniformRand() <= prob)
{
if (G4UniformRand() <= q)
cth = a-am1*ap1/sqrt(am1*am1+4.*a*G4UniformRand());
else cth = -1.+2.*exp(log(G4UniformRand())/(b+1.));
}
else cth = c-cp1*cm1/exp(log(w2+(w1-w2)*G4UniformRand())/gamma1);
}
}
}
G4double sth = sqrt(1.-cth*cth);
G4double phi = twopi*G4UniformRand();
G4double dirx = sth*cos(phi), diry = sth*sin(phi), dirz = cth;
G4ParticleMomentum ParticleDirection = aParticle->GetMomentumDirection();
G4ThreeVector newDirection(dirx,diry,dirz);
newDirection.rotateUz(ParticleDirection);
fParticleChange.SetMomentumChange(newDirection.x(),
newDirection.y(),
newDirection.z());
if (fLatDisplFlag)
{
// compute mean lateral displacement, only for safety > tolerance !
G4double safetyminustolerance = stepData.GetPostStepPoint()->GetSafety();
G4double rmean, etau;
if (safetyminustolerance > 0.)
{
if (tau < tausmall) rmean = 0.;
else if(tau < taulim) rmean = 5.*tau*tau*tau/12.;
else
{
if(tau<taubig) etau = exp(-tau);
else etau = 0.;
rmean = -kappa*tau;
rmean = -exp(rmean)/(kappa*kappami1);
rmean += tau-kappapl1/kappa+kappa*etau/kappami1;
}
if (rmean>0.) rmean = 2.*fTransportMeanFreePath*sqrt(rmean/3.);
else rmean = 0.;
// for rmean > 0) only
if (rmean > 0.)
{
if (rmean>safetyminustolerance) rmean = safetyminustolerance;
// sample direction of lateral displacement
phi = twopi*G4UniformRand();
dirx = cos(phi); diry = sin(phi); dirz = 0.;
G4ThreeVector latDirection(dirx,diry,dirz);
latDirection.rotateUz(ParticleDirection);
// compute new endpoint of the Step
G4ThreeVector newPosition = stepData.GetPostStepPoint()->GetPosition()
+ rmean*latDirection;
G4Navigator* navigator =
G4TransportationManager::GetTransportationManager()
->GetNavigatorForTracking();
navigator->LocateGlobalPointWithinVolume(newPosition);
fParticleChange.SetPositionChange(newPosition);
}
}
}
return &fParticleChange;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4bool G4MultipleScattering::StorePhysicsTable(G4ParticleDefinition* particle,
const G4String& directory,
G4bool ascii)
{
G4String filename;
// store mean free path table
filename = GetPhysicsTableFileName(particle,directory,"MeanFreePath",ascii);
if (!theTransportMeanFreePathTable->StorePhysicsTable(filename, ascii) ){
G4cout << " FAIL theMeanFreePathTable->StorePhysicsTable in " << filename
<< G4endl;
return false;
}
G4cout << GetProcessName() << " for " << particle->GetParticleName()
<< ": Success to store the PhysicsTables in "
<< directory << G4endl;
return true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4bool G4MultipleScattering::RetrievePhysicsTable(
G4ParticleDefinition* particle,
const G4String& directory,
G4bool ascii)
{
// delete theTransportMeanFreePathTable
if (theTransportMeanFreePathTable != 0) {
theTransportMeanFreePathTable->clearAndDestroy();
delete theTransportMeanFreePathTable;
}
G4String filename;
// retreive mean free path table
filename = GetPhysicsTableFileName(particle,directory,"MeanFreePath",ascii);
theTransportMeanFreePathTable =
new G4PhysicsTable(G4Material::GetNumberOfMaterials());
if (!theTransportMeanFreePathTable->RetrievePhysicsTable(filename, ascii) ){
G4cout << " FAIL theMeanFreePathTable->RetrievePhysicsTable in " << filename
<< G4endl;
return false;
}
G4cout << GetProcessName() << " for " << particle->GetParticleName()
<< ": Success to retrieve the PhysicsTables from "
<< directory << G4endl;
return true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4MultipleScattering::PrintInfoDefinition()
{
@@ -590,9 +705,10 @@ void G4MultipleScattering::PrintInfoDefinition()
comments += " displacement of the particle , too.";
G4cout << G4endl << GetProcessName() << ": " << comments
<< "\n PhysicsTables from " << G4BestUnit(LowestKineticEnergy,
"Energy")
<< "\n PhysicsTables from "
<< G4BestUnit(LowestKineticEnergy ,"Energy")
<< " to " << G4BestUnit(HighestKineticEnergy,"Energy")
<< " in " << TotBin << " bins. \n";
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -1,643 +0,0 @@
//
// ********************************************************************
// * 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: G4MultipleScatteringx.cc,v 1.4.2.1 2001/06/28 19:12:48 gunter Exp $
// GEANT4 tag $Name: $
//
// --------------------------------------------------------------
// 16/05/01 value of cparm changed , L.Urban
// 18/05/01 V.Ivanchenko Clean up againist Linux ANSI compilation
// --------------------------------------------------------------
#include "G4MultipleScatteringx.hh"
#include "G4Navigator.hh"
#include "G4TransportationManager.hh"
G4MultipleScatteringx::G4MultipleScatteringx(const G4String& processName)
: G4VContinuousDiscreteProcess(processName),
theTransportMeanFreePathTable(0),
fTransportMeanFreePath (1.e12),
range(1.e10*mm),
alpha1(5.),
stepFlag(0),
biglambda (1.e10*mm),
LowestKineticEnergy(0.1*keV),
HighestKineticEnergy(100.*TeV),
TotBin(100),
theElectron(G4Electron::Electron()),
thePositron(G4Positron::Positron()),
lastMaterial(0),
lastKineticEnergy(0.),
materialIndex(0),
tLast (0.0),
zLast (0.0),
Tlimit(1.*keV),
scatteringparameter1(0.9),
scatteringparameter2(5.0),
scatteringparameter3(1.0),
boundary(false),
tuning (1.00),
cparm (1.5),
fLatDisplFlag(true),
NuclCorrPar (0.0615),
FactPar(0.40)
{ }
G4MultipleScatteringx::~G4MultipleScatteringx()
{
if(theTransportMeanFreePathTable)
{
theTransportMeanFreePathTable->clearAndDestroy() ;
delete theTransportMeanFreePathTable ;
}
}
// .........methods..............................
void G4MultipleScatteringx::BuildPhysicsTable(
const G4ParticleDefinition& aParticleType)
// tables are built for MATERIALS
{
const G4double sigmafactor = twopi*classic_electr_radius*
classic_electr_radius ;
G4double KineticEnergy,AtomicNumber,AtomicWeight,
sigma,lambda ;
G4double density ;
// destroy old tables if any
if(theTransportMeanFreePathTable)
{
theTransportMeanFreePathTable->clearAndDestroy() ;
delete theTransportMeanFreePathTable ;
}
// create table
const G4MaterialTable* theMaterialTable=
G4Material::GetMaterialTable();
G4int numOfMaterials = theMaterialTable->length() ;
theTransportMeanFreePathTable = new G4PhysicsTable(numOfMaterials) ;
// loop for materials
for (G4int J=0; J<numOfMaterials; J++)
{
// create physics vector and fill it
G4PhysicsLogVector* aVector = new G4PhysicsLogVector(
LowestKineticEnergy,HighestKineticEnergy,TotBin) ;
// get elements in the material
const G4Material* material = (*theMaterialTable)(J) ;
const G4ElementVector* theElementVector =
material->GetElementVector() ;
const G4double* theAtomicNumDensityVector =
material->GetAtomicNumDensityVector() ;
const G4int NumberOfElements =
material->GetNumberOfElements() ;
density = material->GetDensity() ;
// loop for kinetic energy values
for (G4int i=0; i<TotBin; i++)
{
KineticEnergy = aVector->GetLowEdgeEnergy(i) ;
sigma = 0. ;
// loop for element in the material
for (G4int iel=0; iel<NumberOfElements; iel++)
{
AtomicNumber = (*theElementVector)(iel)->GetZ() ;
AtomicWeight = (*theElementVector)(iel)->GetA() ;
sigma += theAtomicNumDensityVector[iel]*
ComputeTransportCrossSection(aParticleType,
KineticEnergy,
AtomicNumber,AtomicWeight) ;
}
sigma *= sigmafactor ;
lambda = 1./sigma ;
aVector->PutValue(i,lambda) ;
}
theTransportMeanFreePathTable->insert(aVector) ;
}
if( (&aParticleType == G4Electron::Electron()) ||
(&aParticleType == G4MuonPlus::MuonPlus()) ||
(&aParticleType == G4Proton::Proton()) )
{
PrintInfoDefinition() ;
}
}
G4double G4MultipleScatteringx::ComputeTransportCrossSection(
const G4ParticleDefinition& aParticleType,
G4double KineticEnergy,
G4double AtomicNumber,G4double AtomicWeight)
{
const G4double epsfactor = 2.*electron_mass_c2*electron_mass_c2*
Bohr_radius*Bohr_radius/(hbarc*hbarc) ;
const G4double epsmin = 1.e-4 , epsmax = 1.e10 ;
const G4double Zdat[15] = {4.,6.,13.,20.,26.,29.,32.,38.,47.,
50.,56.,64.,74.,79.,82. } ;
const G4double Tdat[22] =
{ 0.0001*MeV,0.0002*MeV,0.0004*MeV,0.0007*MeV,
0.001*MeV,0.002*MeV,0.004*MeV,0.007*MeV,0.01*MeV,
0.02*MeV,0.04*MeV,0.07*MeV,0.1*MeV,0.2*MeV,
0.4*MeV,0.7*MeV,1.*MeV,2.*MeV,4.*MeV,
7.*MeV,10.*MeV,20.*MeV} ;
// corr. factors for e-/e+ lambda
const G4double celectron[15][22] =
{{1.125,1.072,1.051,1.047,1.047,1.050,1.052,1.054,
1.054,1.057,1.062,1.069,1.075,1.090,1.105,1.111,
1.112,1.108,1.100,1.093,1.089,1.087 },
{1.408,1.246,1.143,1.096,1.077,1.059,1.053,1.051,
1.052,1.053,1.058,1.065,1.072,1.087,1.101,1.108,
1.109,1.105,1.097,1.090,1.086,1.082 },
{2.833,2.268,1.861,1.612,1.486,1.309,1.204,1.156,
1.136,1.114,1.106,1.106,1.109,1.119,1.129,1.132,
1.131,1.124,1.113,1.104,1.099,1.098 },
{3.879,3.016,2.380,2.007,1.818,1.535,1.340,1.236,
1.190,1.133,1.107,1.099,1.098,1.103,1.110,1.113,
1.112,1.105,1.096,1.089,1.085,1.098 },
{6.937,4.330,2.886,2.256,1.987,1.628,1.395,1.265,
1.203,1.122,1.080,1.065,1.061,1.063,1.070,1.073,
1.073,1.070,1.064,1.059,1.056,1.056 },
{9.616,5.708,3.424,2.551,2.204,1.762,1.485,1.330,
1.256,1.155,1.099,1.077,1.070,1.068,1.072,1.074,
1.074,1.070,1.063,1.059,1.056,1.052 },
{11.72,6.364,3.811,2.806,2.401,1.884,1.564,1.386,
1.300,1.180,1.112,1.082,1.073,1.066,1.068,1.069,
1.068,1.064,1.059,1.054,1.051,1.050 },
{18.08,8.601,4.569,3.183,2.662,2.025,1.646,1.439,
1.339,1.195,1.108,1.068,1.053,1.040,1.039,1.039,
1.039,1.037,1.034,1.031,1.030,1.036 },
{18.22,10.48,5.333,3.713,3.115,2.367,1.898,1.631,
1.498,1.301,1.171,1.105,1.077,1.048,1.036,1.033,
1.031,1.028,1.024,1.022,1.021,1.024 },
{14.14,10.65,5.710,3.929,3.266,2.453,1.951,1.669,
1.528,1.319,1.178,1.106,1.075,1.040,1.027,1.022,
1.020,1.017,1.015,1.013,1.013,1.020 },
{14.11,11.73,6.312,4.240,3.478,2.566,2.022,1.720,
1.569,1.342,1.186,1.102,1.065,1.022,1.003,0.997,
0.995,0.993,0.993,0.993,0.993,1.011 },
{22.76,20.01,8.835,5.287,4.144,2.901,2.219,1.855,
1.677,1.410,1.224,1.121,1.073,1.014,0.986,0.976,
0.974,0.972,0.973,0.974,0.975,0.987 },
{50.77,40.85,14.13,7.184,5.284,3.435,2.520,2.059,
1.837,1.512,1.283,1.153,1.091,1.010,0.969,0.954,
0.950,0.947,0.949,0.952,0.954,0.963 },
{65.87,59.06,15.87,7.570,5.567,3.650,2.682,2.182,
1.939,1.579,1.325,1.178,1.108,1.014,0.965,0.947,
0.941,0.938,0.940,0.944,0.946,0.954 },
// {45.60,47.34,15.92,7.810,5.755,3.767,2.760,2.239, // paper.....
{55.60,47.34,15.92,7.810,5.755,3.767,2.760,2.239,
1.985,1.609,1.343,1.188,1.113,1.013,0.960,0.939,
0.933,0.930,0.933,0.936,0.939,0.949 }};
const G4double cpositron[15][22] = {
{2.589,2.044,1.658,1.446,1.347,1.217,1.144,1.110,
1.097,1.083,1.080,1.086,1.092,1.108,1.123,1.131,
1.131,1.126,1.117,1.108,1.103,1.100 },
{3.904,2.794,2.079,1.710,1.543,1.325,1.202,1.145,
1.122,1.096,1.089,1.092,1.098,1.114,1.130,1.137,
1.138,1.132,1.122,1.113,1.108,1.102 },
{7.970,6.080,4.442,3.398,2.872,2.127,1.672,1.451,
1.357,1.246,1.194,1.179,1.178,1.188,1.201,1.205,
1.203,1.190,1.173,1.159,1.151,1.145 },
{9.714,7.607,5.747,4.493,3.815,2.777,2.079,1.715,
1.553,1.353,1.253,1.219,1.211,1.214,1.225,1.228,
1.225,1.210,1.191,1.175,1.166,1.174 },
{17.97,12.95,8.628,6.065,4.849,3.222,2.275,1.820,
1.624,1.382,1.259,1.214,1.202,1.202,1.214,1.219,
1.217,1.203,1.184,1.169,1.160,1.151 },
{24.83,17.06,10.84,7.355,5.767,3.707,2.546,1.996,
1.759,1.465,1.311,1.252,1.234,1.228,1.238,1.241,
1.237,1.222,1.201,1.184,1.174,1.159 },
{23.26,17.15,11.52,8.049,6.375,4.114,2.792,2.155,
1.880,1.535,1.353,1.281,1.258,1.247,1.254,1.256,
1.252,1.234,1.212,1.194,1.183,1.170 },
{22.33,18.01,12.86,9.212,7.336,4.702,3.117,2.348,
2.015,1.602,1.385,1.297,1.268,1.251,1.256,1.258,
1.254,1.237,1.214,1.195,1.185,1.179 },
{33.91,24.13,15.71,10.80,8.507,5.467,3.692,2.808,
2.407,1.873,1.564,1.425,1.374,1.330,1.324,1.320,
1.312,1.288,1.258,1.235,1.221,1.205 },
{32.14,24.11,16.30,11.40,9.015,5.782,3.868,2.917,
2.490,1.925,1.596,1.447,1.391,1.342,1.332,1.327,
1.320,1.294,1.264,1.240,1.226,1.214 },
{29.51,24.07,17.19,12.28,9.766,6.238,4.112,3.066,
2.602,1.995,1.641,1.477,1.414,1.356,1.342,1.336,
1.328,1.302,1.270,1.245,1.231,1.233 },
{38.19,30.85,21.76,15.35,12.07,7.521,4.812,3.498,
2.926,2.188,1.763,1.563,1.484,1.405,1.382,1.371,
1.361,1.330,1.294,1.267,1.251,1.239 },
{49.71,39.80,27.96,19.63,15.36,9.407,5.863,4.155,
3.417,2.478,1.944,1.692,1.589,1.480,1.441,1.423,
1.409,1.372,1.330,1.298,1.280,1.258 },
{59.25,45.08,30.36,20.83,16.15,9.834,6.166,4.407,
3.641,2.648,2.064,1.779,1.661,1.531,1.482,1.459,
1.442,1.400,1.354,1.319,1.299,1.272 },
{56.38,44.29,30.50,21.18,16.51,10.11,6.354,4.542,
3.752,2.724,2.116,1.817,1.692,1.554,1.499,1.474,
1.456,1.412,1.364,1.328,1.307,1.282 }};
G4double Z23,ParticleMass,rat2,Charge,TotalEnergy,beta2,bg2,
eps,Z1,Z2,ratZ,T,E,b2small,b2big,ratb2,c1,c2,cc1,cc2,
corr,sigma,corrfactor,ChargeSquare ;
G4int iZ,iT ;
Z23 = 2.*log(AtomicNumber)/3. ;
Z23 = exp(Z23) ;
ParticleMass = aParticleType.GetPDGMass() ;
rat2 = ParticleMass/electron_mass_c2 ;
rat2 = rat2*rat2 ;
Charge = aParticleType.GetPDGCharge() ;
ChargeSquare = Charge*Charge/(eplus*eplus) ;
TotalEnergy = KineticEnergy + ParticleMass ;
beta2 = KineticEnergy*(TotalEnergy+ParticleMass)/
(TotalEnergy*TotalEnergy) ;
bg2 = KineticEnergy*(TotalEnergy+ParticleMass)/
(ParticleMass*ParticleMass) ;
eps = rat2*epsfactor*bg2/Z23 ;
if(eps<epsmin)
sigma = 2.*eps*eps ;
else if(eps<epsmax)
sigma = log(1.+2.*eps)-2.*eps/(1.+2.*eps) ;
else
sigma = log(2.*eps)-1.+1./eps ;
sigma *=ChargeSquare*AtomicNumber*AtomicNumber/rat2 ;
sigma /= beta2*bg2 ;
// nuclear size effect correction for high energy
// ( a simple approximation at present)
G4double corrnuclsize,a,x0,w1,w2,w ;
x0 = 1. - NuclCorrPar*ParticleMass/(KineticEnergy*
exp(log(AtomicWeight/(g/mole))/3.)) ;
if((x0 < -1.) || (KineticEnergy <= 10.*MeV))
{
x0=-1. ;
corrnuclsize = 1. ;
}
else
{
a = 1.+1./eps ;
if(eps > epsmax)
w1=log(2.*eps)+1./eps-3./(8.*eps*eps) ;
else
w1=log((a+1.)/(a-1.))-2./(a+1.) ;
w = 1./((1.-x0)*eps) ;
if(w < epsmin)
w2=-log(w)-1.+2.*w-1.5*w*w ;
else
w2 = log((a-x0)/(a-1.))-(1.-x0)/(a-x0) ;
corrnuclsize = w1/w2 ;
// ####################################################
corrnuclsize = exp(-FactPar*proton_mass_c2/KineticEnergy)*
(corrnuclsize-1.)+1. ;
}
// correct this value using the corrections computed for e+/e-
KineticEnergy *= electron_mass_c2/ParticleMass ;
// interpolate in AtomicNumber and beta2
// get bin number in Z
iZ = 14 ;
while ((iZ>=0)&&(Zdat[iZ]>=AtomicNumber)) iZ -= 1 ;
if (iZ==14) iZ = 13 ;
if (iZ==-1) iZ = 0 ;
Z1 = Zdat[iZ] ;
Z2 = Zdat[iZ+1] ;
ratZ = (AtomicNumber-Z1)/(Z2-Z1) ;
// get bin number in T (beta2)
iT = 21 ;
while ((iT>=0)&&(Tdat[iT]>=KineticEnergy))
iT -= 1 ;
if(iT==21)
iT = 20 ;
if(iT==-1)
iT = 0 ;
// calculate betasquare values
T = Tdat[iT] ;
E = T + electron_mass_c2 ;
b2small = T*(E+electron_mass_c2)/(E*E) ;
T = Tdat[iT+1] ;
E = T + electron_mass_c2 ;
b2big = T*(E+electron_mass_c2)/(E*E) ;
ratb2 = (beta2-b2small)/(b2big-b2small) ;
corrfactor = tuning*(1.+cparm)/(1.+cparm*beta2) ;
if(Charge < 0.)
{
c1 = celectron[iZ][iT] ;
c2 = celectron[iZ+1][iT] ;
cc1 = c1+ratZ*(c2-c1) ;
c1 = celectron[iZ][iT+1] ;
c2 = celectron[iZ+1][iT+1] ;
cc2 = c1+ratZ*(c2-c1) ;
corr = cc1+ratb2*(cc2-cc1) ;
sigma /= corr ;
}
if(Charge > 0.)
{
c1 = cpositron[iZ][iT] ;
c2 = cpositron[iZ+1][iT] ;
cc1 = c1+ratZ*(c2-c1) ;
c1 = cpositron[iZ][iT+1] ;
c2 = cpositron[iZ+1][iT+1] ;
cc2 = c1+ratZ*(c2-c1) ;
corr = cc1+ratb2*(cc2-cc1) ;
sigma /= corr ;
}
sigma *= corrfactor ;
// nucl. size correction for particles other than e+/e- only at present !!!!
if((&aParticleType != G4Electron::Electron()) &&
(&aParticleType != G4Positron::Positron()) )
sigma /= corrnuclsize ;
return sigma ;
}
G4VParticleChange* G4MultipleScatteringx::PostStepDoIt(
const G4Track& trackData,
const G4Step& stepData)
{
static G4double taulim=1.e-6,randlim = 0.25*taulim*taulim ;
static const G4double tausmall = 5.e-5,taubig =10.,
kappa = 2.5, kappapl1 = kappa+1., kappami1 = kappa-1. ;
const G4DynamicParticle* aParticle ;
G4double KineticEnergy,truestep,tau,cth,sth,phi,
dirx,diry,dirz,w,etau,rmean,safetyminustolerance;
G4double prob = 0.0;
G4bool isOut;
fParticleChange.Initialize(trackData) ;
truestep = stepData.GetStepLength() ;
aParticle = trackData.GetDynamicParticle() ;
KineticEnergy = aParticle->GetKineticEnergy() ;
if(stepFlag == 0)
{
fTransportMeanFreePath = (*theTransportMeanFreePathTable)
(materialIndex)->GetValue(KineticEnergy,isOut);
}
// change direction first ( scattering ) ..........................
static G4double cp0 = 3.218 ;
static G4double cp1 = 118.08 ;
static G4double cmax=5.0 ;
static G4double alfa0=0.180 ;
static G4double alfa1=53.08 ;
static G4double alfamax = 1.0 ;
G4double alfa ;
G4double a,ap1,am1,b,c,c1,c2,c3,u1,u2,u3,v1,v2,v3,I0,I1,I2,e ;
G4double w1,w2 ;
if(stepFlag == 0)
{
tau = truestep/fTransportMeanFreePath ;
}
else
{
tau = truestep/range ;
if(tau < taulim)
prob = exp(-(alpha1-1.)*tau)*(1.+scatteringparameter1*tau) ;
else if(tau < 1.)
prob = exp((alpha1-1.)*log(1.-tau))*(1.+scatteringparameter1*tau) ;
else
prob = 0. ;
}
if(tau >= taulim)
{
if(stepFlag == 0)
{
if(tau < taubig)
{
e=exp(-tau) ;
alfa =alfa0+alfa1*tau ;
if(alfa > alfamax) alfa=alfamax ;
a = exp(alfa*tau) ;
am1 = a-1. ;
ap1 = a+1. ;
c=cp0+cp1*tau ;
if(c > cmax) c=cmax ;
if(c > scatteringparameter2) c=scatteringparameter2 ;
c1=c-1. ;
c2=c-2. ;
c3=c-3. ;
u3=exp(log(ap1)*c3) ;
v3=exp(log(am1)*c3) ;
u2=u3*ap1 ;
v2=v3*am1 ;
u1=u2*ap1 ;
v1=v2*am1 ;
I0 = (1./v1-1./u1)/c1 ;
I1 = a*I0-(1./v2-1./u2)/c2 ;
I2 = a*a*I0-2.*a*(1./v2-1./u2)/c2+(1./v3-1./u3)/c3 ;
b = c/(am1+c) ;
if(b > 1.) b = 1. ; // from the definition of f(x)
prob = e*(I0-b*I1)/(I1-b*I2) ;
if(prob > 1.) prob = 1. ;
if(G4UniformRand() <= prob)
{
w1 = 1.-a*b ;
w2 = G4std::max(w1/am1,w1/ap1)+b ;
do
{
cth = a -am1*ap1/exp(log(v2+G4UniformRand()*(u2-v2))/c2) ;
} while ( G4UniformRand() > (w1/(a-cth)+b)/w2 ) ;
}
else
{
cth = -1.+2.*G4UniformRand() ;
}
}
else
{
cth = -1.+2.*G4UniformRand() ;
}
}
else
{
if(G4UniformRand()<prob)
{
w = 1.+scatteringparameter1*tau ;
w1 = w-1. ;
cth = w-w1*(w+1.)/sqrt(w1*w1+4.*w*G4UniformRand()) ;
}
else
cth = -1.+2.*G4UniformRand() ;
}
}
else
cth = 1. ;
sth = sqrt(1.-cth*cth) ;
phi = twopi*G4UniformRand() ;
dirx = sth*cos(phi) ;
diry = sth*sin(phi) ;
dirz = cth ;
G4ParticleMomentum ParticleDirection = aParticle->GetMomentumDirection();
G4ThreeVector newDirection(dirx,diry,dirz) ;
newDirection.rotateUz(ParticleDirection) ;
fParticleChange.SetMomentumChange(newDirection.x(),
newDirection.y(),
newDirection.z()) ;
if(fLatDisplFlag)
{
// compute mean lateral displacement ...............
// only for safety > tolerance !!!!!!!!!
safetyminustolerance = stepData.GetPostStepPoint()->GetSafety();
if(safetyminustolerance > 0.)
{
if(tau<tausmall)
rmean = 5.*tau*tau*tau/12. ;
else
{
if(tau<taubig)
etau = exp(-tau) ;
else
etau = 0. ;
rmean = -kappa*tau ;
rmean = -exp(rmean)/(kappa*kappami1) ;
rmean += tau-kappapl1/kappa+kappa*etau/kappami1 ;
}
if(rmean>0.)
rmean = 2.*fTransportMeanFreePath*sqrt(rmean/3.) ;
else
rmean = 0. ;
// for rmean > 0) only
if(rmean>0.)
{
if(rmean>safetyminustolerance)
rmean = safetyminustolerance ;
// sample direction of lateral displacement
phi = twopi*G4UniformRand() ;
dirx = cos(phi) ;
diry = sin(phi) ;
dirz = 0. ;
G4ThreeVector latDirection(dirx,diry,dirz);
latDirection.rotateUz(ParticleDirection) ;
// compute new endpoint of the Step
G4ThreeVector newPosition=
stepData.GetPostStepPoint()->GetPosition()+
rmean*latDirection;
G4Navigator *navigator=
G4TransportationManager::GetTransportationManager()
->GetNavigatorForTracking();
navigator->LocateGlobalPointWithinVolume( newPosition );
fParticleChange.SetPositionChange(newPosition) ;
}
}
}
return &fParticleChange ;
}
void G4MultipleScatteringx::PrintInfoDefinition()
{
G4String comments = " Tables of transport mean free paths.";
comments += "\n New model of MSC , computes the lateral \n";
comments += " displacement of the particle , too.";
G4cout << G4endl << GetProcessName() << ": " << comments
<< "\n PhysicsTables from " << G4BestUnit(LowestKineticEnergy,
"Energy")
<< " to " << G4BestUnit(HighestKineticEnergy,"Energy")
<< " in " << TotBin << " bins. \n";
}
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4VEnergyLoss.cc,v 1.21.2.1 2001/06/28 19:12:48 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4VEnergyLoss.cc,v 1.28 2001/11/08 15:56:52 maire Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
// --------------------------------------------------------------
@@ -33,6 +33,9 @@
// bugfix in fluct.
// (some variables are doubles instead of ints now),L.Urban 23/03/01
// 18/05/01 V.Ivanchenko Clean up againist Linux ANSI compilation
// 17-09-01 migration of Materials to pure STL (mma)
// 26-10-01 static inline functions moved from .hh file (mma)
// 08.11.01 some static methods,data members are not static L.Urban
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -42,12 +45,6 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4VEnergyLoss::ParticleMass ;
G4double G4VEnergyLoss::taulow ;
G4double G4VEnergyLoss::tauhigh ;
G4double G4VEnergyLoss::ltaulow ;
G4double G4VEnergyLoss::ltauhigh ;
G4bool G4VEnergyLoss::rndmStepFlag = false;
G4bool G4VEnergyLoss::EnlossFlucFlag = true;
@@ -104,14 +101,39 @@ G4VEnergyLoss::G4VEnergyLoss(G4VEnergyLoss& right)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4VEnergyLoss::SetRndmStep(G4bool value) {rndmStepFlag = value;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4VEnergyLoss::SetEnlossFluc(G4bool value) {EnlossFlucFlag = value;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4VEnergyLoss::SetSubSec(G4bool value) {subSecFlag = value;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4VEnergyLoss::SetMinDeltaCutInRange(G4double value)
{MinDeltaCutInRange = value; setMinDeltaCutInRange = true;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4VEnergyLoss::SetStepFunction(G4double c1, G4double c2)
{
dRoverRange = c1; finalRange = c2;
c1lim=dRoverRange;
c2lim=2.*(1-dRoverRange)*finalRange;
c3lim=-(1.-dRoverRange)*finalRange*finalRange;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4PhysicsTable* G4VEnergyLoss::BuildRangeTable(
G4PhysicsTable* theDEDXTable,G4PhysicsTable* theRangeTable,
G4double LowestKineticEnergy,G4double HighestKineticEnergy,G4int TotBin)
// Build range table from the energy loss table
{
const G4MaterialTable* theMaterialTable=
G4Material::GetMaterialTable();
G4int numOfMaterials = theMaterialTable->length();
G4int numOfMaterials = G4Material::GetNumberOfMaterials();
if(theRangeTable)
{ theRangeTable->clearAndDestroy();
@@ -143,10 +165,8 @@ void G4VEnergyLoss::BuildRangeVector(G4PhysicsTable* theDEDXTable,
G4int nbin=100,i;
G4bool isOut;
// ??????????????????????????????????
static const G4double small = 1.e-6 ;
static G4double masslimit = 0.52*MeV ;
const G4double small = 1.e-6 ;
const G4double masslimit = 0.52*MeV ;
G4double tlim=2.*MeV,t1=0.1*MeV,t2=0.025*MeV ;
G4double tlime=0.2*keV,factor=2.*electron_mass_c2 ;
@@ -348,9 +368,7 @@ G4PhysicsTable* G4VEnergyLoss::BuildLabTimeTable(G4PhysicsTable* theDEDXTable,
G4double HighestKineticEnergy,G4int TotBin)
{
const G4MaterialTable* theMaterialTable=
G4Material::GetMaterialTable();
G4int numOfMaterials = theMaterialTable->length();
G4int numOfMaterials = G4Material::GetNumberOfMaterials();
if(theLabTimeTable)
{ theLabTimeTable->clearAndDestroy();
@@ -382,9 +400,7 @@ G4PhysicsTable* G4VEnergyLoss::BuildProperTimeTable(G4PhysicsTable* theDEDXTable
G4double HighestKineticEnergy,G4int TotBin)
{
const G4MaterialTable* theMaterialTable=
G4Material::GetMaterialTable();
G4int numOfMaterials = theMaterialTable->length();
G4int numOfMaterials = G4Material::GetNumberOfMaterials();
if(theProperTimeTable)
{ theProperTimeTable->clearAndDestroy();
@@ -608,9 +624,7 @@ G4PhysicsTable* G4VEnergyLoss::BuildInverseRangeTable(G4PhysicsTable* theRangeTa
{
G4double SmallestRange,BiggestRange ;
G4bool isOut ;
const G4MaterialTable* theMaterialTable=
G4Material::GetMaterialTable();
G4int numOfMaterials = theMaterialTable->length();
G4int numOfMaterials = G4Material::GetNumberOfMaterials();
if(theInverseRangeTable)
{ theInverseRangeTable->clearAndDestroy();
@@ -704,9 +718,7 @@ G4PhysicsTable* G4VEnergyLoss::BuildRangeCoeffATable(G4PhysicsTable* theRangeTab
// Build tables of coefficients for the energy loss calculation
// create table for coefficients "A"
{
const G4MaterialTable* theMaterialTable=
G4Material::GetMaterialTable();
G4int numOfMaterials = theMaterialTable->length();
G4int numOfMaterials = G4Material::GetNumberOfMaterials();
if(theRangeCoeffATable)
{ theRangeCoeffATable->clearAndDestroy();
@@ -767,9 +779,7 @@ G4PhysicsTable* G4VEnergyLoss::BuildRangeCoeffBTable(G4PhysicsTable* theRangeTab
// Build tables of coefficients for the energy loss calculation
// create table for coefficients "B"
{
const G4MaterialTable* theMaterialTable=
G4Material::GetMaterialTable();
G4int numOfMaterials = theMaterialTable->length();
G4int numOfMaterials = G4Material::GetNumberOfMaterials();
if(theRangeCoeffBTable)
{ theRangeCoeffBTable->clearAndDestroy();
@@ -829,9 +839,7 @@ G4PhysicsTable* G4VEnergyLoss::BuildRangeCoeffCTable(G4PhysicsTable* theRangeTab
// Build tables of coefficients for the energy loss calculation
// create table for coefficients "C"
{
const G4MaterialTable* theMaterialTable=
G4Material::GetMaterialTable();
G4int numOfMaterials = theMaterialTable->length();
G4int numOfMaterials = G4Material::GetNumberOfMaterials();
if(theRangeCoeffCTable)
{ theRangeCoeffCTable->clearAndDestroy();
@@ -892,12 +900,12 @@ G4double G4VEnergyLoss::GetLossWithFluct(const G4DynamicParticle* aParticle,
// calculate actual loss from the mean loss
// The model used to get the fluctuation is essentially the same as in Glandz in Geant3.
{
static const G4double minLoss = 1.*eV ;
static const G4double probLim = 0.01 ;
static const G4double sumaLim = -log(probLim) ;
static const G4double alim=10.;
static const G4double kappa = 10. ;
static const G4double factor = twopi_mc2_rcl2 ;
const G4double minLoss = 1.*eV ;
const G4double probLim = 0.01 ;
const G4double sumaLim = -log(probLim) ;
const G4double alim=10.;
const G4double kappa = 10. ;
const G4double factor = twopi_mc2_rcl2 ;
// check if the material has changed ( cache mechanism)
@@ -932,7 +940,7 @@ G4double G4VEnergyLoss::GetLossWithFluct(const G4DynamicParticle* aParticle,
G4double Tkin = aParticle->GetKineticEnergy();
ParticleMass = aParticle->GetMass() ;
threshold =((*G4Electron::Electron()).GetCutsInEnergy())[imat];
threshold =((G4Electron::Electron())->GetEnergyCuts())[imat];
G4double rmass = electron_mass_c2/ParticleMass;
G4double tau = Tkin/ParticleMass, tau1 = tau+1., tau2 = tau*(tau+2.);
G4double Tm = 2.*electron_mass_c2*tau2/(1.+2.*tau1*rmass+rmass*rmass);
@@ -1104,5 +1112,31 @@ G4double G4VEnergyLoss::GetLossWithFluct(const G4DynamicParticle* aParticle,
return loss ;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4bool G4VEnergyLoss::EqualCutVectors( G4double* vec1, G4double* vec2 )
{
if ( (vec1==0 ) || (vec2==0) ) return false;
G4bool flag = true;
for (size_t j=0; flag && j<G4Material::GetNumberOfMaterials(); j++){
flag = (vec1[j] == vec2[j]);
}
return flag;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double* G4VEnergyLoss::CopyCutVectors( G4double* dest, G4double* source )
{
if ( dest != 0) delete [] dest;
dest = new G4double [G4Material::GetNumberOfMaterials()];
for (size_t j=0; j<G4Material::GetNumberOfMaterials(); j++){
dest[j] = source[j];
}
return dest;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......