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
@@ -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 ;