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
+45 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.12 2001/05/30 14:33:44 vnivanch Exp $
$Id: History,v 1.26 2001/11/12 11:08:20 maire Exp $
-------------------------------------------------------------------
=========================================================
@@ -16,6 +16,50 @@ committal in the CVS repository !
----------------------------------------------------------
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
12 nov 01: mma (muons-V03-02-10)
- ParticleMass and Charge: local variables
- merge 09 + 06a
07 nov 01: mma (muons-V03-02-09)
- correction(Tmax+xsection computation) L.Urban
28 oct 01: mma (muons-V03-02-08)
- all static functions no more inlined
24 oct 01: mma (muons-V03-02-07)
- cut per material : all classes
08 nov 01: G.Cosmo (muons-V03-02-06a)
- Introduced changes to G4VMuEnergyLoss.cc for reference-counted touchables
(R.Chytracek). Not included in further tags till "muons-V03-02-09".
28 sep 01: mma (muons-V03-02-06)
- suppression of theMuonPlus ..etc..data members : all classes
- completion of store/retrieve PhysicsTables
20 sep 01: L.Urban (muons-V03-02-05)
- in MuPairProduction::ComputeMicroscopicCrossSection, remove:
if(MaxPairEnergy<CutInPairEnergy) MaxPairEnergy=CutInPairEnergy
19 sep 01: mma (muons-V03-02-04)
- come back to previous process name "MuIoni"
17 sep 01: mma (muons-V03-02-03)
- modifs in all classes for the migration of Materials to pure STL,
but backward compatible with g4rw
13 sep 01: L/Urban (muons-V03-02-02)
-G4VxEnergyLoss: min.delta cut is set as rcut/100 + some optimisation
11 sep 01: L.Urban (muons-V03-02-01)
- G4VMuEnergyLoss: subcutoff delta-rays mechanism implemented
29 aug 01: mma (muons-V03-02-00)
- G4MuIonisation: new function ComputeRestrictedMeandEdx() + 'cleanup'
10 aug 01: mma
- store/retrieve PhysicsTables implemented in MuIonis, MuBrems, MuPairProd
29 may 01: V.Ivanchenko
- clean up againist Linux ANSI strict compilation mode.
@@ -21,23 +21,22 @@
// ********************************************************************
//
//
// $Id: G4MuBremsstrahlung.hh,v 1.8.4.2 2001/06/28 20:19:44 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4MuBremsstrahlung.hh,v 1.12 2001/10/29 13:53:18 maire Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
// ------------------------------------------------------------
// GEANT 4 class header file
//
// History: first implementation, based on object model of
// 2nd December 1995, G.Cosmo
// -------- G4MuBremsstrahlung physics process ---------
//--------------- G4MuBremsstrahlung physics process ------------------
// by Laszlo Urban, September 1997
// ************************************************************
//------------------------------------------------------------------------------
// 10/02/00 modifications , new e.m. structure, L.Urban
//
// 10-08-01: new methods Store/Retrieve PhysicsTable (mma)
// 29-10-01 all static functions no more inlined (mma)
//------------------------------------------------------------------------------
#ifndef G4MuBremsstrahlung_h
#define G4MuBremsstrahlung_h 1
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4ios.hh"
#include "globals.hh"
#include "Randomize.hh"
@@ -47,6 +46,8 @@
#include "G4OrderedTable.hh"
#include "G4PhysicsTable.hh"
#include "G4PhysicsLogVector.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class G4MuBremsstrahlung : public G4VMuEnergyLoss
@@ -64,15 +65,15 @@ class G4MuBremsstrahlung : public G4VMuEnergyLoss
void BuildLossTable(const G4ParticleDefinition& ParticleType);
void BuildLambdaTable(const G4ParticleDefinition& ParticleType);
void PrintInfoDefinition() ;
void PrintInfoDefinition();
G4double GetMeanFreePath(const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition ) ;
G4ForceCondition* condition );
G4VParticleChange *PostStepDoIt(const G4Track& track,
const G4Step& Step ) ;
const G4Step& Step );
G4double GetDMicroscopicCrossSection(
const G4ParticleDefinition* ParticleType,
@@ -80,6 +81,16 @@ class G4MuBremsstrahlung : public G4VMuEnergyLoss
G4double AtomicNumber,
G4double AtomicMass,
G4double GammaEnergy);
G4bool StorePhysicsTable(G4ParticleDefinition* ,
const G4String& directory, G4bool);
// store eLoss and MeanFreePath tables into an external file
// specified by 'directory' (must exist before invokation)
G4bool RetrievePhysicsTable(G4ParticleDefinition* ,
const G4String& directory, G4bool);
// retrieve eLoss and MeanFreePath tables from an external file
// specified by 'directory'
protected:
@@ -120,37 +131,39 @@ class G4MuBremsstrahlung : public G4VMuEnergyLoss
private:
G4PhysicsTable* theMeanFreePathTable ;
G4PhysicsTable* theMeanFreePathTable;
G4OrderedTable PartialSumSigma;
static G4double LowerBoundLambda ; // bining for lambda table
static G4double UpperBoundLambda ;
static G4int NbinLambda ;
G4double LowestKineticEnergy,HighestKineticEnergy ;
G4int TotBin ;
static G4double LowerBoundLambda; // bining for lambda table
static G4double UpperBoundLambda;
static G4int NbinLambda;
G4double LowestKineticEnergy,HighestKineticEnergy;
G4int TotBin;
const G4double* GammaCutInKineticEnergy;
G4double GammaCutInKineticEnergyNow;
// tables for sampling ..............
static G4int nzdat,ntdat,NBIN ;
static G4double zdat[5],adat[5],tdat[8] ;
static G4double ya[1001],proba[5][8][1001] ;
static G4double CutFixed ;
// tables for sampling
static G4int nzdat,ntdat,NBIN;
static G4double zdat[5],adat[5],tdat[8];
static G4double ya[1001],proba[5][8][1001];
static G4double CutFixed;
public:
static void SetLowerBoundLambda(G4double val) {LowerBoundLambda = val;};
static void SetUpperBoundLambda(G4double val) {UpperBoundLambda = val;};
static void SetNbinLambda(G4int n) {NbinLambda = n;};
static G4double GetLowerBoundLambda() { return LowerBoundLambda;};
static G4double GetUpperBoundLambda() { return UpperBoundLambda;};
static G4int GetNbinLambda() {return NbinLambda;};
static void SetLowerBoundLambda(G4double val);
static void SetUpperBoundLambda(G4double val);
static void SetNbinLambda(G4int n);
static G4double GetLowerBoundLambda();
static G4double GetUpperBoundLambda();
static G4int GetNbinLambda();
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4MuBremsstrahlung.icc"
#endif
@@ -21,25 +21,23 @@
// ********************************************************************
//
//
// $Id: G4MuBremsstrahlung.icc,v 1.4.2.2 2001/06/28 20:19:44 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4MuBremsstrahlung.icc,v 1.8 2001/10/24 16:36:40 maire Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
// ---------------------------------------------------------------
// GEANT 4 class inlined methods file
//
// History: first implementation, based on object model of
// 2nd December 1995, G.Cosmo
// -------- G4MuBremsstrahlung physics process ---------
//--------------- G4MuBremsstrahlung physics process ------------------
// by Laszlo Urban, September 1997
// ***************************************************************
//------------------------------------------------------------------------------
//
// Modified:
//
// 29.05.01 V.Ivanchenko minor changes to provide ANSI -wall compilation
//
// ---------------------------------------------------------------
// 17-09-01 migration of Materials to pure STL (mma)
// 29.05.01 V.Ivanchenko minor changes to provide ANSI -wall compilation
// 28-09-01 suppression of theMuonPlus ..etc..data members (mma)
//
//------------------------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double G4MuBremsstrahlung::GetMeanFreePath(const G4Track& trackData,
G4double previousStepSize,
G4ForceCondition* condition)
@@ -66,7 +64,8 @@ inline G4double G4MuBremsstrahlung::GetMeanFreePath(const G4Track& trackData,
return MeanFreePath;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double G4MuBremsstrahlung::ComputeMeanFreePath(
const G4ParticleDefinition* ParticleType,
G4double KineticEnergy,
@@ -75,26 +74,29 @@ inline G4double G4MuBremsstrahlung::ComputeMeanFreePath(
const G4ElementVector* theElementVector = aMaterial->GetElementVector() ;
const G4double* theAtomNumDensityVector =
aMaterial->GetAtomicNumDensityVector();
G4double GammaEnergyCut = (G4Gamma::GetCutsInEnergy())[aMaterial->GetIndex()];
G4double GammaEnergyCut = (G4Gamma::Gamma())->GetEnergyThreshold(aMaterial);
G4double SIGMA = 0 ;
for ( size_t i=0 ; i < aMaterial->GetNumberOfElements() ; i++ )
{
SIGMA += theAtomNumDensityVector[i] *
ComputeMicroscopicCrossSection(
ParticleType, KineticEnergy,
(*theElementVector)(i)->GetZ(),
(*theElementVector)(i)->GetA(),
(*theElementVector)[i]->GetZ(),
(*theElementVector)[i]->GetA(),
GammaEnergyCut );
}
return SIGMA<=0.0 ? DBL_MAX : 1./SIGMA ;
return SIGMA > 0. ? 1./SIGMA : DBL_MAX;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4bool G4MuBremsstrahlung::IsApplicable(
const G4ParticleDefinition& particle)
{
return( (&particle == (const G4ParticleDefinition *)theMuonMinus)
||(&particle == (const G4ParticleDefinition *)theMuonPlus)
) ;
return ((&particle == G4MuonPlus::MuonPlus() ) ||
(&particle == G4MuonMinus::MuonMinus()) );
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -21,111 +21,161 @@
// ********************************************************************
//
//
// $Id: G4MuIonisation.hh,v 1.8.4.2 2001/06/28 20:19:44 gunter Exp $
// GEANT4 tag $Name: $
// ------------------------------------------------------------
// GEANT 4 class header file
// $Id: G4MuIonisation.hh,v 1.13 2001/10/29 13:53:18 maire Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
// History: first implementation, based on object model of
// 2nd December 1995, G.Cosmo
// ------------ G4MuIonisation physics process ------------
// by Laszlo Urban, September 1997
// ------------------------------------------------------------
// It is the implementation of the NEW IONISATION
// PROCESS. ( delta rays + continuous energy loss)
// It calculates the ionisation for muons.
// ************************************************************
//
// 10/02/00 modifications , new e.m. structure, L.Urban
// ------------------------------------------------------------
// --------------- G4MuIonisation physics process ------------------------------
// by Laszlo Urban, September 1997
// -----------------------------------------------------------------------------
//
// 10-02-00 modifications , new e.m. structure, L.Urban
// 10-08-01 new methods Store/Retrieve PhysicsTable (mma)
// 29-08-01 new function ComputeRestrictedMeandEdx() + 'cleanup' (mma)
// 19-09-01 come back to the old process name 'MuIoni'
// 29-10-01 all static functions no more inlined (mma)
//
// -----------------------------------------------------------------------------
// Class description
//
// This class manages the ionisation process for muons.
// it inherites from G4VContinuousDiscreteProcess via G4VMuEnergyLoss.
//
// Class description - end
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef G4MuIonisation_h
#define G4MuIonisation_h 1
#include "G4ios.hh"
#include "globals.hh"
#include "Randomize.hh"
#include "G4VMuEnergyLoss.hh"
#include "globals.hh"
#include "G4Track.hh"
#include "G4Step.hh"
#include "G4PhysicsLogVector.hh"
#include "G4PhysicsLinearVector.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class G4MuIonisation : public G4VMuEnergyLoss
{
public:
public: // with description
G4MuIonisation(const G4String& processName = "MuIoni");
G4MuIonisation(const G4String& processName = "MuIoni");
~G4MuIonisation();
~G4MuIonisation();
G4bool IsApplicable(const G4ParticleDefinition&);
G4bool IsApplicable(const G4ParticleDefinition&);
// return true for charged particles, false otherwise
void BuildPhysicsTable(const G4ParticleDefinition& aParticleType);
// this function overloads a virtual function of the base class.
// It is invoked by the G4ParticleWithCuts::SetCut() method.
// It invokes BuildLambdaTable(), BuildLossTable(), BuildDEDXTable()
void BuildLossTable(const G4ParticleDefinition& aParticleType);
// build the dE/dx tables due to the ionisation, for every materials.
// (restricted stopping power, Bethe-Bloch formula)
void BuildLambdaTable(const G4ParticleDefinition& aParticleType);
// build mean free path tables for the delta rays production.
// the tables are built for every materials.
G4bool StorePhysicsTable(G4ParticleDefinition* ,
const G4String& directory, G4bool);
// store eLoss and MeanFreePath tables into an external file
// specified by 'directory' (must exist before invokation)
G4bool RetrievePhysicsTable(G4ParticleDefinition* ,
const G4String& directory, G4bool);
// retrieve eLoss and MeanFreePath tables from an external file
// specified by 'directory'
virtual void PrintInfoDefinition();
// Print few lines of informations about the process: validity range,
// origine ..etc..
// Invoked by BuildPhysicsTable().
G4double GetMeanFreePath(const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition );
// It returns the MeanFreePath of the process for the current track :
// (energy, material)
// The previousStepSize and G4ForceCondition* are not used.
// This function overloads a virtual function of the base class.
// It is invoked by the ProcessManager of the Particle.
G4VParticleChange* PostStepDoIt(const G4Track& track,
const G4Step& Step );
// It computes the final state of the process (at end of step),
// returned as a ParticleChange object.
// This function overloads a virtual function of the base class.
// It is invoked by the ProcessManager of the Particle.
void BuildPhysicsTable(const G4ParticleDefinition& aParticleType);
void BuildLossTable(const G4ParticleDefinition& aParticleType);
void BuildLambdaTable(const G4ParticleDefinition& aParticleType);
void PrintInfoDefinition();
G4double GetMeanFreePath(const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition ) ;
G4VParticleChange *PostStepDoIt(const G4Track& track,
const G4Step& Step ) ;
protected:
virtual G4double ComputeMicroscopicCrossSection(
protected: // with description
virtual G4double ComputeRestrictedMeandEdx(
const G4ParticleDefinition& aParticleType,
G4double KineticEnergy,
G4double AtomicNumber);
G4double ComputeDMicroscopicCrossSection(
const G4ParticleDefinition& ParticleType,
G4double KineticEnergy, G4double AtomicNumber,
G4double KnockonEnergy);
private:
// hide assignment operator
G4MuIonisation & operator=(const G4MuIonisation &right);
G4MuIonisation(const G4MuIonisation&);
private:
// private data members ...............................
const G4Material* material,
G4double DeltaThreshold);
// computes restricted mean dE/dx in Geant4 internal units.
virtual G4double ComputeCrossSectionPerAtom(
const G4ParticleDefinition& aParticleType,
G4double KineticEnergy,
G4double AtomicNumber,
G4double DeltaThreshold);
// computes total cross section per atom in Geant4 internal units.
virtual G4double ComputeDifCrossSectionPerAtom(
const G4ParticleDefinition& aParticleType,
G4double KineticEnergy,
G4double AtomicNumber,
G4double KnockonEnergy);
// computes differential cross section per atom.
protected:
G4PhysicsTable* theMeanFreePathTable;
static G4double LowerBoundLambda ; // bining for lambda table
static G4double UpperBoundLambda ;
static G4int NbinLambda ;
G4double LowestKineticEnergy,HighestKineticEnergy ;
G4int TotBin ;
private:
const G4double* DeltaCutInKineticEnergy ;
G4double DeltaCutInKineticEnergyNow ;
// hide assignment operator
G4MuIonisation & operator=(const G4MuIonisation &right);
G4MuIonisation(const G4MuIonisation&);
private:
public:
static G4double LowerBoundLambda; // bining for lambda table
static G4double UpperBoundLambda;
static G4int NbinLambda;
G4double LowestKineticEnergy; // binning for dE/dx table
G4double HighestKineticEnergy;
G4int TotBin;
static void SetLowerBoundLambda(G4double val) {LowerBoundLambda = val;};
static void SetUpperBoundLambda(G4double val) {UpperBoundLambda = val;};
static void SetNbinLambda(G4int n) {NbinLambda = n;};
static G4double GetLowerBoundLambda() { return LowerBoundLambda;};
static G4double GetUpperBoundLambda() { return UpperBoundLambda;};
static G4int GetNbinLambda() {return NbinLambda;};
public: // with description
static void SetLowerBoundLambda(G4double val);
static void SetUpperBoundLambda(G4double val);
static void SetNbinLambda(G4int n);
// set the parameters of the mean free path table.
static G4double GetLowerBoundLambda();
static G4double GetUpperBoundLambda();
static G4int GetNbinLambda();
// get the parameters of the mean free path table.
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4MuIonisation.icc"
#endif
@@ -21,56 +21,49 @@
// ********************************************************************
//
//
// $Id: G4MuIonisation.icc,v 1.2.4.2 2001/06/28 20:19:44 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4MuIonisation.icc,v 1.4 2001/08/29 16:38:05 maire Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// GEANT 4 class inlined methods file
//
// ------------ G4MuIonisation physics process ------------
// by Laszlo Urban, September 1997
// ---------------------------------------------------------------
// GEANT 4 class inlined methods file
//
// History: first implementation, based on object model of
// 2nd December 1995, G.Cosmo
// ------------ G4MuIonisation physics process -------------
// by Laszlo Urban, September 1997
// ---------------------------------------------------------------
// It is the implementation of the NEW IONISATION PROCESS.
// It calculates the ionisation of muons.
// ***************************************************************
// 24/11/97: correction on MeanFreePath for KinEnergy > HighestLimit
// 20/11/97: correction on MeanFreePath for KineticEnergy > HighestLimit
// 14-08-01: 'cleanup' of GetMeanFreePath (mma)
//
// ---------------------------------------------------------------
inline G4double G4MuIonisation::GetMeanFreePath(const G4Track& trackData,
G4double previousStepSize,
G4ForceCondition* condition)
{
const G4DynamicParticle* aParticle ;
G4Material* aMaterial ;
G4double KineticEnergy,MeanFreePath;
G4bool isOutRange ;
*condition = NotForced ;
aParticle = trackData.GetDynamicParticle() ;
aMaterial = trackData.GetMaterial() ;
KineticEnergy = aParticle->GetKineticEnergy() ;
if( KineticEnergy < LowestKineticEnergy )
MeanFreePath = DBL_MAX ;
else {
if(KineticEnergy > HighestKineticEnergy)
KineticEnergy = HighestKineticEnergy;
MeanFreePath = ((*theMeanFreePathTable)(aMaterial->GetIndex()))->
GetValue(KineticEnergy,isOutRange) ;
}
return MeanFreePath ;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4bool G4MuIonisation::IsApplicable(
const G4ParticleDefinition& particle)
{
return ( (&particle == (const G4ParticleDefinition *)theMuonPlus)
||(&particle == (const G4ParticleDefinition *)theMuonMinus)
);
const G4ParticleDefinition& particle)
{
return ((&particle == G4MuonPlus::MuonPlus() ) ||
(&particle == G4MuonMinus::MuonMinus()) );
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4MuIonisation::GetMeanFreePath(const G4Track& track, G4double,
G4ForceCondition*)
{
G4double KineticEnergy = track.GetDynamicParticle()->GetKineticEnergy();
G4Material* aMaterial = track.GetMaterial();
G4double MeanFreePath;
G4bool isOut;
if (KineticEnergy > HighestKineticEnergy) KineticEnergy = HighestKineticEnergy;
if (KineticEnergy > LowestKineticEnergy)
MeanFreePath = ((*theMeanFreePathTable)(aMaterial->GetIndex()))->
GetValue(KineticEnergy, isOut);
else MeanFreePath = DBL_MAX;
return MeanFreePath;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -21,23 +21,22 @@
// ********************************************************************
//
//
// $Id: G4MuPairProduction.hh,v 1.8.4.2 2001/06/28 20:19:44 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4MuPairProduction.hh,v 1.12 2001/10/29 13:53:18 maire Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
// ------------------------------------------------------------
// GEANT 4 class header file
//
// History: first implementation, based on object model of
// 2nd December 1995, G.Cosmo
// -------- G4MuPairProduction physics process ---------
//--------------- G4MuPairProduction physics process ------------------
// by Laszlo Urban, May 1998
// ************************************************************
// 10/02/00 modifications , new e.m. structure, L.Urban
//
//------------------------------------------------------------------------------
// 10-02-00 modifications , new e.m. structure, L.Urban
// 10-08-01 new methods Store/Retrieve PhysicsTable (mma)
// 29-10-01 all static functions no more inlined (mma)
//------------------------------------------------------------------------------
#ifndef G4MuPairproduction_h
#define G4MuPairproduction_h 1
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4ios.hh"
#include "globals.hh"
#include "Randomize.hh"
@@ -47,7 +46,9 @@
#include "G4OrderedTable.hh"
#include "G4PhysicsTable.hh"
#include "G4PhysicsLogVector.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class G4MuPairProduction : public G4VMuEnergyLoss
{
@@ -69,16 +70,26 @@ class G4MuPairProduction : public G4VMuEnergyLoss
G4double GetMeanFreePath( const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition ) ;
G4ForceCondition* condition );
G4VParticleChange *PostStepDoIt(const G4Track& track,
const G4Step& Step ) ;
const G4Step& Step );
G4double GetDMicroscopicCrossSection(
const G4ParticleDefinition* ParticleType,
G4double KineticEnergy,
G4double AtomicNumber,
G4double PairEnergy);
G4bool StorePhysicsTable(G4ParticleDefinition* ,
const G4String& directory, G4bool);
// store eLoss and MeanFreePath tables into an external file
// specified by 'directory' (must exist before invokation)
G4bool RetrievePhysicsTable(G4ParticleDefinition* ,
const G4String& directory, G4bool);
// retrieve eLoss and MeanFreePath tables from an external file
// specified by 'directory'
protected:
@@ -125,15 +136,15 @@ class G4MuPairProduction : public G4VMuEnergyLoss
private:
G4PhysicsTable* theMeanFreePathTable ;
G4PhysicsTable* theMeanFreePathTable;
G4OrderedTable PartialSumSigma;
static G4double LowerBoundLambda ; // bining for lambda table
static G4double UpperBoundLambda ;
static G4int NbinLambda ;
G4double LowestKineticEnergy,HighestKineticEnergy ;
G4int TotBin ;
static G4double LowerBoundLambda; // bining for lambda table
static G4double UpperBoundLambda;
static G4int NbinLambda;
G4double LowestKineticEnergy,HighestKineticEnergy;
G4int TotBin;
const G4double* ElectronCutInKineticEnergy;
const G4double* PositronCutInKineticEnergy;
@@ -141,23 +152,25 @@ class G4MuPairProduction : public G4VMuEnergyLoss
G4double ElectronCutInKineticEnergyNow;
G4double PositronCutInKineticEnergyNow;
// tables for sampling ..............
static G4int nzdat,ntdat,NBIN ;
static G4double zdat[5],tdat[8] ;
static G4double ya[1001],proba[5][8][1001] ;
static G4double MinPairEnergy ;
// tables for sampling
static G4int nzdat,ntdat,NBIN;
static G4double zdat[5],tdat[8];
static G4double ya[1001],proba[5][8][1001];
static G4double MinPairEnergy;
public:
static void SetLowerBoundLambda(G4double val) {LowerBoundLambda = val;};
static void SetUpperBoundLambda(G4double val) {UpperBoundLambda = val;};
static void SetNbinLambda(G4int n) {NbinLambda = n;};
static G4double GetLowerBoundLambda() { return LowerBoundLambda;};
static G4double GetUpperBoundLambda() { return UpperBoundLambda;};
static G4int GetNbinLambda() {return NbinLambda;};
static void SetLowerBoundLambda(G4double val);
static void SetUpperBoundLambda(G4double val);
static void SetNbinLambda(G4int n);
static G4double GetLowerBoundLambda();
static G4double GetUpperBoundLambda();
static G4int GetNbinLambda();
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4MuPairProduction.icc"
#endif
@@ -21,25 +21,23 @@
// ********************************************************************
//
//
// $Id: G4MuPairProduction.icc,v 1.4.2.2 2001/06/28 20:19:44 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4MuPairProduction.icc,v 1.8 2001/10/24 16:36:40 maire Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
// ---------------------------------------------------------------
// GEANT 4 class inlined methods file
//
// History: first implementation, based on object model of
// 2nd December 1995, G.Cosmo
// -------- G4MuPairProduction physics process ---------
//--------------- G4MuPairProduction physics process ------------------
// by Laszlo Urban, May 1998
// ***************************************************************
//------------------------------------------------------------------------------
//
// Modified:
//
// 29.05.01 V.Ivanchenko minor changes to provide ANSI -wall compilation
//
// ---------------------------------------------------------------
// 17-09-01 migration of Materials to pure STL (mma)
// 29.05.01 V.Ivanchenko minor changes to provide ANSI -wall compilation
// 28-09-01 suppression of theMuonPlus ..etc..data members (mma)
//
//------------------------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double G4MuPairProduction::GetMeanFreePath(const G4Track& trackData,
G4double previousStepSize,
G4ForceCondition* condition)
@@ -66,35 +64,40 @@ inline G4double G4MuPairProduction::GetMeanFreePath(const G4Track& trackData,
return MeanFreePath;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double G4MuPairProduction::ComputeMeanFreePath(
const G4ParticleDefinition* ParticleType,
G4double KineticEnergy,
const G4Material* aMaterial)
{
const G4ElementVector* theElementVector = aMaterial->GetElementVector() ;
const G4ElementVector* theElementVector = aMaterial->GetElementVector();
const G4double* theAtomNumDensityVector =
aMaterial->GetAtomicNumDensityVector();
G4double ElectronEnergyCut =
(G4Electron::GetCutsInEnergy())[aMaterial->GetIndex()];
G4Electron::Electron()->GetEnergyThreshold(aMaterial);
G4double PositronEnergyCut =
(G4Positron::GetCutsInEnergy())[aMaterial->GetIndex()];
G4Positron::Positron()->GetEnergyThreshold(aMaterial);
G4double SIGMA = 0 ;
G4double SIGMA = 0;
for ( size_t i=0 ; i < aMaterial->GetNumberOfElements() ; i++ )
{
SIGMA += theAtomNumDensityVector[i] *
ComputeMicroscopicCrossSection( ParticleType, KineticEnergy,
(*theElementVector)(i)->GetZ(),
(*theElementVector)[i]->GetZ(),
ElectronEnergyCut,PositronEnergyCut );
}
return SIGMA<=0.0 ? DBL_MAX : 1./SIGMA ;
return SIGMA > 0. ? 1./SIGMA : DBL_MAX;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4bool G4MuPairProduction::IsApplicable(
const G4ParticleDefinition& particle)
{
return( (&particle == (const G4ParticleDefinition *)theMuonMinus)
||(&particle == (const G4ParticleDefinition *)theMuonPlus)
) ;
return ((&particle == G4MuonPlus::MuonPlus() ) ||
(&particle == G4MuonMinus::MuonMinus()) );
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4VMuEnergyLoss.hh,v 1.2.4.2 2001/06/28 20:19:44 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4VMuEnergyLoss.hh,v 1.7 2001/10/29 13:53:18 maire Exp $
// GEANT4 tag $Name: geant4-04-00 $
// -------------------------------------------------------------------
// GEANT 4 class header file
//
@@ -41,9 +41,12 @@
// This class creates static muplus/muminus dE/dx and range tables ,
// which tables can be used by other processes.
// ************************************************************
// some corrections by L.Urban on 27/05/98 , (but other corrections come soon!)
// cleanup L.Urban on 23/10/98
// corrections due to new e.m. structure L.Urban 10/02/00
// 27-05-98 some corrections by L.Urban
// 23-10-98 cleanup L.Urban
// 10-02-00 corrections due to new e.m. structure L.Urban
// 10-09-01 loss+ mechanism has been implemented (subcutoff delta rays), L.Urban
// 28-09-01 suppression of theMuonPlus ..etc..data members (mma)
// 29-10-01 all static functions no more inlined (mma)
// ------------------------------------------------------------
#ifndef G4VMuEnergyLoss_h
@@ -113,20 +116,13 @@ class G4VMuEnergyLoss : public G4VEnergyLoss
G4double GetConstraints(const G4DynamicParticle *aParticle,
G4Material *aMaterial);
// =====================================================================
public:
protected:
G4PhysicsTable* theLossTable ;
G4double lastgammaCutInRange ;
G4double lastelectronCutInRange ;
const G4Electron* theElectron;
const G4Positron* thePositron;
const G4MuonPlus* theMuonPlus;
const G4MuonMinus* theMuonMinus;
G4double* lastgammaCutInRange ;
G4double* lastelectronCutInRange ;
private:
@@ -156,51 +152,51 @@ class G4VMuEnergyLoss : public G4VEnergyLoss
// static part of the class
public: // With description
static void SetNbOfProcesses(G4int nb) {NbOfProcesses=nb;};
static void SetNbOfProcesses(G4int nb);
// Sets number of processes giving contribution to the energy loss
static void PlusNbOfProcesses() {NbOfProcesses++ ;};
static void PlusNbOfProcesses();
// Increases number of processes giving contribution to the energy loss
static void MinusNbOfProcesses() {NbOfProcesses-- ;};
static void MinusNbOfProcesses();
// Decreases number of processes giving contribution to the energy loss
static G4int GetNbOfProcesses() {return NbOfProcesses;};
static G4int GetNbOfProcesses();
// Gets number of processes giving contribution to the energy loss
// ( default value = 3)
static void SetLowerBoundEloss(G4double val) {LowerBoundEloss=val;};
static void SetUpperBoundEloss(G4double val) {UpperBoundEloss=val;};
static void SetNbinEloss(G4int nb) {NbinEloss=nb;};
static void SetLowerBoundEloss(G4double val);
static void SetUpperBoundEloss(G4double val);
static void SetNbinEloss(G4int nb);
static G4double GetLowerBoundEloss() {return LowerBoundEloss;};
static G4double GetUpperBoundEloss() {return UpperBoundEloss;};
static G4int GetNbinEloss() {return NbinEloss;};
static G4double GetLowerBoundEloss();
static G4double GetUpperBoundEloss();
static G4int GetNbinEloss();
protected:
static G4PhysicsTable* theDEDXmuplusTable ;
static G4PhysicsTable* theDEDXmuminusTable ;
static G4PhysicsTable* theRangemuplusTable ;
static G4PhysicsTable* theRangemuminusTable ;
static G4PhysicsTable* theDEDXmuplusTable;
static G4PhysicsTable* theDEDXmuminusTable;
static G4PhysicsTable* theRangemuplusTable;
static G4PhysicsTable* theRangemuminusTable;
static G4PhysicsTable* theInverseRangemuplusTable ;
static G4PhysicsTable* theInverseRangemuminusTable ;
static G4PhysicsTable* theInverseRangemuplusTable;
static G4PhysicsTable* theInverseRangemuminusTable;
static G4PhysicsTable* theLabTimemuplusTable ;
static G4PhysicsTable* theLabTimemuminusTable ;
static G4PhysicsTable* theLabTimemuplusTable;
static G4PhysicsTable* theLabTimemuminusTable;
static G4PhysicsTable* theProperTimemuplusTable ;
static G4PhysicsTable* theProperTimemuminusTable ;
static G4PhysicsTable* theProperTimemuplusTable;
static G4PhysicsTable* theProperTimemuminusTable;
// processes inherited from G4muEnergyLoss
// register themselves in the static array Recorder
static G4int NbOfProcesses ;
static G4int NbOfProcesses;
static G4PhysicsTable** RecorderOfmuplusProcess;
static G4PhysicsTable** RecorderOfmuminusProcess;
static G4int CounterOfmuplusProcess ;
static G4int CounterOfmuminusProcess ;
static G4int CounterOfmuplusProcess;
static G4int CounterOfmuminusProcess;
private:
@@ -220,6 +216,10 @@ class G4VMuEnergyLoss : public G4VEnergyLoss
static G4EnergyLossMessenger* eLossMessenger;
static G4double cN; // coeff to compute nb of deltas
static G4int Ndeltamax; // upper limit for nb of subcutoff
// delta rays in one step
};
#include "G4VMuEnergyLoss.icc"
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4VMuEnergyLoss.icc,v 1.1.4.2 2001/06/28 20:19:44 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4VMuEnergyLoss.icc,v 1.3 2001/09/28 15:44:20 maire Exp $
// GEANT4 tag $Name: geant4-04-00 $
// ---------------------------------------------------------------
// GEANT 4 class inlined methods file
//
@@ -34,11 +34,14 @@
// It is the implementation of the NEW UNIFIED ENERGY LOSS PROCESS.
// It calculates the energy loss of muons.
// ***************************************************************
// correction for KineticEnergy< LowerBoundEloss by L.Urban on 27/11/97
// corrections by L. Urban on 27/05/98 ( other corrs come soon!)
// cleanup L.Urban on 23/10/98
// 27-11-97 correction for KineticEnergy< LowerBoundEloss by L.Urban
// 27-05-98 corrections by L. Urban
// 23-10-98 cleanup L.Urban
// 28-09-01 suppression of theMuonPlus ..etc..data members (mma)
// ---------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double G4VMuEnergyLoss::GetContinuousStepLimit(
const G4Track& track,
G4double,
@@ -55,10 +58,14 @@ inline G4double G4VMuEnergyLoss::GetContinuousStepLimit(
return Step ;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4bool G4VMuEnergyLoss::IsApplicable(const G4ParticleDefinition&
particle)
{
return ( (&particle == (const G4ParticleDefinition *)theMuonPlus)
||(&particle == (const G4ParticleDefinition *)theMuonMinus)
);
return ((&particle == G4MuonPlus::MuonPlus() ) ||
(&particle == G4MuonMinus::MuonMinus()) );
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -21,45 +21,47 @@
// ********************************************************************
//
//
// $Id: G4MuBremsstrahlung.cc,v 1.15.2.2 2001/06/28 20:19:45 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4MuBremsstrahlung.cc,v 1.22 2001/11/09 13:52:31 maire Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// --------------------------------------------------------------
// GEANT 4 class implementation file
//
// History: first implementation, based on object model of
// 2nd December 1995, G.Cosmo
// -------- G4MuBremsstrahlung physics process ---------
//--------------- G4MuBremsstrahlung physics process ---------------------------
// by Laszlo Urban, September 1997
//
// 08-04-98: remove 'tracking cut' of muon in oIt, MMa
// 26/10/98: new cross section of R.Kokoulin,cleanup , L.Urban
// 10/02/00 modifications , new e.m. structure, L.Urban
// 29/05/01 V.Ivanchenko minor changes to provide ANSI -wall compilation
// --------------------------------------------------------------
// 08-04-98 remove 'tracking cut' of muon in oIt, MMa
// 26/10/98 new cross section of R.Kokoulin,cleanup , L.Urban
// 10/02/00 modifications , new e.m. structure, L.Urban
// 29/05/01 V.Ivanchenko minor changes to provide ANSI -wall compilation
// 09-08-01 new methods Store/Retrieve PhysicsTable (mma)
// 17-09-01 migration of Materials to pure STL (mma)
// 26-09-01 completion of store/retrieve PhysicsTable (mma)
// 28-09-01 suppression of theMuonPlus ..etc..data members (mma)
// 29-10-01 all static functions no more inlined (mma)
// 08-11-01 particleMass becomes a local variable (mma)
//------------------------------------------------------------------------------
#include "G4MuBremsstrahlung.hh"
#include "G4UnitsTable.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
// static members ........
G4int G4MuBremsstrahlung::nzdat = 5 ;
// static members
//
G4int G4MuBremsstrahlung::nzdat = 5 ;
G4double G4MuBremsstrahlung::zdat[]={1.,4.,13.,29.,92.};
G4double G4MuBremsstrahlung::adat[]={1.01,9.01,26.98,63.55,238.03};
G4int G4MuBremsstrahlung::ntdat = 8 ;
G4int G4MuBremsstrahlung::ntdat = 8 ;
G4double G4MuBremsstrahlung::tdat[]={1.e3,1.e4,1.e5,1.e6,1.e7,1.e8,1.e9,1.e10};
G4int G4MuBremsstrahlung::NBIN = 1000; // 100 ;
//G4double G4MuBremsstrahlung::ya[1001]={0.};
//G4double G4MuBremsstrahlung::proba[5][8][1001]={0.};
G4int G4MuBremsstrahlung::NBIN = 1000; // 100 ;
G4double G4MuBremsstrahlung::ya[1001];
G4double G4MuBremsstrahlung::proba[5][8][1001];
G4double G4MuBremsstrahlung::CutFixed=0.98*keV ;
G4double G4MuBremsstrahlung::CutFixed=0.98*keV;
G4double G4MuBremsstrahlung::LowerBoundLambda = 1.*keV;
G4double G4MuBremsstrahlung::UpperBoundLambda = 1000000.*TeV;
G4int G4MuBremsstrahlung::NbinLambda = 150;
G4double G4MuBremsstrahlung::LowerBoundLambda = 1.*keV ;
G4double G4MuBremsstrahlung::UpperBoundLambda = 1000000.*TeV ;
G4int G4MuBremsstrahlung::NbinLambda = 150 ;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
// constructor
@@ -67,6 +69,8 @@ G4MuBremsstrahlung::G4MuBremsstrahlung(const G4String& processName)
: G4VMuEnergyLoss(processName),
theMeanFreePathTable(NULL)
{ }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4MuBremsstrahlung::~G4MuBremsstrahlung()
{
@@ -79,6 +83,38 @@ G4MuBremsstrahlung::~G4MuBremsstrahlung()
PartialSumSigma.clearAndDestroy();
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4MuBremsstrahlung::SetLowerBoundLambda(G4double val)
{LowerBoundLambda = val;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4MuBremsstrahlung::SetUpperBoundLambda(G4double val)
{UpperBoundLambda = val;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4MuBremsstrahlung::SetNbinLambda(G4int n)
{NbinLambda = n;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4MuBremsstrahlung::GetLowerBoundLambda()
{ return LowerBoundLambda;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4MuBremsstrahlung::GetUpperBoundLambda()
{ return UpperBoundLambda;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4int G4MuBremsstrahlung::GetNbinLambda()
{return NbinLambda;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4MuBremsstrahlung::BuildPhysicsTable(
const G4ParticleDefinition& aParticleType)
@@ -90,30 +126,30 @@ void G4MuBremsstrahlung::BuildPhysicsTable(
BuildLossTable(aParticleType) ;
if(&aParticleType==theMuonMinus)
if(&aParticleType==G4MuonMinus::MuonMinus())
{
RecorderOfmuminusProcess[CounterOfmuminusProcess] = (*this).theLossTable ;
RecorderOfmuminusProcess[CounterOfmuminusProcess] = (*this).theLossTable;
CounterOfmuminusProcess++;
}
else
{
RecorderOfmuplusProcess[CounterOfmuplusProcess] = (*this).theLossTable ;
RecorderOfmuplusProcess[CounterOfmuplusProcess] = (*this).theLossTable;
CounterOfmuplusProcess++;
}
if(theMeanFreePathTable == NULL)
MakeSamplingTables(&aParticleType) ;
G4double gammaCutInRange = G4Gamma::Gamma()->GetCuts();
if(gammaCutInRange != lastgammaCutInRange)
BuildLambdaTable(aParticleType) ;
G4double* gammaCutInRange = G4Gamma::Gamma()->GetLengthCuts();
if( !EqualCutVectors(gammaCutInRange,lastgammaCutInRange))
BuildLambdaTable(aParticleType) ;
G4VMuEnergyLoss::BuildDEDXTable(aParticleType) ;
G4VMuEnergyLoss::BuildDEDXTable(aParticleType);
if(&aParticleType == theMuonPlus)
PrintInfoDefinition() ;
if(&aParticleType == G4MuonPlus::MuonPlus()) PrintInfoDefinition();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4MuBremsstrahlung::BuildLossTable(
const G4ParticleDefinition& aParticleType)
@@ -123,10 +159,10 @@ void G4MuBremsstrahlung::BuildLossTable(
const G4MaterialTable* theMaterialTable =
G4Material::GetMaterialTable();
ParticleMass = aParticleType.GetPDGMass();
G4double particleMass = aParticleType.GetPDGMass();
GammaCutInKineticEnergy = G4Gamma::Gamma()->GetEnergyCuts() ;
G4int numOfMaterials = theMaterialTable->length() ;
G4int numOfMaterials = G4Material::GetNumberOfMaterials();
if (theLossTable) {
theLossTable->clearAndDestroy();
@@ -151,17 +187,17 @@ void G4MuBremsstrahlung::BuildLossTable(
for (G4int i=0; i<TotBin; i++)
{
KineticEnergy = aVector->GetLowEdgeEnergy(i) ;
TotalEnergy = KineticEnergy+ParticleMass ;
TotalEnergy = KineticEnergy+particleMass ;
Cut = GammaCutInKineticEnergyNow ;
if(Cut>KineticEnergy) Cut = KineticEnergy ;
bremloss = 0.;
for (G4int iel=0; iel<NumberOfElements; iel++)
{
Z=(*theElementVector)(iel)->GetZ();
Z=(*theElementVector)[iel]->GetZ();
natom = theAtomicNumDensityVector[iel] ;
loss = ComputeBremLoss((&aParticleType),Z,
(*theElementVector)(iel)->GetA(),
(*theElementVector)[iel]->GetA(),
KineticEnergy,Cut) ;
bremloss += natom*loss ;
}
@@ -173,6 +209,8 @@ void G4MuBremsstrahlung::BuildLossTable(
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4MuBremsstrahlung::ComputeBremLoss(
const G4ParticleDefinition* aParticleType,
G4double AtomicNumber,G4double AtomicMass,
@@ -185,8 +223,9 @@ G4double G4MuBremsstrahlung::ComputeBremLoss(
G4double xgi[]={0.03377,0.16940,0.38069,0.61931,0.83060,0.96623};
G4double wgi[]={0.08566,0.18038,0.23396,0.23396,0.18038,0.08566};
G4double loss = 0. ;
TotalEnergy=KineticEnergy+ParticleMass ;
G4double particleMass = aParticleType->GetPDGMass();
TotalEnergy=KineticEnergy+particleMass ;
vcut = GammaEnergyCut/TotalEnergy ;
vmax = KineticEnergy/TotalEnergy ;
@@ -214,6 +253,8 @@ G4double G4MuBremsstrahlung::ComputeBremLoss(
return loss ;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4MuBremsstrahlung::BuildLambdaTable(
const G4ParticleDefinition& ParticleType)
{
@@ -254,11 +295,14 @@ void G4MuBremsstrahlung::BuildLambdaTable(
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4MuBremsstrahlung::ComputePartialSumSigma(
const G4ParticleDefinition* ParticleType,
G4double KineticEnergy,
const G4Material* aMaterial)
// Build the table of cross section per element.The table is built for MATERIALS.
G4double KineticEnergy,
const G4Material* aMaterial)
// Build the table of cross section per element.
// The table is built for MATERIALS.
// This table is used by DoIt to select randomly an element in the material.
{
G4int Imate = aMaterial->GetIndex();
@@ -266,7 +310,7 @@ void G4MuBremsstrahlung::ComputePartialSumSigma(
const G4ElementVector* theElementVector = aMaterial->GetElementVector();
const G4double* theAtomNumDensityVector =
aMaterial->GetAtomicNumDensityVector();
G4double GammaEnergyCut = (G4Gamma::Gamma()->GetCutsInEnergy())[Imate];
G4double GammaEnergyCut = (G4Gamma::Gamma()->GetEnergyCuts())[Imate];
PartialSumSigma[Imate] = new G4DataVector();
@@ -276,13 +320,15 @@ void G4MuBremsstrahlung::ComputePartialSumSigma(
{
SIGMA += theAtomNumDensityVector[Ielem] *
ComputeMicroscopicCrossSection( ParticleType, KineticEnergy,
(*theElementVector)(Ielem)->GetZ(),
(*theElementVector)(Ielem)->GetA(),
(*theElementVector)[Ielem]->GetZ(),
(*theElementVector)[Ielem]->GetA(),
GammaEnergyCut );
PartialSumSigma[Imate]->push_back(SIGMA);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4MuBremsstrahlung::ComputeMicroscopicCrossSection(
const G4ParticleDefinition* ParticleType,
G4double KineticEnergy,
@@ -298,8 +344,9 @@ G4double G4MuBremsstrahlung::ComputeMicroscopicCrossSection(
G4double xgi[]={0.03377,0.16940,0.38069,0.61931,0.83060,0.96623};
G4double wgi[]={0.08566,0.18038,0.23396,0.23396,0.18038,0.08566};
G4double CrossSection = 0. ;
TotalEnergy=KineticEnergy+ParticleMass ;
G4double particleMass = ParticleType->GetPDGMass();
TotalEnergy=KineticEnergy+particleMass ;
vcut = GammaEnergyCut/TotalEnergy ;
vmax = KineticEnergy/TotalEnergy ;
if(vmax <= vcut) return CrossSection;
@@ -327,6 +374,8 @@ G4double G4MuBremsstrahlung::ComputeMicroscopicCrossSection(
return CrossSection;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4MuBremsstrahlung::GetDMicroscopicCrossSection(
const G4ParticleDefinition* ParticleType,
@@ -337,9 +386,11 @@ G4double G4MuBremsstrahlung::GetDMicroscopicCrossSection(
// get differential cross section
{
return ComputeDMicroscopicCrossSection(ParticleType,KineticEnergy,
AtomicNumber,AtomicMass,GammaEnergy) ;
AtomicNumber,AtomicMass,GammaEnergy);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4MuBremsstrahlung::ComputeDMicroscopicCrossSection(
const G4ParticleDefinition* ParticleType,
G4double KineticEnergy,
@@ -348,9 +399,11 @@ G4double G4MuBremsstrahlung::ComputeDMicroscopicCrossSection(
G4double GammaEnergy)
// differential cross section
{
G4double particleMass = ParticleType->GetPDGMass();
static const G4double sqrte=sqrt(exp(1.)) ;
static const G4double bh=202.4,bh1=446.,btf=183.,btf1=1429. ;
static const G4double rmass=ParticleMass/electron_mass_c2 ;
static const G4double rmass=particleMass/electron_mass_c2 ;
static const G4double cc=classic_electr_radius/rmass ;
static const G4double coeff= 16.*fine_structure_const*cc*cc/3. ;
@@ -359,9 +412,9 @@ G4double G4MuBremsstrahlung::ComputeDMicroscopicCrossSection(
if( GammaEnergy > KineticEnergy) return dxsection ;
G4double A = AtomicMass/(g/mole) ; // !!!!!!!!!!!!!!!!!!!
G4double E=KineticEnergy+ParticleMass ;
G4double E=KineticEnergy+particleMass ;
G4double v=GammaEnergy/E ;
G4double delta=0.5*ParticleMass*ParticleMass*v/(E-GammaEnergy) ;
G4double delta=0.5*particleMass*particleMass*v/(E-GammaEnergy) ;
G4double rab0=delta*sqrte ;
G4double z13=exp(-log(AtomicNumber)/3.) ;
@@ -385,15 +438,15 @@ G4double G4MuBremsstrahlung::ComputeDMicroscopicCrossSection(
// nucleus contribution logarithm
G4double rab1=b*z13;
G4double fn=log(rab1/(dnstar*(electron_mass_c2+rab0*rab1))*
(ParticleMass+delta*(dnstar*sqrte-2.))) ;
(particleMass+delta*(dnstar*sqrte-2.))) ;
if(fn <0.) fn = 0. ;
// electron contribution logarithm
G4double epmax1=E/(1.+0.5*ParticleMass*rmass/E) ;
G4double epmax1=E/(1.+0.5*particleMass*rmass/E) ;
G4double fe=0.;
if(GammaEnergy<epmax1)
{
G4double rab2=b1*z13*z13 ;
fe=log(rab2*ParticleMass/((1.+delta*rmass/(electron_mass_c2*sqrte))*
fe=log(rab2*particleMass/((1.+delta*rmass/(electron_mass_c2*sqrte))*
(electron_mass_c2+rab0*rab2))) ;
if(fe<0.) fe=0. ;
}
@@ -404,6 +457,8 @@ G4double G4MuBremsstrahlung::ComputeDMicroscopicCrossSection(
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4MuBremsstrahlung::MakeSamplingTables(
const G4ParticleDefinition* ParticleType)
{
@@ -411,7 +466,7 @@ void G4MuBremsstrahlung::MakeSamplingTables(
G4double AtomicNumber,AtomicWeight,KineticEnergy,
TotalEnergy,Maxep ;
ParticleMass = ParticleType->GetPDGMass() ;
G4double particleMass = ParticleType->GetPDGMass() ;
for (G4int iz=0; iz<nzdat; iz++)
{
@@ -421,7 +476,7 @@ void G4MuBremsstrahlung::MakeSamplingTables(
for (G4int it=0; it<ntdat; it++)
{
KineticEnergy = tdat[it];
TotalEnergy = KineticEnergy + ParticleMass;
TotalEnergy = KineticEnergy + particleMass;
Maxep = KineticEnergy ;
G4double CrossSection = 0.0 ;
@@ -473,6 +528,7 @@ void G4MuBremsstrahlung::MakeSamplingTables(
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VParticleChange* G4MuBremsstrahlung::PostStepDoIt(const G4Track& trackData,
@@ -493,7 +549,7 @@ G4VParticleChange* G4MuBremsstrahlung::PostStepDoIt(const G4Track& trackData,
// Gamma cut in this material
G4double GammaEnergyCut =
(G4Gamma::Gamma()->GetCutsInEnergy())[aMaterial->GetIndex()];
G4Gamma::Gamma()->GetEnergyThreshold(aMaterial);
// check against insufficient energy
if(KineticEnergy < GammaEnergyCut)
@@ -610,6 +666,8 @@ G4VParticleChange* G4MuBremsstrahlung::PostStepDoIt(const G4Track& trackData,
return G4VContinuousDiscreteProcess::PostStepDoIt(trackData,stepData);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4Element* G4MuBremsstrahlung::SelectRandomAtom(G4Material* aMaterial) const
{
// select randomly 1 element within the material
@@ -618,14 +676,127 @@ G4Element* G4MuBremsstrahlung::SelectRandomAtom(G4Material* aMaterial) const
const G4int NumberOfElements = aMaterial->GetNumberOfElements();
const G4ElementVector* theElementVector = aMaterial->GetElementVector();
G4double rval = G4UniformRand()*((*PartialSumSigma[Index])[NumberOfElements-1]);
G4double rval = G4UniformRand()
*((*PartialSumSigma[Index])[NumberOfElements-1]);
for ( G4int i=0; i < NumberOfElements; i++ )
if (rval <= (*PartialSumSigma[Index])[i]) return ((*theElementVector)(i));
if (rval <= (*PartialSumSigma[Index])[i]) return ((*theElementVector)[i]);
G4cout << " WARNING !!! - The Material " << aMaterial->GetName()
<< " has no elements, NULL pointer returned." << G4endl;
return NULL;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4bool G4MuBremsstrahlung::StorePhysicsTable(G4ParticleDefinition* particle,
const G4String& directory,
G4bool ascii)
{
G4String filename;
// store stopping power table
filename = GetPhysicsTableFileName(particle,directory,"StoppingPower",ascii);
if ( !theLossTable->StorePhysicsTable(filename, ascii) ){
G4cout << " FAIL theLossTable->StorePhysicsTable in " << filename
<< G4endl;
return false;
}
// store mean free path table
filename = GetPhysicsTableFileName(particle,directory,"MeanFreePath",ascii);
if ( !theMeanFreePathTable->StorePhysicsTable(filename, ascii) ){
G4cout << " FAIL theMeanFreePathTable->StorePhysicsTable in " << filename
<< G4endl;
return false;
}
// store PartialSumSigma table (G4OrderedTable)
filename = GetPhysicsTableFileName(particle,directory,"PartSumSigma",ascii);
if ( !PartialSumSigma.Store(filename, ascii) ){
G4cout << " FAIL PartialSumSigma.store 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 G4MuBremsstrahlung::RetrievePhysicsTable(G4ParticleDefinition* particle,
const G4String& directory,
G4bool ascii)
{
// delete theLossTable and theMeanFreePathTable
if (theLossTable != 0) {
theLossTable->clearAndDestroy();
delete theLossTable;
}
if (theMeanFreePathTable != 0) {
theMeanFreePathTable->clearAndDestroy();
delete theMeanFreePathTable;
}
if (&PartialSumSigma != 0) PartialSumSigma.clear();
// get bining from EnergyLoss
LowestKineticEnergy = GetLowerBoundEloss();
HighestKineticEnergy = GetUpperBoundEloss();
TotBin = GetNbinEloss();
G4String filename;
// retreive stopping power table
filename = GetPhysicsTableFileName(particle,directory,"StoppingPower",ascii);
theLossTable = new G4PhysicsTable(G4Material::GetNumberOfMaterials());
if ( !theLossTable->RetrievePhysicsTable(filename, ascii) ){
G4cout << " FAIL theLossTable->RetrievePhysicsTable in " << filename
<< G4endl;
return false;
}
// retreive mean free path table
filename = GetPhysicsTableFileName(particle,directory,"MeanFreePath",ascii);
theMeanFreePathTable = new G4PhysicsTable(G4Material::GetNumberOfMaterials());
if ( !theMeanFreePathTable->RetrievePhysicsTable(filename, ascii) ){
G4cout << " FAIL theMeanFreePathTable->RetrievePhysicsTable in " << filename
<< G4endl;
return false;
}
// retrieve PartialSumSigma table (G4OrderedTable)
filename = GetPhysicsTableFileName(particle,directory,"PartSumSigma",ascii);
if ( !PartialSumSigma.Retrieve(filename, ascii) ){
G4cout << " FAIL PartialSumSigma.retrieve in " << filename
<< G4endl;
return false;
}
G4cout << GetProcessName() << " for " << particle->GetParticleName()
<< ": Success to retrieve the PhysicsTables from "
<< directory << G4endl;
if (particle->GetPDGCharge() < 0.)
{
RecorderOfmuminusProcess[CounterOfmuminusProcess] = (*this).theLossTable;
CounterOfmuminusProcess++;
}
else
{
RecorderOfmuplusProcess[CounterOfmuplusProcess] = (*this).theLossTable;
CounterOfmuplusProcess++;
}
MakeSamplingTables(particle);
G4VMuEnergyLoss::BuildDEDXTable(*particle);
return true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4MuBremsstrahlung::PrintInfoDefinition()
{
G4String comments = "theoretical cross section \n ";
@@ -638,3 +809,5 @@ void G4MuBremsstrahlung::PrintInfoDefinition()
<< " in " << NbinLambda << " bins. \n";
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
File diff suppressed because it is too large Load Diff
@@ -21,51 +21,57 @@
// ********************************************************************
//
//
// $Id: G4MuPairProduction.cc,v 1.17.2.2 2001/06/28 20:19:45 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4MuPairProduction.cc,v 1.26 2001/11/09 13:52:32 maire Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
// --------------------------------------------------------------
// GEANT 4 class implementation file
//
// History: first implementation, based on object model of
// 2nd December 1995, G.Cosmo
// -------- G4MuPairProduction physics process ---------
//--------------- G4MuPairProduction physics process ---------------------------
// by Laszlo Urban, May 1998
// **************************************************************
// 04-06-98, in DoIt,secondary production condition:range>G4std::min(threshold,safety)
// 26/10/98, new stuff from R. Kokoulin + cleanup , L.Urban
// 06/05/99 , bug fixed , L.Urban
// 10/02/00 modifications+bug fix , new e.m. structure, L.Urban
// 29/05/01 V.Ivanchenko minor changes to provide ANSI -wall compilation
// --------------------------------------------------------------
//------------------------------------------------------------------------------
// 04-06-98 in DoIt,secondary production condition:
// range>G4std::min(threshold,safety)
// 26/10/98 new stuff from R. Kokoulin + cleanup , L.Urban
// 06/05/99 bug fixed , L.Urban
// 10/02/00 modifications+bug fix , new e.m. structure, L.Urban
// 29/05/01 V.Ivanchenko minor changes to provide ANSI -wall compilation
// 10-08-01 new methods Store/Retrieve PhysicsTable (mma)
// 17-09-01 migration of Materials to pure STL (mma)
// 20-09-01 (L.Urban) in ComputeMicroscopicCrossSection, remove:
// if(MaxPairEnergy<CutInPairEnergy) MaxPairEnergy=CutInPairEnergy
// 26-09-01 completion of store/retrieve PhysicsTable
// 28-09-01 suppression of theMuonPlus ..etc..data members (mma)
// 29-10-01 all static functions no more inlined (mma)
// 07-11-01 particleMass becomes a local variable (mma)
//------------------------------------------------------------------------------
#include "G4MuPairProduction.hh"
#include "G4EnergyLossTables.hh"
#include "G4UnitsTable.hh"
// static members ........
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
// static members
G4int G4MuPairProduction::nzdat = 5 ;
G4int G4MuPairProduction::nzdat = 5 ;
G4double G4MuPairProduction::zdat[]={1.,4.,13.,26.,92.};
G4int G4MuPairProduction::ntdat = 8 ;
G4int G4MuPairProduction::ntdat = 8 ;
G4double G4MuPairProduction::tdat[]={1.e3,1.e4,1.e5,1.e6,1.e7,1.e8,1.e9,1.e10};
G4int G4MuPairProduction::NBIN = 1000 ; //100 ;
//G4double G4MuPairProduction::ya[1001]={0.};
//G4double G4MuPairProduction::proba[5][8][1001]={0.};
G4int G4MuPairProduction::NBIN = 1000 ; //100 ;
G4double G4MuPairProduction::ya[1001];
G4double G4MuPairProduction::proba[5][8][1001];
G4double G4MuPairProduction::MinPairEnergy = 4.*electron_mass_c2 ;
G4double G4MuPairProduction::MinPairEnergy = 4.*electron_mass_c2;
G4double G4MuPairProduction::LowerBoundLambda = 1.*keV ;
G4double G4MuPairProduction::UpperBoundLambda = 1000000.*TeV ;
G4int G4MuPairProduction::NbinLambda = 150 ;
G4double G4MuPairProduction::LowerBoundLambda = 1.*keV;
G4double G4MuPairProduction::UpperBoundLambda = 1000000.*TeV;
G4int G4MuPairProduction::NbinLambda = 150;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4MuPairProduction::G4MuPairProduction(const G4String& processName)
: G4VMuEnergyLoss(processName),
theMeanFreePathTable(NULL)
{ }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4MuPairProduction::~G4MuPairProduction()
{
@@ -79,6 +85,38 @@ G4MuPairProduction::~G4MuPairProduction()
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4MuPairProduction::SetLowerBoundLambda(G4double val)
{LowerBoundLambda = val;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4MuPairProduction::SetUpperBoundLambda(G4double val)
{UpperBoundLambda = val;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4MuPairProduction::SetNbinLambda(G4int n)
{NbinLambda = n;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4MuPairProduction::GetLowerBoundLambda()
{ return LowerBoundLambda;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4MuPairProduction::GetUpperBoundLambda()
{ return UpperBoundLambda;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4int G4MuPairProduction::GetNbinLambda()
{return NbinLambda;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4MuPairProduction::BuildPhysicsTable(
const G4ParticleDefinition& aParticleType)
// just call BuildLossTable+BuildLambdaTable
@@ -91,7 +129,7 @@ void G4MuPairProduction::BuildPhysicsTable(
BuildLossTable(aParticleType) ;
if(&aParticleType==theMuonMinus)
if(&aParticleType==G4MuonMinus::MuonMinus())
{
RecorderOfmuminusProcess[CounterOfmuminusProcess] = (*this).theLossTable ;
CounterOfmuminusProcess++;
@@ -104,18 +142,19 @@ void G4MuPairProduction::BuildPhysicsTable(
// sampling table should be made only once !
if(theMeanFreePathTable == NULL)
MakeSamplingTables(&aParticleType) ;
MakeSamplingTables(&aParticleType);
G4double electronCutInRange = G4Electron::Electron()->GetCuts();
if(electronCutInRange != lastelectronCutInRange)
G4double* electronCutInRange = G4Electron::Electron()->GetLengthCuts();
if( !EqualCutVectors(electronCutInRange, lastelectronCutInRange))
BuildLambdaTable(aParticleType) ;
G4VMuEnergyLoss::BuildDEDXTable(aParticleType) ;
G4VMuEnergyLoss::BuildDEDXTable(aParticleType);
if(&aParticleType==theMuonPlus)
PrintInfoDefinition() ;
if(&aParticleType==G4MuonPlus::MuonPlus()) PrintInfoDefinition();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4MuPairProduction::BuildLossTable(
const G4ParticleDefinition& aParticleType)
{
@@ -124,11 +163,11 @@ void G4MuPairProduction::BuildLossTable(
const G4MaterialTable* theMaterialTable =
G4Material::GetMaterialTable();
ParticleMass = aParticleType.GetPDGMass() ;
ElectronCutInKineticEnergy = (*theElectron).GetEnergyCuts() ;
PositronCutInKineticEnergy = (*thePositron).GetEnergyCuts() ;
G4double particleMass = aParticleType.GetPDGMass();
ElectronCutInKineticEnergy = G4Electron::Electron()->GetEnergyCuts();
PositronCutInKineticEnergy = G4Positron::Positron()->GetEnergyCuts();
G4int numOfMaterials = theMaterialTable->length() ;
G4int numOfMaterials = G4Material::GetNumberOfMaterials();
if (theLossTable) {
theLossTable->clearAndDestroy();
@@ -154,7 +193,7 @@ void G4MuPairProduction::BuildLossTable(
for (G4int i=0; i<TotBin; i++)
{
KineticEnergy = aVector->GetLowEdgeEnergy(i) ;
TotalEnergy = KineticEnergy+ParticleMass ;
TotalEnergy = KineticEnergy+particleMass ;
eCut = ElectronCutInKineticEnergyNow ;
pCut = PositronCutInKineticEnergyNow ;
@@ -166,7 +205,7 @@ void G4MuPairProduction::BuildLossTable(
pairloss = 0.;
for (G4int iel=0; iel<NumberOfElements; iel++)
{
Z=(*theElementVector)(iel)->GetZ();
Z=(*theElementVector)[iel]->GetZ();
natom = theAtomicNumDensityVector[iel] ;
loss = ComputePairLoss(&aParticleType,
Z,KineticEnergy,eCut,pCut) ;
@@ -181,6 +220,8 @@ void G4MuPairProduction::BuildLossTable(
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4MuPairProduction::ComputePairLoss(
const G4ParticleDefinition* ParticleType,
G4double AtomicNumber,
@@ -204,8 +245,9 @@ G4double G4MuPairProduction::ComputePairLoss(
G4double CutInPairEnergy = ElectronEnergyCut+PositronEnergyCut
+2.*electron_mass_c2 ;
if( CutInPairEnergy <= MinPairEnergy ) return loss ;
G4double MaxPairEnergy = KineticEnergy+ParticleMass*(1.-0.75*sqrte*z13) ;
G4double particleMass = ParticleType->GetPDGMass();
G4double MaxPairEnergy = KineticEnergy+particleMass*(1.-0.75*sqrte*z13) ;
if(MaxPairEnergy < MinPairEnergy)
MaxPairEnergy = MinPairEnergy ;
@@ -239,7 +281,8 @@ G4double G4MuPairProduction::ComputePairLoss(
if (loss < 0.) loss = 0.;
return loss ;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4MuPairProduction::BuildLambdaTable(
const G4ParticleDefinition& ParticleType)
@@ -282,6 +325,8 @@ void G4MuPairProduction::BuildLambdaTable(
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4MuPairProduction::ComputePartialSumSigma(
const G4ParticleDefinition* ParticleType,
G4double KineticEnergy,
@@ -292,8 +337,8 @@ void G4MuPairProduction::ComputePartialSumSigma(
const G4ElementVector* theElementVector = aMaterial->GetElementVector();
const G4double* theAtomNumDensityVector = aMaterial->
GetAtomicNumDensityVector();
G4double ElectronEnergyCut = (G4Electron::GetCutsInEnergy())[Imate];
G4double PositronEnergyCut = (G4Positron::GetCutsInEnergy())[Imate];
G4double ElectronEnergyCut = (G4Electron::Electron()->GetEnergyCuts())[Imate];
G4double PositronEnergyCut = (G4Positron::Positron()->GetEnergyCuts())[Imate];
PartialSumSigma[Imate] = new G4DataVector();
@@ -303,13 +348,15 @@ void G4MuPairProduction::ComputePartialSumSigma(
{
SIGMA += theAtomNumDensityVector[Ielem] *
ComputeMicroscopicCrossSection( ParticleType, KineticEnergy,
(*theElementVector)(Ielem)->GetZ(),
(*theElementVector)[Ielem]->GetZ(),
ElectronEnergyCut,PositronEnergyCut );
PartialSumSigma[Imate]->push_back(SIGMA);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4MuPairProduction::ComputeMicroscopicCrossSection(
const G4ParticleDefinition* ParticleType,
G4double KineticEnergy,
@@ -337,10 +384,9 @@ G4double G4MuPairProduction::ComputeMicroscopicCrossSection(
if( CutInPairEnergy < 4.*electron_mass_c2 )
CutInPairEnergy = 4.*electron_mass_c2 ;
G4double MaxPairEnergy = KineticEnergy+ParticleMass*(1.-0.75*sqrte*z13) ;
if(MaxPairEnergy < CutInPairEnergy)
MaxPairEnergy = CutInPairEnergy ;
G4double particleMass = ParticleType->GetPDGMass();
G4double MaxPairEnergy = KineticEnergy+particleMass*(1.-0.75*sqrte*z13) ;
if( CutInPairEnergy >= MaxPairEnergy ) return CrossSection ;
G4double aaa,bbb,hhh,x,epln,ep ;
@@ -370,6 +416,8 @@ G4double G4MuPairProduction::ComputeMicroscopicCrossSection(
return CrossSection;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4MuPairProduction::MakeSamplingTables(
const G4ParticleDefinition* ParticleType)
{
@@ -378,6 +426,7 @@ void G4MuPairProduction::MakeSamplingTables(
G4double c,y,ymin,ymax,dy,yy,dx,x,ep ;
static const G4double sqrte = sqrt(exp(1.)) ;
G4double particleMass = ParticleType->GetPDGMass();
for (G4int iz=0; iz<nzdat; iz++)
{
@@ -387,7 +436,7 @@ void G4MuPairProduction::MakeSamplingTables(
for (G4int it=0; it<ntdat; it++)
{
KineticEnergy = tdat[it];
G4double MaxPairEnergy = KineticEnergy+ParticleMass*(1.-0.75*sqrte*z13) ;
G4double MaxPairEnergy = KineticEnergy+particleMass*(1.-0.75*sqrte*z13) ;
G4double CrossSection = 0.0 ;
@@ -429,7 +478,8 @@ void G4MuPairProduction::MakeSamplingTables(
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4MuPairProduction::ComputeDDMicroscopicCrossSection(
const G4ParticleDefinition* ParticleType,
@@ -446,15 +496,16 @@ G4double G4MuPairProduction::ComputeDDMicroscopicCrossSection(
G4double g2tf = 5.3e-5 ;
G4double g1h = 4.4e-5 ;
G4double g2h = 4.8e-5 ;
G4double massratio = ParticleMass/electron_mass_c2 ;
G4double particleMass = ParticleType->GetPDGMass();
G4double massratio = particleMass/electron_mass_c2 ;
G4double massratio2 = massratio*massratio ;
G4double TotalEnergy = KineticEnergy + ParticleMass ;
G4double TotalEnergy = KineticEnergy + particleMass ;
G4double z13 = exp(log(AtomicNumber)/3.) ;
G4double z23 = z13*z13 ;
G4double EnergyLoss = TotalEnergy - PairEnergy ;
G4double c3 = 3.*sqrte*ParticleMass/4. ;
G4double c3 = 3.*sqrte*particleMass/4. ;
G4double DDCrossSection = 0. ;
@@ -462,7 +513,7 @@ G4double G4MuPairProduction::ComputeDDMicroscopicCrossSection(
return DDCrossSection ;
G4double c7 = 4.*electron_mass_c2 ;
G4double c8 = 6.*ParticleMass*ParticleMass ;
G4double c8 = 6.*particleMass*particleMass ;
G4double alf = c7/PairEnergy ;
G4double a3 = 1. - alf ;
@@ -483,10 +534,10 @@ G4double G4MuPairProduction::ComputeDDMicroscopicCrossSection(
g1 = g1tf ;
g2 = g2tf ;
}
zeta1 = 0.073 * log(TotalEnergy/(ParticleMass+g1*z23*TotalEnergy))-0.26 ;
zeta1 = 0.073 * log(TotalEnergy/(particleMass+g1*z23*TotalEnergy))-0.26 ;
if( zeta1 > 0.)
{
zeta2 = 0.058*log(TotalEnergy/(ParticleMass+g2*z13*TotalEnergy))-0.14 ;
zeta2 = 0.058*log(TotalEnergy/(particleMass+g2*z13*TotalEnergy))-0.14 ;
zeta = zeta1/zeta2 ;
}
else
@@ -560,6 +611,8 @@ G4double G4MuPairProduction::ComputeDDMicroscopicCrossSection(
return DDCrossSection ;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4MuPairProduction::GetDMicroscopicCrossSection(
const G4ParticleDefinition* ParticleType,
@@ -569,7 +622,9 @@ G4double G4MuPairProduction::GetDMicroscopicCrossSection(
return ComputeDMicroscopicCrossSection(ParticleType,KineticEnergy,
AtomicNumber,PairEnergy) ;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4MuPairProduction::ComputeDMicroscopicCrossSection(
const G4ParticleDefinition* ParticleType,
G4double KineticEnergy, G4double AtomicNumber,
@@ -586,9 +641,10 @@ G4double G4MuPairProduction::ComputeDMicroscopicCrossSection(
G4double DCrossSection = 0. ;
G4double TotalEnergy = KineticEnergy + ParticleMass ;
G4double particleMass = ParticleType->GetPDGMass();
G4double TotalEnergy = KineticEnergy + particleMass;
G4double EnergyLoss = TotalEnergy - PairEnergy ;
G4double a = 6.*ParticleMass*ParticleMass/(TotalEnergy*EnergyLoss) ;
G4double a = 6.*particleMass*particleMass/(TotalEnergy*EnergyLoss) ;
G4double b = 4.*electron_mass_c2/PairEnergy ;
if((b+2.*a*(1.-b))/(1.+(1.-a)*sqrt(1.-b)) <= 0.) return DCrossSection ;
@@ -613,7 +669,9 @@ G4double G4MuPairProduction::ComputeDMicroscopicCrossSection(
return DCrossSection ;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VParticleChange* G4MuPairProduction::PostStepDoIt(const G4Track& trackData,
const G4Step& stepData)
{
@@ -622,15 +680,16 @@ G4VParticleChange* G4MuPairProduction::PostStepDoIt(const G4Track& trackData,
aParticleChange.Initialize(trackData);
G4Material* aMaterial=trackData.GetMaterial() ;
const G4DynamicParticle* aDynamicParticle=trackData.GetDynamicParticle();
G4double KineticEnergy = aDynamicParticle->GetKineticEnergy();
G4double KineticEnergy = aDynamicParticle->GetKineticEnergy();
G4double particleMass = aDynamicParticle->GetDefinition()->GetPDGMass();
G4ParticleMomentum ParticleDirection =
aDynamicParticle->GetMomentumDirection();
// e-e+ cut in this material
G4double ElectronEnergyCut = electron_mass_c2+
((*G4Electron::Electron()).GetCutsInEnergy())[aMaterial->GetIndex()];
G4Electron::Electron()->GetEnergyThreshold(aMaterial);
G4double PositronEnergyCut = electron_mass_c2+
((*G4Positron::Positron()).GetCutsInEnergy())[aMaterial->GetIndex()];
G4Positron::Positron()->GetEnergyThreshold(aMaterial);
G4double CutInPairEnergy = ElectronEnergyCut + PositronEnergyCut ;
if (CutInPairEnergy < MinPairEnergy) CutInPairEnergy = MinPairEnergy ;
@@ -643,10 +702,10 @@ G4VParticleChange* G4MuPairProduction::PostStepDoIt(const G4Track& trackData,
G4Element* anElement = SelectRandomAtom(aMaterial);
// limits of the energy sampling
G4double TotalEnergy = KineticEnergy + ParticleMass ;
//G4double TotalMomentum = sqrt(KineticEnergy*(TotalEnergy+ParticleMass)) ;
G4double TotalEnergy = KineticEnergy + particleMass ;
//G4double TotalMomentum = sqrt(KineticEnergy*(TotalEnergy+particleMass)) ;
G4double Z3 = anElement->GetIonisation()->GetZ3() ;
G4double MaxPairEnergy = TotalEnergy-0.75*esq*ParticleMass*Z3 ;
G4double MaxPairEnergy = TotalEnergy-0.75*esq*particleMass*Z3 ;
if(MinPairEnergy >= MaxPairEnergy)
return G4VContinuousDiscreteProcess::PostStepDoIt(trackData,stepData);
@@ -716,7 +775,7 @@ G4VParticleChange* G4MuPairProduction::PostStepDoIt(const G4Track& trackData,
PairEnergy = MinPairEnergy*exp(x*log(MaxPairEnergy/MinPairEnergy)) ;
// sample r=(E+-E-)/PairEnergy ( uniformly .....)
G4double rmax = (1.-6.*ParticleMass*ParticleMass/(TotalEnergy*
G4double rmax = (1.-6.*particleMass*particleMass/(TotalEnergy*
(TotalEnergy-PairEnergy)))
*sqrt(1.-MinPairEnergy/PairEnergy) ;
r = rmax * (-1.+2.*G4UniformRand()) ;
@@ -791,7 +850,7 @@ G4VParticleChange* G4MuPairProduction::PostStepDoIt(const G4Track& trackData,
aParticleChange.AddSecondary( aParticle2 ) ;
G4double NewKinEnergy = KineticEnergy - ElectronEnergy - PositronEnergy ;
//G4double finalMomentum=sqrt(NewKinEnergy*(NewKinEnergy+2.*ParticleMass));
//G4double finalMomentum=sqrt(NewKinEnergy*(NewKinEnergy+2.*particleMass));
aParticleChange.SetMomentumChange( ParticleDirection );
@@ -814,6 +873,8 @@ G4VParticleChange* G4MuPairProduction::PostStepDoIt(const G4Track& trackData,
return G4VContinuousDiscreteProcess::PostStepDoIt(trackData,stepData);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4Element* G4MuPairProduction::SelectRandomAtom(G4Material* aMaterial) const
{
// select randomly 1 element within the material
@@ -827,12 +888,124 @@ G4Element* G4MuPairProduction::SelectRandomAtom(G4Material* aMaterial) const
for ( G4int i=0; i < NumberOfElements; i++ )
{
if (rval <= (*PartialSumSigma[Index])[i]) return ((*theElementVector)(i));
if (rval <= (*PartialSumSigma[Index])[i]) return ((*theElementVector)[i]);
}
G4cout << " WARNING !!! - The Material '"<< aMaterial->GetName()
<< "' has no elements, NULL pointer returned." << G4endl;
return NULL;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4bool G4MuPairProduction::StorePhysicsTable(G4ParticleDefinition* particle,
const G4String& directory,
G4bool ascii)
{
G4String filename;
// store stopping power table
filename = GetPhysicsTableFileName(particle,directory,"StoppingPower",ascii);
if ( !theLossTable->StorePhysicsTable(filename, ascii) ){
G4cout << " FAIL theLossTable->StorePhysicsTable in " << filename
<< G4endl;
return false;
}
// store mean free path table
filename = GetPhysicsTableFileName(particle,directory,"MeanFreePath",ascii);
if ( !theMeanFreePathTable->StorePhysicsTable(filename, ascii) ){
G4cout << " FAIL theMeanFreePathTable->StorePhysicsTable in " << filename
<< G4endl;
return false;
}
// store PartialSumSigma table (G4OrderedTable)
filename = GetPhysicsTableFileName(particle,directory,"PartSumSigma",ascii);
if ( !PartialSumSigma.Store(filename, ascii) ){
G4cout << " FAIL PartialSumSigma.store 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 G4MuPairProduction::RetrievePhysicsTable(G4ParticleDefinition* particle,
const G4String& directory,
G4bool ascii)
{
// delete theLossTable and theMeanFreePathTable
if (theLossTable != 0) {
theLossTable->clearAndDestroy();
delete theLossTable;
}
if (theMeanFreePathTable != 0) {
theMeanFreePathTable->clearAndDestroy();
delete theMeanFreePathTable;
}
if (&PartialSumSigma != 0) PartialSumSigma.clear();
// get bining from EnergyLoss
LowestKineticEnergy = GetLowerBoundEloss();
HighestKineticEnergy = GetUpperBoundEloss();
TotBin = GetNbinEloss();
G4String filename;
// retreive stopping power table
filename = GetPhysicsTableFileName(particle,directory,"StoppingPower",ascii);
theLossTable = new G4PhysicsTable(G4Material::GetNumberOfMaterials());
if ( !theLossTable->RetrievePhysicsTable(filename, ascii) ){
G4cout << " FAIL theLossTable0->RetrievePhysicsTable in " << filename
<< G4endl;
return false;
}
// retreive mean free path table
filename = GetPhysicsTableFileName(particle,directory,"MeanFreePath",ascii);
theMeanFreePathTable = new G4PhysicsTable(G4Material::GetNumberOfMaterials());
if ( !theMeanFreePathTable->RetrievePhysicsTable(filename, ascii) ){
G4cout << " FAIL theMeanFreePathTable->RetrievePhysicsTable in " << filename
<< G4endl;
return false;
}
// retrieve PartialSumSigma table (G4OrderedTable)
filename = GetPhysicsTableFileName(particle,directory,"PartSumSigma",ascii);
if ( !PartialSumSigma.Retrieve(filename, ascii) ){
G4cout << " FAIL PartialSumSigma.retrieve in " << filename
<< G4endl;
return false;
}
G4cout << GetProcessName() << "for " << particle->GetParticleName()
<< ": Success to retrieve the PhysicsTables from "
<< directory << G4endl;
if (particle->GetPDGCharge() < 0.)
{
RecorderOfmuminusProcess[CounterOfmuminusProcess] = (*this).theLossTable;
CounterOfmuminusProcess++;
}
else
{
RecorderOfmuplusProcess[CounterOfmuplusProcess] = (*this).theLossTable;
CounterOfmuplusProcess++;
}
MakeSamplingTables(particle);
G4VMuEnergyLoss::BuildDEDXTable(*particle);
return true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4MuPairProduction::PrintInfoDefinition()
{
G4String comments = "theoretical cross sections \n ";
@@ -845,4 +1018,5 @@ void G4MuPairProduction::PrintInfoDefinition()
<< " in " << NbinLambda << " bins. \n";
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4VMuEnergyLoss.cc,v 1.9.2.2 2001/06/28 20:19:45 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4VMuEnergyLoss.cc,v 1.19 2001/11/08 15:31:06 radoone Exp $
// GEANT4 tag $Name: geant4-04-00 $
// --------------------------------------------------------------
// GEANT 4 class implementation file
//
@@ -40,12 +40,20 @@
// corrections due to new e.m. structure L.Urban 10/02/00
// signature in GetLossWithFluct changed L.Urban 30/10/00
// 29/05/01 V.Ivanchenko minor changes to provide ANSI -wall compilation
// 10/09/01 L.Urban : loss+ mechanism (subcutoff delta rays) implemented
// 12/09/01 min.delta cut is set as rcut/100 + some optimisation, L.Urban
// 17-09-01 migration of Materials to pure STL (mma)
// 28-09-01 suppression of theMuonPlus ..etc..data members (mma)
// 29-10-01 all static functions no more inlined (mma)
// 08-11-01 some small cosmetics , L.Urban
// --------------------------------------------------------------
#include "G4VMuEnergyLoss.hh"
#include "G4EnergyLossTables.hh"
#include "G4Poisson.hh"
#include "G4Navigator.hh"
#include "G4TransportationManager.hh"
// Initialisation of static members *******************************************
@@ -82,6 +90,10 @@ G4double G4VMuEnergyLoss::UpperBoundEloss = 1000000.*TeV ;
G4int G4VMuEnergyLoss::NbinEloss = 150 ;
G4double G4VMuEnergyLoss::RTable,G4VMuEnergyLoss::LOGRTable;
G4double G4VMuEnergyLoss::cN = 0.077*MeV*cm2/g ;
G4int G4VMuEnergyLoss::Ndeltamax = 100 ;
G4EnergyLossMessenger* G4VMuEnergyLoss::eLossMessenger = 0 ;
// constructor and destructor
@@ -89,12 +101,8 @@ G4EnergyLossMessenger* G4VMuEnergyLoss::eLossMessenger = 0 ;
G4VMuEnergyLoss::G4VMuEnergyLoss(const G4String& processName)
: G4VEnergyLoss (processName),
theLossTable(0),
lastgammaCutInRange(0.),
lastelectronCutInRange(0.),
theElectron ( G4Electron::Electron() ),
thePositron ( G4Positron::Positron() ),
theMuonPlus ( G4MuonPlus::MuonPlus() ),
theMuonMinus ( G4MuonMinus::MuonMinus() ),
lastgammaCutInRange(0),
lastelectronCutInRange(0),
theRangeCoeffATable(0),
theRangeCoeffBTable(0),
theRangeCoeffCTable(0)
@@ -109,8 +117,29 @@ G4VMuEnergyLoss::~G4VMuEnergyLoss()
}
}
void G4VMuEnergyLoss::SetNbOfProcesses(G4int nb) {NbOfProcesses=nb;}
// Sets number of processes giving contribution to the energy loss
void G4VMuEnergyLoss::PlusNbOfProcesses() {NbOfProcesses++ ;}
// Increases number of processes giving contribution to the energy loss
void G4VMuEnergyLoss::MinusNbOfProcesses() {NbOfProcesses-- ;}
// Decreases number of processes giving contribution to the energy loss
G4int G4VMuEnergyLoss::GetNbOfProcesses() {return NbOfProcesses;}
// Gets number of processes giving contribution to the energy loss
// ( default value = 3)
void G4VMuEnergyLoss::SetLowerBoundEloss(G4double val) {LowerBoundEloss=val;}
void G4VMuEnergyLoss::SetUpperBoundEloss(G4double val) {UpperBoundEloss=val;}
void G4VMuEnergyLoss::SetNbinEloss(G4int nb) {NbinEloss=nb;}
G4double G4VMuEnergyLoss::GetLowerBoundEloss() {return LowerBoundEloss;}
G4double G4VMuEnergyLoss::GetUpperBoundEloss() {return UpperBoundEloss;}
G4int G4VMuEnergyLoss::GetNbinEloss() {return NbinEloss;}
void G4VMuEnergyLoss::BuildDEDXTable(
void G4VMuEnergyLoss::BuildDEDXTable(
const G4ParticleDefinition& aParticleType)
{
@@ -121,8 +150,10 @@ G4VMuEnergyLoss::~G4VMuEnergyLoss()
//set physically consistent value for finalRange
// and parameters for en.loss step limit
if(finalRange > G4Electron::Electron()->GetCuts())
finalRange = G4Electron::Electron()->GetCuts() ;
for (size_t idxMate=0; idxMate<G4Material::GetNumberOfMaterials(); idxMate++){
if(finalRange > (G4Electron::Electron()->GetLengthCuts())[idxMate])
finalRange = (G4Electron::Electron()->GetLengthCuts())[idxMate];
}
c1lim = dRoverRange ;
c2lim = 2.*(1.-dRoverRange)*finalRange ;
c3lim = -(1.-dRoverRange)*finalRange*finalRange;
@@ -130,32 +161,35 @@ G4VMuEnergyLoss::~G4VMuEnergyLoss()
G4bool MakeTable ;
ParticleMass = aParticleType.GetPDGMass() ;
G4double Charge = aParticleType.GetPDGCharge()/eplus ;
G4double gammaCutInRange = G4Gamma::Gamma()->GetCuts();
G4double electronCutInRange = G4Electron::Electron()->GetCuts();
G4double* gammaCutInRange = G4Gamma::Gamma()->GetLengthCuts();
G4double* electronCutInRange = G4Electron::Electron()->GetLengthCuts();
MakeTable = false ;
// Create tables only if there are new cut values
if((gammaCutInRange == lastgammaCutInRange) &&
(electronCutInRange == lastelectronCutInRange))
if(EqualCutVectors(gammaCutInRange,lastgammaCutInRange) &&
EqualCutVectors(electronCutInRange,lastelectronCutInRange))
{
;
}
else
{
lastgammaCutInRange = CopyCutVectors(lastgammaCutInRange,gammaCutInRange);
lastelectronCutInRange = CopyCutVectors(lastelectronCutInRange,electronCutInRange);
if((Charge > 0.)&&(CounterOfmuplusProcess==NbOfProcesses))
MakeTable = true ;
if((Charge < 0.)&&(CounterOfmuminusProcess==NbOfProcesses))
MakeTable = true ;
}
const G4MaterialTable* theMaterialTable=
G4Material::GetMaterialTable();
G4int numOfMaterials = G4Material::GetNumberOfMaterials();
if( MakeTable )
{
// Build energy loss table as a sum of the energy loss due to the
// different processes.
const G4MaterialTable* theMaterialTable=
G4Material::GetMaterialTable();
G4int numOfMaterials = theMaterialTable->length();
if( Charge >0.)
{
@@ -309,8 +343,55 @@ G4VMuEnergyLoss::~G4VMuEnergyLoss()
(Charge > 0)? theProperTimemuplusTable: theProperTimemuminusTable,
LowerBoundEloss, UpperBoundEloss, 1.,NbinEloss);
lastgammaCutInRange = gammaCutInRange ;
lastelectronCutInRange = electronCutInRange ;
// create array for the min. delta cuts in kinetic energy
if(!setMinDeltaCutInRange) {
MinDeltaCutInRange = (G4Electron::Electron()->GetLengthCuts())[0];
for (size_t idxMate=1; idxMate<G4Material::GetNumberOfMaterials(); idxMate++){
if(MinDeltaCutInRange > (G4Electron::Electron()->GetLengthCuts())[idxMate])
MinDeltaCutInRange = (G4Electron::Electron()->GetLengthCuts())[idxMate];
}
MinDeltaCutInRange *= 0.01;
}
// if((subSecFlag) && (aParticleType.GetParticleName()=="mu+"))
// {
// G4cout << G4endl;
// G4cout.precision(5) ;
// G4cout << " hIoni Minimum Delta cut in range=" << MinDeltaCutInRange/mm
// << " mm." << G4endl;
// G4cout << G4endl;
// G4cout << " material min.delta energy(keV) " << G4endl;
// G4cout << G4endl;
// }
if(MinDeltaEnergy) {delete [] MinDeltaEnergy; MinDeltaEnergy=0;}
MinDeltaEnergy = new G4double [numOfMaterials];
if(LowerLimitForced) {delete [] LowerLimitForced; LowerLimitForced=0;}
LowerLimitForced = new G4bool [numOfMaterials];
G4double Tlowerlimit = 1.*keV ;
for(G4int mat=0; mat<numOfMaterials; mat++)
{
LowerLimitForced[mat] = false ;
MinDeltaEnergy[mat] = G4EnergyLossTables::GetPreciseEnergyFromRange(
G4Electron::Electron(),MinDeltaCutInRange,
(*theMaterialTable)[mat]) ;
if(MinDeltaEnergy[mat]<Tlowerlimit) MinDeltaEnergy[mat]=Tlowerlimit ;
if(MinDeltaEnergy[mat]>G4Electron::Electron()->GetEnergyCuts()[mat])
MinDeltaEnergy[mat]=G4Electron::Electron()->GetEnergyCuts()[mat] ;
// if((subSecFlag) && (aParticleType.GetParticleName()=="mu+"))
// {
// G4cout << G4std::setw(20) << (*theMaterialTable)[mat]->GetName()
// << G4std::setw(15) << MinDeltaEnergy[mat]/keV ;
// if(LowerLimitForced[mat])
// G4cout << " lower limit forced." << G4endl;
// else
// G4cout << G4endl ;
// }
}
}
@@ -410,10 +491,10 @@ G4VParticleChange* G4VMuEnergyLoss::AlongStepDoIt(
// get particle and material pointers from trackData
const G4DynamicParticle* aParticle = trackData.GetDynamicParticle();
G4double E = aParticle->GetKineticEnergy() ;
G4double charge = aParticle->GetDefinition()->GetPDGCharge();
G4double Charge = aParticle->GetDefinition()->GetPDGCharge();
G4Material* aMaterial = trackData.GetMaterial();
//G4int index = aMaterial->GetIndex();
G4int index = aMaterial->GetIndex();
G4double Step = stepData.GetStepLength();
@@ -441,10 +522,10 @@ G4VParticleChange* G4VMuEnergyLoss::AlongStepDoIt(
if(Step/fRangeNow < linLossLimit) finalT = E-Step*fdEdx ;
else
{
if (charge<0.) finalT = G4EnergyLossTables::GetPreciseEnergyFromRange(
theMuonMinus,fRangeNow-Step,aMaterial);
if (Charge<0.) finalT = G4EnergyLossTables::GetPreciseEnergyFromRange(
G4MuonMinus::MuonMinus(),fRangeNow-Step,aMaterial);
else finalT = G4EnergyLossTables::GetPreciseEnergyFromRange(
theMuonPlus,fRangeNow-Step,aMaterial);
G4MuonPlus::MuonPlus(),fRangeNow-Step,aMaterial);
}
}
@@ -452,6 +533,212 @@ G4VParticleChange* G4VMuEnergyLoss::AlongStepDoIt(
MeanLoss = E-finalT ;
// subcutoff delta ray production start
if((subSecFlag) && (trackData.GetCurrentStepNumber() > 1))
{
G4double MinDeltaEnergyNow,Tc,TmintoProduceDelta,w,ww ;
G4double rcut,T0,presafety,postsafety,safety,delta,Tmax,mass ;
G4double fragment = Step;
G4double frperstep = 1.0;
G4double x1,y1,z1,dx,dy,dz,dTime,time0,DeltaTime;
//G4double epsil = MinKineticEnergy/2. ;
MinDeltaEnergyNow = MinDeltaEnergy[index] ;
Tc=G4Electron::Electron()->GetEnergyCuts()[index];
const G4ParticleDefinition* aParticleType=aParticle->GetDefinition() ;
mass=aParticleType->GetPDGMass() ;
w=mass+electron_mass_c2 ;
ww=2.*mass-MinDeltaEnergyNow ;
TmintoProduceDelta=0.5*(sqrt(ww*ww+2.*w*w*MinDeltaEnergyNow/
electron_mass_c2)-ww) ;
if((E > TmintoProduceDelta) && (MeanLoss > MinDeltaEnergyNow)
&& (finalT > MinKineticEnergy))
{
// max. possible delta energy
Tmax = 2.*electron_mass_c2*E*(E+2.*mass)/
(mass*mass+2.*electron_mass_c2*(E+mass)+
electron_mass_c2*electron_mass_c2) ;
rcut=(G4Electron::Electron()->GetLengthCuts())[index];
if(Tc > Tmax) Tc=Tmax ;
// generate subcutoff delta rays only if Tc>MinDeltaEnergyNow!
if((Tc > MinDeltaEnergyNow) && (Tmax > MinDeltaEnergyNow))
{
presafety = stepData.GetPreStepPoint()->GetSafety() ;
// postsafety = stepData.GetPostStepPoint()->GetSafety() ;
G4Navigator *navigator=
G4TransportationManager::GetTransportationManager()
->GetNavigatorForTracking();
postsafety =
navigator->ComputeSafety(stepData.GetPostStepPoint()->GetPosition());
safety = G4std::min(presafety,postsafety) ;
if(safety < rcut)
{
x1=stepData.GetPreStepPoint()->GetPosition().x();
y1=stepData.GetPreStepPoint()->GetPosition().y();
z1=stepData.GetPreStepPoint()->GetPosition().z();
dx=stepData.GetPostStepPoint()->GetPosition().x()-x1 ;
dy=stepData.GetPostStepPoint()->GetPosition().y()-y1 ;
dz=stepData.GetPostStepPoint()->GetPosition().z()-z1 ;
time0=stepData.GetPreStepPoint()->GetGlobalTime();
dTime=stepData.GetPostStepPoint()->GetGlobalTime()-time0;
if((presafety<rcut)&&(postsafety<rcut))
{
fragment = Step ;
frperstep=1. ;
}
else if(presafety<rcut)
{
delta=presafety*Step/(postsafety-presafety) ;
fragment=rcut*(Step+delta)/postsafety-delta ;
frperstep=fragment/Step;
}
else if(postsafety<rcut)
{
delta=postsafety*Step/(presafety-postsafety) ;
fragment=rcut*(Step+delta)/presafety-delta ;
x1 += dx;
y1 += dy;
z1 += dz;
time0 += dTime ;
frperstep=-fragment/Step;
}
if(fragment>0.)
{
T0=G4EnergyLossTables::GetPreciseEnergyFromRange(
G4Electron::Electron(),
G4std::min(presafety,postsafety),
aMaterial) ;
// absolute lower limit for T0
// if(T0<MinDeltaEnergyNow) T0=MinDeltaEnergyNow ;
if((T0<MinDeltaEnergyNow)||(LowerLimitForced[aMaterial->GetIndex()]))
T0=MinDeltaEnergyNow ;
// compute nb of delta rays to be generated
// approximate value based on Bethe-Bloch and
// assuming an 1/E**2 delta spectrum
G4double deldedx=cN*aMaterial->GetDensity()*
((E+mass)*(E+mass)*log(Tc/T0)/(E*(E+mass))) ;
G4double delToverTc=1.-T0/Tc ;
G4double N = G4int(deldedx*fragment*delToverTc/(T0*log(Tc/T0))+0.5) ;
if(N > Ndeltamax) N = Ndeltamax ;
G4double Px,Py,Pz ;
G4ThreeVector ParticleDirection ;
ParticleDirection=aParticle->
GetMomentumDirection() ;
Px =ParticleDirection.x() ;
Py =ParticleDirection.y() ;
Pz =ParticleDirection.z() ;
G4int subdelta = 0;
if(N > 0)
{
G4double Tkin,Etot,P,T,p,costheta,sintheta,phi,dirx,diry,dirz,
Pnew,urandom;
//delTkin,delLoss,rate,
//G4StepPoint *point ;
Tkin = E ;
Etot = Tkin+mass ;
P = sqrt(Tkin*(Etot+mass)) ;
aParticleChange.SetNumberOfSecondaries(N);
do {
subdelta += 1 ;
Tmax = 2.*electron_mass_c2*Tkin*(Tkin+2.*mass)/
(mass*mass+2.*electron_mass_c2*(Tkin+mass)+
electron_mass_c2*electron_mass_c2) ;
if(Tc>Tmax) Tc = Tmax ;
//check if there is enough energy ....
if((Tkin>TmintoProduceDelta)&&(Tc > T0)&&(MeanLoss>0.))
{
T=T0/(1.-delToverTc*G4UniformRand()) ;
if(T > MeanLoss) T=MeanLoss ;
MeanLoss -= T ;
p=sqrt(T*(T+2.*electron_mass_c2)) ;
costheta = T*(Etot+electron_mass_c2)/(P*p) ;
if(costheta<-1.) costheta=-1.;
if(costheta> 1.) costheta= 1.;
phi=twopi*G4UniformRand() ;
sintheta=sqrt(1.-costheta*costheta);
dirx=sintheta*cos(phi);
diry=sintheta*sin(phi);
dirz=costheta;
urandom = G4UniformRand() ;
// distribute x,y,z along Pre-Post !
G4double xd,yd,zd ;
xd=x1+frperstep*dx*urandom ;
yd=y1+frperstep*dy*urandom ;
zd=z1+frperstep*dz*urandom ;
G4ThreeVector DeltaPosition(xd,yd,zd) ;
DeltaTime=time0+frperstep*dTime*urandom ;
G4ThreeVector DeltaDirection(dirx,diry,dirz) ;
DeltaDirection.rotateUz(ParticleDirection);
G4DynamicParticle* theDelta = new G4DynamicParticle ;
theDelta->SetDefinition(G4Electron::Electron());
theDelta->SetKineticEnergy(T);
theDelta->SetMomentumDirection(DeltaDirection.x(),
DeltaDirection.y(),DeltaDirection.z());
// update initial particle,fill ParticleChange
Tkin -= T ;
Px =(P*ParticleDirection.x()-p*DeltaDirection.x()) ;
Py =(P*ParticleDirection.y()-p*DeltaDirection.y()) ;
Pz =(P*ParticleDirection.z()-p*DeltaDirection.z()) ;
Pnew = sqrt(Px*Px+Py*Py+Pz*Pz) ;
Px /= Pnew ;
Py /= Pnew ;
Pz /= Pnew ;
P = Pnew ;
G4ThreeVector ParticleDirectionnew(Px,Py,Pz) ;
ParticleDirection = ParticleDirectionnew;
G4Track* deltaTrack =
new G4Track(theDelta,DeltaTime,DeltaPosition);
deltaTrack->
SetTouchableHandle(stepData.GetPostStepPoint()->GetTouchableHandle()) ;
deltaTrack->SetParentID(trackData.GetTrackID()) ;
aParticleChange.AddSecondary(deltaTrack) ;
}
} while (subdelta<N) ;
// update the particle direction and kinetic energy
if(subdelta > 0)
aParticleChange.SetMomentumChange(Px,Py,Pz) ;
E = Tkin ;
}
}
}
}
}
}
// end of subcutoff business
finalT = E - MeanLoss ;
if(finalT < MinKineticEnergy) finalT = 0. ;
//now the loss with fluctuation
if ((EnlossFlucFlag) && (finalT > 0.) && (finalT < E)&&(E > LowerBoundEloss))
@@ -467,7 +754,7 @@ G4VParticleChange* G4VMuEnergyLoss::AlongStepDoIt(
aParticleChange.SetStatusChange(fStopButAlive);
}
aParticleChange.SetNumberOfSecondaries(0);
// aParticleChange.SetNumberOfSecondaries(0);
aParticleChange.SetEnergyChange(finalT);
aParticleChange.SetLocalEnergyDeposit(E-finalT);