Import Geant4 0.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 15:09:25 +02:00
parent b97f8d0df7
commit aaa409b6ee
2922 changed files with 55107 additions and 81674 deletions
+3 -1
View File
@@ -1,4 +1,4 @@
# $Id: GNUmakefile,v 2.6 1998/12/17 03:16:18 gcosmo Exp $
# $Id: GNUmakefile,v 1.4 1999/06/02 18:45:38 gcosmo Exp $
# ----------------------------------------------------------------------
# GNUmakefile for processes library, Gabriele Cosmo 27-Jun-1998
# ----------------------------------------------------------------------
@@ -8,6 +8,7 @@ name := G4processes
SUBDIRS = management optical decay transportation parameterisation
SUBDIRS += electromagnetic/muons electromagnetic/standard
SUBDIRS += electromagnetic/utils electromagnetic/xrays
SUBDIRS += electromagnetic/lowenergy
SUBDIRS += hadronic/management hadronic/util hadronic/processes
SUBDIRS += hadronic/cross_sections hadronic/stopping
SUBDIRS += hadronic/models/low_energy hadronic/models/high_energy
@@ -26,6 +27,7 @@ SUBDIRS += hadronic/models/generator/util
SUBLIBS = G4procman G4optical G4decay G4transportation G4parameterisation
SUBLIBS += G4muons G4emstandard G4emutils G4xrays
SUBLIBS += G4emlowenergy
SUBLIBS += G4hadronic_mgt G4hadronic_util G4hadronic_proc
SUBLIBS += G4hadronic_xsect G4hadronic_stop G4hadronic_LE G4hadronic_HE
SUBLIBS += G4hadronic_neu
+9 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 2.15 1998/09/25 08:11:50 kurasige Exp $
$Id: History,v 1.4 1999/05/31 17:38:37 stesting Exp $
-------------------------------------------------------------------
=========================================================
@@ -16,6 +16,14 @@ committal in the CVS repository !
----------------------------------------------------------
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
May 29, 1999: John Allison
- Added electromagnetic/lowenergy to GNUmakefile and
electromagnetic/GNUmakefile..
Dec 09: J.P.Wellisch
-hadronics tagged.
Sep 25: H.Kurashige.
- procman-00-02-05 has tagged
Added deleteion of all processes in the destructor of G4ProcessTable
+1 -1
View File
@@ -1,4 +1,4 @@
# $Id: GNUmakefile,v 2.0 1998/07/02 16:18:12 gunter Exp $
# $Id: GNUmakefile,v 1.1 1999/01/07 16:10:59 gunter Exp $
# --------------------------------------------------------------
# GNUmakefile for processes/decay library. G.Folger 9/12/97
# --------------------------------------------------------------
+6 -6
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4Decay.hh,v 2.2 1998/08/10 13:03:15 kurasige Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4Decay.hh,v 1.2 1999/04/13 09:56:05 kurasige Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// ------------------------------------------------------------
@@ -55,12 +55,12 @@ class G4Decay : public G4VRestDiscreteProcess
// and
// AtRestDoIt (for decay at rest)
G4VParticleChange *PostStepDoIt(
virtual G4VParticleChange *PostStepDoIt(
const G4Track& aTrack,
const G4Step& aStep
);
G4VParticleChange* AtRestDoIt(
virtual G4VParticleChange* AtRestDoIt(
const G4Track& aTrack,
const G4Step& aStep
);
@@ -72,7 +72,7 @@ class G4Decay : public G4VRestDiscreteProcess
// becasuse this table is universal for all particle types,
G4bool IsApplicable(const G4ParticleDefinition&);
virtual G4bool IsApplicable(const G4ParticleDefinition&);
// returns "true" if the decay process can be applied to
// the particle type.
@@ -85,7 +85,7 @@ class G4Decay : public G4VRestDiscreteProcess
// which has information of daughter particles.
public:
G4double AtRestGetPhysicalInteractionLength(
virtual G4double AtRestGetPhysicalInteractionLength(
const G4Track& track,
G4ForceCondition* condition
);
+5 -5
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4Decay.cc,v 2.5 1998/12/15 09:40:26 kurasige Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4Decay.cc,v 1.3 1999/04/13 09:56:08 kurasige Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// --------------------------------------------------------------
@@ -25,7 +25,7 @@
// rename thePhysicsTable to aPhyscisTable 2 Aug. 1998 H.Kurashige
// modified IsApplicable in order to protect the decay from registered
// to resonances 12 Dec. 1998 H.Kurashige
// remove G4ParticleMomentum 6 Feb. 99 H.Kurashige
#include "G4Decay.hh"
#include "G4DynamicParticle.hh"
@@ -229,7 +229,7 @@ G4VParticleChange* G4Decay::DecayIt(const G4Track& aTrack, const G4Step& )
fParticleChangeForDecay.Initialize(aTrack);
// get particle
const G4DynamicParticle* aParticle = aTrack.GetDynamicParticle();
G4DynamicParticle* aParticle = aTrack.GetDynamicParticle();
//check if thePreAssignedDecayProducts exists
G4DecayProducts* products = aParticle->GetPreAssignedDecayProducts();
@@ -290,7 +290,7 @@ G4VParticleChange* G4Decay::DecayIt(const G4Track& aTrack, const G4Step& )
// get parent particle information ...................................
G4double ParentEnergy = aParticle->GetTotalEnergy();
G4ParticleMomentum ParentDirection(aParticle->GetMomentumDirection());
G4ThreeVector ParentDirection(aParticle->GetMomentumDirection());
//boost all decay products to laboratory frame
G4double energyDeposit = 0.0;
+3 -3
View File
@@ -1,4 +1,4 @@
# $Id: GNUmakefile,v 2.0 1998/07/02 16:18:56 gunter Exp $
# $Id: GNUmakefile,v 1.2 1999/05/31 17:38:38 stesting Exp $
# ------------------------------------------------------------------
# GNUmakefile for electromagnetic library. Gabriele Cosmo, 18/9/96.
# ------------------------------------------------------------------
@@ -7,8 +7,8 @@ MAKEFLAGS= --no-print-directory
name := G4electromagnetic
SUBDIRS = muons standard utils xrays
SUBLIBS = G4muons G4emstandard G4emutils G4xrays
SUBDIRS = muons standard utils xrays lowenergy
SUBLIBS = G4muons G4emstandard G4emutils G4xrays G4emlowenergy
ifndef G4INSTALL
G4INSTALL = ../../..
+32
View File
@@ -0,0 +1,32 @@
$Id: History,v 1.2 1999/06/14 14:30:15 johna Exp $
-------------------------------------------------------------------
=========================================================
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
=========================================================
Category History file
---------------------
This file should be used by G4 developers and category coordinators
to briefly summarize all major modifications introduced in the code
and keep track of all category-tags.
It DOES NOT substitute the CVS log-message one should put at every
committal in the CVS repository !
----------------------------------------------------------
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
14th June 1999 John Allison (em-01-00-05b)
- Muon corrections in G4MultipleScattering.cc, G4MuBremsstrahlung.cc
and G4MuPairProduction.cc by Laszlo Urban, Pedro Arce.
(Also in rocesses/photoleplon_hadron/src/G4MuNuclearInteraction.cc.)
5th June 1999 John Allison
- standard/GNUmakefile: Force non-optimised compliation of some
files on HP with aCC: HP ANSI C++ B3910B A.01.15.
May 29, 1999: John Allison
- Added electromagnetic/lowenergy to GNUmakefile and
electromagnetic/GNUmakefile..
@@ -0,0 +1,34 @@
# $Id: GNUmakefile,v 1.2 1999/05/29 14:16:45 aforti Exp $
# --------------------------------------------------------------------
# GNUmakefile for electromagnetic sub-library. John Allison, 25/6/98.
# --------------------------------------------------------------------
name := G4emlowenergy
ifndef G4INSTALL
G4INSTALL = ../../../..
endif
include $(G4INSTALL)/config/architecture.gmk
CPPFLAGS += -I$(G4BASE)/global/management/include \
-I$(G4BASE)/global/HEPRandom/include \
-I$(G4BASE)/global/HEPGeometry/include \
-I$(G4BASE)/geometry/management/include \
-I$(G4BASE)/geometry/magneticfield/include \
-I$(G4BASE)/geometry/volumes/include \
-I$(G4BASE)/track/include \
-I$(G4BASE)/processes/management/include \
-I$(G4BASE)/processes/electromagnetic/utils/include \
-I$(G4BASE)/processes/electromagnetic/standard/include \
-I$(G4BASE)/management/include \
-I$(G4BASE)/particles/management/include \
-I$(G4BASE)/particles/bosons/include \
-I$(G4BASE)/particles/leptons/include \
-I$(G4BASE)/particles/hadrons/barions/include \
-I$(G4BASE)/particles/hadrons/mesons/include \
-I$(G4BASE)/particles/hadrons/ions/include \
-I$(G4BASE)/intercoms/include \
-I$(G4BASE)/materials/include
include $(G4INSTALL)/config/common.gmk
@@ -0,0 +1,49 @@
// This code implementation is the intellectual property of
// the RD44 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.
//
// -------------------------------------------------------------------
// GEANT 4 class file
//
// For information related to this code contact:
// CERN, IT Division, ASD group
// CERN, Geneva, Switzerland
//
// File name: G4Data.hh
//
// Author: Alessandra Forti (Alessandra.Forti@cern.ch)
//
// Creation date: 1 Giugno 1999
//
// Modifications:
//
// -------------------------------------------------------------------
#ifndef G4DATA_HH
#define G4DATA_HH
#include "G4DataVector.hh"
class G4Data : public G4DataVector{
public:
~G4Data();
G4bool operator == (const G4Data& ) const;
G4bool operator < (const G4Data&) const;
};
#endif
@@ -0,0 +1,69 @@
// This code implementation is the intellectual property of
// the RD44 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.
//
// -------------------------------------------------------------------
// GEANT 4 class file
//
// For information related to this code contact:
// CERN, IT Division, ASD group
// CERN, Geneva, Switzerland
//
// File name: G4Epdl89File
//
// Author: Alessandra Forti (Alessandra.Forti@cern.ch)
//
// Creation date: 2 February 1999
//
// Modifications:
//
// -------------------------------------------------------------------
#ifndef G4Epdl89File_hh
#define G4Epdl89File_hh
// Other Class Headers
#include "globals.hh"
#include "G4VDataFile.hh"
#include "G4Data.hh"
// C++ Headers
#include <fstream.h>
// Class Declarations
class G4Epdl89File: public G4VDataFile{
public:
// Constructors
G4Epdl89File(const G4String&, G4int*);
// Destructor
~G4Epdl89File();
virtual G4bool FindTheProcess();
virtual G4bool FindTheElement(G4int);
virtual G4bool FindOneElemProc(G4int&);
protected:
// Member Functions
void GetDataValues(G4Data& valList);
G4double GetOneData(const char*);
private:
G4int* _flags; // data flags
};
#endif // G4Epdl89File
@@ -0,0 +1,68 @@
// This code implementation is the intellectual property of
// the RD44 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.
//
// -------------------------------------------------------------------
// GEANT 4 class file
//
// For information related to this code contact:
// CERN, IT Division, ASD group
// CERN, Geneva, Switzerland
//
// File name: G4Epdl97File.hh
//
// Author: Alessandra Forti (Alessandra.Forti@cern.ch)
//
// Creation date: 2 February 1999
//
// Modifications:
//
// -------------------------------------------------------------------
#ifndef G4Epdl97File_hh
#define G4Epdl97File_hh
// Other Class Headers
#include "globals.hh"
#include "G4VDataFile.hh"
#include "G4Data.hh"
// C++ Headers
#include <fstream.h>
// Class Declarations
class G4Epdl97File: public G4VDataFile{
public:
// Constructors
G4Epdl97File(const G4String&, G4int*);
// Destructor
~G4Epdl97File();
virtual G4bool FindTheProcess();
virtual G4bool FindTheElement(G4int);
virtual G4bool FindOneElemProc(G4int&);
G4int* GetTheProcFlags();
protected:
// Member Functions
void GetDataValues(G4Data& valList);
G4double GetOneData(const char*);
private:
G4int* _flags; // data flags
};
#endif // G4Epdl97File
@@ -0,0 +1,89 @@
// This code implementation is the intellectual property of
// the RD44 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.
//
// -------------------------------------------------------------------
// GEANT 4 class file
//
// For information related to this code contact:
// CERN, IT Division, ASD group
// CERN, Geneva, Switzerland
//
// File name: G4EpdlTables
//
// Author: Alessandra Forti (Alessandra.Forti@cern.ch)
//
// Creation date: 2 February 1999
//
// Modifications:
//
// -------------------------------------------------------------------
#ifndef G4EpdlTables_hh
#define G4EpdlTables_hh
// Base Class Header
#include "G4VTables.hh"
// Other Class Headers
#include "globals.hh"
#include "G4PhysicsTable.hh"
#include "G4Data.hh"
#include "G4FirstLevel.hh"
#include "G4SecondLevel.hh"
// C++ Headers
// Class Declarations
class G4VDataFile;
class G4EpdlTables: public G4VTables{
public:
// Constructors
G4EpdlTables(G4VDataFile& DFile);
// Destructor
~G4EpdlTables();
// Member Functions
// search the data table in the file
void FillDataTable();
G4SecondLevel* FillTheTable(G4int nemEl = 0);
// inline member functions
inline G4PhysicsTable* GetFstDataTable(){return theDataTable1;};
inline G4PhysicsTable* GetSndDataTable(){return theDataTable2;};
inline G4PhysicsTable* GetTrdDataTable(){return theDataTable3;};
//G4SecondLevel* GetGlobalList();
protected:
private:
G4PhysicsTable* theDataTable1;
G4PhysicsTable* theDataTable2;
G4PhysicsTable* theDataTable3;
// G4SecondLevel* allElementList;
G4VDataFile& datfile;
};
#endif // G4EpdlTables
@@ -0,0 +1,53 @@
// This code implementation is the intellectual property of
// the RD44 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.
//
// -------------------------------------------------------------------
// GEANT 4 class file
//
// For information related to this code contact:
// CERN, IT Division, ASD group
// CERN, Geneva, Switzerland
//
// File name: G4FirstLevel.hh
//
// Author: Alessandra Forti (Alessandra.Forti@cern.ch)
//
// Creation date: 1 Giugno 1999
//
// Modifications:
//
// -------------------------------------------------------------------
#ifndef G4FIRSTLEVEL_HH
#define G4FIRSTLEVEL_HH
#include "G4Data.hh"
#include <rw/tpordvec.h>
class G4FirstLevel : public RWTPtrOrderedVector< G4Data >{
public:
// G4FirstLevel( G4FirstLevel& )
~G4FirstLevel();
G4bool operator == (const G4FirstLevel& ) const;
G4bool operator < (const G4FirstLevel&) const;
};
#endif
@@ -0,0 +1,138 @@
// This code implementation is the intellectual property of
// the RD44 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: G4LowEnergyBremsstrahlung.hh,v 1.7 1999/07/01 17:37:26 aforti Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// ------------------------------------------------------------
// GEANT 4 class header file
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, IT Division, ASD group
// History: first implementation, based on object model of
// 2nd December 1995, G.Cosmo
// ------------ G4LowEnergyBremsstrahlung physics process ------
// by Michel Maire, 24 July 1996
// ************************************************************
// 1-10-96 : new type G4OrderedTable; ComputePartialSumSigma()
// 20/03/97: new energy loss+ionisation+brems scheme, L.Urban
// 01-09-98, new methods SetBining() and PrintInfo()
// ------------------------------------------------------------
#ifndef G4LowEnergyBremsstrahlung_h
#define G4LowEnergyBremsstrahlung_h 1
// Base Class Headers
//#include "G4VDiscreteProcess.hh"
#include "G4eEnergyLoss.hh"
// Contained Variables Headers
#include "G4LowEnergyUtilities.hh"
#include "G4Electron.hh"
#include "G4Positron.hh"
class G4LowEnergyBremsstrahlung : public G4eEnergyLoss{
public:
G4LowEnergyBremsstrahlung(const G4String& processName = "LowEnBrem");
~G4LowEnergyBremsstrahlung();
G4bool IsApplicable(const G4ParticleDefinition&);
void SetCutForLowEnSecPhotons(G4double);
void SetPhysicsTableBining(G4double lowE, G4double highE, G4int nBins);
void PrintInfoDefinition();
void BuildPhysicsTable(const G4ParticleDefinition& ParticleType);
void BuildLossTable(const G4ParticleDefinition& ParticleType);
G4double GetMeanFreePath(const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition );
G4VParticleChange* PostStepDoIt(const G4Track& track,
const G4Step& step);
G4double GetLambda(G4double KineticEnergy,G4Material* material);
protected:
void BuildCrossSectionTable();
void BuildMeanFreePathTable();
void BuildATable();
void BuildBTable();
void BuildZVec();
void ComputePartialSumSigma(G4double KineticEnergy,
const G4Material* aMaterial);
private:
G4double ComputeA(G4int Z, G4double ElectKinEnergy); // interpolation
G4double ComputeB(G4int Z, G4double ElectKinEnergy); // parametrized formula
G4double ComputeBremLoss(G4double Z, G4double natom, G4double T,
G4double Cut, G4double x);
G4double ComputeXYPolynomial(G4double x,G4double y,G4int xSize,
G4int ySize,const G4double coeff[]);
G4double ComputePositronCorrFactorLoss(G4double AtomicNumber,
G4double KineticEnergy,
G4double GammaEnergyCut);
G4Element* SelectRandomAtom(G4Material* aMaterial) const;
G4LowEnergyBremsstrahlung & operator=(const G4LowEnergyBremsstrahlung &right);
G4LowEnergyBremsstrahlung(const G4LowEnergyBremsstrahlung&);
private:
G4SecondLevel* theCrossSectionTable ;
G4PhysicsTable* theMeanFreePathTable ;
G4SecondLevel* ATable;
G4FirstLevel* BTable;
G4Data* ZNumVec;
G4LowEnergyUtilities util;
// partial sum of total crosssection
G4OrderedTable PartialSumSigma;
G4double LowestKineticEnergy;
G4double HighestKineticEnergy;
G4double lowEnergyCut; // lower limit of the energy sampling formula
G4int TotBin; // number of bins in the tables
G4double CutForLowEnergySecondaryPhotons;
};
#include "G4LowEnergyBremsstrahlung.icc"
#endif
@@ -0,0 +1,111 @@
// This code implementation is the intellectual property of
// the RD44 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: G4LowEnergyBremsstrahlung.icc,v 1.9 1999/07/06 14:36:18 aforti Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// ---------------------------------------------------------------
// GEANT 4 class inlined methods file
//
// For information related to this code contact:
// CERN, IT Division, ASD group
// History: first implementation, based on object model of
// 2nd December 1995, G.Cosmo
// ------------ G4LowEnergyBremsstrahlung physics process ---------
// by Michel Maire, 27 July 1996
// ***************************************************************
// 13-12-96 : Sign corrected in the ScreenFunctions, L.Urban
// 20/03/97 : new energy loss+ionisation+brems scheme, L.Urban
// ***************************************************************
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4bool G4LowEnergyBremsstrahlung::IsApplicable(
const G4ParticleDefinition& particle)
{
return( (&particle == G4Electron::Electron())
||(&particle == G4Positron::Positron()) );
}
inline G4double G4LowEnergyBremsstrahlung::GetMeanFreePath(const G4Track& track,
G4double,
G4ForceCondition*)
// gives the MeanFreePath in GEANT4 internal units
{
const G4DynamicParticle* aDynamicParticle = track.GetDynamicParticle();
G4double KineticEnergy = aDynamicParticle->GetKineticEnergy();
G4Material* aMaterial = track.GetMaterial();
G4double MeanFreePath;
G4bool isOutRange ;
if (KineticEnergy < LowestKineticEnergy)
MeanFreePath = DBL_MIN;
else {
if (KineticEnergy > HighestKineticEnergy) KineticEnergy = 0.99*HighestKineticEnergy ;
MeanFreePath = util.DataLogInterpolation(KineticEnergy, aMaterial->GetIndex(), theMeanFreePathTable);
}
return MeanFreePath;
}
inline G4double G4LowEnergyBremsstrahlung::ComputeA(G4int AtomicNumber, G4double ElectronKinEnergy){
G4double aVal;
G4FirstLevel* oneAtomCoeff = (*ATable)[AtomicNumber-1];
G4Data* ElectEnVec = (*oneAtomCoeff)[0];
G4Data* AValueVec = (*oneAtomCoeff)[1];
aVal = util.DataLogInterpolation(ElectronKinEnergy, (*ElectEnVec), (*AValueVec));
if(AtomicNumber > 99){
aVal = 0;
}
return aVal;
}
inline G4double G4LowEnergyBremsstrahlung::ComputeB(G4int AtomicNumber, G4double ElectronKinEnergy){
G4double bVal;
G4double constTerm = (*(*BTable)[0])[AtomicNumber-1];
G4double linearTerm = (*(*BTable)[1])[AtomicNumber-1];
G4double logElectEn = log10(ElectronKinEnergy);
if(logElectEn > -5 && logElectEn < (-constTerm/linearTerm)){
bVal = linearTerm*logElectEn+constTerm;
}
else{
bVal = 0;
}
if(AtomicNumber > 99){
bVal = 0;
}
return bVal;
}
@@ -0,0 +1,100 @@
// This code implementation is the intellectual property of
// the RD44 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: G4LowEnergyCompton.hh,v 1.3 1999/06/28 15:47:03 aforti Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// ------------------------------------------------------------
// GEANT 4 class header file --- Copyright CERN 1995
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, CN Division, ASD group
// History: first implementation, based on object model of
// 2nd December 1995, G.Cosmo
// ------------ G4LowEnergyCompton physics process ------
// by Michel Maire, April 1996
// ************************************************************
// 01-02-96, First implementation A.Forti
// 21-06-96, SetCuts implementation, M.Maire
// 06-01-97, crossection table + meanfreepath table, M.Maire
// 17-02-97, New Physics scheme
// 25-02-97, GetMeanFreePath() now is public function
// 12-03-97, new physics scheme again
// ------------------------------------------------------------
#ifndef G4LowEnergyCompton_h
#define G4LowEnergyCompton_h
// Base Class Headers
#include "G4VDiscreteProcess.hh"
// Contained Variables Headers
#include "G4LowEnergyUtilities.hh"
#include "G4Gamma.hh"
class G4LowEnergyCompton : public G4VDiscreteProcess{
private:
// hide assignment operator as private
G4LowEnergyCompton& operator=(const G4LowEnergyCompton &right);
G4LowEnergyCompton(const G4LowEnergyCompton& );
public:
G4LowEnergyCompton(const G4String& processName ="LowEnCompton");
~G4LowEnergyCompton();
G4bool IsApplicable(const G4ParticleDefinition&);
void BuildPhysicsTable(const G4ParticleDefinition& GammaType);
G4double GetMeanFreePath(const G4Track& aTrack,
G4double previousStepSize,
G4ForceCondition* condition);
G4VParticleChange* PostStepDoIt(const G4Track& aTrack, const G4Step& aStep);
protected:
void BuildScatteringFunctionTable();
void BuildCrossSectionTable();
void BuildMeanFreePathTable();
void BuildZVec();
private:
G4Element* SelectRandomAtom(const G4DynamicParticle*, G4Material*);
G4SecondLevel* theCrossSectionTable;
G4SecondLevel* theScatteringFunctionTable;
G4PhysicsTable* theMeanFreePathTable;
G4Data* ZNumVec;
G4LowEnergyUtilities util;
G4double LowestEnergyLimit; // low energy limit of the crosssection data
G4double HighestEnergyLimit; // high energy limit of the crosssection data
G4int NumbBinTable; // number of bins in the data tables
G4double MeanFreePath; // actual Mean Free Path (current medium)
};
#include "G4LowEnergyCompton.icc"
#endif
@@ -0,0 +1,60 @@
// This code implementation is the intellectual property of
// the RD44 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: G4LowEnergyCompton.icc,v 1.8 1999/07/06 15:03:19 aforti Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// ---------------------------------------------------------------
// GEANT 4 class inlined methods file
//
// For information related to this code contact:
// CERN, CN Division, ASD group
// History: first implementation, based on object model of
// 2nd December 1995, G.Cosmo
// ------------ G4LowEnergyCompton physics process ---------
// by Michel Maire, April 1996
// ***************************************************************
inline G4bool
G4LowEnergyCompton::IsApplicable(const G4ParticleDefinition& particle){
return ( &particle == G4Gamma::Gamma() );
}
inline G4double
G4LowEnergyCompton::GetMeanFreePath(const G4Track& aTrack, G4double, G4ForceCondition*){
// returns the gamma mean free path in GEANT4 internal units
const G4DynamicParticle* aDynamicGamma = aTrack.GetDynamicParticle();
G4double GammaEnergy = aDynamicGamma->GetKineticEnergy();
G4Material* aMaterial = aTrack.GetMaterial();
G4bool isOutRange ;
if (GammaEnergy > HighestEnergyLimit){
MeanFreePath = DBL_MAX;
}
else if(GammaEnergy < LowestEnergyLimit){
MeanFreePath = DBL_MIN;
}
else {
MeanFreePath = util.DataLogInterpolation(GammaEnergy,
aMaterial->GetIndex(),
theMeanFreePathTable);
}
return MeanFreePath;
}
@@ -0,0 +1,103 @@
// This code implementation is the intellectual property of
// the RD44 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: G4LowEnergyGammaConversion.hh,v 1.2 1999/06/28 15:47:03 aforti Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// ------------------------------------------------------------
// GEANT 4 class header file
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, CN Division, ASD group
// History: first implementation, based on object model of
// 2nd December 1995, G.Cosmo
// ------------ G4LowEnergyGammaConversion physics process ------
// by Michel Maire, 24 May 1996
// ************************************************************
// 11-06-96, Added GetRandomAtom() method and new data member
// for cumulative total cross section, by M.Maire
// 21-06-96, SetCuts inplementation, M.Maire
// 16-09-96, Dynamical array PartialSumSigma, M.Maire
// 14-01-97, crossection table + meanfreepath table.
// PartialSumSigma removed, M.Maire
// 14-03-97, new physics scheme for geant4alpha, M.Maire
// ------------------------------------------------------------
#ifndef G4LowEnergyGammaConversion_h
#define G4LowEnergyGammaConversion_h 1
// Base Class Headers
#include "G4VDiscreteProcess.hh"
// Contained Variables Headers
#include "G4LowEnergyUtilities.hh"
#include "G4Gamma.hh"
class G4LowEnergyGammaConversion : public G4VDiscreteProcess
{
private:
// hide assignment operator as private
G4LowEnergyGammaConversion& operator=(const G4LowEnergyGammaConversion &right);
G4LowEnergyGammaConversion(const G4LowEnergyGammaConversion& );
public:
G4LowEnergyGammaConversion(const G4String& processName ="LowEnConversion");
~G4LowEnergyGammaConversion();
G4bool IsApplicable(const G4ParticleDefinition&);
void BuildPhysicsTable(const G4ParticleDefinition& GammaType);
G4double GetMeanFreePath(const G4Track& aTrack,
G4double previousStepSize,
G4ForceCondition* condition);
G4VParticleChange* PostStepDoIt(const G4Track& aTrack, const G4Step& aStep);
protected:
void BuildCrossSectionTable();
void BuildMeanFreePathTable();
void BuildZVec();
private:
G4Element* SelectRandomAtom(const G4DynamicParticle*, G4Material*);
static G4double ScreenFunction1(G4double ScreenVariable);
static G4double ScreenFunction2(G4double ScreenVariable);
private:
G4SecondLevel* theCrossSectionTable;
G4PhysicsTable* theMeanFreePathTable;
G4LowEnergyUtilities util;
G4double LowestEnergyLimit;
G4double HighestEnergyLimit;
G4int NumbBinTable;
G4Data* ZNumVec;
G4double MeanFreePath; // actual Mean Free Path (current medium)
};
#include "G4LowEnergyGammaConversion.icc"
#endif
@@ -0,0 +1,90 @@
// This code implementation is the intellectual property of
// the RD44 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: G4LowEnergyGammaConversion.icc,v 1.6 1999/06/28 15:47:35 aforti Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// ---------------------------------------------------------------
// GEANT 4 class inlined methods file
//
// For information related to this code contact:
// CERN, CN Division, ASD group
// History: first implementation, based on object model of
// 2nd December 1995, G.Cosmo
// ------------ G4LowEnergyGammaConversion physics process ---------
// by Michel Maire, 24 May 1996
// ***************************************************************
// 11-06-96, in GetMeanFreePath() the partial sum is stored, by M.Maire
// 16-09-96, dynamical array PartialSumSigma, by M.Maire
// 13-12-96, Sign corrected in the ScreenFunctions, by L.Urban
// 14-01-97, crossection table + meanfreepath table.
// PartialSumSigma removed, by M.Maire
// 14-01-97, new physics scheme for geant4alpha, M.Maire
// ---------------------------------------------------------------
inline G4bool G4LowEnergyGammaConversion::IsApplicable(const G4ParticleDefinition& particle)
{
return ( &particle == G4Gamma::Gamma() );
}
inline G4double
G4LowEnergyGammaConversion::GetMeanFreePath(const G4Track& aTrack, G4double, G4ForceCondition*){
// returns the gamma mean free path in GEANT4 internal units
const G4DynamicParticle* aDynamicGamma = aTrack.GetDynamicParticle();
G4double GammaEnergy = aDynamicGamma->GetKineticEnergy();
G4Material* aMaterial = aTrack.GetMaterial();
G4bool isOutRange ;
if (GammaEnergy < LowestEnergyLimit){
MeanFreePath = DBL_MAX;
}
else {
if(GammaEnergy > HighestEnergyLimit) GammaEnergy = 0.99*HighestEnergyLimit;
MeanFreePath = util.DataLogInterpolation(GammaEnergy, aMaterial->GetIndex(), theMeanFreePathTable);
}
return MeanFreePath;
}
inline G4double
G4LowEnergyGammaConversion::ScreenFunction1(G4double ScreenVariable)
// compute the value of the screening function 3*PHI1 - PHI2
{
G4double screenVal;
if (ScreenVariable > 1.)
screenVal = 42.24 - 8.368*log(ScreenVariable+0.952);
else
screenVal = 42.392 - ScreenVariable* (7.796 - 1.961*ScreenVariable);
return screenVal;
}
inline G4double
G4LowEnergyGammaConversion::ScreenFunction2(G4double ScreenVariable)
// compute the value of the screening function 1.5*PHI1 - 0.5*PHI2
{
G4double screenVal;
if (ScreenVariable > 1.)
screenVal = 42.24 - 8.368*log(ScreenVariable+0.952);
else
screenVal = 41.405 - ScreenVariable* (5.828 - 0.8945*ScreenVariable);
return screenVal;
}
@@ -0,0 +1,142 @@
// This code implementation is the intellectual property of
// the RD44 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: G4LowEnergyIonisation.hh,v 1.9 1999/07/06 13:21:02 aforti Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// ------------------------------------------------------------
// GEANT 4 class header file
//
// For information related to this code contact:
// CERN, IT Division, ASD group
// History: based on object model of
// 2nd December 1995, G.Cosmo
// ---------- G4LowEnergyIonisation physics process -----------
// by Laszlo Urban, 20 March 1997
// ************************************************************
// It is the first implementation of the NEW IONISATION
// PROCESS. ( delta rays + continuous energy loss)
// It calculates the ionisation for e+/e-.
// ************************************************************
//
// 04-09-98: new methods SetBining() PrintInfo(), MMa
// ------------------------------------------------------------
#ifndef G4LowEnergyIonisation_h
#define G4LowEnergyIonisation_h 1
// Base Class Headers
#include "G4VDiscreteProcess.hh"
#include "G4eEnergyLoss.hh"
// Contained Variables Headers
#include "G4LowEnergyUtilities.hh"
#include "G4Electron.hh"
#include "G4Positron.hh"
#include <fstream.h>
typedef G4FirstLevel oneShellTable;
typedef G4SecondLevel oneAtomTable;
typedef G4ThirdLevel allAtomTable;
class G4LowEnergyIonisation : public G4eEnergyLoss{
public:
G4LowEnergyIonisation(const G4String& processName = "LowEnergyIoni");
~G4LowEnergyIonisation();
G4bool IsApplicable(const G4ParticleDefinition&);
void SetCutForLowEnSecPhotons(G4double);
void SetCutForLowEnSecElectrons(G4double);
void BuildPhysicsTable(const G4ParticleDefinition& aParticleType);
G4double GetMeanFreePath(const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition ) ;
inline G4double GetTransitionShell(G4int k){return(thePrimShVec(k));};
G4VParticleChange *PostStepDoIt(const G4Track& track,
const G4Step& Step ) ;
void Print();
protected:
virtual G4double ComputeCrossSection(const G4double AtomicNumber,
const G4double IncEnergy);
void BuildLossTable(const G4ParticleDefinition& aParticleType);
void BuildShellCrossSectionTable();
void BuildBindingEnergyTable();
void BuildFluorTransitionTable();
void BuildSamplingCoeffTable();
void BuildZVec();
private:
// hide assignment operator
G4LowEnergyIonisation & operator=(const G4LowEnergyIonisation &right);
G4LowEnergyIonisation(const G4LowEnergyIonisation&);
private:
G4int SelectRandomShell(const G4int AtomIndex, const G4double IncEnergy);
G4Element* SelectRandomAtom(const G4DynamicParticle* aDynamicPhoton,
G4Material* aMaterial);
G4bool SelectRandomTransition(G4int, G4double*,
const oneAtomTable*);
G4double EnergySampling(const G4int, const G4int,const G4double);
allAtomTable* allAtomShellCrossSec;
allAtomTable* theFluorTransitionTable;
allAtomTable* theSamplingCoeffTable;
G4SecondLevel* theBindingEnergyTable;
G4DataVector thePrimShVec;
G4Data* ZNumVec;
G4Data* ZNumVecFluor;
G4LowEnergyUtilities util;
G4double LowestKineticEnergy;
G4double HighestKineticEnergy;
G4int TotBin;
G4double CutForLowEnergySecondaryPhotons;
G4double CutForLowEnergySecondaryElectrons;
G4double MeanFreePath;
};
#include "G4LowEnergyIonisation.icc"
#endif
@@ -0,0 +1,83 @@
// This code implementation is the intellectual property of
// the RD44 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: G4LowEnergyIonisation.icc,v 1.6 1999/07/06 13:21:19 aforti Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// ---------------------------------------------------------------
// GEANT 4 class inlined methods file
//
// For information related to this code contact:
// CERN, IT Division, ASD group
// ------------ G4LowEnergyIonisation physics process ------------
// by Laszlo Urban, 20 March 1997
// ***************************************************************
// It is the first implementation of the NEW IONISATION PROCESS.
// It calculates the ionisation of e+/e-.
// ***************************************************************
//
// 24-11-97: correction on MeanFreePath for KinEnergy > HighestLimit
//
// ---------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4bool G4LowEnergyIonisation::IsApplicable(
const G4ParticleDefinition& particle)
{
return( (&particle == G4Electron::Electron())
||(&particle == G4Positron::Positron()) );
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4LowEnergyIonisation::GetMeanFreePath(
const G4Track& track,
G4double,
G4ForceCondition*){
const G4DynamicParticle* aParticle = track.GetDynamicParticle();
G4double KineticEnergy = aParticle->GetKineticEnergy();
const G4Material* aMaterial = track.GetMaterial();
G4bool isOutRange ;
if( KineticEnergy < LowestKineticEnergy )
MeanFreePath = DBL_MIN;
else {
if (KineticEnergy > HighestKineticEnergy) KineticEnergy = HighestKineticEnergy;
const
G4ElementVector* theElementVector = aMaterial->GetElementVector();
const
G4double* theAtomicNumDensityVector = aMaterial->GetAtomicNumDensityVector();
const
G4int NumberOfElements = aMaterial->GetNumberOfElements() ;
G4double SIGMA = 0;
for(G4int iel=0; iel<NumberOfElements; iel++ ){
G4double Cs = ComputeCrossSection((*theElementVector)(iel)->GetZ(), KineticEnergy)*barn;
SIGMA += theAtomicNumDensityVector[iel]*Cs;
}
// mean free path = 1./macroscopic cross section
MeanFreePath = SIGMA > DBL_MIN ? 1./SIGMA : DBL_MAX;
}
return MeanFreePath ;
}
@@ -0,0 +1,125 @@
// This code implementation is the intellectual property of
// the RD44 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: G4LowEnergyPhotoElectric.hh,v 1.9 1999/06/28 15:47:04 aforti Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// ------------------------------------------------------------
// GEANT 4 class header file
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, CN Division, ASD group
// History: first implementation, based on object model of
// 2nd December 1995, G.Cosmo
// ------------ G4LowEnergyPhotoElectric physics process ------
// by Michel Maire, April 1996
// ************************************************************
// 12-06-96, Added SelectRandomAtom() method and new data member
// for cumulative total cross section, by M.Maire
// 21-06-96, SetCuts implementation, M.Maire
// 17-09-96, Dynamic array PartialSumSigma
// split ComputeBindingEnergy(), M.Maire
// 08-01-97, crossection table + meanfreepath table, M.Maire
// 13-03-97, adapted for the new physics scheme, M.Maire
// ------------------------------------------------------------
#ifndef G4LowEnergyPhotoElectric_h
#define G4LowEnergyPhotoElectric_h 1
// Base Class Headers
#include "G4VDiscreteProcess.hh"
// Contained Variables Headers
#include "G4LowEnergyUtilities.hh"
#include "G4Gamma.hh"
typedef G4FirstLevel oneShellTable;
typedef G4SecondLevel oneAtomTable;
typedef G4ThirdLevel allAtomTable;
class G4LowEnergyPhotoElectric : public G4VDiscreteProcess{
private:
// hide assignment operator as private
G4LowEnergyPhotoElectric& operator=(const G4LowEnergyPhotoElectric &right);
G4LowEnergyPhotoElectric(const G4LowEnergyPhotoElectric& );
public:
G4LowEnergyPhotoElectric(const G4String& processName ="LowEnPhotoElec");
~G4LowEnergyPhotoElectric();
G4bool IsApplicable(const G4ParticleDefinition&);
void SetCutForLowEnSecPhotons(G4double);
// void SetCutForLowEnSecElectrons(G4double);
void BuildPhysicsTable(const G4ParticleDefinition& PhotonType);
G4double GetMeanFreePath(const G4Track& aTrack,
G4double previousStepSize,
G4ForceCondition* condition);
G4double GetCrossSection(G4DynamicParticle* aDynamicGamma,
G4Element* anElement);
inline G4double GetTransitionShell(G4int k){return(thePrimShVec(k));};
G4VParticleChange* PostStepDoIt(const G4Track& aTrack, const G4Step& aStep);
protected:
virtual G4double ComputeCrossSection(const G4double AtomicNumber,
const G4double IncEnergy);
void BuildCrossSectionTable();
void BuildShellCrossSectionTable();
void BuildBindingEnergyTable();
void BuildFluorTransitionTable();
void BuildMeanFreePathTable();
void BuildZVec();
private:
G4int SelectRandomShell(const G4int AtomIndex, const G4double IncEnergy);
G4Element* SelectRandomAtom(const G4DynamicParticle* aDynamicPhoton,
G4Material* aMaterial);
G4bool SelectRandomTransition(G4int, G4double*, const oneAtomTable*);
G4SecondLevel* theCrossSectionTable;
G4PhysicsTable* theMeanFreePathTable;
allAtomTable* allAtomShellCrossSec;
allAtomTable* theFluorTransitionTable;
G4SecondLevel* theBindingEnergyTable;
G4DataVector thePrimShVec;
G4Data* ZNumVec;
G4Data* ZNumVecFluor;
G4LowEnergyUtilities util;
G4double LowestEnergyLimit;
G4double HighestEnergyLimit;
G4int NumbBinTable;
G4double CutForLowEnergySecondaryPhotons;
G4double MeanFreePath;
};
#include "G4LowEnergyPhotoElectric.icc"
#endif
@@ -0,0 +1,87 @@
// This code implementation is the intellectual property of
// the RD44 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: G4LowEnergyPhotoElectric.icc,v 1.10 1999/07/06 15:03:20 aforti Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// ---------------------------------------------------------------
// GEANT 4 class inlined methods file
//
// For information related to this code contact:
// CERN, CN Division, ASD group
// History: first implementation, based on object model of
// 2nd December 1995, G.Cosmo
// ------------ G4LowEnergyPhotoElectric physics process ---------
// by Michel Maire, April 1996
// ***************************************************************
// 12-06-96, update by M.Maire
// 17-09-96, PartialSumSigma(i)
// split ComputeBinbingEnergy(), M.Maire
// 08-01-97, crossection table + meanfreepath table , M.Maire
// 13-03-97, adapted for the new physics scheme, M.Maire
// 20-11-97, change for lowest energy limit default action
// ---------------------------------------------------------------
inline G4bool G4LowEnergyPhotoElectric::IsApplicable(const G4ParticleDefinition& particle)
{
return ( &particle == G4Gamma::Gamma() );
}
inline G4double
G4LowEnergyPhotoElectric::GetMeanFreePath(const G4Track& aTrack, G4double, G4ForceCondition*){
// returns the gamma mean free path in GEANT4 internal units
const G4DynamicParticle* aDynamicGamma = aTrack.GetDynamicParticle();
G4double GammaEnergy = aDynamicGamma->GetKineticEnergy();
G4Material* aMaterial = aTrack.GetMaterial();
G4bool isOutRange ;
if (GammaEnergy > HighestEnergyLimit){
MeanFreePath = DBL_MAX;
}
else if(GammaEnergy < LowestEnergyLimit){
MeanFreePath = DBL_MIN;
}
else {
MeanFreePath = util.DataLogInterpolation(GammaEnergy,
aMaterial->GetIndex(),
theMeanFreePathTable);
}
return MeanFreePath;
}
inline G4double G4LowEnergyPhotoElectric::GetCrossSection(G4DynamicParticle* aDynamicGamma,
G4Element* anElement)
// gives the microscopic total cross section in GEANT4 internal units
{
G4double crossSection;
G4double GammaEnergy = aDynamicGamma->GetKineticEnergy();
G4bool isOutRange ;
if (GammaEnergy < LowestEnergyLimit || GammaEnergy > HighestEnergyLimit)
crossSection = 0.;
else{
G4int elemZ = (G4int) anElement->GetZ();
const G4FirstLevel* oneAtomCS
= (*theCrossSectionTable)[ZNumVec->index(elemZ)];
crossSection = util.DataLogInterpolation(GammaEnergy, (*(*oneAtomCS)[0]), (*(*oneAtomCS)[1]));
}
return crossSection*barn;
}
@@ -0,0 +1,108 @@
// This code implementation is the intellectual property of
// the RD44 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: G4LowEnergyRayleigh.hh,v 1.3 1999/06/28 15:47:04 aforti Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// ------------------------------------------------------------
// GEANT 4 class header file --- Copyright CERN 1995
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, CN Division, ASD group
// History: first implementation, based on object model of
// 2nd December 1995, G.Cosmo
// ------------ G4LowEnergyRayleigh physics process ------
// by Michel Maire, April 1996
// ************************************************************
// 10-06-96, updated by M.Maire
// 21-06-96, SetCuts implementation, M.Maire
// 06-01-97, crossection table + meanfreepath table, M.Maire
// 17-02-97, New Physics scheme
// 25-02-97, GetMeanFreePath() now is public function
// 12-03-97, new physics scheme again
// ------------------------------------------------------------
#ifndef G4LowEnergyRayleigh_h
#define G4LowEnergyRayleigh_h
// Base Class Headers
#include "G4VDiscreteProcess.hh"
// Contained Variables Headers
#include "G4LowEnergyUtilities.hh"
#include "G4Gamma.hh"
class G4LowEnergyRayleigh : public G4VDiscreteProcess {
private:
// hide assignment operator as private
G4LowEnergyRayleigh& operator=(const G4LowEnergyRayleigh &right);
G4LowEnergyRayleigh(const G4LowEnergyRayleigh& );
public:
G4LowEnergyRayleigh(const G4String& processName ="LowEnRayleigh");
~G4LowEnergyRayleigh();
G4bool IsApplicable(const G4ParticleDefinition&);
void BuildPhysicsTable(const G4ParticleDefinition& GammaType);
G4double GetMeanFreePath(const G4Track& aTrack,
G4double previousStepSize,
G4ForceCondition* condition);
G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step& aStep);
protected:
void BuildFormFactorTable();
void BuildCrossSectionTable();
void BuildMeanFreePathTable();
void BuildZVec();
private:
G4Element* SelectRandomAtom(const G4DynamicParticle*, G4Material*);
G4SecondLevel* theCrossSectionTable;
G4SecondLevel* theFormFactorTable;
G4PhysicsTable* theMeanFreePathTable;
G4Data* ZNumVec;
G4LowEnergyUtilities util;
G4double LowestEnergyLimit; // low energy limit of the crosssection formula
G4double HighestEnergyLimit; // high energy limit of the crosssection formula
G4int NumbBinTable; // number of bins in the crossection table
G4double MeanFreePath; // actual Mean Free Path (current medium)
};
#include "G4LowEnergyRayleigh.icc"
#endif
@@ -0,0 +1,61 @@
// This code implementation is the intellectual property of
// the RD44 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: G4LowEnergyRayleigh.icc,v 1.7 1999/07/06 15:03:20 aforti Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// ---------------------------------------------------------------
// GEANT 4 class inlined methods file
//
// For information related to this code contact:
// CERN, CN Division, ASD group
// History: first implementation, based on object model of
// 2nd December 1995, G.Cosmo
// ------------ G4LowEnergyRayleigh physics process ---------
// by Michel Maire, April 1996
// ***************************************************************
// 10-06-96, updated by M.Maire
// 06-01-97, crossection table + meanfreepath table, M.Maire
// 12-03-97, new Physics scheme
// 21-11-97, change for lowest energy limit default action
// ---------------------------------------------------------------
inline G4bool G4LowEnergyRayleigh::IsApplicable(const G4ParticleDefinition& particle){
return ( &particle == G4Gamma::Gamma() );
}
inline G4double G4LowEnergyRayleigh::GetMeanFreePath(const G4Track& aTrack, G4double, G4ForceCondition*){
// returns the gamma mean free path in GEANT4 internal units
const G4DynamicParticle* aDynamicGamma = aTrack.GetDynamicParticle();
G4double GammaEnergy = aDynamicGamma->GetKineticEnergy();
G4Material* aMaterial = aTrack.GetMaterial();
G4bool isOutRange ;
if (GammaEnergy > HighestEnergyLimit){
MeanFreePath = DBL_MAX;
}
else if(GammaEnergy < LowestEnergyLimit){
MeanFreePath = DBL_MIN;
}
else {
MeanFreePath = util.DataLogInterpolation(GammaEnergy,
aMaterial->GetIndex(),
theMeanFreePathTable);
}
return MeanFreePath;
}
@@ -0,0 +1,198 @@
// This code implementation is the intellectual property of
// the RD44 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: G4LowEnergyUtilities.hh,v 1.1 1999/06/28 15:47:05 aforti Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// ------------------------------------------------------------
// GEANT 4 class header file
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, CN Division, ASD group
// History: first implementation, based on object model of
// 2nd December 1995, G.Cosmo
// ------------ G4LowEnergyPhotoElectric physics process ------
// by Michel Maire, April 1996
// ************************************************************
// 12-06-96, Added SelectRandomAtom() method and new data member
// for cumulative total cross section, by M.Maire
// 21-06-96, SetCuts implementation, M.Maire
// 17-09-96, Dynamic array PartialSumSigma
// split ComputeBindingEnergy(), M.Maire
// 08-01-97, crossection table + meanfreepath table, M.Maire
// 13-03-97, adapted for the new physics scheme, M.Maire
// ------------------------------------------------------------
#ifndef G4LowEnergyUtilities_h
#define G4LowEnergyUtilities_h 1
//#include "G4FirstLevel.hh"
//#include "G4SecondLevel.hh"
#include "G4ThirdLevel.hh"
#include "G4PhysicsVector.hh"
#include "G4PhysicsTable.hh"
typedef G4FirstLevel oneShellTable;
typedef G4SecondLevel oneAtomTable;
typedef G4ThirdLevel allAtomTable;
class G4LowEnergyUtilities
{
public:
G4LowEnergyUtilities();
~G4LowEnergyUtilities();
G4FirstLevel* BuildFirstLevelTables(const G4int, const G4int, const char*);
G4SecondLevel* BuildSecondLevelTables(const G4int, const G4int, const char*);
//inline functions
G4int FindBinLocation(const G4double BinValue, const G4Data& arg);
G4int FindBinLocation(const G4double, const G4PhysicsVector*);
G4double DataLogInterpolation(const G4double,
const G4Data&,
const G4Data&);
G4double DataLogInterpolation(const G4double Argument,
const G4double AtomicNumber,
const G4PhysicsTable* Table);
G4double DataSemiLogInterpolation(const G4double,
const G4Data&,
const G4Data&);
};
inline G4int G4LowEnergyUtilities::FindBinLocation(const G4double arg, const G4Data& vec){
G4int numberOfBin = vec.length();
G4int lowerBound = 0;
G4int upperBound = numberOfBin-1;
do {
G4int midBin = (lowerBound + upperBound)/2;
if( arg < vec[midBin] )
upperBound = midBin-1;
else
lowerBound = midBin+1;
} while (lowerBound <= upperBound);
return upperBound;
};
inline G4double G4LowEnergyUtilities::DataLogInterpolation(const G4double Argument,
const G4Data& argVec,
const G4Data& valVec){
G4int theLoc = FindBinLocation(Argument, argVec);
if(theLoc == argVec.length()-1){
return valVec[theLoc];
}
G4double val1 = valVec[theLoc], val2 = valVec[theLoc+1];
G4double arg1 = argVec[theLoc], arg2 = argVec[theLoc+1];
if(arg1 == 0.0) arg1 = 1e-17; if(val1 == 0.0) val1 = 1e-17;
G4double theVal = (log10(val1)*log10(arg2/Argument)
+log10(val2)*log10(Argument/arg1))/log10(arg2/arg1);
theVal = pow(10,theVal);
return theVal;
};
inline G4int G4LowEnergyUtilities::FindBinLocation(const G4double arg,
const G4PhysicsVector* vec){
if(!vec){
G4Exception("G4LowEnergy: FindBinLocation: Vector Empty "
"probably the program hasn't found data files or data files are empty");
}
G4int numberOfBin = vec->GetVectorLength();
G4int lowerBound = 0;
G4int upperBound = numberOfBin-1;
do {
G4int midBin = (lowerBound + upperBound)/2;
if( arg < vec->GetLowEdgeEnergy(midBin) )
upperBound = midBin-1;
else
lowerBound = midBin+1;
} while (lowerBound <= upperBound);
return upperBound;
}
inline G4double G4LowEnergyUtilities::DataLogInterpolation(const G4double Argument,
const G4double TableIndex,
const G4PhysicsTable* Table){
G4PhysicsVector* theVec = 0;
theVec = (*Table)(TableIndex);
G4int theLoc = FindBinLocation(Argument, theVec);
G4double val1 = (*theVec)(theLoc), val2 = (*theVec)(theLoc+1);
G4double arg1 = theVec->GetLowEdgeEnergy(theLoc), arg2 = theVec->GetLowEdgeEnergy(theLoc+1);
G4double theVal = (log10(val1)*log10(arg2/Argument)
+log10(val2)*log10(Argument/arg1))/log10(arg2/arg1);
theVal = pow(10,theVal);
return theVal;
}
inline G4double G4LowEnergyUtilities::DataSemiLogInterpolation(const G4double Argument,
const G4Data& argVec,
const G4Data& valVec){
G4int theLoc = FindBinLocation(Argument, argVec);
if(theLoc == argVec.length()-1){
return valVec[theLoc];
}
G4double val1 = valVec[theLoc], val2 = valVec[theLoc+1];
G4double arg1 = argVec[theLoc], arg2 = argVec[theLoc+1];
G4double theVal = (val1*log10(arg2/Argument)
+val2*log10(Argument/arg1))/log10(arg2/arg1);
return theVal;
}
#endif
@@ -0,0 +1,50 @@
// This code implementation is the intellectual property of
// the RD44 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.
//
// -------------------------------------------------------------------
// GEANT 4 class file
//
// For information related to this code contact:
// CERN, IT Division, ASD group
// CERN, Geneva, Switzerland
//
// File name: G4SecondLevel.hh
//
// Author: Alessandra Forti (Alessandra.Forti@cern.ch)
//
// Creation date: 1 Giugno 1999
//
// Modifications:
//
// -------------------------------------------------------------------
#ifndef G4SECONDLEVEL_HH
#define G4SECONDLEVEL_HH
#include "G4FirstLevel.hh"
#include <rw/tpordvec.h>
class G4SecondLevel : public RWTPtrOrderedVector< G4FirstLevel >{
public:
~G4SecondLevel();
G4bool operator == (const G4SecondLevel& ) const;
G4bool operator < (const G4SecondLevel&) const;
};
#endif
@@ -0,0 +1,50 @@
// This code implementation is the intellectual property of
// the RD44 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.
//
// -------------------------------------------------------------------
// GEANT 4 class file
//
// For information related to this code contact:
// CERN, IT Division, ASD group
// CERN, Geneva, Switzerland
//
// File name: G4ThirdLevel.hh
//
// Author: Alessandra Forti (Alessandra.Forti@cern.ch)
//
// Creation date: 1 Giugno 1999
//
// Modifications:
//
// -------------------------------------------------------------------
#ifndef G4THIRDLEVEL_HH
#define G4THIRDLEVEL_HH
#include "G4SecondLevel.hh"
#include <rw/tpordvec.h>
class G4ThirdLevel : public RWTPtrOrderedVector< G4SecondLevel >{
public:
virtual ~G4ThirdLevel();
G4bool operator == (const G4ThirdLevel& ) const;
G4bool operator < (const G4ThirdLevel&) const;
};
#endif
@@ -0,0 +1,95 @@
// This code implementation is the intellectual property of
// the RD44 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.
//
// -------------------------------------------------------------------
// GEANT 4 class file
//
// For information related to this code contact:
// CERN, IT Division, ASD group
// CERN, Geneva, Switzerland
//
// File name: G4VDataFile
//
// Author: Alessandra Forti (Alessandra.Forti@cern.ch)
//
// Creation date: 2 February 1999
//
// Modifications:
//
// -------------------------------------------------------------------
#ifndef G4VDataFile_hh
#define G4VDataFile_hh
// Other Class Headers
#include "globals.hh"
#include "G4Data.hh"
// C++ Headers
#include <fstream.h>
class G4VDataFile{
public:
// Constructors
G4VDataFile(const G4String& file);
// Destructor
~G4VDataFile();
// Member Functions
void OpenFile();
void CloseFile();
void Eof();
G4bool IsOpen();
void SeekPos(streampos);
streampos TellPos();
void GetLine();
G4int LineLength();
char* GetBuf();
virtual G4bool FindTheProcess() = 0;
virtual G4bool FindTheElement(G4int) = 0;
virtual G4bool FindOneElemProc(G4int& subsh) = 0;
virtual void GetDataValues(G4Data& valList) = 0;
protected:
// Member Functions
void SetBufferSize(G4int);
private:
const G4String& _filename; // data file name
ifstream _istr;
G4int _bufSize;
char* buf;
};
#endif // G4VDataFile
@@ -0,0 +1,61 @@
// This code implementation is the intellectual property of
// the RD44 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.
//
// -------------------------------------------------------------------
// GEANT 4 class file
//
// For information related to this code contact:
// CERN, IT Division, ASD group
// CERN, Geneva, Switzerland
//
// File name: G4VTables
//
// Author: Alessandra Forti (Alessandra.Forti@cern.ch)
//
// Creation date: 2 February 1999
//
// Modifications:
//
// -------------------------------------------------------------------
#ifndef G4VTables_hh
#define G4VTables_hh
#include "globals.hh"
#include "G4SecondLevel.hh"
class G4VTables{
public:
// Constructors
G4VTables();
// Destructor
~G4VTables();
// Member Functions
// search the data table in the file
virtual void FillDataTable() = 0;
virtual G4SecondLevel* FillTheTable(G4int nemEl = 0) = 0;
protected:
private:
};
#endif // G4VTables
@@ -0,0 +1,46 @@
// This code implementation is the intellectual property of
// the RD44 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.
//
// -------------------------------------------------------------------
// GEANT 4 class file
//
// For information related to this code contact:
// CERN, IT Division, ASD group
// CERN, Geneva, Switzerland
//
// File name: G4Data.hh
//
// Author: Alessandra Forti (Alessandra.Forti@cern.ch)
//
// Creation date: 1 Giugno 1999
//
// Modifications:
//
// -------------------------------------------------------------------
#include "G4Data.hh"
G4Data::~G4Data(){
this->clear();
}
G4bool G4Data::operator == (const G4Data& input) const {
return(this->length() == input.length());
}
G4bool G4Data::operator < (const G4Data& input) const {
return(this->length() < input.length());
}
@@ -0,0 +1,177 @@
// This code implementation is the intellectual property of
// the RD44 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.
//
// -------------------------------------------------------------------
// GEANT 4 class file
//
// For information related to this code contact:
// CERN, IT Division, ASD group
// CERN, Geneva, Switzerland
//
// File name: G4Epdl89File
//
// Author: Alessandra Forti (Alessandra.Forti@cern.ch)
//
// Creation date: 2 February 1999
//
// Modifications:
//
// -------------------------------------------------------------------
// This Class Header
#include "G4Epdl89File.hh"
//C++ Headers
#include "CLHEP/String/Strings.h"
// Constructors
G4Epdl89File::G4Epdl89File(const G4String& filename, G4int* paramVec):
G4VDataFile(filename),
_flags(paramVec)
{
SetBufferSize(80);
}
// Destructor
G4Epdl89File::~G4Epdl89File()
{
}
G4bool G4Epdl89File::FindTheElement(G4int numZ){
G4double llength = LineLength();
G4bool elementFound = FALSE;
HepString flag(GetBuf());
if(numZ){
if(llength == 70){
}
}
return elementFound;
}
G4bool G4Epdl89File::FindTheProcess(){
G4double llength = LineLength();
G4bool tableFound = FALSE;
if(llength == 68){
HepString flag(GetBuf());
if(_flags[0] == flag(0,2).toInt()){
if(_flags[1] == flag(2,3).toInt()){
if(_flags[2] == flag(5,3).toInt()){
G4int subsh;
G4int Xi3 = flag(31,1).toInt();
if(Xi3 == 0){
subsh = flag(22,1).toInt();
}
else if(Xi3 == 1){
subsh = (flag(22,1) + flag(24,1)).toInt();
}
if(_flags[3] == subsh){
tableFound = TRUE;
}
}
}
}
}
return tableFound;
}
G4bool G4Epdl89File::FindOneElemProc(G4int& subsh){
G4double llength = LineLength();
G4bool tableFound = FALSE;
if(llength == 68){
HepString flag(GetBuf());
if(_flags[0] == flag(0,2).toInt()){
if(_flags[1] == flag(2,3).toInt()){
if(_flags[2] == flag(5,3).toInt()){
G4int Xi3 = flag(31,1).toInt();
if(Xi3 == 0){
subsh = flag(22,1).toInt();
}
else if(Xi3 == 1){
subsh = (flag(22,1) + flag(24,1)).toInt();
}
tableFound = TRUE;
}
}
}
}
return tableFound;
}
void G4Epdl89File::GetDataValues(G4Data& valList){
char* token = 0;
G4int i = 0;
do{
if(i == 0){
token = strtok(GetBuf()," ");
}
else{
token = strtok(NULL," ");
}
if(token) {
valList.append(GetOneData(token));
}
i++;
}while(token);
}
G4double G4Epdl89File::GetOneData(const char* token){
HepString parts;
G4double floatTok = 0;
if(token){
parts = token;
floatTok = parts.toFloat();
}
return floatTok;
}
@@ -0,0 +1,188 @@
// This code implementation is the intellectual property of
// the RD44 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.
//
// -------------------------------------------------------------------
// GEANT 4 class file
//
// For information related to this code contact:
// CERN, IT Division, ASD group
// CERN, Geneva, Switzerland
//
// File name: G4Epdl97File
//
// Author: Alessandra Forti (Alessandra.Forti@cern.ch)
//
// Creation date: 2 February 1999
//
// Modifications:
//
// -------------------------------------------------------------------
// This Class Header
#include "G4Epdl97File.hh"
//C++ Headers
#include "CLHEP/String/Strings.h"
// Constructors
G4Epdl97File::G4Epdl97File(const G4String& filename, G4int* paramVec):
G4VDataFile(filename),
_flags(paramVec)
{
SetBufferSize(74);
}
// Destructor
G4Epdl97File::~G4Epdl97File()
{
}
G4bool G4Epdl97File::FindTheElement(G4int numZ){
G4double llength = LineLength();
G4bool elementFound = FALSE;
HepString flag(GetBuf());
if(numZ){
if(llength == 70){
}
}
return elementFound;
}
G4bool G4Epdl97File::FindTheProcess(){
G4double llength = LineLength();
G4bool tableFound = FALSE;
HepString flag(GetBuf());
if(llength == 68 || llength == 69){
if(_flags[0] == flag(0,2).toInt()){
if(_flags[1] == flag(2,3).toInt()){
if(_flags[2] == flag(5,3).toInt()){
G4int subsh;
G4int Xi3 = flag(31,1).toInt();
if(Xi3 == 0){
subsh = flag(22,1).toInt();
}
else if(Xi3 == 1){
subsh = (flag(22,1) + flag(24,1)).toInt();
}
if(_flags[3] == subsh){
tableFound = TRUE;
}
}
}
}
}
return tableFound;
}
G4bool G4Epdl97File::FindOneElemProc(G4int& subsh){
G4double llength = LineLength();
G4bool tableFound = FALSE;
if(llength == 68){
HepString flag(GetBuf());
if(_flags[0] == flag(0,2).toInt()){
if(_flags[1] == flag(2,3).toInt()){
if(_flags[2] == flag(5,3).toInt()){
G4int Xi3 = flag(31,1).toInt();
if(Xi3 == 0){
subsh = flag(22,1).toInt();
}
else if(Xi3 == 1){
subsh = (flag(22,1) + flag(24,1)).toInt();
}
tableFound = TRUE;
}
}
}
}
return tableFound;
}
G4int* G4Epdl97File::GetTheProcFlags(){ return _flags; }
void G4Epdl97File::GetDataValues(G4Data& valList){
char* token = 0;
G4int i = 0;
do{
if(i == 0){
token = strtok(GetBuf()," ");
}
else{
token = strtok(NULL," ");
}
if(token) {
valList.append(GetOneData(token));
}
i++;
}while(token);
}
G4double G4Epdl97File::GetOneData(const char* token){
HepString parts, tot;
G4double floatTok = 0;
if(token){
parts = token;
if(parts(8,1) == "-" || parts(8,1) == "+"){
tot = parts(0,8) + "E" + parts(8,2);
}
else{
tot = parts(0,7) + "E" + parts(7,3);
}
floatTok = tot.toFloat();
}
return floatTok;
}
@@ -0,0 +1,337 @@
// This code implementation is the intellectual property of
// the RD44 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.
//
// -------------------------------------------------------------------
// GEANT 4 class file
//
// For information related to this code contact:
// CERN, IT Division, ASD group
// CERN, Geneva, Switzerland
//
// File name: G4EpdlTables
//
// Author: Alessandra Forti (Alessandra.Forti@cern.ch)
//
// Creation date: 2 February 1999
//
// Modifications:
//
// -------------------------------------------------------------------
// This class header
#include "G4EpdlTables.hh"
// Other Class Headers
#include "G4VDataFile.hh"
#include "G4DataVector.hh"
#include "G4PhysicsFreeVector.hh"
#include "CLHEP/String/Strings.h"
// C++ Headers
#include <iostream.h>
#include <fstream.h>
// Constructors
G4EpdlTables::G4EpdlTables(G4VDataFile& DFile):
G4VTables(),
datfile(DFile)
{
theDataTable1 = 0;
theDataTable2 = 0;
theDataTable3 = 0;
// allElementList = 0;
}
// Destructor
G4EpdlTables::~G4EpdlTables()
{
}
// Member Functions
void G4EpdlTables::FillDataTable() {
// line counters
G4int numTable = 0;
// variables to flag 68 characters lines
G4bool lineMatch = FALSE;
// list of data vectors to be filled
G4FirstLevel vecList;
G4int numBin = 100;
if(theDataTable1){
theDataTable1->clearAndDestroy(); delete theDataTable1;
}
if(theDataTable2){
theDataTable2->clearAndDestroy(); delete theDataTable2;
}
if(theDataTable3){
theDataTable3->clearAndDestroy(); delete theDataTable3;
}
theDataTable1 = new G4PhysicsTable(numBin);
theDataTable2 = new G4PhysicsTable(numBin);
theDataTable3 = new G4PhysicsTable(numBin);
//open input file
datfile.OpenFile();
// loop on the stream
for(;;){
datfile.Eof();
datfile.GetLine();
// lines counters
G4int llength = datfile.LineLength();
if(llength == 0) break;
if(llength == 70){
HepString AtomicNum(datfile.GetBuf());
G4int numAtom = AtomicNum(0,3).toInt();
}
// search for the process flags line
if(llength == 68 || llength == 69) {
lineMatch = datfile.FindTheProcess();
continue;
}
G4double lvl;
if(llength < 68){
if(lineMatch == TRUE){
//list of values in one line
G4Data values;
datfile.GetDataValues(values);
lvl = values.length();
if(!vecList.entries()){
for(G4int k = 0; k < lvl; k++){
vecList.insert(new G4Data);
}
}
for(G4int h = 0; h < lvl; h++){
vecList[h]->append(values[h]);
}
// Clear the temporary list
values.clear();
}
}
if(llength == 72 || llength == 73){
// build the G4PhysicsTables
if(lineMatch == TRUE){
if(lvl >= 1){
G4PhysicsFreeVector* freevec;
freevec = new G4PhysicsFreeVector(*vecList[0],*vecList[1]);
theDataTable1->insertAt(numTable, freevec);
if(lvl == 3){
freevec = new G4PhysicsFreeVector(*vecList[0],*vecList[2]);
theDataTable2->insertAt(numTable, freevec);
}
if(lvl == 4){
freevec = new G4PhysicsFreeVector(*vecList[0],*vecList[2]);
theDataTable2->insertAt(numTable, freevec);
freevec = new G4PhysicsFreeVector(*vecList[0],*vecList[3]);
theDataTable3->insertAt(numTable, freevec);
}
}
numTable++;
lineMatch = FALSE;
vecList.clearAndDestroy();
if(numTable == 99){
break;
}
}
}
}// end for(;;)
if(theDataTable1->length() == 0){
delete theDataTable1;
}
if(theDataTable2->length() == 0){
delete theDataTable2;
}
if(theDataTable3->length() == 0){
delete theDataTable3;
}
} // end FillDataTable
//G4SecondLevel* G4EpdlTables::GetGlobalList(){
//return new G4SecondLevel((*allElementList));
//////}
G4SecondLevel* G4EpdlTables::FillTheTable(G4int numEl) {
// line counters
G4int numTable = 0;
// variables to flag 68 characters lines
G4bool lineMatch = FALSE;
// list of data vectors to be filled
G4FirstLevel* vecList = new G4FirstLevel();
// if(allElementList){
//delete allElementList;
//}
G4SecondLevel* allElementList = new G4SecondLevel();
//open input file
datfile.OpenFile();
// loop on the stream
G4int subSh = 0;
for(;;){
datfile.Eof();
datfile.GetLine();
// lines counters
G4int llength = datfile.LineLength();
if(llength == 0) break;
G4int numAtom;
if(llength == 70){
HepString AtomicNum(datfile.GetBuf());
numAtom = AtomicNum(0,3).toInt();
}
// search for the process flags line
if(llength == 68 || llength == 69) {
if(numEl){
if(numEl != numAtom){
continue;
}
else{
lineMatch = datfile.FindOneElemProc(subSh);
}
}
else{
lineMatch = datfile.FindTheProcess();
}
continue;
}
G4double lvl;
if(llength < 68){
if(lineMatch == TRUE){
//list of values in one line
G4Data values;
datfile.GetDataValues(values);
lvl = values.length();
if(!vecList->entries()){
for(G4int k = 0; k < lvl; k++){
vecList->insert(new G4Data);
}
}
for(G4int h = 0; h < lvl; h++){
(*vecList)[h]->insert(values[h]);
}
// Clear the temporary list
values.clear();
}
}
if(llength == 72 || llength == 73){
// build the G4PhysicsTables
if(lineMatch == TRUE){
allElementList->insert(vecList);
numTable++;
lineMatch = FALSE;
vecList = new G4FirstLevel();
if(numTable == 99){
break;
}
}
}
}// end for(;;)
return allElementList;
} // end FillDataTable
@@ -0,0 +1,45 @@
// This code implementation is the intellectual property of
// the RD44 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.
//
// -------------------------------------------------------------------
// GEANT 4 class file
//
// For information related to this code contact:
// CERN, IT Division, ASD group
// CERN, Geneva, Switzerland
//
// File name: G4FirstLevel.hh
//
// Author: Alessandra Forti (Alessandra.Forti@cern.ch)
//
// Creation date: 1 Giugno 1999
//
// Modifications:
//
// -------------------------------------------------------------------
#include "G4FirstLevel.hh"
G4FirstLevel::~G4FirstLevel(){
this->clearAndDestroy();
}
G4bool G4FirstLevel::operator == (const G4FirstLevel& input) const{
return( this->entries() == input.entries());
}
G4bool G4FirstLevel::operator < (const G4FirstLevel& input) const{
return(this->entries() < input.entries());
}
@@ -0,0 +1,870 @@
// This code implementation is the intellectual property of
// the RD44 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: G4LowEnergyBremsstrahlung.cc,v 1.13 1999/07/06 14:35:47 aforti Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// --------------------------------------------------------------
// GEANT 4 class implementation file
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, IT Division, ASD group
// History: first implementation, based on object model of
// 2nd December 1995, G.Cosmo
// ------------ G4LowEnergyBremsstrahlung physics process --------
// by Michel Maire, 24 July 1996
// **************************************************************
// 26-09-96 : extension of the total crosssection above 100 GeV, M.Maire
// 1-10-96 : new type G4OrderedTable; ComputePartialSumSigma(), M.Maire
// 16-10-96 : DoIt() call to the non static GetEnergyCuts(), L.Urban
// 13-12-96 : Sign corrected in grejmax and greject
// error definition of screenvar, L.Urban
// 20-03-97 : new energy loss+ionisation+brems scheme, L.Urban
// 07-04-98 : remove 'tracking cut' of the diffracted particle, MMa
// 13-08-98 : new methods SetBining() PrintInfo()
// --------------------------------------------------------------
// This Class Header
#include "G4LowEnergyBremsstrahlung.hh"
// Collaborating Class Headers
#include "G4EnergyLossTables.hh"
#include "G4UnitsTable.hh"
#include "G4Gamma.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
// constructor
G4LowEnergyBremsstrahlung::G4LowEnergyBremsstrahlung(const G4String& processName)
: G4eEnergyLoss(processName), // initialization
theCrossSectionTable(0),
theMeanFreePathTable(0),
ATable(0),
BTable(0),
ZNumVec(0),
LowestKineticEnergy (250.*eV),
HighestKineticEnergy(100.*GeV),
lowEnergyCut(0.1*eV),
CutForLowEnergySecondaryPhotons(0.),
TotBin(200)
{
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
// destructor
G4LowEnergyBremsstrahlung::~G4LowEnergyBremsstrahlung()
{
if (theMeanFreePathTable) {
theMeanFreePathTable->clearAndDestroy();
delete theMeanFreePathTable;
}
if (theCrossSectionTable) {
delete theCrossSectionTable;
}
if(ZNumVec){
ZNumVec->clear();
delete ZNumVec;
}
if (ATable) {
delete ATable;
}
if (BTable) {
delete BTable;
}
if (&PartialSumSigma) {
PartialSumSigma.clearAndDestroy();
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4LowEnergyBremsstrahlung::SetPhysicsTableBining(G4double lowE, G4double highE, G4int nBins)
{
LowestKineticEnergy = lowE; HighestKineticEnergy = highE; TotBin = nBins;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4LowEnergyBremsstrahlung::SetCutForLowEnSecPhotons(G4double cut){
CutForLowEnergySecondaryPhotons = cut;
}
void G4LowEnergyBremsstrahlung::BuildPhysicsTable(const G4ParticleDefinition& aParticleType)
// just call BuildLossTable+BuildLambdaTable
{
BuildLossTable(aParticleType) ;
if (&aParticleType==G4Electron::Electron()){
RecorderOfElectronProcess[CounterOfElectronProcess] = (*this).theLossTable ;
CounterOfElectronProcess++;
}
else{
RecorderOfPositronProcess[CounterOfPositronProcess] = (*this).theLossTable ;
CounterOfPositronProcess++;
}
BuildZVec();
BuildCrossSectionTable() ;
BuildMeanFreePathTable() ;
BuildDEDXTable (aParticleType) ;
// smpling energy formula coefficient
BuildATable();
BuildBTable();
// if(&aParticleType==G4Electron::Electron())
// PrintInfoDefinition();
//}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4LowEnergyBremsstrahlung::BuildCrossSectionTable(){
if (theCrossSectionTable) {
delete theCrossSectionTable;
}
theCrossSectionTable = new G4SecondLevel();
G4int dataNum = 2;
for(G4int TableInd = 0; TableInd < ZNumVec->entries(); TableInd++){
G4int AtomInd = (G4int) (*ZNumVec)[TableInd];
G4FirstLevel* oneAtomCS = util.BuildFirstLevelTables(AtomInd, dataNum, "brem/br-cs-");
theCrossSectionTable->insert(oneAtomCS);
}//end for on atoms
}
void G4LowEnergyBremsstrahlung::BuildATable(){
if (ATable) {
delete ATable;
}
G4int dataNum = 2;
ATable = util.BuildSecondLevelTables(0,dataNum,"brem/br-co-a");
}
void G4LowEnergyBremsstrahlung::BuildBTable(){
if (BTable) {
delete BTable;
}
G4int dataNum = 2;
BTable = util.BuildFirstLevelTables(0, dataNum, "brem/br-co-b");
}
void G4LowEnergyBremsstrahlung::BuildZVec(){
const G4MaterialTable* theMaterialTable=G4Material::GetMaterialTable();
G4int numOfMaterials = theMaterialTable->length();
if(ZNumVec){
ZNumVec->clear();
delete ZNumVec;
}
ZNumVec = new G4Data();
for (G4int J=0 ; J < numOfMaterials; J++){
const G4Material* material= (*theMaterialTable)[J];
const G4ElementVector* theElementVector = material->GetElementVector();
const G4int NumberOfElements = material->GetNumberOfElements() ;
for (G4int iel=0; iel<NumberOfElements; iel++ ){
G4double Zel = (*theElementVector)(iel)->GetZ();
if(ZNumVec->contains(Zel) == FALSE){
ZNumVec->insert(Zel);
}
else{
continue;
}
}
}
}
void G4LowEnergyBremsstrahlung::BuildLossTable(const G4ParticleDefinition& aParticleType)
// Build table for energy loss due to soft brems
// tables are built for *MATERIALS*
{
G4double KineticEnergy,TotalEnergy,bremloss,Z,x,
losslim,loss,rate,natom,Cut;
const G4double MinKinEnergy = 1.*keV;
const G4double MinCut = 1.*keV;
const G4double Thigh = 100.*GeV;
const G4double Cuthigh = 50.*GeV;
const G4double Factorhigh = 36./(1450.*GeV);
const G4double coef1 = -0.5, coef2 = 2./9.;
ParticleMass = aParticleType.GetPDGMass() ;
G4double* GammaCutInKineticEnergy = G4Gamma::Gamma()->GetEnergyCuts();
// create table
const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable();
G4int numOfMaterials = theMaterialTable->length() ;
if (theLossTable) { theLossTable->clearAndDestroy();
delete theLossTable;
}
theLossTable = new G4PhysicsTable(numOfMaterials);
// loop for materials
for (G4int J=0; J<numOfMaterials; J++)
{
// create physics vector and fill it
G4PhysicsLogVector* aVector = new G4PhysicsLogVector(
LowestKineticEnergy,HighestKineticEnergy,TotBin);
// get elements in the material
const G4Material* material = (*theMaterialTable)[J];
const G4ElementVector* theElementVector = material->GetElementVector();
const G4double* theAtomicNumDensityVector = material->GetAtomicNumDensityVector();
const G4int NumberOfElements = material->GetNumberOfElements();
// loop for the kinetic energy values
for (G4int i=0; i<TotBin; i++){
KineticEnergy = aVector->GetLowEdgeEnergy(i) ;
TotalEnergy = KineticEnergy+ParticleMass ;
Cut = GammaCutInKineticEnergy[J] ;
if (Cut < MinCut) Cut = MinCut ;
if (Cut > KineticEnergy) Cut = KineticEnergy ;
bremloss = 0.;
if (KineticEnergy>MinKinEnergy)
{
if (Cut > KineticEnergy) Cut = KineticEnergy ;
// loop for elements in the material
for (G4int iel=0; iel<NumberOfElements; iel++)
{
Z=(*theElementVector)(iel)->GetZ();
natom = theAtomicNumDensityVector[iel] ;
if (KineticEnergy <= Thigh)
{
//loss for MinKineticEnergy<KineticEnergy<=100 GeV
x=log(TotalEnergy/ParticleMass);
loss = ComputeBremLoss(Z,natom,KineticEnergy,Cut,x) ;
if (&aParticleType==G4Positron::Positron())
loss *= ComputePositronCorrFactorLoss(Z,KineticEnergy,Cut) ;
}
else
{
// extrapolation for KineticEnergy>100 GeV
x=log(Thigh/ParticleMass) ;
if (Cut<Thigh)
{
losslim = ComputeBremLoss(Z,natom,Thigh,Cut,x) ;
if (&aParticleType==G4Positron::Positron())
loss *= ComputePositronCorrFactorLoss(Z,Thigh,Cut) ;
rate = Cut/TotalEnergy ;
loss = losslim*(1.+coef1*rate+coef2*rate*rate) ;
rate = Cut/Thigh ;
loss /= (1.+coef1*rate+coef2*rate*rate) ;
}
else
{
losslim = ComputeBremLoss(Z,natom,Thigh,Cuthigh,x) ;
if (&aParticleType==G4Positron::Positron())
loss *= ComputePositronCorrFactorLoss(Z,Thigh,Cuthigh) ;
rate = Cut/TotalEnergy ;
loss = losslim*(1.+coef1*rate+coef2*rate*rate) ;
loss *= Factorhigh*Cut ;
}
}
bremloss += natom*loss;
}
}
// now compute the correction due to the LPM effect
const G4double MigdalConstant = classic_electr_radius*
electron_Compton_length*
electron_Compton_length/pi ;
const G4double LPMconstant = fine_structure_const*electron_mass_c2*
electron_mass_c2/(8.*pi*hbarc) ;
const G4double kmin = 1.*eV ;
const G4double klim = 1.*keV ;
G4double LPMEnergy = LPMconstant*(material->GetRadlen()) ;
G4double TotalEnergysquare = TotalEnergy*TotalEnergy ;
G4double LPMGammaEnergyLimit = TotalEnergysquare/LPMEnergy ;
if(LPMGammaEnergyLimit > klim)
{
G4double kmax = min(Cut,LPMGammaEnergyLimit) ;
G4double floss = 0. ;
G4int nmax = 1000 ;
G4int nn ;
G4double vmin=log(kmin);
G4double vmax=log(Cut) ;
nn = int(nmax*(vmax-vmin)/(log(HighestKineticEnergy)-vmin)) ;
G4double u,uu,s2lpm,sp,fac,c,v,dv,w ;
dv = (vmax-vmin)/nn ;
v = vmin-dv ;
for(G4int n=0; n<=nn; n++)
{
v += dv ;
u = exp(v) ;
uu = u*u ;
if(u<=kmax)
{
s2lpm=LPMEnergy*u/TotalEnergysquare ;
sp=uu/(uu+MigdalConstant*TotalEnergysquare*
(material->GetElectronDensity())) ;
w=s2lpm*(1.+1./sp) ;
fac=0.5*(sqrt(w*w+4.*s2lpm)-w)/sp;
if(fac>1.)
fac=1. ;
}
else
{
fac=1. ;
}
fac *= uu*u ;
if((n==0)||(n==nn))
c=0.5;
else
c=1.;
fac *= c ;
floss += fac ;
}
floss *=dv*3./(Cut*Cut*Cut-kmin*kmin*kmin) ;
if(floss > 1.) floss = 1. ;
// correct the loss
bremloss *= floss ;
}
if(bremloss < 0.) bremloss = 0. ;
aVector->PutValue(i,bremloss);
}
theLossTable->insert(aVector);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4LowEnergyBremsstrahlung::ComputeXYPolynomial(G4double x, G4double y,
G4int xSize, G4int ySize,
const G4double coeff[])
{
// Computes the polynomial (1 y y^2 ...) * matrix * (1 x x^2 ...) .
// xSize and ySize are the dimensions of the matrix,
// coeff containts the elements, stored row-wise.
G4double* a= new G4double[xSize];
G4int i, j;
for (i=0; i<xSize; i++) a[i]= 0.0;
G4int index= 0; G4double yy= 1.0;
for (j=0; j<ySize; j++)
{ for (i=0; i<xSize; i++) a[i]+= coeff[index++]*yy;
yy*= y;
}
G4double r= a[0]; G4double xx= x;
for (i=1; i<xSize; i++) { r+= a[i]*xx; xx*= x;}
delete[] a;
return r;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4LowEnergyBremsstrahlung::ComputeBremLoss(G4double Z,G4double natom,
G4double T,G4double Cut,G4double x)
// compute loss due to soft brems
// 'Migdal' version , this is the default in GEANT3
{
const G4double beta=0.99,ksi=2.51,ve=0.00004 ;
const G4double corrfac = classic_electr_radius*electron_Compton_length*electron_Compton_length/pi ;
static const G4double
CMbarn[]= {
-0.960613e-1, 0.631029e-1,-0.142819e-1, 0.150437e-2,-0.733286e-4, 0.131404e-5,
0.859343e-1,-0.529023e-1, 0.131899e-1,-0.159201e-2, 0.926958e-4,-0.208439e-5,
-0.684096e+1, 0.370364e+1,-0.786752e0, 0.822670e-1,-0.424710e-2, 0.867980e-4,
-0.200856e+1, 0.129573e+1,-0.306533e0, 0.343682e-1,-0.185931e-2, 0.392432e-4,
0.127538e+1,-0.515705e0, 0.820644e-1,-0.641997e-2, 0.245913e-3,-0.365789e-5,
0.115792e0, -0.463143e-1, 0.725442e-2,-0.556266e-3, 0.208049e-4,-0.300895e-6};
static const G4double
CPbarn[]= {
-0.960613e-1, 0.631029e-1,-0.142819e-1, 0.150437e-2,-0.733286e-4, 0.131404e-5,
0.859343e-1,-0.529023e-1, 0.131899e-1,-0.159201e-2, 0.926958e-4,-0.208439e-5,
-0.271082e-1, 0.173949e-1,-0.452531e-2, 0.569405e-3,-0.344856e-4, 0.803964e-6,
0.419855e-2,-0.277188e-2, 0.737658e-3,-0.939463e-4, 0.569748e-5,-0.131737e-6,
-0.318752e-3, 0.215144e-3,-0.579787e-4, 0.737972e-5,-0.441485e-6, 0.994726e-8,
0.938233e-5,-0.651642e-5, 0.177303e-5,-0.224680e-6, 0.132080e-7,-0.288593e-9};
static const G4double
CCMbarn[]= {
-0.245667e-3, 0.833406e-4,-0.129217e-4, 0.915099e-6,-0.247179e-7,
0.147696e-3,-0.498793e-4, 0.402375e-5, 0.989281e-7,-0.133378e-7,
-0.737702e-2, 0.333057e-2,-0.553141e-3, 0.402464e-4,-0.107977e-5,
-0.641533e-2, 0.290113e-2,-0.477641e-3, 0.342008e-4,-0.900582e-6,
0.574303e-5, 0.908521e-4,-0.256900e-4, 0.239921e-5,-0.741271e-7};
static const G4double
CCPbarn[]= {
-0.245667e-3, 0.833406e-4,-0.129217e-4, 0.915099e-6,-0.247179e-7,
0.147696e-3,-0.498793e-4, 0.402375e-5, 0.989281e-7,-0.133378e-7,
-0.341260e-4, 0.971711e-5,-0.172031e-6,-0.119455e-6, 0.704166e-8,
0.341740e-5,-0.775867e-6,-0.653231e-7, 0.225605e-7,-0.114860e-8,
-0.119391e-6, 0.194885e-7, 0.588959e-8,-0.127589e-8, 0.608247e-10};
G4double CM[36],CP[36],CCM[25],CCP[25]; //Set the unit: barn
for (G4int i=0; i<36; i++) { CM[i] = CMbarn[i]*barn;
CP[i] = CPbarn[i]*barn;
}
for (G4int ii=0; ii<25; ii++) { CCM[ii] = CCMbarn[ii]*barn;
CCP[ii] = CCPbarn[ii]*barn;
}
// -----------------------------------------------------------
G4double TotalEnergy = T + electron_mass_c2;
G4double y=log(Cut/(ve*TotalEnergy));
G4double loss;
if (y <= 0.) loss = ComputeXYPolynomial(x, y, 6, 6, CM)
+ Z * ComputeXYPolynomial(x, y, 5, 5, CCM);
else loss = ComputeXYPolynomial(x, y, 6, 6, CP)
+ Z * ComputeXYPolynomial(x, y, 5, 5, CCP);
G4double rate = TotalEnergy/Cut ;
G4double corr = 1./(1.+corrfac*natom*rate*rate) ;
G4double factor = pow(Cut*corr/T,beta);
factor *= Z*(Z+ksi)*TotalEnergy*TotalEnergy/(TotalEnergy+electron_mass_c2) ;
loss *= factor ;
return loss ;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4LowEnergyBremsstrahlung::ComputePositronCorrFactorLoss(
G4double Z,G4double KineticEnergy,G4double GammaCut)
//calculates the correction factor for the energy loss due to bremsstrahlung for positrons
//the same correction is in the (discrete) bremsstrahlung
{
static const G4double K = 132.9416*eV ;
static const G4double a1=4.15e-1, a3=2.10e-3, a5=54.0e-5 ;
G4double x = log(KineticEnergy/(K*Z*Z)), x2 = x*x, x3 = x2*x;
G4double eta = 0.5+atan(a1*x+a3*x3+a5*x3*x2)/pi;
G4double e0 = GammaCut/KineticEnergy;
G4double factor(0.);
if (e0!=1.0) { factor=log(1.-e0)/eta; factor=exp(factor);}
factor = eta*(1.-factor)/e0;
return factor;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4LowEnergyBremsstrahlung::BuildMeanFreePathTable()
// Build mean free path tables for the gamma emission by e- or e+.
// tables are Build for MATERIALS.
{
G4double FixedEnergy = (LowestKineticEnergy + HighestKineticEnergy)/2.;
//create table
if (theMeanFreePathTable) {theMeanFreePathTable->clearAndDestroy();
delete theMeanFreePathTable;
}
G4double NumbOfMaterials = G4Material::GetNumberOfMaterials();
const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable();
G4Material* material;
PartialSumSigma.resize(NumbOfMaterials);
G4double LowEdgeEnergy , Value;
theMeanFreePathTable = new G4PhysicsTable(NumbOfMaterials);
G4PhysicsLogVector* ptrVector;
for ( G4int J=0 ; J < NumbOfMaterials; J++ ){
//create physics vector then fill it ....
ptrVector = new G4PhysicsLogVector(LowestKineticEnergy, HighestKineticEnergy,
TotBin ) ;
material= (*theMaterialTable)(J);
const G4ElementVector* theElementVector = material->GetElementVector();
const G4double* theAtomNumDensityVector = material->GetAtomicNumDensityVector();
for ( G4int i = 0 ; i < TotBin ; i++ ){
LowEdgeEnergy = ptrVector->GetLowEdgeEnergy( i ) ;
const G4double BigPath= DBL_MAX;
G4double SIGMA = 0 ;
for ( G4int k=0 ; k < material->GetNumberOfElements() ; k++ ){
G4int AtomIndex = (G4int) (*theElementVector)(k)->GetZ();
const G4FirstLevel* oneAtomCS
= (*theCrossSectionTable)[ZNumVec->index(AtomIndex)];
G4double interCrsSec = util.DataLogInterpolation(LowEdgeEnergy,
(*(*oneAtomCS)[0]),
(*(*oneAtomCS)[1]))*barn;
SIGMA += theAtomNumDensityVector[k]*interCrsSec;
}
Value = SIGMA<=0.0 ? BigPath : 1./SIGMA ;
ptrVector->PutValue( i , Value ) ;
}
theMeanFreePathTable->insert( ptrVector );
// Compute the PartialSumSigma table at a given fixed energy
ComputePartialSumSigma(FixedEnergy, material) ;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4LowEnergyBremsstrahlung::ComputePartialSumSigma(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();
G4int NbOfElements = aMaterial->GetNumberOfElements();
const G4ElementVector* theElementVector = aMaterial->GetElementVector();
const G4double* theAtomNumDensityVector = aMaterial->GetAtomicNumDensityVector();
PartialSumSigma(Imate) = new G4ValVector(NbOfElements);
G4double SIGMA = 0. ;
for ( G4int Ielem=0 ; Ielem < NbOfElements ; Ielem++ ){
G4int AtomIndex = (G4int) (*theElementVector)(Ielem)->GetZ();
const G4FirstLevel* oneAtomCS
= (*theCrossSectionTable)[ZNumVec->index(AtomIndex)];
G4double interCrsSec = util.DataLogInterpolation(KineticEnergy,
(*(*oneAtomCS)[0]),
(*(*oneAtomCS)[1]))*barn;
SIGMA += theAtomNumDensityVector[Ielem]*interCrsSec;
PartialSumSigma(Imate)->insert(SIGMA);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4VParticleChange* G4LowEnergyBremsstrahlung::PostStepDoIt(const G4Track& trackData,
const G4Step& stepData){
//
// The emitted gamma energy is sampled using a parametrized formula from L. Urban.
// This parametrization is derived from :
// cross-section values of Seltzer and Berger for electron energies 1 keV - 10 GeV,
// screened Bethe Heilter differential cross section above 10 GeV,
// Migdal corrections in both case.
// Seltzer & Berger: Nim B 12:95 (1985)
// Nelson, Hirayama & Rogers: Technical report 265 SLAC (1985)
// Migdal: Phys Rev 103:1811 (1956); Messel & Crawford: Pergamon Press (1970)
//
// A modified version of the random number techniques of Butcher & Messel is used
// (Nuc Phys 20(1960),15).
//
// GEANT4 internal units.
//
const G4double MigdalConstant = classic_electr_radius
*electron_Compton_length
*electron_Compton_length/pi;
const G4double LPMconstant = fine_structure_const*electron_mass_c2*
electron_mass_c2/(8.*pi*hbarc) ;
aParticleChange.Initialize(trackData);
G4Material* aMaterial=trackData.GetMaterial() ;
G4double LPMEnergy = LPMconstant*(aMaterial->GetRadlen()) ;
const G4DynamicParticle* aDynamicParticle=trackData.GetDynamicParticle();
G4double charge = aDynamicParticle->GetDefinition()->GetPDGCharge();
G4double ElectKinEn = aDynamicParticle->GetKineticEnergy();
if(ElectKinEn <= LowestKineticEnergy){
aParticleChange.SetStatusChange(fStopAndKill);
aParticleChange.SetEnergyChange(0.);
aParticleChange.SetLocalEnergyDeposit(ElectKinEn);
return G4VContinuousDiscreteProcess::PostStepDoIt(trackData,stepData);
}
G4ParticleMomentum ElectDirection = aDynamicParticle->GetMomentumDirection();
// Gamma production cut in this material
G4double GammaEnergyCut = (G4Gamma::GetCutsInEnergy())[aMaterial->GetIndex()];
// check against insufficient energy
if (ElectKinEn < GammaEnergyCut){
aParticleChange.SetMomentumChange( ElectDirection );
aParticleChange.SetEnergyChange( ElectKinEn );
aParticleChange.SetLocalEnergyDeposit (0.);
aParticleChange.SetNumberOfSecondaries(0);
return G4VContinuousDiscreteProcess::PostStepDoIt(trackData,stepData);
}
// select randomly one element constituing the material
G4Element* anElement = SelectRandomAtom(aMaterial);
// limits of the energy sampling
G4double TotalEnergy = ElectKinEn + electron_mass_c2;
G4double TotalEnergysquare = TotalEnergy*TotalEnergy ;
G4double LPMGammaEnergyLimit = TotalEnergysquare/LPMEnergy ;
//
// sample the energy rate of the emitted gamma for electron kinetic energy
// sampling formula: spet(T) = A(T)/E+B(T)
//
G4double p1 = 0, p2 = 0;
G4double coeffA = 0, coeffB = 0;
G4int AtomicNum = (G4int) anElement->GetZ();
coeffA = ComputeA(AtomicNum, ElectKinEn);
coeffB = ComputeB(AtomicNum, ElectKinEn);
p1 = coeffA*log(ElectKinEn/lowEnergyCut);
p2 = coeffB*(ElectKinEn - lowEnergyCut);
G4double IntegrProb = p1+p2;
G4double R1 = G4UniformRand()*IntegrProb;
G4double GammaEnergy;
if(R1 <= p1){
G4double R2 = G4UniformRand();
GammaEnergy = ElectKinEn*pow((lowEnergyCut/ElectKinEn),R2);
}
else if(p1 < R1 <= p1+p2){
G4double R2 = G4UniformRand();
GammaEnergy = ElectKinEn - R2*(ElectKinEn - lowEnergyCut);
}
// now comes the supression due to the LPM effect I leave it
if(GammaEnergy < LPMGammaEnergyLimit){
G4double S2LPM = LPMEnergy*GammaEnergy/TotalEnergysquare ;
G4double Spol = GammaEnergy*GammaEnergy/(GammaEnergy*GammaEnergy +
MigdalConstant*(aMaterial->GetElectronDensity())*
TotalEnergysquare) ;
G4double w = S2LPM*(1.+1./Spol) ;
G4double Supr = 0.5*(sqrt(w*w+4.*S2LPM)-w)/Spol ;
if (G4UniformRand() > Supr )
GammaEnergy = 0. ;
}
//protection: DO NOT PRODUCE a gamma with energy 0. !
if (GammaEnergy <= 0.){
return G4VContinuousDiscreteProcess::PostStepDoIt(trackData,stepData);
}
//**********************//
// Angular distribution //
//**********************//
// angles of the emitted gamma. ( Z - axis along the parent particle)
//
// universal distribution suggested by L. Urban (Geant3 manual (1993) Phys211),
// derived from Tsai distribution (Rev Mod Phys 49,421(1977))
if(GammaEnergy > CutForLowEnergySecondaryPhotons){
G4double u;
const G4double a1 = 0.625 , a2 = 3.*a1 , d = 27. ;
if (9./(9.+d) > G4UniformRand()) u = - log(G4UniformRand()*G4UniformRand())/a1 ;
else u = - log(G4UniformRand()*G4UniformRand())/a2 ;
G4double Teta = u*electron_mass_c2/TotalEnergy ;
G4double Phi = twopi * G4UniformRand() ;
G4double dirx = sin(Teta)*cos(Phi) , diry = sin(Teta)*sin(Phi) , dirz = cos(Teta) ;
G4ThreeVector GammaDirection ( dirx, diry, dirz);
GammaDirection.rotateUz(ElectDirection);
//
// Update the incident particle
//
G4double NewKinEnergy = ElectKinEn - GammaEnergy;
if (NewKinEnergy > 0.){
aParticleChange.SetMomentumChange( ElectDirection );
aParticleChange.SetEnergyChange( NewKinEnergy );
if(GammaEnergy < GammaEnergyCut){
aParticleChange.SetLocalEnergyDeposit (GammaEnergy);
}
else{
// create G4DynamicParticle object for the Gamma
G4DynamicParticle* aGamma= new G4DynamicParticle (G4Gamma::Gamma(),
GammaDirection, GammaEnergy);
aParticleChange.SetNumberOfSecondaries(1);
aParticleChange.AddSecondary(aGamma);
aParticleChange.SetLocalEnergyDeposit (0);
}
}
else{
aParticleChange.SetEnergyChange( 0. );
aParticleChange.SetLocalEnergyDeposit (0.);
if (charge<0.){
aParticleChange.SetStatusChange(fStopAndKill);
}
else{
aParticleChange.SetStatusChange(fStopButAlive);
}
}
}
else{
aParticleChange.SetNumberOfSecondaries(0);
}
#ifdef G4VERBOSE
if(verboseLevel > 15){
G4cout<<"LE Bremsstrahlung PostStepDoIt"<<endl;
}
#endif
return G4VContinuousDiscreteProcess::PostStepDoIt(trackData,stepData);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4Element* G4LowEnergyBremsstrahlung::SelectRandomAtom(G4Material* aMaterial) const
{
// select randomly 1 element within the material
const G4int Index = aMaterial->GetIndex();
const G4int NumberOfElements = aMaterial->GetNumberOfElements();
const G4ElementVector* theElementVector = aMaterial->GetElementVector();
G4double rval = G4UniformRand()*((*PartialSumSigma(Index))(NumberOfElements-1));
for ( G4int i=0; i < NumberOfElements; i++ )
if (rval <= (*PartialSumSigma(Index))(i)) return ((*theElementVector)(i));
// G4cout << " WARNING !!! - The Material '"<< aMaterial->GetName()
// << "' has no elements" << endl;
return (*theElementVector)(0);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4LowEnergyBremsstrahlung::PrintInfoDefinition()
{
G4String comments = "Total cross sections from a parametrisation(L.Urban). ";
comments += "Good description from 1 KeV to 100 GeV.\n";
comments += " log scale extrapolation above 100 GeV \n";
comments += " Gamma energy sampled from a parametrised formula.";
G4cout << endl << GetProcessName() << ": " << comments
<< "\n PhysicsTables from " << G4BestUnit(LowestKineticEnergy,"Energy")
<< " to " << G4BestUnit(HighestKineticEnergy,"Energy")
<< " in " << TotBin << " bins. \n";
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,421 @@
// This code implementation is the intellectual property of
// the RD44 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: G4LowEnergyCompton.cc,v 1.12 1999/07/06 15:03:02 aforti Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// --------------------------------------------------------------
// GEANT 4 class implementation file
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, IT Division, ASD group
// History: first implementation, based on object model of
// 2nd December 1995, G.Cosmo
// ------------ G4LowEnergyCompton physics process --------
// by Michel Maire, April 1996
// **************************************************************
// 28-05-96, DoIt() small change in ElecDirection, by M.Maire
// 10-06-96, simplification in ComputeMicroscopicCrossSection(), by M.Maire
// 21-06-96, SetCuts implementation, M.Maire
// 13-09-96, small changes in DoIt for better efficiency. Thanks to P.Urban
// 06-01-97, crossection table + meanfreepath table, M.Maire
// 05-03-97, new Physics scheme, M.Maire
// 28-03-97, protection in BuildPhysicsTable, M.Maire
// 07-04-98, remove 'tracking cut' of the scattered gamma, MMa
// 04-06-98, in DoIt, secondary production condition: range>min(threshold,safety)
// --------------------------------------------------------------
// This Class Header
#include "G4LowEnergyCompton.hh"
// Collaborating Class Headers
#include "G4EnergyLossTables.hh"
#include "G4Electron.hh"
// constructor
G4LowEnergyCompton::G4LowEnergyCompton(const G4String& processName)
: G4VDiscreteProcess(processName),
theCrossSectionTable(0),
theMeanFreePathTable(0),
theScatteringFunctionTable(0),
ZNumVec(0),
LowestEnergyLimit (250*eV), // initialization
HighestEnergyLimit(100*GeV),
NumbBinTable(200)
{
if (verboseLevel>0) {
G4cout << GetProcessName() << " is created "<< endl;
G4cout << "LowestEnergy: " << LowestEnergyLimit/keV << "keV ";
G4cout << "HighestEnergy: " << HighestEnergyLimit/TeV << "TeV " << endl;
}
}
// destructor
G4LowEnergyCompton::~G4LowEnergyCompton()
{
if (theCrossSectionTable) {
delete theCrossSectionTable;
}
if (theScatteringFunctionTable) {
delete theScatteringFunctionTable;
}
if (theMeanFreePathTable) {
theMeanFreePathTable->clearAndDestroy();
delete theMeanFreePathTable;
}
if(ZNumVec){
ZNumVec->clear();
delete ZNumVec;
}
}
// methods.............................................................................
// to change with other functions like in G4eIonization
void G4LowEnergyCompton::BuildPhysicsTable(const G4ParticleDefinition& GammaType){
BuildZVec();
// Build microscopic cross section table and mean free path table
BuildCrossSectionTable();
// Build mean free path table for the Compton Scattering process
BuildMeanFreePathTable();
// build the scattering function table
BuildScatteringFunctionTable();
}
void G4LowEnergyCompton::BuildCrossSectionTable(){
if (theCrossSectionTable) {
delete theCrossSectionTable;
}
theCrossSectionTable = new G4SecondLevel();
G4int dataNum = 2;
for(G4int TableInd = 0; TableInd < ZNumVec->entries(); TableInd++){
G4int AtomInd = (G4int) (*ZNumVec)[TableInd];
G4FirstLevel* oneAtomCS = util.BuildFirstLevelTables(AtomInd, dataNum, "comp/ce-cs-");
theCrossSectionTable->insert(oneAtomCS);
}//end for on atoms
}
void G4LowEnergyCompton::BuildScatteringFunctionTable(){
if (theScatteringFunctionTable) {
delete theScatteringFunctionTable;
}
theScatteringFunctionTable = new G4SecondLevel();
G4int dataNum = 2;
for(G4int TableInd = 0; TableInd < ZNumVec->entries(); TableInd++){
G4int AtomInd = (G4int) (*ZNumVec)[TableInd];
G4FirstLevel* oneAtomSF = util.BuildFirstLevelTables(AtomInd, dataNum, "comp/ce-sf-");
theScatteringFunctionTable->insert(oneAtomSF);
}//end for on atoms
}
void G4LowEnergyCompton::BuildZVec(){
const G4MaterialTable* theMaterialTable=G4Material::GetMaterialTable();
G4int numOfMaterials = theMaterialTable->length();
if(ZNumVec){
ZNumVec->clear();
delete ZNumVec;
}
ZNumVec = new G4Data();
for (G4int J=0 ; J < numOfMaterials; J++){
const G4Material* material= (*theMaterialTable)[J];
const G4ElementVector* theElementVector = material->GetElementVector();
const G4int NumberOfElements = material->GetNumberOfElements() ;
for (G4int iel=0; iel<NumberOfElements; iel++ ){
G4double Zel = (*theElementVector)(iel)->GetZ();
if(ZNumVec->contains(Zel) == FALSE){
ZNumVec->insert(Zel);
}
else{
continue;
}
}
}
}
G4VParticleChange* G4LowEnergyCompton::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep){
//
// The scattered gamma energy is sampled according to Klein - Nishina formula.
// The random number techniques of Butcher & Messel are used
// (Nuc Phys 20(1960),15).
// GEANT4 internal units
//
aParticleChange.Initialize(aTrack);
// Dynamic particle quantities
const G4DynamicParticle* aDynamicGamma = aTrack.GetDynamicParticle();
G4double GammaEnergy0 = aDynamicGamma->GetKineticEnergy();
if(GammaEnergy0 <= LowestEnergyLimit){
aParticleChange.SetStatusChange(fStopAndKill);
aParticleChange.SetEnergyChange(0.);
aParticleChange.SetLocalEnergyDeposit(GammaEnergy0);
return G4VDiscreteProcess::PostStepDoIt(aTrack,aStep);
}
G4double E0_m = GammaEnergy0 / electron_mass_c2 ;
G4ParticleMomentum GammaDirection0 = aDynamicGamma->GetMomentumDirection();
// Select randomly one element
G4Material* aMaterial = aTrack.GetMaterial();
const G4int numOfElem = aMaterial->GetNumberOfElements();
G4Element* theElement = SelectRandomAtom(aDynamicGamma, aMaterial);
G4int elementZ = (G4int) theElement->GetZ();
G4double epsilon, epsilonsq, onecost, sint2, greject ;
G4double epsilon0 = 1./(1. + 2*E0_m) , epsilon0sq = epsilon0*epsilon0;
G4double alpha1 = - log(epsilon0) , alpha2 = 0.5*(1.- epsilon0sq);
G4double ScatteringFunction, x;
G4double wlGamma = h_Planck*c_light/GammaEnergy0;
// sample the energy rate of the scattered gamma
do{
if ( alpha1/(alpha1+alpha2) > G4UniformRand()){
epsilon = exp(-alpha1*G4UniformRand()); // pow(epsilon0,G4UniformRand())
epsilonsq = epsilon*epsilon;
}
else{
epsilonsq = epsilon0sq + (1.- epsilon0sq)*G4UniformRand();
epsilon = sqrt(epsilonsq);
}
onecost = (1.- epsilon)/(epsilon*E0_m);
sint2 = onecost*(2.-onecost);
x = sqrt(onecost/2)/wlGamma;
const G4FirstLevel* oneAtomSF
= (*theScatteringFunctionTable)[ZNumVec->index(elementZ)];
ScatteringFunction = util.DataLogInterpolation(x, (*(*oneAtomSF)[0]),
(*(*oneAtomSF)[1]))/cm;
greject = (1. - epsilon*sint2/(1.+ epsilonsq))*ScatteringFunction;
} while(greject < elementZ*G4UniformRand());
G4double cosTeta = 1. - onecost , sinTeta = sqrt (sint2);
G4double Phi = twopi * G4UniformRand() ;
G4double dirx = sinTeta*cos(Phi) , diry = sinTeta*sin(Phi) , dirz = cosTeta ;
//
// update G4VParticleChange for the scattered gamma
//
G4ThreeVector GammaDirection1 ( dirx,diry,dirz );
GammaDirection1.rotateUz(GammaDirection0);
aParticleChange.SetMomentumChange( GammaDirection1 ) ;
G4double GammaEnergy1 = epsilon*GammaEnergy0;
if (GammaEnergy1 > 0.)
{
aParticleChange.SetEnergyChange( GammaEnergy1 ) ;
}
else
{
aParticleChange.SetEnergyChange(0.) ;
aParticleChange.SetStatusChange(fStopAndKill);
}
//
// kinematic of the scattered electron
//
G4double ElecKineEnergy = GammaEnergy0 - GammaEnergy1 ;
if (G4EnergyLossTables::GetRange(G4Electron::Electron(), ElecKineEnergy, aMaterial)
>= min(G4Electron::GetCuts(), aStep.GetPostStepPoint()->GetSafety())){
G4double ElecMomentum = sqrt(ElecKineEnergy*(ElecKineEnergy+2.*electron_mass_c2));
G4ThreeVector ElecDirection((GammaEnergy0*GammaDirection0 -
GammaEnergy1*GammaDirection1)*(1./ElecMomentum));
// create G4DynamicParticle object for the electron.
G4DynamicParticle* aElectron= new G4DynamicParticle (G4Electron::Electron(),
ElecDirection, ElecKineEnergy) ;
aParticleChange.SetNumberOfSecondaries(1);
aParticleChange.AddSecondary( aElectron );
aParticleChange.SetLocalEnergyDeposit (0.);
}
else{
aParticleChange.SetNumberOfSecondaries(0);
aParticleChange.SetLocalEnergyDeposit (ElecKineEnergy);
}
#ifdef G4VERBOSE
if(verboseLevel > 0){
G4cout<<"LE Compton Effect PostStepDoIt"<<endl;
}
#endif
return G4VDiscreteProcess::PostStepDoIt( aTrack, aStep);
}
void G4LowEnergyCompton::BuildMeanFreePathTable(){
if (theMeanFreePathTable) {
theMeanFreePathTable->clearAndDestroy(); delete theMeanFreePathTable; }
// material
G4double NumbOfMaterials = G4Material::GetNumberOfMaterials();
const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable() ;
G4Material* material;
// MeanFreePath
G4double LowEdgeEnergy, Value;
theMeanFreePathTable = new G4PhysicsTable(NumbOfMaterials);
G4PhysicsLogVector* ptrVector;
for ( G4int J = 0 ; J < NumbOfMaterials; J++ ) { // For each material
//create physics vector then fill it ....
ptrVector = new G4PhysicsLogVector(LowestEnergyLimit, HighestEnergyLimit, NumbBinTable);
material = (*theMaterialTable)(J);
const G4ElementVector* theElementVector = material->GetElementVector();
const G4double* theAtomNumDensityVector = material->GetAtomicNumDensityVector();
for ( G4int i = 0 ; i < NumbBinTable ; i++ ){
//For each energy
LowEdgeEnergy = ptrVector->GetLowEdgeEnergy(i);
const G4double BigPath= DBL_MAX;
G4double SIGMA = 0 ;
for ( G4int k=0 ; k < material->GetNumberOfElements() ; k++ ){
G4int AtomIndex = (G4int) (*theElementVector)(k)->GetZ();
const G4FirstLevel* oneAtomCS
= (*theCrossSectionTable)[ZNumVec->index(AtomIndex)];
G4double interCrsSec = util.DataLogInterpolation(LowEdgeEnergy,
(*(*oneAtomCS)[0]),
(*(*oneAtomCS)[1]))*barn;
SIGMA += theAtomNumDensityVector[k]*interCrsSec;
}
Value = SIGMA<=0.0 ? BigPath : 1./SIGMA ;
ptrVector->PutValue( i , Value ) ;
}
theMeanFreePathTable->insertAt( J , ptrVector );
}
}
G4Element* G4LowEnergyCompton::SelectRandomAtom(const G4DynamicParticle* aDynamicGamma,
G4Material* aMaterial){
// select randomly 1 element within the material
G4double GammaEnergy = aDynamicGamma->GetKineticEnergy();
const G4int NumberOfElements = aMaterial->GetNumberOfElements();
const G4ElementVector* theElementVector = aMaterial->GetElementVector();
if (NumberOfElements == 1) return (*theElementVector)(0);
const G4double* theAtomNumDensityVector = aMaterial->GetAtomicNumDensityVector();
//GetMeanFreePath
G4double PartialSumSigma = 0.;
G4double rval = 0;
rval = G4UniformRand()/MeanFreePath;
for ( G4int i=0 ; i < NumberOfElements ; i++ ){
G4double crossSection;
if (GammaEnergy < LowestEnergyLimit)
crossSection = 0. ;
else {
if (GammaEnergy > HighestEnergyLimit) GammaEnergy = 0.99*HighestEnergyLimit ;
G4int AtomIndex = (G4int) (*theElementVector)(i)->GetZ();
const G4FirstLevel* oneAtomCS
= (*theCrossSectionTable)[ZNumVec->index(AtomIndex)];
crossSection = util.DataLogInterpolation(GammaEnergy,
(*(*oneAtomCS)[0]),
(*(*oneAtomCS)[1]))*barn;
}
PartialSumSigma += theAtomNumDensityVector[i] * crossSection;
if(rval <= PartialSumSigma) return ((*theElementVector)(i));
}
// G4cout << " WARNING !!! - The Material '"<< aMaterial->GetName()
// << "' has no elements" << endl;
return (*theElementVector)(0);
}
@@ -0,0 +1,425 @@
// This code implementation is the intellectual property of
// the RD44 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: G4LowEnergyGammaConversion.cc,v 1.9 1999/06/28 15:46:00 aforti Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// --------------------------------------------------------------
// GEANT 4 class implementation file
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, IT Division, ASD group
// History: first implementation, based on object model of
// 2nd December 1995, G.Cosmo
// ------------ G4LowEnergyGammaConversion physics process --------
// by Michel Maire, 24 May 1996
// **************************************************************
// 11-06-96, Added SelectRandomAtom() method, M.Maire
// 21-06-96, SetCuts implementation, M.Maire
// 24-06-96, simplification in ComputeMicroscopicCrossSection, M.Maire
// 24-06-96, in DoIt : change the particleType stuff, M.Maire
// 25-06-96, modification in the generation of the teta angle, M.Maire
// 16-09-96, minors optimisations in DoIt. Thanks to P.Urban
// dynamical array PartialSumSigma
// 13-12-96, fast sampling of epsil below 2 MeV, L.Urban
// 14-01-97, crossection table + meanfreepath table.
// PartialSumSigma removed, M.Maire
// 14-01-97, in DoIt the positron is always created, even with Ekine=0,
// for further annihilation, M.Maire
// 14-03-97, new Physics scheme for geant4alpha, M.Maire
// 28-03-97, protection in BuildPhysicsTable, M.Maire
// 19-06-97, correction in ComputeMicroscopicCrossSection, L.Urban
// 04-06-98, in DoIt, secondary production condition: range>min(threshold,safety)
// --------------------------------------------------------------
// This Class Header
#include "G4LowEnergyGammaConversion.hh"
// Collaborating Class Headers
#include "G4EnergyLossTables.hh"
#include "G4Electron.hh"
#include "G4Positron.hh"
// constructor
G4LowEnergyGammaConversion::G4LowEnergyGammaConversion(const G4String& processName)
: G4VDiscreteProcess(processName),
theCrossSectionTable(0),
theMeanFreePathTable(0),
ZNumVec(0),
LowestEnergyLimit (1.2200),
HighestEnergyLimit(100*GeV),
NumbBinTable(200)
{
if (verboseLevel>0) {
G4cout << GetProcessName() << " is created "<< endl;
G4cout << "LowestEnergy: " << LowestEnergyLimit/keV << "keV ";
G4cout << "HighestEnergy: " << HighestEnergyLimit/GeV << "GeV " << endl;
}
}
// destructor
G4LowEnergyGammaConversion::~G4LowEnergyGammaConversion()
{
if (theCrossSectionTable) {
delete theCrossSectionTable;
}
if (theMeanFreePathTable) {
theMeanFreePathTable->clearAndDestroy();
delete theMeanFreePathTable;
}
if(ZNumVec){
ZNumVec->clear();
delete ZNumVec;
}
}
// methods.............................................................................
void G4LowEnergyGammaConversion::BuildPhysicsTable(const G4ParticleDefinition& GammaType){
BuildZVec();
// Build microscopic cross section tables for the Compton Scattering process
BuildCrossSectionTable();
// Build mean free path table for the Compton Scattering process
BuildMeanFreePathTable();
}
void G4LowEnergyGammaConversion::BuildCrossSectionTable(){
if (theCrossSectionTable) {
delete theCrossSectionTable;
}
theCrossSectionTable = new G4SecondLevel();
G4int dataNum = 2;
for(G4int TableInd = 0; TableInd < ZNumVec->entries(); TableInd++){
G4int AtomInd = (G4int) (*ZNumVec)[TableInd];
G4FirstLevel* oneAtomCS = util.BuildFirstLevelTables(AtomInd, dataNum, "pair/pp-cs-");
theCrossSectionTable->insert(oneAtomCS);
}//end for on atoms
}
void G4LowEnergyGammaConversion::BuildZVec(){
const G4MaterialTable* theMaterialTable=G4Material::GetMaterialTable();
G4int numOfMaterials = theMaterialTable->length();
if(ZNumVec){
ZNumVec->clear();
delete ZNumVec;
}
ZNumVec = new G4Data();
for (G4int J=0 ; J < numOfMaterials; J++){
const G4Material* material= (*theMaterialTable)[J];
const G4ElementVector* theElementVector = material->GetElementVector();
const G4int NumberOfElements = material->GetNumberOfElements() ;
for (G4int iel=0; iel<NumberOfElements; iel++ ){
G4double Zel = (*theElementVector)(iel)->GetZ();
if(ZNumVec->contains(Zel) == FALSE){
ZNumVec->insert(Zel);
}
else{
continue;
}
}
}
}
G4VParticleChange* G4LowEnergyGammaConversion::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep){
//
// The secondaries e+e- energies are sampled using the Bethe - Heitler
// cross sections with Coulomb correction. A modified version of the random
// number techniques of Butcher & Messel is used (Nuc Phys 20(1960),15).
//
// GEANT4 internal units.
//
// Note 1 : Effects due to the breakdown of the Born approximation at low
// energy are ignored.
// Note 2 : The differential cross section implicitly takes account of
// pair creation in both nuclear and atomic electron fields. However triplet
// prodution is not generated.
aParticleChange.Initialize(aTrack);
G4Material* aMaterial = aTrack.GetMaterial();
const G4DynamicParticle* aDynamicGamma = aTrack.GetDynamicParticle();
G4double GammaEnergy = aDynamicGamma->GetKineticEnergy();
G4ParticleMomentum GammaDirection = aDynamicGamma->GetMomentumDirection();
G4double epsil ;
G4double epsil0 = electron_mass_c2 / GammaEnergy ;
// do it fast if GammaEnergy < 2. MeV
const G4double Egsmall=2.*MeV;
if (GammaEnergy<Egsmall) { epsil = epsil0 + (0.5-epsil0)*G4UniformRand(); }
else{ // now comes the case with GammaEnergy >= 2. MeV
// select randomly one element constituing the material
G4Element* anElement = SelectRandomAtom(aDynamicGamma, aMaterial);
// Extract Coulomb factor for this Element
G4double FZ = 8.*(anElement->GetIonisation()->GetlogZ3());
if (GammaEnergy > 50.*MeV) FZ += 8.*(anElement->GetfCoulomb());
// limits of the screening variable
G4double screenfac = 136.*epsil0/(anElement->GetIonisation()->GetZ3()) ;
G4double screenmax = exp ((42.24 - FZ)/8.368) - 0.952 ;
G4double screenmin = min(4.*screenfac,screenmax) ;
// limits of the energy sampling
G4double epsil1 = 0.5 - 0.5*sqrt(1. - screenmin/screenmax) ;
G4double epsilmin = max(epsil0,epsil1) , epsilrange = 0.5 - epsilmin ;
//
// sample the energy rate of the created electron (or positron)
//
//G4double epsil, screenvar, greject ;
G4double screenvar, greject ;
G4double F10 = ScreenFunction1(screenmin) - FZ , F20 = ScreenFunction2(screenmin) - FZ;
G4double NormF1 = max(F10*epsilrange*epsilrange,0.) , NormF2 = max(1.5*F20,0.);
do {
if ( NormF1/(NormF1+NormF2) > G4UniformRand() ){
epsil = 0.5 - epsilrange*pow(G4UniformRand(), 1/3) ;
screenvar = screenfac/(epsil*(1-epsil));
greject = (ScreenFunction1(screenvar) - FZ)/F10 ;
}
else {
epsil = epsilmin + epsilrange*G4UniformRand();
screenvar = screenfac/(epsil*(1-epsil));
greject = (ScreenFunction2(screenvar) - FZ)/F20 ;
}
} while( greject < G4UniformRand() );
} // end of epsil sampling.........................
//
// fixe charges randomly
//
G4double ElectTotEnergy, PositTotEnergy;
if (RandFlat::shootBit()){
ElectTotEnergy = (1.-epsil)*GammaEnergy;
PositTotEnergy = epsil*GammaEnergy;
}
else{
PositTotEnergy = (1.-epsil)*GammaEnergy;
ElectTotEnergy = epsil*GammaEnergy;
}
//
// scattered electron (positron) angles. ( Z - axis along the parent photon)
// universal distribution suggested by L. Urban (Geant3 manual (1993) Phys211),
// derived from Tsai distribution (Rev Mod Phys 49,421(1977))
G4double u;
const G4double a1 = 0.625 , a2 = 3.*a1 , d = 27. ;
if (9./(9.+d) > G4UniformRand()){
u = - log(G4UniformRand()*G4UniformRand())/a1 ;
}
else{
u = - log(G4UniformRand()*G4UniformRand())/a2 ;
}
G4double Teta = u*electron_mass_c2/GammaEnergy ;
G4double Phi = twopi * G4UniformRand() ;
G4double dirx = sin(Teta)*cos(Phi) , diry = sin(Teta)*sin(Phi) , dirz = cos(Teta);
//
// kinematic of the created pair
// the electron and positron are assumed to have a symetric angular
// distribution with respect to the Z axis along the parent photon.
G4double LocalEnerDeposit = 0. ;
aParticleChange.SetNumberOfSecondaries(2) ;
G4double ElectKineEnergy = max(0.,ElectTotEnergy - electron_mass_c2) ;
if (G4EnergyLossTables::GetRange(G4Electron::Electron(), ElectKineEnergy, aMaterial)
>= min(G4Electron::GetCuts(), aStep.GetPostStepPoint()->GetSafety()) ){
G4ThreeVector ElectDirection ( dirx, diry, dirz );
ElectDirection.rotateUz(GammaDirection);
// create G4DynamicParticle object for the particle1
G4DynamicParticle* aParticle1= new G4DynamicParticle (G4Electron::Electron(),ElectDirection, ElectKineEnergy);
aParticleChange.AddSecondary( aParticle1 ) ;
}
else{
LocalEnerDeposit += ElectKineEnergy ;
}
// the e+ is always created (even with Ekine=0) for further annihilation.
G4double PositKineEnergy = max(0.,PositTotEnergy - electron_mass_c2) ;
if (G4EnergyLossTables::GetRange(G4Positron::Positron(),PositKineEnergy,aMaterial)
< min(G4Positron::GetCuts(), aStep.GetPostStepPoint()->GetSafety()) ){
LocalEnerDeposit += PositKineEnergy ;
PositKineEnergy = 0. ;
}
G4ThreeVector PositDirection ( -dirx, -diry, dirz );
PositDirection.rotateUz(GammaDirection);
// create G4DynamicParticle object for the particle2
G4DynamicParticle* aParticle2= new G4DynamicParticle (G4Positron::Positron(),
PositDirection, PositKineEnergy);
aParticleChange.AddSecondary( aParticle2 ) ;
aParticleChange.SetLocalEnergyDeposit( LocalEnerDeposit ) ;
//
// Kill the incident photon
//
aParticleChange.SetMomentumChange( 0., 0., 0. ) ;
aParticleChange.SetEnergyChange( 0. ) ;
aParticleChange.SetStatusChange( fStopAndKill ) ;
#ifdef G4VERBOSE
if(verboseLevel > 15){
G4cout<<"LE Gamma Conversion PostStepDoIt"<<endl;
}
#endif
// Reset NbOfInteractionLengthLeft and return aParticleChange
return G4VDiscreteProcess::PostStepDoIt( aTrack, aStep );
}
void G4LowEnergyGammaConversion::BuildMeanFreePathTable(){
if (theMeanFreePathTable) {
theMeanFreePathTable->clearAndDestroy(); delete theMeanFreePathTable; }
// material
G4double NumbOfMaterials = G4Material::GetNumberOfMaterials();
const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable() ;
G4Material* material;
// MeanFreePath
G4double LowEdgeEnergy, Value;
theMeanFreePathTable = new G4PhysicsTable(NumbOfMaterials);
G4PhysicsLogVector* ptrVector;
for ( G4int J = 0 ; J < NumbOfMaterials; J++ ) { // For each material
//create physics vector then fill it ....
ptrVector = new G4PhysicsLogVector(LowestEnergyLimit, HighestEnergyLimit, NumbBinTable);
material = (*theMaterialTable)(J);
const G4ElementVector* theElementVector = material->GetElementVector();
const G4double* theAtomNumDensityVector = material->GetAtomicNumDensityVector();
for ( G4int i = 0 ; i < NumbBinTable ; i++ ){
//For each energy
LowEdgeEnergy = ptrVector->GetLowEdgeEnergy(i);
const G4double BigPath= DBL_MAX;
G4double SIGMA = 0 ;
for ( G4int k=0 ; k < material->GetNumberOfElements() ; k++ ){
// For each element
G4int AtomIndex = (G4int) (*theElementVector)(k)->GetZ();
const G4FirstLevel* oneAtomCS
= (*theCrossSectionTable)[ZNumVec->index(AtomIndex)];
G4double interCrsSec = util.DataLogInterpolation(LowEdgeEnergy,
(*(*oneAtomCS)[0]),
(*(*oneAtomCS)[1]))*barn;
SIGMA += theAtomNumDensityVector[k]*interCrsSec;
}
Value = SIGMA<=0.0 ? BigPath : 1./SIGMA ;
ptrVector->PutValue( i , Value ) ;
}
theMeanFreePathTable->insertAt( J , ptrVector ) ;
}
}
G4Element* G4LowEnergyGammaConversion::SelectRandomAtom(const G4DynamicParticle* aDynamicGamma, G4Material* aMaterial){
// select randomly 1 element within the material
G4double GammaEnergy = aDynamicGamma->GetKineticEnergy();
const G4int NumberOfElements = aMaterial->GetNumberOfElements();
const G4ElementVector* theElementVector = aMaterial->GetElementVector();
if (NumberOfElements == 1) return (*theElementVector)(0);
const G4double* theAtomNumDensityVector = aMaterial->GetAtomicNumDensityVector();
G4double PartialSumSigma = 0.;
G4double rval = G4UniformRand()/MeanFreePath;
for ( G4int i=0 ; i < NumberOfElements ; i++ ){
G4double crossSection;
if (GammaEnergy < LowestEnergyLimit)
crossSection = 0. ;
else {
if (GammaEnergy > HighestEnergyLimit) GammaEnergy = 0.99*HighestEnergyLimit ;
G4int AtomIndex = (G4int) (*theElementVector)(i)->GetZ();
const G4FirstLevel* oneAtomCS
= (*theCrossSectionTable)[ZNumVec->index(AtomIndex)];
crossSection = util.DataLogInterpolation(GammaEnergy,
(*(*oneAtomCS)[0]),
(*(*oneAtomCS)[1]))*barn;
}
PartialSumSigma += theAtomNumDensityVector[i] * crossSection;
if(rval <= PartialSumSigma) return ((*theElementVector)(i));
}
// G4cout << " WARNING !!! - The Material '"<< aMaterial->GetName()
// << "' has no elements" << endl;
return (*theElementVector)(0);
}
@@ -0,0 +1,983 @@
// This code implementation is the intellectual property of
// the RD44 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: G4LowEnergyIonisation.cc,v 1.20 1999/07/06 13:20:25 aforti Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// -------------------------------------------------------------
// GEANT 4 class implementation file
//
// For information related to this code contact:
// CERN, IT Division, ASD group
// History: based on object model of
// 2nd December 1995, G.Cosmo
// ---------- G4LowEnergyIonisation physics process -----------
// by Laszlo Urban, 20 March 1997
// **************************************************************
// It is the first implementation of the NEW IONISATION PROCESS.
// It calculates the ionisation of e+/e-.
// **************************************************************
//
// 07-04-98: remove 'tracking cut' of the ionizing particle, MMa
// 04-09-98: new methods SetBining() PrintInfo()
// 07-09-98: Cleanup
// --------------------------------------------------------------
// This Class Header
#include "G4LowEnergyIonisation.hh"
// Collaborating Class Headers
#include "G4EnergyLossTables.hh"
#include "G4Gamma.hh"
#include "G4UnitsTable.hh"
typedef RWTPtrOrderedVector<G4DynamicParticle> G4ParticleVector;
// constructor and destructor
G4LowEnergyIonisation::G4LowEnergyIonisation(const G4String& processName)
: G4eEnergyLoss(processName),
allAtomShellCrossSec(0),
theBindingEnergyTable(0),
theFluorTransitionTable(0),
theSamplingCoeffTable(0),
LowestKineticEnergy(250.*eV),
HighestKineticEnergy(100.*GeV),
CutForLowEnergySecondaryPhotons(0.),
CutForLowEnergySecondaryElectrons(0.),
ZNumVec(0),
ZNumVecFluor(0),
TotBin(200)
{
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4LowEnergyIonisation::~G4LowEnergyIonisation()
{
if (allAtomShellCrossSec) {
delete allAtomShellCrossSec;
}
if (theBindingEnergyTable) {
delete theBindingEnergyTable;
}
if (theFluorTransitionTable) {
delete theFluorTransitionTable;
}
if(theSamplingCoeffTable){
delete theSamplingCoeffTable;
}
if(ZNumVec){
ZNumVec->clear();
delete ZNumVec;
}
if(ZNumVecFluor){
ZNumVecFluor->clear();
delete ZNumVecFluor;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4LowEnergyIonisation::SetCutForLowEnSecPhotons(G4double cut){
CutForLowEnergySecondaryPhotons = cut;
}
void G4LowEnergyIonisation::SetCutForLowEnSecElectrons(G4double cut){
CutForLowEnergySecondaryElectrons = cut;
// LowestKineticEnergy = 2*cut;
}
void G4LowEnergyIonisation::BuildPhysicsTable(const G4ParticleDefinition& aParticleType)
// just call BuildLossTable+BuildLambdaTable
{
BuildLossTable(aParticleType) ;
if(&aParticleType==G4Electron::Electron())
{
RecorderOfElectronProcess[CounterOfElectronProcess] = (*this).theLossTable ;
CounterOfElectronProcess++;
}
else
{
RecorderOfPositronProcess[CounterOfPositronProcess] = (*this).theLossTable ;
CounterOfPositronProcess++;
}
BuildDEDXTable(aParticleType);
BuildZVec();
BuildShellCrossSectionTable();
BuildFluorTransitionTable();
BuildBindingEnergyTable();
BuildSamplingCoeffTable();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4LowEnergyIonisation::BuildLossTable(const G4ParticleDefinition& aParticleType)
{
// Build tables for the ionization energy loss
// the tables are built for *MATERIALS*
const G4double twoln10 = 2.*log(10.);
const G4double Factor = twopi_mc2_rcl2;
G4double LowEdgeEnergy, ionloss;
// material properties
G4double ElectronDensity,Eexc,Eexcm2,Cden,Mden,Aden,X0den,X1den ;
// some local variables
G4double tau,Tmax,gamma,gamma2,bg2,beta2,d,d2,d3,d4,delta,x,y ;
ParticleMass = aParticleType.GetPDGMass();
G4double* ParticleCutInKineticEnergy = aParticleType.GetEnergyCuts() ;
// create table
const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable();
G4int numOfMaterials = theMaterialTable->length();
if (theLossTable) { theLossTable->clearAndDestroy();
delete theLossTable;
}
theLossTable = new G4PhysicsTable(numOfMaterials);
// loop for materials
for (G4int J=0; J<numOfMaterials; J++)
{
// create physics vector and fill it
G4PhysicsLogVector* aVector = new G4PhysicsLogVector(
LowestKineticEnergy, HighestKineticEnergy, TotBin);
// get material parameters needed for the energy loss calculation
const G4Material* material= (*theMaterialTable)[J];
ElectronDensity = material->GetElectronDensity();
Eexc = material->GetIonisation()->GetMeanExcitationEnergy();
Eexc /= ParticleMass; Eexcm2 = Eexc*Eexc;
Cden = material->GetIonisation()->GetCdensity();
Mden = material->GetIonisation()->GetMdensity();
Aden = material->GetIonisation()->GetAdensity();
X0den = material->GetIonisation()->GetX0density();
X1den = material->GetIonisation()->GetX1density();
// now comes the loop for the kinetic energy values
for (G4int i = 0 ; i < TotBin ; i++)
{
LowEdgeEnergy = aVector->GetLowEdgeEnergy(i) ;
tau = LowEdgeEnergy/ParticleMass ;
// Seltzer-Berger formula
gamma = tau + 1.; gamma2 = gamma*gamma;
bg2 = tau*(tau+2.);
beta2 = bg2/gamma2;
// electron
if (&aParticleType==G4Electron::Electron())
{
Tmax = LowEdgeEnergy/2.;
d = min(ParticleCutInKineticEnergy[J], Tmax)/ParticleMass;
ionloss = log(2.*(tau+2.)/Eexcm2)-1.-beta2
+ log((tau-d)*d)+tau/(tau-d)
+ (0.5*d*d+(2.*tau+1.)*log(1.-d/tau))/gamma2;
}
else //positron
{
Tmax = LowEdgeEnergy ;
d = min(ParticleCutInKineticEnergy[J], Tmax)/ParticleMass;
d2=d*d/2.; d3=d*d*d/3.; d4=d*d*d*d/4.;
y=1./(1.+gamma);
ionloss = log(2.*(tau+2.)/Eexcm2)+log(tau*d)
- beta2*(tau+2.*d-y*(3.*d2+y*(d-d3+y*(d2-tau*d3+d4))))/tau;
}
//density correction
x = log(bg2)/twoln10;
if (x < X0den) delta = 0.;
else { delta = twoln10*x - Cden;
if (x < X1den) delta += Aden*pow((X1den-x),Mden);
}
//now you can compute the total ionization loss
ionloss -= delta ;
ionloss *= Factor*ElectronDensity/beta2 ;
if (ionloss <= 0.) ionloss = 0.;
aVector->PutValue(i,ionloss) ;
}
theLossTable->insert(aVector);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4LowEnergyIonisation::BuildShellCrossSectionTable(){
if (allAtomShellCrossSec) {
delete allAtomShellCrossSec;
}
allAtomShellCrossSec = new allAtomTable();
G4int dataNum = 2;
for(G4int TableInd = 0; TableInd < ZNumVec->entries(); TableInd++){
G4int AtomInd = (G4int) (*ZNumVec)[TableInd];
oneAtomTable* oneAtomShellCS = util.BuildSecondLevelTables(AtomInd, dataNum, "ioni/ion-ss-cs-");
allAtomShellCrossSec->insert(oneAtomShellCS);
}//end for on atoms
}
void G4LowEnergyIonisation::BuildBindingEnergyTable(){
if (theBindingEnergyTable) {
delete theBindingEnergyTable;
}
G4int dataNum = 2;
theBindingEnergyTable = util.BuildSecondLevelTables(0,dataNum,"fluor/binding");
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4LowEnergyIonisation::BuildFluorTransitionTable(){
if (theFluorTransitionTable) {
delete theFluorTransitionTable;
}
theFluorTransitionTable = new allAtomTable();
ZNumVecFluor = new G4Data(*ZNumVec);
G4int dataNum = 3;
for(G4int TableInd = 0; TableInd < ZNumVec->entries(); TableInd++){
G4int AtomInd = (G4int) (*ZNumVec)[TableInd];
if(AtomInd > 5){
oneAtomTable* oneAtomShellFL = util.BuildSecondLevelTables(AtomInd, dataNum, "fluor/fl-tr-pr-");
theFluorTransitionTable->insert(oneAtomShellFL);
}
else{
ZNumVecFluor->remove(AtomInd);
}
}//end for on atoms
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4LowEnergyIonisation::BuildSamplingCoeffTable(){
if (theSamplingCoeffTable) {
delete theSamplingCoeffTable;
}
theSamplingCoeffTable = new allAtomTable();
G4int dataNum = 12;
for(G4int TableInd = 0; TableInd < ZNumVec->entries(); TableInd++){
G4int AtomInd = (G4int) (*ZNumVec)[TableInd];
oneAtomTable* oneAtomShellSc = util.BuildSecondLevelTables(AtomInd, dataNum, "ioni/ion-co-");
theSamplingCoeffTable->insert(oneAtomShellSc);
}//end for on atoms
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4LowEnergyIonisation::BuildZVec(){
const G4MaterialTable* theMaterialTable=G4Material::GetMaterialTable();
G4int numOfMaterials = theMaterialTable->length();
if(ZNumVec){
ZNumVec->clear();
delete ZNumVec;
}
ZNumVec = new G4Data();
for (G4int J=0 ; J < numOfMaterials; J++){
const G4Material* material= (*theMaterialTable)[J];
const G4ElementVector* theElementVector = material->GetElementVector();
const G4int NumberOfElements = material->GetNumberOfElements() ;
for (G4int iel=0; iel<NumberOfElements; iel++ ){
G4double Zel = (*theElementVector)(iel)->GetZ();
if(ZNumVec->contains(Zel) == FALSE){
ZNumVec->insert(Zel);
}
else{
continue;
}
}
}
}
G4double G4LowEnergyIonisation::ComputeCrossSection(const G4double AtomIndex,
const G4double IncEnergy){
// calculates the microscopic cross section from subshell cross sections
//(it is called for elements , AtomicNumber = Z )
G4double TotalCrossSection(0.);
const oneAtomTable* oneAtomCS
= (*allAtomShellCrossSec)[ZNumVec->index(AtomIndex)];
for(G4int ind = 0; ind < oneAtomCS->entries(); ind++){
G4double crossSec = 0;
G4Data* EnergyVector = (*(*oneAtomCS)[ind])[0];
G4Data* CrossSecVector = (*(*oneAtomCS)[ind])[1];
if(IncEnergy < (*EnergyVector)[1]){ // First element is the shell number
crossSec = 0;
}
else{
crossSec = util.DataLogInterpolation(IncEnergy, (*EnergyVector), (*CrossSecVector));
}
TotalCrossSection += crossSec;
}
return TotalCrossSection ;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4VParticleChange* G4LowEnergyIonisation::PostStepDoIt( const G4Track& trackData,
const G4Step& stepData){
aParticleChange.Initialize(trackData);
G4Material* aMaterial = trackData.GetMaterial() ;
const G4DynamicParticle* aParticle = trackData.GetDynamicParticle() ;
// select randomly one element constituing the material.
G4Element* anElement = SelectRandomAtom(aParticle, aMaterial);
G4int AtomIndex = (G4int) anElement->GetZ();
G4double KineticEnergy = aParticle->GetKineticEnergy();
if(KineticEnergy <= LowestKineticEnergy){
aParticleChange.SetStatusChange(fStopAndKill);
aParticleChange.SetEnergyChange(0.);
aParticleChange.SetLocalEnergyDeposit(KineticEnergy);
return G4VContinuousDiscreteProcess::PostStepDoIt(trackData,stepData);
}
// Select the subshell WARNING!!!!
G4int subShellIndex = SelectRandomShell(AtomIndex, KineticEnergy);
G4FirstLevel* theBindEnVec = (*theBindingEnergyTable)[AtomIndex-1];
G4int thePrimaryShell = (G4int) (*(*theBindEnVec)[0])[subShellIndex];
G4double BindingEn = (*(*theBindEnVec)[1])[subShellIndex];
G4double theEnergyDeposit = BindingEn;
G4double charge = aParticle->GetDefinition()->GetPDGCharge();
ParticleMass = aParticle->GetDefinition()->GetPDGMass();
G4double Psquare = KineticEnergy*(KineticEnergy+2*ParticleMass);
G4double TotalMomentum = sqrt(Psquare);
G4ParticleMomentum ParticleDirection = aParticle->GetMomentumDirection();
// get kinetic energy cut for the electron
G4double* DeltaCutInKineticEnergy = G4Electron::Electron()->GetCutsInEnergy() ;
G4double DeltaThreshold = DeltaCutInKineticEnergy[aMaterial->GetIndex()];
// some kinematics
G4double MaxKineticEnergyTransfer;
if (charge < 0.) MaxKineticEnergyTransfer = 0.5*(KineticEnergy);
else MaxKineticEnergyTransfer = KineticEnergy;
// sampling kinetic energy of the delta ray
if (MaxKineticEnergyTransfer <= 0 || MaxKineticEnergyTransfer <= LowestKineticEnergy/2){
// pathological case (should not happen, there is no change at all)
return G4VContinuousDiscreteProcess::PostStepDoIt(trackData,stepData);
}
// **** normal case ****
//Energy Sampling
G4double DeltaKineticEnergy = EnergySampling(AtomIndex, subShellIndex, KineticEnergy);
// protection :do not produce a secondary with 0. kinetic energy !
if (DeltaKineticEnergy <= 0.){
return G4VContinuousDiscreteProcess::PostStepDoIt(trackData,stepData);
}
if(DeltaKineticEnergy <= DeltaThreshold){
aParticleChange.SetNumberOfSecondaries(0);
aParticleChange.SetEnergyChange(KineticEnergy - DeltaKineticEnergy - BindingEn);
aParticleChange.SetLocalEnergyDeposit(DeltaKineticEnergy+BindingEn);
return G4VContinuousDiscreteProcess::PostStepDoIt(trackData,stepData);
}
G4double finalKineticEnergy = KineticEnergy - DeltaKineticEnergy;
// G4double finalKineticEnergy = KineticEnergy - DeltaKineticEnergy - BindingEn;
if(thePrimShVec.length() != 0){
thePrimShVec.clear();
}
thePrimShVec.insert(thePrimaryShell);
// delta ray kinematics
G4double DeltaTotalMomentum = sqrt(DeltaKineticEnergy * (DeltaKineticEnergy +
2. * electron_mass_c2 ));
if(finalKineticEnergy > 0.){
G4double finalMomentum=sqrt(finalKineticEnergy*
(finalKineticEnergy+2.*ParticleMass));
G4double costheta = (Psquare-(finalMomentum*finalMomentum)+
(DeltaTotalMomentum*DeltaTotalMomentum))/(2*DeltaTotalMomentum*TotalMomentum);
G4double costhetasc = (Psquare+(finalMomentum*finalMomentum)-
(DeltaTotalMomentum*DeltaTotalMomentum))/(2*finalMomentum*TotalMomentum);
if (costheta < -1.) costheta = -1.;
if (costheta > +1.) costheta = +1.;
// direction of the delta electron
G4double phi = twopi * G4UniformRand();
G4double sintheta = sqrt((1.+costheta)*(1.-costheta));
G4double dirx = sintheta * cos(phi), diry = sintheta * sin(phi), dirz = costheta;
G4ThreeVector DeltaDirection(dirx,diry,dirz);
DeltaDirection.rotateUz(ParticleDirection);
// finalKineticEnergy and finalMomentum defined above
// because needed for costheta computation
G4double finalPx = (TotalMomentum*ParticleDirection.x()
- DeltaTotalMomentum*DeltaDirection.x())/finalMomentum;
G4double finalPy = (TotalMomentum*ParticleDirection.y()
- DeltaTotalMomentum*DeltaDirection.y())/finalMomentum;
G4double finalPz = (TotalMomentum*ParticleDirection.z()
- DeltaTotalMomentum*DeltaDirection.z())/finalMomentum;
G4double momtot = sqrt(finalPx*finalPx + finalPy*finalPy + finalPz*finalPz);
if(momtot-1. > 1e-6){
finalPx /= momtot; finalPy /= momtot; finalPz /= momtot;
}
// Create lists of pointers to DynamicParticles (photons and electrons)
G4ParticleVector photvec;
G4int photInd = 0;
G4ParticleVector elecvec;
G4int elecInd = 0;
// create G4DynamicParticle object for delta ray
G4DynamicParticle* theDeltaRay = new G4DynamicParticle;
theDeltaRay->SetKineticEnergy( DeltaKineticEnergy );
theDeltaRay->SetMomentumDirection(DeltaDirection.x(),
DeltaDirection.y(),
DeltaDirection.z());
theDeltaRay->SetDefinition(G4Electron::Electron());
elecvec.insert(theDeltaRay);
// FLUORESCENCE
// load the transition probability table for the element
// theTable[i][j][k]
// i = subshell, j = type of information (second shell, transition energy ,
// transition probability), k = previous vectors.
// Fluorescence data start from element 6
if(AtomIndex > 5){
G4bool ThereAreShells = TRUE;
G4int AtomInd = ZNumVecFluor->index(AtomIndex);
oneAtomTable* oneAtomFluorTrans = (*theFluorTransitionTable)[AtomInd];
while(ThereAreShells == TRUE){
// Select the second transition from another subshell
// fluorPar[0] = SubShell
// fluorPar[1] = Sec SubShell (if there is),
// fluorPar[2] = Transition Probability
// fluorPar[3] = Transition Energy
// the same for augerPar
G4double fluorPar[3] = {0};
// SelectRandomTransition argument is oneAtomTable loop on shells is inside
ThereAreShells = SelectRandomTransition(thePrimaryShell,
fluorPar,
oneAtomFluorTrans);
// Daugther dynamic particle
G4DynamicParticle* newPart;
// Direction of the outcoming particle isotropic selection
G4double newcosTh = 1-2*G4UniformRand();
G4double newsinTh = sqrt(1-newcosTh*newcosTh);
G4double newPhi = twopi*G4UniformRand();
G4double dirx, diry, dirz;
dirz = newcosTh;
diry = newsinTh*cos(newPhi);
dirx = newsinTh*sin(newPhi);
G4ThreeVector newPartDirection(dirx, diry, dirz);
newPartDirection.rotateUz(ParticleDirection);
if(ThereAreShells != FALSE){
thePrimaryShell = (G4int) fluorPar[0];
theEnergyDeposit -= fluorPar[2]*MeV;
if(fluorPar[2] >= CutForLowEnergySecondaryPhotons){
newPart = new G4DynamicParticle (G4Gamma::Gamma(),
newPartDirection,
fluorPar[2]);
photvec.insert(newPart);
}
}
else{
// last shell transition from continuum
G4int k = 0;
while(thePrimaryShell != (*(*theBindEnVec)[0])[k]){
k++;
}
G4double lastTransEnergy = (*(*theBindEnVec)[1])[k];
thePrimaryShell = (G4int) fluorPar[0];
if(fluorPar[2] >= CutForLowEnergySecondaryPhotons){
theEnergyDeposit -= lastTransEnergy*MeV;
newPart = new G4DynamicParticle(G4Gamma::Gamma(),
newPartDirection,
lastTransEnergy);
photvec.insert(newPart);
}
thePrimShVec.insert(thePrimaryShell);
}
}
} //END OF THE CHECK ON ATOMIC NUMBER
G4int numOfElec = elecvec.entries(), numOfPhot = photvec.entries();
G4int numOfDau = numOfElec + numOfPhot;
aParticleChange.SetNumberOfSecondaries(numOfDau);
G4int l = 0;
for(l = 0; l<numOfElec; l++ ){
aParticleChange.AddSecondary(elecvec[l]);
}
for(l = 0; l < numOfPhot; l++) {
aParticleChange.AddSecondary(photvec[l]);
}
photvec.clear();
elecvec.clear();
// fill aParticleChange
// changed energy and momentum of the actual particle
if(theEnergyDeposit < 0){
theEnergyDeposit = 0;
}
aParticleChange.SetMomentumChange(finalPx,finalPy,finalPz);
aParticleChange.SetEnergyChange(finalKineticEnergy);
aParticleChange.SetLocalEnergyDeposit (0.);
aParticleChange.SetLocalEnergyDeposit (theEnergyDeposit);
}
else{
finalKineticEnergy = 0.;
if (charge < 0.) aParticleChange.SetStatusChange(fStopAndKill);
else aParticleChange.SetStatusChange(fStopButAlive);
}
return G4VContinuousDiscreteProcess::PostStepDoIt(trackData,stepData);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4LowEnergyIonisation::Print()
{
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4int G4LowEnergyIonisation::SelectRandomShell(const G4int AtomIndex, const G4double IncEnergy){
G4double partialSum = 0;
G4double totalSum = ComputeCrossSection(AtomIndex,IncEnergy);
G4double rval = totalSum*G4UniformRand();
const oneAtomTable* oneAtomCS
= (*allAtomShellCrossSec)[ZNumVec->index(AtomIndex)];
for(G4int ind = 0; ind < oneAtomCS->entries(); ind++){
G4double crossSec;
G4Data* EnergyVector = (*(*oneAtomCS)[ind])[0];
G4Data* CrossSecVector = (*(*oneAtomCS)[ind])[1];
if(IncEnergy < (*EnergyVector)[0]){ //First element is the shell number
crossSec = 0;
}
else{
crossSec = util.DataLogInterpolation(IncEnergy, (*EnergyVector), (*CrossSecVector));
}
partialSum += crossSec;
if(rval <= partialSum) return ind;
}
G4Exception("LEIonisation: Cannot select a shell");
return 0;
}
G4Element*
G4LowEnergyIonisation::SelectRandomAtom(const G4DynamicParticle* aDynamicParticle,
G4Material* aMaterial){
// select randomly 1 element within the material
G4double KineticEnergy = aDynamicParticle->GetKineticEnergy();
const G4int NumberOfElements = aMaterial->GetNumberOfElements();
const G4ElementVector* theElementVector = aMaterial->GetElementVector();
if (NumberOfElements == 1) return (*theElementVector)(0);
const G4double* theAtomNumDensityVector = aMaterial->GetAtomicNumDensityVector();
G4double PartialSumSigma = 0. ;
// G4int materialIndex = aMaterial->GetIndex();
G4double rval = G4UniformRand()/MeanFreePath;
for ( G4int i=0 ; i < NumberOfElements ; i++ ){
G4double crossSection;
if (KineticEnergy < LowestKineticEnergy)
crossSection = 0. ;
else {
if (KineticEnergy > HighestKineticEnergy) KineticEnergy = 0.99*HighestKineticEnergy;
G4int AtomIndex = (G4int) (*theElementVector)(i)->GetZ();
crossSection = ComputeCrossSection(AtomIndex, KineticEnergy);
}
PartialSumSigma += theAtomNumDensityVector[i] * crossSection;
if (rval <= PartialSumSigma) return ((*theElementVector)(i));
}
return (*theElementVector)(0);
}
G4bool G4LowEnergyIonisation::SelectRandomTransition(G4int thePrimShell,
G4double* TransParam,
const oneAtomTable* TransitionTable){
G4int SubShellCol = 0, ProbCol = 1, EnergyCol = 2;
//transitionTable means for one atom not for one shell
// too check when the subshell are finished
G4bool ColIsFull = TRUE;
G4int ShellNum = 0;
G4double TotalSum = 0;
G4int maxNumOfShells = TransitionTable->entries()-1;
if(thePrimShell <= (*(*(*TransitionTable)[maxNumOfShells])[0])[0]){
while(thePrimShell != (*(*(*TransitionTable)[ShellNum])[0])[0]){
if(ShellNum == maxNumOfShells){
break;
}
ShellNum++;
}
//TransProb start from 1 because the first element of the list is the primary shall id number
G4int TransProb = 1;
for(TransProb = 1; TransProb < (*(*TransitionTable)[ShellNum])[ProbCol]->length(); TransProb++){
TotalSum += (*(*(*TransitionTable)[ShellNum])[ProbCol])[TransProb];
}
G4double PartialProb = G4UniformRand()*TotalSum;
G4double PartSum = 0;
TransProb = 1;
while(TransProb < (*(*TransitionTable)[ShellNum])[ProbCol]->length()){
PartSum += (*(*(*TransitionTable)[ShellNum])[ProbCol])[TransProb];
if(PartialProb <= PartSum){
TransParam[0] = (*(*(*TransitionTable)[ShellNum])[SubShellCol])[TransProb];
TransParam[1] = (*(*(*TransitionTable)[ShellNum])[ProbCol])[TransProb];
TransParam[2] = (*(*(*TransitionTable)[ShellNum])[EnergyCol])[TransProb];
break;
}
TransProb++;
}
}
else{
ColIsFull = FALSE;
}
return ColIsFull;
}
G4double G4LowEnergyIonisation::EnergySampling(const G4int AtomicNumber,
const G4int ShellIndex,
const G4double KinEn){
// 1) Load Coefficients (I need Z number and the index of the shell)
oneAtomTable* oneAtomCoeffTable = (*theSamplingCoeffTable)[ZNumVec->index(AtomicNumber)];
oneShellTable* oneShellCoeffTable = (*oneAtomCoeffTable)[ShellIndex];
G4double BindingEn = (*(*(*theBindingEnergyTable)[AtomicNumber-1])[1])[ShellIndex];
// 2) Interpolate coefficients (I need the incoming electron kinetic energy)
const G4int CoeffNumber = oneShellCoeffTable->entries();
const G4Data* energyVec = (*oneShellCoeffTable)[0];
const G4int LastPar = energyVec->length()-1;
G4Data Parms;
for(G4int ind = 1; ind < CoeffNumber-1; ind++){
const G4Data* oneCoeffVec = (*oneShellCoeffTable)[ind];
if(KinEn < (*energyVec)[0]){
Parms.insert((*oneCoeffVec)[0]);
}
else if(KinEn > (*energyVec)[LastPar]){
Parms.insert((*oneCoeffVec)[LastPar]);
}
else{
G4double par = util.DataSemiLogInterpolation(KinEn,(*energyVec),(*oneCoeffVec));
Parms.insert(par);
}
}
// cut in energy is always the same
Parms.insert((*(*oneShellCoeffTable)[CoeffNumber-1])[0]);
// 2') order of parameters:
// * Parms[0] = par1 LET
// * Parms[1] = par2 LET
// * Parms[2] = par3 LET
// * Parms[3] = par4 LET
// * Parms[4] = par5 LET
// * Parms[5] = par6 LET
// * Parms[6] = par1 HET
// * Parms[7] = max rejection function: g(x)
// * Parms[8] = area1
// * Parms[9] = area2
// * Parms[10] = cut in energy
// 3) Compute partial areas (with functions here the cut is used)
// minimum energy that can take an ejected electron
const G4double minEn = 0.1*eV;
const G4double argmax = 1/(BindingEn+Parms[10]);
const G4double argmin = 1/(minEn+BindingEn);
const G4double area1 = Parms[8];
//Parms[0]*log(argmin/argmax)+Parms[1]*(argmin-argmax)+
//2*Parms[2]*(pow(argmin,2)-pow(argmax,2))+3*Parms[3]*(pow(argmin,3)-pow(argmax,3))+
//4*Parms[4]*(pow(argmin,4)-pow(argmax,4))+5*Parms[5]*(pow(argmin,5)-pow(argmax,5));
const G4double maxEn = (KinEn-BindingEn)/2;
G4double area2;
if(maxEn >= Parms[10]){
area2 = Parms[9];
}
else{
area2 = 0;
}
G4double areaTot = area1+area2;
G4int which;
// 4) Generate a random number .to select the region of work
G4double rand1 = areaTot*G4UniformRand();
// 5) Sampling
G4double sample = 0;
if(rand1 < area1){
// Low energy transfer
G4double rejection = 0;
which =1;
do{
G4double rand2 = G4UniformRand();
G4double Ka = 0;
if(Parms[10] < maxEn){
Ka = (BindingEn + Parms[10])/(minEn+BindingEn);
}
else{
Ka = (BindingEn + maxEn)/(minEn+BindingEn);
}
sample = (minEn + BindingEn)*pow(Ka,rand2)-BindingEn;
G4double arg = sample + BindingEn;
rejection = Parms[0]/arg+Parms[1]/pow(arg,2)+Parms[2]/pow(arg,3)+
Parms[3]/pow(arg,4)+Parms[4]/pow(arg,5)+Parms[5]/pow(arg,6);
rejection /= Parms[7];
}while(rejection < G4UniformRand());
}
else if(area1 < rand1 && rand1 < areaTot){
which = 2;
// High energy transfer
G4double Norm = (1/Parms[10])-(1/maxEn);
G4double rand2 = Norm*G4UniformRand();
sample = 1/((1/Parms[10])-rand2);
}
//cout<<"ShellIndex: "<<ShellIndex<<" ShellId: "<<(*(*(*theBindingEnergyTable)[AtomicNumber-1])[0])[ShellIndex]<<endl;
return sample;
}
@@ -0,0 +1,683 @@
// This code implementation is the intellectual property of
// the RD44 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: G4LowEnergyPhotoElectric.cc,v 1.16 1999/07/06 15:03:03 aforti Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// --------------------------------------------------------------
// GEANT 4 class implementation file
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, IT Division, ASD group
// History: first implementation, based on object model of
// 2nd December 1995, G.Cosmo
// ------------ G4LowEnergyPhotoElectric physics process --------
// by Michel Maire, April 1996
// **************************************************************
// 12-06-96, Added SelectRandomAtom() method, by M.Maire
// 21-06-96, SetCuts implementation, M.Maire
// 17-09-96, PartialSumSigma(i)
// split of ComputeBindingEnergy, M.Maire
// 08-01-97, crossection table + meanfreepath table, M.Maire
// 13-03-97, adapted for the new physics scheme, M.Maire
// 28-03-97, protection in BuildPhysicsTable, M.Maire
// 04-06-98, in DoIt, secondary production condition: range>min(threshold,safety)
// --------------------------------------------------------------
// This Class Header
#include "G4LowEnergyPhotoElectric.hh"
// Collaborating Class Headers
#include "G4EnergyLossTables.hh"
#include "G4Electron.hh"
typedef RWTPtrOrderedVector<G4DynamicParticle> G4ParticleVector;
// constructor
G4LowEnergyPhotoElectric::G4LowEnergyPhotoElectric(const G4String& processName)
: G4VDiscreteProcess(processName), // initialization
LowestEnergyLimit (250*eV),
HighestEnergyLimit(100*GeV),
theCrossSectionTable(0),
theBindingEnergyTable(0),
theMeanFreePathTable(0),
theFluorTransitionTable(0),
allAtomShellCrossSec(0),
CutForLowEnergySecondaryPhotons(0.),
ZNumVec(0),
ZNumVecFluor(0),
NumbBinTable(200)
{
if (verboseLevel>0) {
G4cout << GetProcessName() << " is created "<< endl;
G4cout << "LowestEnergy: " << LowestEnergyLimit/keV << "keV ";
G4cout << "HighestEnergy: " << HighestEnergyLimit/MeV << "MeV " << endl;
}
}
// destructor
G4LowEnergyPhotoElectric::~G4LowEnergyPhotoElectric()
{
if (theCrossSectionTable) {
// theCrossSectionTable->clearAndDestroy();
delete theCrossSectionTable;
}
if (theBindingEnergyTable) {
theBindingEnergyTable->clearAndDestroy();
delete theBindingEnergyTable;
}
if (theMeanFreePathTable) {
theMeanFreePathTable->clearAndDestroy();
delete theMeanFreePathTable;
}
// ClearAndDestroy of this tables is called in their destructors
if (theFluorTransitionTable) {
delete theFluorTransitionTable;
}
if (allAtomShellCrossSec) {
delete allAtomShellCrossSec;
}
if(ZNumVec){
ZNumVec->clear();
delete ZNumVec;
}
if(ZNumVecFluor){
ZNumVecFluor->clear();
delete ZNumVecFluor;
}
}
// methods.............................................................................
void G4LowEnergyPhotoElectric::SetCutForLowEnSecPhotons(G4double cut){
CutForLowEnergySecondaryPhotons = cut;
}
void G4LowEnergyPhotoElectric::BuildPhysicsTable(const G4ParticleDefinition& PhotonType)
// Build microscopic cross section table and mean free path table
{
BuildZVec();
BuildCrossSectionTable();
BuildShellCrossSectionTable();
BuildMeanFreePathTable();
BuildBindingEnergyTable();
BuildFluorTransitionTable();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4LowEnergyPhotoElectric::BuildCrossSectionTable(){
if (theCrossSectionTable) {
//theCrossSectionTable->clearAndDestroy();
delete theCrossSectionTable;
}
theCrossSectionTable = new G4SecondLevel();
G4int dataNum = 2;
for(G4int TableInd = 0; TableInd < ZNumVec->entries(); TableInd++){
G4int AtomInd = (G4int) (*ZNumVec)[TableInd];
G4FirstLevel* oneAtomCS = util.BuildFirstLevelTables(AtomInd, dataNum, "phot/pe-cs-");
theCrossSectionTable->insert(oneAtomCS);
}//end for on atoms
}
void G4LowEnergyPhotoElectric::BuildShellCrossSectionTable(){
if (allAtomShellCrossSec) {
delete allAtomShellCrossSec;
}
allAtomShellCrossSec = new allAtomTable();
G4int dataNum = 2;
for(G4int TableInd = 0; TableInd < ZNumVec->entries(); TableInd++){
G4int AtomInd = (G4int) (*ZNumVec)[TableInd];
oneAtomTable* oneAtomShellCS = util.BuildSecondLevelTables(AtomInd, dataNum, "phot/pe-ss-cs-");
allAtomShellCrossSec->insert(oneAtomShellCS);
}//end for on atoms
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4LowEnergyPhotoElectric::BuildBindingEnergyTable(){
if (theBindingEnergyTable) {
delete theBindingEnergyTable;
}
G4int dataNum = 2;
theBindingEnergyTable = util.BuildSecondLevelTables(0,dataNum,"fluor/binding");
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4LowEnergyPhotoElectric::BuildFluorTransitionTable(){
if (theFluorTransitionTable) {
delete theFluorTransitionTable;
}
theFluorTransitionTable = new allAtomTable();
ZNumVecFluor = new G4Data(*ZNumVec);
G4int dataNum = 3;
for(G4int TableInd = 0; TableInd < ZNumVec->entries(); TableInd++){
G4int AtomInd = (G4int) (*ZNumVec)[TableInd];
if(AtomInd > 5){
oneAtomTable* oneAtomShellFL = util.BuildSecondLevelTables(AtomInd, dataNum, "fluor/fl-tr-pr-");
theFluorTransitionTable->insert(oneAtomShellFL);
}
else{
ZNumVecFluor->remove(AtomInd);
}
}//end for on atoms
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4LowEnergyPhotoElectric::BuildZVec(){
const G4MaterialTable* theMaterialTable=G4Material::GetMaterialTable();
G4int numOfMaterials = theMaterialTable->length();
if(ZNumVec){
ZNumVec->clear();
delete ZNumVec;
}
ZNumVec = new G4Data();
for (G4int J=0 ; J < numOfMaterials; J++){
const G4Material* material= (*theMaterialTable)[J];
const G4ElementVector* theElementVector = material->GetElementVector();
const G4int NumberOfElements = material->GetNumberOfElements() ;
for (G4int iel=0; iel<NumberOfElements; iel++ ){
G4double Zel = (*theElementVector)(iel)->GetZ();
if(ZNumVec->contains(Zel) == FALSE){
ZNumVec->insert(Zel);
}
else{
continue;
}
}
}
}
G4double G4LowEnergyPhotoElectric::ComputeCrossSection(const G4double AtomIndex,
const G4double IncEnergy){
// calculates the microscopic cross section from subshell cross sections
//(it is called for elements , AtomicNumber = Z )
G4double TotalCrossSection(0.);
const oneAtomTable* oneAtomCS
= (*allAtomShellCrossSec)[ZNumVec->index(AtomIndex)];
for(G4int ind = 0; ind < oneAtomCS->entries(); ind++){
G4double crossSec = 0;
G4Data* EnergyVector = (*(*oneAtomCS)[ind])[0];
G4Data* CrossSecVector = (*(*oneAtomCS)[ind])[1];
if(IncEnergy < (*EnergyVector)[1]){ // First element is the shell number
crossSec = 0;
}
else{
crossSec = util.DataLogInterpolation(IncEnergy, (*EnergyVector), (*CrossSecVector));
}
TotalCrossSection += crossSec;
}
return TotalCrossSection ;
}
void G4LowEnergyPhotoElectric::BuildMeanFreePathTable(){
if (theMeanFreePathTable) {
theMeanFreePathTable->clearAndDestroy();
delete theMeanFreePathTable; }
// material
G4double NumbOfMaterials = G4Material::GetNumberOfMaterials();
const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable() ;
G4Material* material;
// MeanFreePath
G4double LowEdgeEnergy, Value;
theMeanFreePathTable = new G4PhysicsTable(NumbOfMaterials);
G4PhysicsLogVector* ptrVector;
for ( G4int J = 0 ; J < NumbOfMaterials; J++ ) { // For each material
//create physics vector then fill it ....
// WARNING!!! below 50 ev cross section lower limit depend on the element
ptrVector = new G4PhysicsLogVector(LowestEnergyLimit, HighestEnergyLimit, NumbBinTable);
material = (*theMaterialTable)(J);
const G4ElementVector* theElementVector = material->GetElementVector();
const G4double* theAtomNumDensityVector = material->GetAtomicNumDensityVector();
for ( G4int i = 0 ; i < NumbBinTable ; i++ ){
//For each energy
LowEdgeEnergy = ptrVector->GetLowEdgeEnergy(i);
const G4double BigPath= DBL_MAX;
G4double SIGMA = 0 ;
for ( G4int k=0 ; k < material->GetNumberOfElements() ; k++ ){
// For each element
G4int AtomIndex = (G4int) (*theElementVector)(k)->GetZ();
const G4FirstLevel* oneAtomCS
= (*theCrossSectionTable)[ZNumVec->index(AtomIndex)];
G4double interCrsSec = util.DataLogInterpolation(LowEdgeEnergy, (*(*oneAtomCS)[0]), (*(*oneAtomCS)[1]))*barn;
//DataLogInterpolation(LowEdgeEnergy, tableIndex, theCrossSectionTable)*barn;
SIGMA += theAtomNumDensityVector[k]*interCrsSec;
}
Value = SIGMA<=0.0 ? BigPath : 1./SIGMA ;
ptrVector->PutValue( i , Value ) ;
}
theMeanFreePathTable->insertAt( J , ptrVector ) ;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4VParticleChange* G4LowEnergyPhotoElectric::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep){
// incoming particle initialization
aParticleChange.Initialize(aTrack);
G4Material* aMaterial = aTrack.GetMaterial();
const G4DynamicParticle* aDynamicPhoton = aTrack.GetDynamicParticle();
const G4double PhotonEnergy = aDynamicPhoton->GetKineticEnergy();
if(PhotonEnergy <= LowestEnergyLimit){
aParticleChange.SetStatusChange(fStopAndKill);
aParticleChange.SetEnergyChange(0.);
aParticleChange.SetLocalEnergyDeposit(PhotonEnergy);
return G4VDiscreteProcess::PostStepDoIt(aTrack,aStep);
}
const G4ParticleMomentum PhotonDirection = aDynamicPhoton->GetMomentumDirection();
// select randomly one element constituing the material.
G4Element* anElement = SelectRandomAtom(aDynamicPhoton, aMaterial);
// PAY ATTENTION TO THE MEANING OF THIS NUMBER
G4int AtomNum = (G4int) anElement->GetZ();
// Select the subshell WARNING!!!!
G4int subShellIndex = SelectRandomShell(AtomNum, PhotonEnergy);
G4FirstLevel* theBindEnVec = (*theBindingEnergyTable)[AtomNum-1];
G4int thePrimaryShell = (G4int) (*(*theBindEnVec)[0])[subShellIndex];
G4double BindingEn = (*(*theBindEnVec)[1])[subShellIndex];
if(thePrimShVec.length() != 0){
thePrimShVec.clear();
}
thePrimShVec.insert(thePrimaryShell);
// Create lists of pointers to DynamicParticles (photons and electrons)
G4ParticleVector photvec;
G4int photInd = 0;
G4ParticleVector elecvec;
G4int elecInd = 0;
// primary outcoming electron
G4double ElecKineEnergy = (PhotonEnergy - BindingEn)*MeV;
G4double theEnergyDeposit = (PhotonEnergy - ElecKineEnergy)*MeV;
if (G4EnergyLossTables::GetRange(G4Electron::Electron(),ElecKineEnergy,aMaterial)
>= min(G4Electron::GetCuts(), aStep.GetPostStepPoint()->GetSafety()) ){
// the electron is created in the direction of the incident photon ...
G4DynamicParticle* aElectron = new G4DynamicParticle (G4Electron::Electron(),
PhotonDirection, ElecKineEnergy) ;
elecvec.append(aElectron);
// load the transition probability table for the element
// theTable[i][j][k]
// i = subshell, j = type of information (second shell, transition energy ,
// transition probability), k = previous vectors.
if(AtomNum > 5){
G4bool ThereAreShells = TRUE;
G4int AtomInd = ZNumVecFluor->index(AtomNum);
oneAtomTable* oneAtomFluorTrans = (*theFluorTransitionTable)[AtomInd];
while(ThereAreShells == TRUE){
// Select the second transition from another subshell
// fluorPar[0] = SubShell
// fluorPar[1] = Sec SubShell (if there is),
// fluorPar[2] = Transition Probability
// the same for augerPar
G4double fluorPar[3] = {0};
ThereAreShells = SelectRandomTransition(thePrimaryShell,
fluorPar,
oneAtomFluorTrans);
// Daugther dynamic particle
G4DynamicParticle* newPart;
// Direction of the outcoming particle isotropic selection
G4double newcosTh = 1-2*G4UniformRand();
G4double newsinTh = sqrt(1-newcosTh*newcosTh);
G4double newPhi = twopi*G4UniformRand();
G4double dirx, diry, dirz;
dirz = newcosTh;
diry = newsinTh*cos(newPhi);
dirx = newsinTh*sin(newPhi);
G4ThreeVector newPartDirection(dirx, diry, dirz);
newPartDirection.rotateUz(PhotonDirection);
if(ThereAreShells != FALSE){
thePrimaryShell = (G4int) fluorPar[0];
if(fluorPar[2] >= CutForLowEnergySecondaryPhotons){
theEnergyDeposit -= fluorPar[2]*MeV;
newPart = new G4DynamicParticle (G4Gamma::Gamma(),
newPartDirection,
fluorPar[2]) ;
photvec.append(newPart);
}
}
else{
G4int k = 0;
while(thePrimaryShell != (*(*theBindEnVec)[0])[k]) k++;
G4double lastTransEnergy = (*(*theBindEnVec)[1])[k];
thePrimaryShell = (G4int) fluorPar[0];
if(fluorPar[2] >= CutForLowEnergySecondaryPhotons){
theEnergyDeposit -= lastTransEnergy*MeV;
newPart = new G4DynamicParticle (G4Gamma::Gamma(),
newPartDirection,
lastTransEnergy) ;
photvec.append(newPart);
}
}
thePrimShVec.insert(thePrimaryShell);
}
} //END OF THE CHECK ON ATOMIC NUMBER
G4int numOfElec = elecvec.entries(), numOfPhot = photvec.entries();
G4int numOfDau = numOfElec + numOfPhot;
aParticleChange.SetNumberOfSecondaries(numOfDau);
G4int l = 0;
for( l = 0; l<numOfElec; l++ ){
aParticleChange.AddSecondary(elecvec[l]);
}
for(l = 0; l < numOfPhot; l++) {
aParticleChange.AddSecondary(photvec[l]);
}
photvec.clear();
elecvec.clear();
if(theEnergyDeposit < 0){
theEnergyDeposit = 0;
}
} // END OF CUTS
else{
ElecKineEnergy = 0. ;
aParticleChange.SetNumberOfSecondaries(0) ;
}
// Kill the incident photon
aParticleChange.SetMomentumChange( 0., 0., 0. );
aParticleChange.SetEnergyChange( 0. );
if(theEnergyDeposit < 0){
theEnergyDeposit = 0;
}
aParticleChange.SetLocalEnergyDeposit(theEnergyDeposit) ;
aParticleChange.SetStatusChange( fStopAndKill ) ;
#ifdef G4VERBOSE
if(verboseLevel > 15){
G4cout<<"LE PhotoElectric PostStepDoIt"<<endl;
}
#endif
// Reset NbOfInteractionLengthLeft and return aParticleChange
return G4VDiscreteProcess::PostStepDoIt( aTrack, aStep );
}
G4int G4LowEnergyPhotoElectric::SelectRandomShell(const G4int AtomIndex, const G4double IncEnergy){
G4double partialSum = 0;
G4double totalSum = ComputeCrossSection(AtomIndex,IncEnergy);
G4double rval = totalSum*G4UniformRand();
const oneAtomTable* oneAtomCS
= (*allAtomShellCrossSec)[ZNumVec->index(AtomIndex)];
for(G4int ind = 0; ind < oneAtomCS->entries(); ind++){
G4double crossSec;
G4Data* EnergyVector = (*(*oneAtomCS)[ind])[0];
G4Data* CrossSecVector = (*(*oneAtomCS)[ind])[1];
if(IncEnergy < (*EnergyVector)[0]){ //First element is the shell number
crossSec = 0;
}
else{
crossSec = util.DataLogInterpolation(IncEnergy, (*EnergyVector), (*CrossSecVector));
}
partialSum += crossSec;
if(rval <= partialSum) return ind;
}
G4Exception("LEPhotoElectric: Cannot select a shell");
return 0;
}
G4Element*
G4LowEnergyPhotoElectric::SelectRandomAtom(const G4DynamicParticle* aDynamicPhoton, G4Material* aMaterial){
// select randomly 1 element within the material
G4double GammaEnergy = aDynamicPhoton->GetKineticEnergy();
const G4int NumberOfElements = aMaterial->GetNumberOfElements();
const G4ElementVector* theElementVector = aMaterial->GetElementVector();
if (NumberOfElements == 1) return (*theElementVector)(0);
const G4double* theAtomNumDensityVector = aMaterial->GetAtomicNumDensityVector();
G4double PartialSumSigma = 0. ;
G4double rval = G4UniformRand()/MeanFreePath;
for ( G4int i=0 ; i < NumberOfElements ; i++ ){
G4double crossSection;
if (GammaEnergy < LowestEnergyLimit)
crossSection = 0. ;
else {
if (GammaEnergy > HighestEnergyLimit) GammaEnergy = 0.99*HighestEnergyLimit ;
G4int AtomIndex = (G4int) (*theElementVector)(i)->GetZ();
const G4FirstLevel* oneAtomCS
= (*theCrossSectionTable)[ZNumVec->index(AtomIndex)];
crossSection = util.DataLogInterpolation(GammaEnergy, (*(*oneAtomCS)[0]), (*(*oneAtomCS)[1]))*barn;
//DataLogInterpolation(GammaEnergy, tableIndex, theCrossSectionTable)*barn;
}
PartialSumSigma += theAtomNumDensityVector[i] * crossSection;
if (rval <= PartialSumSigma) return ((*theElementVector)(i));
}
// G4cout << " WARNING !!! - The Material '"<< aMaterial->GetName()
// << "' has no elements" << endl;
return (*theElementVector)(0);
}
G4bool G4LowEnergyPhotoElectric::SelectRandomTransition(G4int thePrimShell,
G4double* TransParam,
const oneAtomTable* TransitionTable){
G4int SubShellCol = 0, ProbCol = 1, EnergyCol = 2;
//transitionTable means for one atom not for one shell
// too check when the subshell are finished
G4bool ColIsFull = TRUE;
G4int ShellNum = 0;
G4double TotalSum = 0;
G4int maxNumOfShells = TransitionTable->entries()-1;
if(thePrimShell <= (*(*(*TransitionTable)[maxNumOfShells])[0])[0]){
while(thePrimShell != (*(*(*TransitionTable)[ShellNum])[0])[0]){
if(ShellNum == maxNumOfShells){
break;
}
ShellNum++;
}
// if(ShellNum <= maxNumOfShells) {
//TransProb start from 1 because the first element of the list is the primary shall id number
G4int TransProb = 1;
for(TransProb = 1; TransProb < (*(*TransitionTable)[ShellNum])[ProbCol]->length(); TransProb++){
TotalSum += (*(*(*TransitionTable)[ShellNum])[ProbCol])[TransProb];
}
G4double PartialProb = G4UniformRand()*TotalSum;
G4double PartSum = 0;
TransProb = 1;
while(TransProb < (*(*TransitionTable)[ShellNum])[ProbCol]->length()){
PartSum += (*(*(*TransitionTable)[ShellNum])[ProbCol])[TransProb];
if(PartialProb <= PartSum){
TransParam[0] = (*(*(*TransitionTable)[ShellNum])[SubShellCol])[TransProb];
TransParam[1] = (*(*(*TransitionTable)[ShellNum])[ProbCol])[TransProb];
TransParam[2] = (*(*(*TransitionTable)[ShellNum])[EnergyCol])[TransProb];
break;
}
TransProb++;
}
//if(TransProb == (*(*TransitionTable)[ShellNum])[ProbCol]->length()-1) {
//ColIsFull = FALSE;
//}
//}
//else{
// ColIsFull = FALSE;
//}
}
else{
ColIsFull = FALSE;
}
return ColIsFull;
}
@@ -0,0 +1,366 @@
// This code implementation is the intellectual property of
// the RD44 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: G4LowEnergyRayleigh.cc,v 1.10 1999/07/06 15:03:04 aforti Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// --------------------------------------------------------------
// GEANT 4 class implementation file
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, IT Division, ASD group
// History: first implementation, based on object model of
// 2nd December 1995, G.Cosmo
// ------------ G4LowEnergyRayleigh physics process --------
// by Michel Maire, April 1996
// **************************************************************
// 28-05-96, DoIt() small change in ElecDirection, by M.Maire
// 10-06-96, simplification in ComputeMicroscopicCrossSection(), by M.Maire
// 21-06-96, SetCuts implementation, M.Maire
// 13-09-96, small changes in DoIt for better efficiency. Thanks to P.Urban
// 06-01-97, crossection table + meanfreepath table, M.Maire
// 05-03-97, new Physics scheme, M.Maire
// 28-03-97, protection in BuildPhysicsTable, M.Maire
// 07-04-98, remove 'tracking cut' of the scattered gamma, MMa
// 04-06-98, in DoIt, secondary production condition: range>min(threshold,safety)
// --------------------------------------------------------------
// This Class Header
#include "G4LowEnergyRayleigh.hh"
// Collaborating Class Headers
#include "G4EnergyLossTables.hh"
#include "G4Electron.hh"
// constructor
G4LowEnergyRayleigh::G4LowEnergyRayleigh(const G4String& processName)
: G4VDiscreteProcess(processName),
theCrossSectionTable(0),
theMeanFreePathTable(0),
theFormFactorTable(0),
ZNumVec(0),
LowestEnergyLimit (250*eV), // initialization
HighestEnergyLimit(100*GeV),
NumbBinTable(200)
{
if (verboseLevel>0) {
G4cout << GetProcessName() << " is created "<< endl;
G4cout << "LowestEnergy: " << LowestEnergyLimit/keV << "keV ";
G4cout << "HighestEnergy: " << HighestEnergyLimit/TeV << "TeV " << endl;
}
}
// destructor
G4LowEnergyRayleigh::~G4LowEnergyRayleigh()
{
if (theCrossSectionTable) {
delete theCrossSectionTable;
}
if(theFormFactorTable){
delete theFormFactorTable;
}
if (theMeanFreePathTable) {
theMeanFreePathTable->clearAndDestroy();
delete theMeanFreePathTable;
}
if(ZNumVec){
ZNumVec->clear();
delete ZNumVec;
}
}
// methods.............................................................................
void G4LowEnergyRayleigh::BuildPhysicsTable(const G4ParticleDefinition& GammaType){
BuildZVec();
// Build microscopic cross section tables for the Rayleigh process
BuildCrossSectionTable();
// Build mean free path table for the Rayleigh Scattering process
BuildMeanFreePathTable();
// build the scattering function table
BuildFormFactorTable();
}
void G4LowEnergyRayleigh::BuildCrossSectionTable(){
if (theCrossSectionTable) {
delete theCrossSectionTable;
}
theCrossSectionTable = new G4SecondLevel();
G4int dataNum = 2;
for(G4int TableInd = 0; TableInd < ZNumVec->entries(); TableInd++){
G4int AtomInd = (G4int) (*ZNumVec)[TableInd];
G4FirstLevel* oneAtomCS = util.BuildFirstLevelTables(AtomInd, dataNum, "rayl/re-cs-");
theCrossSectionTable->insert(oneAtomCS);
}//end for on atoms
}
void G4LowEnergyRayleigh::BuildFormFactorTable(){
if (theFormFactorTable) {
delete theFormFactorTable;
}
theFormFactorTable = new G4SecondLevel();
G4int dataNum = 2;
for(G4int TableInd = 0; TableInd < ZNumVec->entries(); TableInd++){
G4int AtomInd = (G4int) (*ZNumVec)[TableInd];
G4FirstLevel* oneAtomFF = util.BuildFirstLevelTables(AtomInd, dataNum, "rayl/re-ff-");
theFormFactorTable->insert(oneAtomFF);
}//end for on atoms
}
void G4LowEnergyRayleigh::BuildZVec(){
const G4MaterialTable* theMaterialTable=G4Material::GetMaterialTable();
G4int numOfMaterials = theMaterialTable->length();
if(ZNumVec){
ZNumVec->clear();
delete ZNumVec;
}
ZNumVec = new G4Data();
for (G4int J=0 ; J < numOfMaterials; J++){
const G4Material* material= (*theMaterialTable)[J];
const G4ElementVector* theElementVector = material->GetElementVector();
const G4int NumberOfElements = material->GetNumberOfElements() ;
for (G4int iel=0; iel<NumberOfElements; iel++ ){
G4double Zel = (*theElementVector)(iel)->GetZ();
if(ZNumVec->contains(Zel) == FALSE){
ZNumVec->insert(Zel);
}
else{
continue;
}
}
}
}
G4VParticleChange* G4LowEnergyRayleigh::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep){
//
// The scattered gamma energy is sampled according to Form Factors and
// then accepted or rejected based on Rayleigh distribution.
// The random number techniques of Butcher & Messel are used
// (Nuc Phys 20(1960),15). GEANT4 internal units
//
aParticleChange.Initialize(aTrack);
// Dynamic particle quantities
const G4DynamicParticle* aDynamicGamma = aTrack.GetDynamicParticle();
G4double GammaEnergy0 = aDynamicGamma->GetKineticEnergy();
if(GammaEnergy0 <= LowestEnergyLimit){
aParticleChange.SetStatusChange(fStopAndKill);
aParticleChange.SetEnergyChange(0.);
aParticleChange.SetLocalEnergyDeposit(GammaEnergy0);
return G4VDiscreteProcess::PostStepDoIt(aTrack,aStep);
}
G4double E0_m = GammaEnergy0 / electron_mass_c2 ;
G4ParticleMomentum GammaDirection0 = aDynamicGamma->GetMomentumDirection();
// Select randomly one element
G4Material* aMaterial = aTrack.GetMaterial();
const G4int numOfElem = aMaterial->GetNumberOfElements();
G4Element* theElement = SelectRandomAtom(aDynamicGamma, aMaterial);
// sample the energy rate of the scattered gamma
G4double wlGamma = h_Planck*c_light/GammaEnergy0;
G4int elementZ = (G4int) theElement->GetZ();
G4double tableIndex = elementZ - 1;
G4double Theta, DataFormFactor;
G4double cosTheta, greject;
G4double Theta_Half, x, SinThHalf, RandomFormFactor;
G4double sinTheta;
do{
Theta_Half = G4UniformRand()*pi/2;
SinThHalf = sin(Theta_Half);
x = SinThHalf/wlGamma;
const G4FirstLevel* oneAtomFF
= (*theFormFactorTable)[ZNumVec->index(elementZ)];
DataFormFactor = util.DataLogInterpolation(x, (*(*oneAtomFF)[0]),
(*(*oneAtomFF)[1]))/cm;
RandomFormFactor = G4UniformRand()*elementZ;
Theta = Theta_Half*2;
cosTheta = cos(Theta);
sinTheta = sin(Theta);
greject = cosTheta*cosTheta*DataFormFactor;
}while( greject < RandomFormFactor);
// scattered gamma angles. ( Z - axis along the parent gamma)
G4double Phi = twopi * G4UniformRand() ;
G4double dirx = sinTheta*cos(Phi) , diry = sinTheta*sin(Phi) , dirz = cosTheta ;
// update G4VParticleChange for the scattered gamma
G4ThreeVector GammaDirection1(dirx, diry, dirz);
GammaDirection1.rotateUz(GammaDirection0);
aParticleChange.SetEnergyChange(GammaEnergy0);
aParticleChange.SetMomentumChange(GammaDirection1);
aParticleChange.SetNumberOfSecondaries(0);
#ifdef G4VERBOSE
if(verboseLevel > 15){
G4cout<<"LE Rayleigh PostStepDoIt"<<endl;
}
#endif
return G4VDiscreteProcess::PostStepDoIt( aTrack, aStep);
}
void G4LowEnergyRayleigh::BuildMeanFreePathTable(){
if (theMeanFreePathTable) {
theMeanFreePathTable->clearAndDestroy(); delete theMeanFreePathTable; }
// material
G4double NumbOfMaterials = G4Material::GetNumberOfMaterials();
const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable() ;
G4Material* material;
// MeanFreePath
G4double LowEdgeEnergy, Value;
theMeanFreePathTable = new G4PhysicsTable(NumbOfMaterials);
G4PhysicsLogVector* ptrVector;
for ( G4int J = 0 ; J < NumbOfMaterials; J++ ) { // For each material
//create physics vector then fill it ....
ptrVector = new G4PhysicsLogVector(LowestEnergyLimit, HighestEnergyLimit, NumbBinTable);
material = (*theMaterialTable)(J);
const G4ElementVector* theElementVector = material->GetElementVector();
const G4double* theAtomNumDensityVector = material->GetAtomicNumDensityVector();
for ( G4int i = 0 ; i < NumbBinTable ; i++ ){
//For each energy
LowEdgeEnergy = ptrVector->GetLowEdgeEnergy(i);
const G4double BigPath= DBL_MAX;
G4double SIGMA = 0 ;
for ( G4int k=0 ; k < material->GetNumberOfElements() ; k++ ){
// For each element
G4double AtomIndex = (*theElementVector)(k)->GetZ();
const G4FirstLevel* oneAtomCS
= (*theCrossSectionTable)[ZNumVec->index(AtomIndex)];
G4double interCrsSec = util.DataLogInterpolation(LowEdgeEnergy,
(*(*oneAtomCS)[0]),
(*(*oneAtomCS)[1]))*barn;
SIGMA += theAtomNumDensityVector[k]*interCrsSec;
}
Value = SIGMA<=0.0 ? BigPath : 1./SIGMA ;
ptrVector->PutValue( i , Value ) ;
}
theMeanFreePathTable->insertAt( J , ptrVector ) ;
}
}
G4Element* G4LowEnergyRayleigh::SelectRandomAtom(const G4DynamicParticle* aDynamicGamma,
G4Material* aMaterial) {
// select randomly 1 element within the material
G4double GammaEnergy = aDynamicGamma->GetKineticEnergy();
const G4int NumberOfElements = aMaterial->GetNumberOfElements();
const G4ElementVector* theElementVector = aMaterial->GetElementVector();
if (NumberOfElements == 1) return (*theElementVector)(0);
const G4double* theAtomNumDensityVector = aMaterial->GetAtomicNumDensityVector();
G4double PartialSumSigma = 0.;
G4double rval = G4UniformRand()/MeanFreePath;
for ( G4int i=0 ; i < NumberOfElements ; i++ ){
G4double crossSection;
if (GammaEnergy < LowestEnergyLimit)
crossSection = 0. ;
else {
if (GammaEnergy > HighestEnergyLimit) GammaEnergy = 0.99*HighestEnergyLimit ;
G4double AtomIndex = (*theElementVector)(i)->GetZ();
const G4FirstLevel* oneAtomCS
= (*theCrossSectionTable)[ZNumVec->index(AtomIndex)];
crossSection = util.DataLogInterpolation(GammaEnergy,
(*(*oneAtomCS)[0]),
(*(*oneAtomCS)[1]))*barn;
}
PartialSumSigma += theAtomNumDensityVector[i] * crossSection;
if(rval <= PartialSumSigma) return ((*theElementVector)(i));
}
// G4cout << " WARNING !!! - The Material '"<< aMaterial->GetName()
// << "' has no elements" << endl;
return (*theElementVector)(0);
}
@@ -0,0 +1,212 @@
// This code implementation is the intellectual property of
// the RD44 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: G4LowEnergyUtilities.cc,v 1.1 1999/06/28 15:46:05 aforti Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// --------------------------------------------------------------
// GEANT 4 class implementation file
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, IT Division, ASD group
// History: first implementation, based on object model of
// 2nd December 1995, G.Cosmo
// ------------ G4LowEnergyUtilities physics process --------
// by Michel Maire, April 1996
// **************************************************************
// 12-06-96, Added SelectRandomAtom() method, by M.Maire
// 21-06-96, SetCuts implementation, M.Maire
// 17-09-96, PartialSumSigma(i)
// split of ComputeBindingEnergy, M.Maire
// 08-01-97, crossection table + meanfreepath table, M.Maire
// 13-03-97, adapted for the new physics scheme, M.Maire
// 28-03-97, protection in BuildPhysicsTable, M.Maire
// 04-06-98, in DoIt, secondary production condition: range>min(threshold,safety)
// --------------------------------------------------------------
// This Class Header
#include "G4LowEnergyUtilities.hh"
// Collaborating Class Headers
#include "G4Element.hh"
#include "G4DynamicParticle.hh"
#include "G4Material.hh"
#include "CLHEP/String/Strings.h"
#include <fstream.h>
G4LowEnergyUtilities::G4LowEnergyUtilities()
{}
G4LowEnergyUtilities::~G4LowEnergyUtilities()
{}
G4SecondLevel* G4LowEnergyUtilities::BuildSecondLevelTables(const G4int TableInd,
const G4int ParNum,
const char* prename){
HepString name, prenameStr(prename);
if(TableInd != 0){
HepString Znum(TableInd);
name = prenameStr + Znum + ".dat";
}
else{
name = prenameStr+ ".dat";
}
char* path = getenv("G4LEDATA");
if(!path){
HepString excep = "Error!!! G4LEDATA (Low Energy Electromagnetic processes data directory) environment variable not set";
G4Exception(excep);
}
HepString path_string(path);
HepString dir_file = path_string + "/" + name;
ifstream file(dir_file);
filebuf* lsdp = file.rdbuf();
if(!lsdp->is_open()){
HepString excep = "Error!!!! data file: " + dir_file + " NOT found";
G4Exception(excep);
}
oneAtomTable* oneAtomPar = new oneAtomTable();
oneShellTable* oneShellPar = new oneShellTable();
for(G4int j = 0; j < ParNum; j++){
oneShellPar->insertAt(j,new G4Data());
}
G4double a = 0;
G4int k = 1, s = 0;
do{
file>>a;
if(a == -1){
if(s == 0){
oneAtomPar->insert(oneShellPar);
oneShellPar = new oneShellTable();
for(G4int j = 0; j < ParNum; j++){
oneShellPar->insertAt(j,new G4Data());
}
}
s++;
if(s == ParNum){
s = 0;
}
}
else if(a == -2){
delete oneShellPar;
}
else{
if(k%ParNum != 0){
(*oneShellPar)[k-1]->insert(a);
k++;
}
else if(k%ParNum == 0){
(*oneShellPar)[k-1]->insert(a);
k = 1;
}
}
}while(a != -2); //end for on file
file.close();
return oneAtomPar;
}
G4FirstLevel* G4LowEnergyUtilities::BuildFirstLevelTables(const G4int TableInd,
const G4int ParNum,
const char* prename){
HepString name, prenameStr(prename);
if(TableInd != 0){
HepString Znum(TableInd);
name = prenameStr + Znum + ".dat";
}
else{
name = prenameStr+ ".dat";
}
char* path = getenv("G4LEDATA");
if(!path){
HepString excep = "Error!!! G4LEDATA (Low Energy Electromagnetic processes data directory) environment variable not set";
G4Exception(excep);
}
HepString path_string(path);
HepString dir_file = path_string + "/" + name;
ifstream file(dir_file);
filebuf* lsdp = file.rdbuf();
if(!lsdp->is_open()){
HepString excep = "Error!!!! data file: " + dir_file + " NOT found";
G4Exception(excep);
}
G4FirstLevel* oneAtomPar = new G4FirstLevel();
for(G4int j = 0; j < ParNum; j++){
oneAtomPar->insertAt(j,new G4Data());
}
G4double a = 0;
G4int k = 1;
do{
file>>a;
if(a == -1 || a == -2){
}
else{
if(k%ParNum != 0){
(*oneAtomPar)[k-1]->insert(a);
k++;
}
else if(k%ParNum == 0){
(*oneAtomPar)[k-1]->insert(a);
k = 1;
}
}
}while(a != -2); //end for on file
file.close();
return oneAtomPar;
}
@@ -0,0 +1,45 @@
// This code implementation is the intellectual property of
// the RD44 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.
//
// -------------------------------------------------------------------
// GEANT 4 class file
//
// For information related to this code contact:
// CERN, IT Division, ASD group
// CERN, Geneva, Switzerland
//
// File name: G4SecondLevel.hh
//
// Author: Alessandra Forti (Alessandra.Forti@cern.ch)
//
// Creation date: 1 Giugno 1999
//
// Modifications:
//
// -------------------------------------------------------------------
#include "G4SecondLevel.hh"
G4SecondLevel::~G4SecondLevel(){
this->clearAndDestroy();
}
G4bool G4SecondLevel::operator == (const G4SecondLevel& input) const{
return( this->entries() == input.entries());
}
G4bool G4SecondLevel::operator < (const G4SecondLevel& input) const{
return(this->entries() < input.entries());
}
@@ -0,0 +1,49 @@
// This code implementation is the intellectual property of
// the RD44 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.
//
// -------------------------------------------------------------------
// GEANT 4 class file
//
// For information related to this code contact:
// CERN, IT Division, ASD group
// CERN, Geneva, Switzerland
//
// File name: G4ThirdLevel.hh
//
// Author: Alessandra Forti (Alessandra.Forti@cern.ch)
//
// Creation date: 1 Giugno 1999
//
// Modifications:
//
// -------------------------------------------------------------------
#include "G4ThirdLevel.hh"
G4ThirdLevel::~G4ThirdLevel(){
this->clearAndDestroy();
}
G4bool G4ThirdLevel::operator == (const G4ThirdLevel& input) const{
return( this->entries() == input.entries());
}
G4bool G4ThirdLevel::operator < (const G4ThirdLevel& input) const{
return(this->entries() < input.entries());
}
@@ -0,0 +1,134 @@
// This code implementation is the intellectual property of
// the RD44 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.
//
// -------------------------------------------------------------------
// GEANT 4 class file
//
// For information related to this code contact:
// CERN, IT Division, ASD group
// CERN, Geneva, Switzerland
//
// File name: G4VDataFile
//
// Author: Alessandra Forti (Alessandra.Forti@cern.ch)
//
// Creation date: 2 February 1999
//
// Modifications:
//
// -------------------------------------------------------------------
// This Class Header
#include "G4VDataFile.hh"
// Other Class Headers
// C++ Headers
#include <iostream.h>
#include <fstream.h>
#include <string.h>
// Constructors
G4VDataFile::G4VDataFile(const G4String& dataFile):
_filename(dataFile)
{
}
// Destructor
G4VDataFile::~G4VDataFile()
{
if(buf){
delete [] buf;
}
}
// Member Functions
void G4VDataFile::OpenFile(){
// open the stream
char* path = getenv("G4LEDATA");
if(!path){
G4Exception("G4LEDATA environment variable not set");
}
G4String path_string(path);
G4String dir_file = path_string + "/" + _filename;
_istr.open(dir_file.data(), ios::in | ios::nocreate);
filebuf* lsdp = _istr.rdbuf();
if(!lsdp->is_open()){
G4String excep = "Error!!!! data file: " + dir_file + " NOT found";
G4Exception(excep);
}
}
void G4VDataFile::CloseFile(){
_istr.close();
}
void G4VDataFile::Eof(){
if(_istr.eof()) {
_istr.close();
}
}
streampos G4VDataFile::TellPos(){
return _istr.tellg();
}
G4bool G4VDataFile::IsOpen(){
return TRUE;//_istr.is_open();
}
void G4VDataFile::SeekPos(streampos pos){
_istr.seekg(pos);
}
void G4VDataFile::SetBufferSize(G4int sz){
_bufSize = sz;
buf = new char[_bufSize+1];
}
void G4VDataFile::GetLine(){
_istr.getline(buf, _bufSize);
if(strlen(buf) >= _bufSize){
G4String excep = "Error!!!! G4VDataFile::GetLine() buffer out of boundaries";
G4Exception(excep);
}
}
G4int G4VDataFile::LineLength(){
return strlen(buf);
}
char* G4VDataFile::GetBuf(){
return buf;
}
@@ -0,0 +1,46 @@
// This code implementation is the intellectual property of
// the RD44 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.
//
// -------------------------------------------------------------------
// GEANT 4 class file
//
// For information related to this code contact:
// CERN, IT Division, ASD group
// CERN, Geneva, Switzerland
//
// File name: G4VTables
//
// Author: Alessandra Forti (Alessandra.Forti@cern.ch)
//
// Creation date: 2 February 1999
//
// Modifications:
//
// -------------------------------------------------------------------
// This Class Header
#include "G4VTables.hh"
// Constructors
G4VTables::G4VTables()
{
}
// Destructor
G4VTables::~G4VTables()
{
}
@@ -1,4 +1,4 @@
# $Id: GNUmakefile,v 2.0 1998/07/02 16:18:43 gunter Exp $
# $Id: GNUmakefile,v 1.3 1999/06/05 13:20:23 stesting Exp $
# --------------------------------------------------------------------
# GNUmakefile for electromagnetic sub-library. John Allison, 25/6/98.
# --------------------------------------------------------------------
@@ -20,6 +20,7 @@ CPPFLAGS += -I$(G4BASE)/global/management/include \
-I$(G4BASE)/track/include \
-I$(G4BASE)/processes/management/include \
-I$(G4BASE)/processes/electromagnetic/utils/include \
-I$(G4BASE)/processes/electromagnetic/standard/include \
-I$(G4BASE)/particles/management/include \
-I$(G4BASE)/particles/bosons/include \
-I$(G4BASE)/particles/leptons/include \
@@ -29,3 +30,14 @@ CPPFLAGS += -I$(G4BASE)/global/management/include \
-I$(G4BASE)/materials/include
include $(G4INSTALL)/config/common.gmk
CXXFLAGS_WITHOUT_O := $(filter-out -O% , $(CXXFLAGS))
CXXFLAGS_WITHOUT_O := $(filter-out +O% , $(CXXFLAGS_WITHOUT_O))
ifeq ($(G4SYSTEM),HP-aCC)
COMPILER := $(shell aCC -V 2>&1)
ifeq ($(COMPILER), aCC: HP ANSI C++ B3910B A.01.15)
$(G4TMP)/$(G4SYSTEM)/$(name)/G4MuEnergyLoss.o: src/G4MuEnergyLoss.cc
$(CXX) $(CXXFLAGS_WITHOUT_O) $(CPPFLAGS) -c $(OUT_OBJ)$@ src/G4MuEnergyLoss.cc
endif
endif
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4IMuBremsstrahlung.hh,v 2.1 1998/08/23 11:50:49 urban Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4IMuBremsstrahlung.hh,v 1.1 1999/01/07 16:11:01 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
// ------------------------------------------------------------
// GEANT 4 class header file
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4IMuBremsstrahlung.icc,v 2.1 1998/08/23 11:50:50 urban Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4IMuBremsstrahlung.icc,v 1.1 1999/01/07 16:11:01 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
// ---------------------------------------------------------------
// GEANT 4 class inlined methods file
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4IMuEnergyLoss.hh,v 2.1 1998/08/23 11:50:51 urban Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4IMuEnergyLoss.hh,v 1.2 1999/04/30 08:04:05 urban Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
// $Id:
// -------------------------------------------------------------------
@@ -43,6 +43,7 @@
#include "G4IVContinuousDiscreteProcess.hh"
#include "G4Material.hh"
#include "G4Element.hh"
#include "G4EnergyLossTables.hh"
#include "G4VParticleChange.hh"
#include "globals.hh"
#include "G4Track.hh"
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4IMuEnergyLoss.icc,v 2.1 1998/08/23 11:50:51 urban Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4IMuEnergyLoss.icc,v 1.1 1999/01/07 16:11:02 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
// $Id:
// ---------------------------------------------------------------
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4IMuIonisation.hh,v 2.1 1998/08/23 11:50:52 urban Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4IMuIonisation.hh,v 1.1 1999/01/07 16:11:02 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
// ------------------------------------------------------------
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4IMuIonisation.icc,v 2.1 1998/08/23 11:50:52 urban Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4IMuIonisation.icc,v 1.1 1999/01/07 16:11:02 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// ---------------------------------------------------------------
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4IMuPairProduction.hh,v 2.1 1998/08/23 11:50:52 urban Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4IMuPairProduction.hh,v 1.1 1999/01/07 16:11:03 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
// $Id:
// ------------------------------------------------------------
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4IMuPairProduction.icc,v 2.1 1998/08/23 11:50:53 urban Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4IMuPairProduction.icc,v 1.1 1999/01/07 16:11:03 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
// $Id:
// ---------------------------------------------------------------
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4MuBremsstrahlung.hh,v 2.4 1998/10/27 12:24:39 urban Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4MuBremsstrahlung.hh,v 1.2 1999/03/15 13:35:32 urban Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
// ------------------------------------------------------------
// GEANT 4 class header file
@@ -28,9 +28,6 @@
#include "G4MuEnergyLoss.hh"
#include "G4Track.hh"
#include "G4Step.hh"
#include "G4Gamma.hh"
#include "G4MuonMinus.hh"
#include "G4MuonPlus.hh"
#include "G4OrderedTable.hh"
#include "G4PhysicsTable.hh"
#include "G4PhysicsLogVector.hh"
@@ -110,22 +107,9 @@ class G4MuBremsstrahlung : public G4MuEnergyLoss
G4double HighestKineticEnergy;
G4int TotBin;
G4double CutInRange;
const G4Gamma* theGamma;
const G4MuonMinus* theMuonMinus;
const G4MuonPlus* theMuonPlus;
const G4double* GammaCutInKineticEnergy;
const G4double* MuonMinusCutInKineticEnergy;
const G4double* MuonPlusCutInKineticEnergy;
const G4double* ParticleCutInKineticEnergy;
G4double GammaCutInKineticEnergyNow;
G4double MuonMinusCutInKineticEnergyNow;
G4double MuonPlusCutInKineticEnergyNow;
G4double ParticleCutInKineticEnergyNow;
// tables for sampling ..............
static G4int nzdat,ntdat,NBIN ;
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4MuBremsstrahlung.icc,v 2.2 1998/10/27 12:24:40 urban Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4MuBremsstrahlung.icc,v 1.2 1999/03/15 13:35:33 urban Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
// ---------------------------------------------------------------
// GEANT 4 class inlined methods file
@@ -32,7 +32,6 @@ inline G4double G4MuBremsstrahlung::GetMeanFreePath(const G4Track& trackData,
aDynamicParticle = trackData.GetDynamicParticle();
aMaterial = trackData.GetMaterial();
G4double KineticEnergy = aDynamicParticle->GetKineticEnergy();
if (KineticEnergy < LowestKineticEnergy)
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4MuEnergyLoss.hh,v 2.7 1998/10/27 12:24:38 urban Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4MuEnergyLoss.hh,v 1.2 1999/03/15 12:53:06 urban Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
// $Id:
// -------------------------------------------------------------------
@@ -48,6 +48,7 @@
#include "globals.hh"
#include "G4Track.hh"
#include "G4Step.hh"
#include "G4Gamma.hh"
#include "G4Electron.hh"
#include "G4Positron.hh"
#include "G4MuonMinus.hh"
@@ -140,10 +141,13 @@ class G4MuEnergyLoss : public G4VContinuousDiscreteProcess
G4PhysicsTable* theLossTable ;
// cut in range
G4double CutInRange ;
// last cut in range
G4double lastCutInRange ;
G4double lastgammaCutInRange ;
G4double lastelectronCutInRange ;
const G4Electron* theElectron;
const G4Positron* thePositron;
const G4MuonPlus* theMuonPlus;
const G4MuonMinus* theMuonMinus;
// particle mass
G4double ParticleMass;
@@ -194,15 +198,6 @@ class G4MuEnergyLoss : public G4VContinuousDiscreteProcess
// variables for the integration routines
G4double taulow,tauhigh,ltaulow,ltauhigh;
// cuts in kinetic energy ........
G4double* ParticleCutInKineticEnergy ;
G4double ParticleCutInKineticEnergyNow ;
const G4Electron* theElectron;
const G4Positron* thePositron;
const G4MuonPlus* theMuonPlus;
const G4MuonMinus* theMuonMinus;
// data members to speed up the fluctuation calculation
G4int imat ;
G4Material *lastMaterial ;
@@ -241,8 +236,6 @@ class G4MuEnergyLoss : public G4VContinuousDiscreteProcess
static G4PhysicsTable* theProperTimemuplusTable ;
static G4PhysicsTable* theProperTimemuminusTable ;
static G4double CutInmupluslossTable;
static G4double CutInmuminuslossTable;
// processes inherited from G4muEnergyLoss
// register themselves in the static array Recorder
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4MuEnergyLoss.icc,v 2.2 1998/10/27 12:24:39 urban Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4MuEnergyLoss.icc,v 1.1 1999/01/07 16:11:04 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
// $Id:
// ---------------------------------------------------------------
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4MuIonisation.hh,v 2.4 1998/10/27 12:24:39 urban Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4MuIonisation.hh,v 1.2 1999/03/15 13:35:34 urban Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
// ------------------------------------------------------------
@@ -36,7 +36,6 @@
#include "globals.hh"
#include "G4Track.hh"
#include "G4Step.hh"
#include "G4Electron.hh"
#include "G4PhysicsLogVector.hh"
#include "G4PhysicsLinearVector.hh"
@@ -98,19 +97,8 @@ class G4MuIonisation : public G4MuEnergyLoss
G4double HighestKineticEnergy;
G4int TotBin;
// cut in range
G4double CutInRange ;
G4double lastCutInRange ;
// particles , cuts in kinetic energy ........
const G4Electron* theElectron;
const G4MuonPlus* theMuonPlus;
const G4MuonMinus* theMuonMinus;
const G4double* ParticleCutInKineticEnergy;
const G4double* DeltaCutInKineticEnergy ;
G4double ParticleCutInKineticEnergyNow ;
G4double DeltaCutInKineticEnergyNow ;
};
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4MuIonisation.icc,v 2.2 1998/10/27 12:24:39 urban Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4MuIonisation.icc,v 1.1 1999/01/07 16:11:04 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// ---------------------------------------------------------------
@@ -1,125 +0,0 @@
// This code implementation is the intellectual property of
// the RD44 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: G4MuNuclearInteraction.hh,v 2.4 1998/10/27 12:24:40 urban Exp $
// GEANT4 tag $Name: geant4-00 $
//
// $Id:
// ------------------------------------------------------------
// GEANT 4 class header file
//
// For information related to this code contact:
// CERN, CN Division, ASD group
// History: first implementation, based on object model of
// 2nd December 1995, G.Cosmo
// -------- G4MuNuclearInteraction physics process ---------
// by Laszlo Urban, May 1998
// ************************************************************
#ifndef G4MuNuclearInteraction_h
#define G4MuNuclearInteraction_h 1
#include "G4ios.hh"
#include "globals.hh"
#include "Randomize.hh"
#include "G4VDiscreteProcess.hh"
#include "G4Track.hh"
#include "G4Step.hh"
#include "G4MuonMinus.hh"
#include "G4MuonPlus.hh"
#include "G4PionZero.hh"
#include "G4OrderedTable.hh"
#include "G4PhysicsTable.hh"
#include "G4ElementTable.hh"
#include "G4PhysicsLogVector.hh"
class G4MuNuclearInteraction : public G4VDiscreteProcess
{
public:
G4MuNuclearInteraction(const G4String& processName = "MuNucl");
~G4MuNuclearInteraction();
G4bool IsApplicable(const G4ParticleDefinition&);
void SetPhysicsTableBining(G4double lowE, G4double highE, G4int nBins);
void BuildPhysicsTable(const G4ParticleDefinition& ParticleType);
void PrintInfoDefinition() ;
G4double GetMeanFreePath(const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition ) ;
G4VParticleChange *PostStepDoIt(const G4Track& track,
const G4Step& Step ) ;
protected:
G4double ComputeMeanFreePath( const G4ParticleDefinition* ParticleType,
G4double KineticEnergy,
const G4Material* aMaterial);
void ComputePartialSumSigma( const G4ParticleDefinition* ParticleType,
G4double KineticEnergy,
const G4Material* aMaterial);
virtual G4double ComputeMicroscopicCrossSection(
const G4ParticleDefinition* ParticleType,
G4double KineticEnergy,
G4double AtomicNumber,
G4double AtomicMass);
virtual G4double ComputeDMicroscopicCrossSection(
const G4ParticleDefinition* ParticleType,
G4double KineticEnergy,
G4double AtomicNumber,
G4double AtomicMass,
G4double epsilon);
private:
G4MuNuclearInteraction & operator=(const G4MuNuclearInteraction &right);
G4MuNuclearInteraction(const G4MuNuclearInteraction&);
G4Element* SelectRandomAtom(G4Material* aMaterial) const;
void MakeSamplingTables( const G4ParticleDefinition* ParticleType );
private:
G4PhysicsTable* theMeanFreePathTable;
G4PhysicsTable* theCrossSectionTable ;
G4OrderedTable PartialSumSigma;
G4double LowestKineticEnergy;
G4double HighestKineticEnergy;
G4int TotBin;
//cut from R.P. Kokoulin
const G4double CutFixed ;
// for the atomic weight conversion
G4double GramPerMole ;
const G4MuonMinus* theMuonMinus;
const G4MuonPlus* theMuonPlus;
const G4PionZero* thePionZero;
// tables for sampling ..............
static G4int nzdat,ntdat,NBIN ;
static G4double zdat[5],adat[5],tdat[8] ;
static G4double ya[1000],proba[5][8][1000] ;
};
#include "G4MuNuclearInteraction.icc"
#endif
@@ -1,80 +0,0 @@
// This code implementation is the intellectual property of
// the RD44 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: G4MuNuclearInteraction.icc,v 2.2 1998/10/27 12:24:41 urban Exp $
// GEANT4 tag $Name: geant4-00 $
//
// $Id:
// ---------------------------------------------------------------
// GEANT 4 class inlined methods file
//
// For information related to this code contact:
// CERN, CN Division, ASD group
// History: first implementation, based on object model of
// 2nd December 1995, G.Cosmo
// -------- G4MuNuclearInteraction physics process ---------
// by Laszlo Urban, May 1998
// ***************************************************************
inline G4double G4MuNuclearInteraction::GetMeanFreePath(
const G4Track& trackData,
G4double previousStepSize,
G4ForceCondition* condition)
{
const G4DynamicParticle* aDynamicParticle;
G4Material* aMaterial;
G4double MeanFreePath;
G4bool isOutRange ;
*condition = NotForced ;
aDynamicParticle = trackData.GetDynamicParticle();
aMaterial = trackData.GetMaterial();
G4double KineticEnergy = aDynamicParticle->GetKineticEnergy();
if (KineticEnergy < LowestKineticEnergy)
MeanFreePath = DBL_MAX ;
else {
if (KineticEnergy > HighestKineticEnergy)
KineticEnergy = 0.99*HighestKineticEnergy ;
MeanFreePath = (*theMeanFreePathTable)(aMaterial->GetIndex())->
GetValue( KineticEnergy, isOutRange );
}
return MeanFreePath;
}
inline G4double G4MuNuclearInteraction::ComputeMeanFreePath(
const G4ParticleDefinition* ParticleType,
G4double KineticEnergy,
const G4Material* aMaterial)
{
const G4ElementVector* theElementVector = aMaterial->GetElementVector() ;
const G4double* theAtomNumDensityVector =
aMaterial->GetAtomicNumDensityVector();
G4double SIGMA = 0 ;
for ( G4int i=0 ; i < aMaterial->GetNumberOfElements() ; i++ )
{
SIGMA += theAtomNumDensityVector[i] *
ComputeMicroscopicCrossSection( ParticleType, KineticEnergy,
(*theElementVector)(i)->GetZ(),
(*theElementVector)(i)->GetA()) ;
}
return SIGMA<=0.0 ? DBL_MAX : 1./SIGMA ;
}
inline G4bool G4MuNuclearInteraction::IsApplicable(
const G4ParticleDefinition& particle)
{
return( (&particle == (const G4ParticleDefinition *)theMuonMinus)
||(&particle == (const G4ParticleDefinition *)theMuonPlus)
) ;
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4MuPairProduction.hh,v 2.6 1998/10/27 12:24:40 urban Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4MuPairProduction.hh,v 1.2 1999/03/15 13:35:35 urban Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
// $Id:
// ------------------------------------------------------------
@@ -29,10 +29,6 @@
#include "G4MuEnergyLoss.hh"
#include "G4Track.hh"
#include "G4Step.hh"
#include "G4Electron.hh"
#include "G4Positron.hh"
#include "G4MuonMinus.hh"
#include "G4MuonPlus.hh"
#include "G4OrderedTable.hh"
#include "G4PhysicsTable.hh"
#include "G4PhysicsLogVector.hh"
@@ -118,25 +114,11 @@ class G4MuPairProduction : public G4MuEnergyLoss
G4double HighestKineticEnergy;
G4int TotBin;
G4double CutInRange;
const G4Electron* theElectron;
const G4Positron* thePositron;
const G4MuonMinus* theMuonMinus;
const G4MuonPlus* theMuonPlus;
const G4double* ElectronCutInKineticEnergy;
const G4double* PositronCutInKineticEnergy;
const G4double* MuonMinusCutInKineticEnergy;
const G4double* MuonPlusCutInKineticEnergy;
const G4double* ParticleCutInKineticEnergy;
G4double ElectronCutInKineticEnergyNow;
G4double PositronCutInKineticEnergyNow;
G4double MuonMinusCutInKineticEnergyNow;
G4double MuonPlusCutInKineticEnergyNow;
G4double ParticleCutInKineticEnergyNow;
// tables for sampling ..............
static G4int nzdat,ntdat,NBIN ;
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4MuPairProduction.icc,v 2.2 1998/10/27 12:24:40 urban Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4MuPairProduction.icc,v 1.1 1999/01/07 16:11:05 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
// $Id:
// ---------------------------------------------------------------
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4IMuBremsstrahlung.cc,v 2.2 1998/12/09 09:20:44 urban Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4IMuBremsstrahlung.cc,v 1.2 1999/05/04 14:24:21 urban Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// --------------------------------------------------------------
@@ -821,6 +821,8 @@ void G4IMuBremsstrahlung::BuildLambdaTable(const G4ParticleDefinition& ParticleT
delete theMeanFreePathTable;
}
theMeanFreePathTable = new G4PhysicsTable( G4Material::GetNumberOfMaterials() ) ;
PartialSumSigma.resize(G4Material::GetNumberOfMaterials());
G4PhysicsLogVector* ptrVector;
for ( G4int J=0 ; J < G4Material::GetNumberOfMaterials(); J++ )
{
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4IMuEnergyLoss.cc,v 2.2 1998/12/09 09:20:44 urban Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4IMuEnergyLoss.cc,v 1.1 1999/01/07 16:11:06 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
// $Id:
// --------------------------------------------------------------
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4IMuIonisation.cc,v 2.2 1998/12/09 09:20:45 urban Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4IMuIonisation.cc,v 1.2 1999/04/13 09:09:42 urban Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// --------------------------------------------------------------
@@ -1031,16 +1031,17 @@ G4VParticleChange* G4IMuIonisation::PostStepDoIt(
finalKineticEnergy = KineticEnergy - DeltaKineticEnergy ;
if (finalKineticEnergy > 0. )
{
// changed energy and momentum of the actual particle
finalMomentum=sqrt(finalKineticEnergy*
(finalKineticEnergy+2.*ParticleMass)) ;
finalPx = (TotalMomentum*ParticleDirection.x()
-DeltaTotalMomentum*DeltaDirection.x())/finalMomentum ;
finalPy = (TotalMomentum*ParticleDirection.y()
-DeltaTotalMomentum*DeltaDirection.y())/finalMomentum ;
finalPz = (TotalMomentum*ParticleDirection.z()
-DeltaTotalMomentum*DeltaDirection.z())/finalMomentum ;
finalPx = TotalMomentum*ParticleDirection.x()
- DeltaTotalMomentum*DeltaDirection.x();
finalPy = TotalMomentum*ParticleDirection.y()
- DeltaTotalMomentum*DeltaDirection.y();
finalPz = TotalMomentum*ParticleDirection.z()
- DeltaTotalMomentum*DeltaDirection.z();
finalMomentum =
sqrt(finalPx*finalPx+finalPy*finalPy+finalPz*finalPz) ;
finalPx /= finalMomentum ;
finalPy /= finalMomentum ;
finalPz /= finalMomentum ;
aParticleChange.SetMomentumChange( finalPx,finalPy,finalPz );
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4IMuPairProduction.cc,v 2.3 1998/12/09 09:20:47 urban Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4IMuPairProduction.cc,v 1.2 1999/05/04 14:24:23 urban Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
// $Id:
// --------------------------------------------------------------
@@ -809,6 +809,8 @@ void G4IMuPairProduction::BuildLambdaTable(const G4ParticleDefinition& ParticleT
delete theMeanFreePathTable;
}
theMeanFreePathTable = new G4PhysicsTable( G4Material::GetNumberOfMaterials() ) ;
PartialSumSigma.resize(G4Material::GetNumberOfMaterials());
if(&ParticleType == theMuonPlus )
themuplusLambdaTable = theMeanFreePathTable ;
if(&ParticleType == theMuonMinus )
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4MuBremsstrahlung.cc,v 2.6 1998/11/13 13:38:35 urban Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4MuBremsstrahlung.cc,v 1.5 1999/06/14 13:26:30 urban Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// --------------------------------------------------------------
@@ -43,10 +43,7 @@ G4MuBremsstrahlung::G4MuBremsstrahlung(const G4String& processName)
theMeanFreePathTable(NULL),
LowestKineticEnergy (1.*GeV),
HighestKineticEnergy (1000000.*TeV),
TotBin(100),
theGamma (G4Gamma::Gamma() ),
theMuonMinus ( G4MuonMinus::MuonMinus() ),
theMuonPlus ( G4MuonPlus::MuonPlus() )
TotBin(100)
{ }
G4MuBremsstrahlung::~G4MuBremsstrahlung()
@@ -85,7 +82,9 @@ void G4MuBremsstrahlung::BuildPhysicsTable(
if(theMeanFreePathTable == NULL)
MakeSamplingTables(&aParticleType) ;
BuildLambdaTable(aParticleType) ;
G4double gammaCutInRange = G4Gamma::Gamma()->GetCuts();
if(gammaCutInRange != lastgammaCutInRange)
BuildLambdaTable(aParticleType) ;
G4MuEnergyLoss::BuildDEDXTable(aParticleType) ;
@@ -103,7 +102,7 @@ void G4MuBremsstrahlung::BuildLossTable(
const G4MaterialTable* theMaterialTable =
G4Material::GetMaterialTable();
ParticleMass = aParticleType.GetPDGMass();
GammaCutInKineticEnergy = (*theGamma).GetEnergyCuts() ;
GammaCutInKineticEnergy = G4Gamma::Gamma()->GetEnergyCuts() ;
G4int numOfMaterials = theMaterialTable->length() ;
@@ -205,6 +204,7 @@ void G4MuBremsstrahlung::BuildLambdaTable(
delete theMeanFreePathTable;
}
theMeanFreePathTable = new G4PhysicsTable(G4Material::GetNumberOfMaterials());
PartialSumSigma.resize(G4Material::GetNumberOfMaterials());
G4PhysicsLogVector* ptrVector;
for ( G4int J=0 ; J < G4Material::GetNumberOfMaterials(); J++ )
@@ -240,7 +240,7 @@ void G4MuBremsstrahlung::ComputePartialSumSigma(
const G4ElementVector* theElementVector = aMaterial->GetElementVector();
const G4double* theAtomNumDensityVector =
aMaterial->GetAtomicNumDensityVector();
G4double GammaEnergyCut = (G4Gamma::GetCutsInEnergy())[Imate];
G4double GammaEnergyCut = (G4Gamma::Gamma()->GetCutsInEnergy())[Imate];
PartialSumSigma(Imate) = new G4ValVector(NbOfElements);
@@ -425,6 +425,8 @@ void G4MuBremsstrahlung::MakeSamplingTables(
}
}
ya[NBIN] = 0. ; // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
if(CrossSection > 0.)
{
for(G4int ib=0; ib<=nbin; ib++)
@@ -454,17 +456,11 @@ G4VParticleChange* G4MuBremsstrahlung::PostStepDoIt(const G4Track& trackData,
// Gamma cut in this material
G4double GammaEnergyCut =
(G4Gamma::GetCutsInEnergy())[aMaterial->GetIndex()];
(G4Gamma::Gamma()->GetCutsInEnergy())[aMaterial->GetIndex()];
// check against insufficient energy
if (KineticEnergy < GammaEnergyCut)
{
aParticleChange.SetMomentumChange( ParticleDirection );
aParticleChange.SetEnergyChange( KineticEnergy );
aParticleChange.SetLocalEnergyDeposit (0.);
aParticleChange.SetNumberOfSecondaries(0);
if(KineticEnergy < GammaEnergyCut)
return G4VContinuousDiscreteProcess::PostStepDoIt(trackData,stepData);
}
// select randomly one element constituing the material
G4Element* anElement = SelectRandomAtom(aMaterial);
@@ -497,22 +493,20 @@ G4VParticleChange* G4MuBremsstrahlung::PostStepDoIt(const G4Track& trackData,
del = abs(log(KineticEnergy)-log(tdat[it])) ;
if(del<delmin)
{
del=delmin;
delmin=del;
itt=it ;
}
}
//sample energy transfer according to the sampling table
G4double r = G4UniformRand() ;
iy = -1 ;
do {
iy += 1 ;
} while (((proba[izz][itt][iy]) < r)&&(iy < NBINminus1)) ;
} while ((proba[izz][itt][iy] < r)&&(iy < NBINminus1)) ;
//sampling is Done uniformly in y in the bin
if( iy < NBINminus1 )
if( iy < NBIN )
y = ya[iy] + G4UniformRand() * ( ya[iy+1] - ya[iy] ) ;
else
y = ya[iy] ;
@@ -573,14 +567,14 @@ G4Element* G4MuBremsstrahlung::SelectRandomAtom(G4Material* aMaterial) const
G4double rval = G4UniformRand()*((*PartialSumSigma(Index))(NumberOfElements-1));
for ( G4int i=0; i < NumberOfElements; i++ )
if (rval <= (*PartialSumSigma(Index))(i)) return ((*theElementVector)(i));
G4cout << " WARNING !!! - The Material '"<< aMaterial->GetName()
<< "' has no elements, NULL pointer returned." << endl;
G4cout << " WARNING !!! - The Material " << aMaterial->GetName()
<< " has no elements, NULL pointer returned." << endl;
return NULL;
}
void G4MuBremsstrahlung::PrintInfoDefinition()
{
G4String comments = "cross sections from R. Kokoulin \n ";
G4String comments = "theoretical cross section \n ";
comments += " Good description up to 1000 TeV.";
G4cout << endl << GetProcessName() << ": " << comments
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4MuEnergyLoss.cc,v 2.8 1998/12/09 09:20:42 urban Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4MuEnergyLoss.cc,v 1.6 1999/06/18 11:30:47 urban Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
// $Id:
// --------------------------------------------------------------
@@ -42,7 +42,7 @@
// The NbOfProcesses data member can be changed using the (public static)
// functions Get/Set/Plus/MinusNbOfProcesses (see G4MuEnergyLoss.hh)
G4int G4MuEnergyLoss::NbOfProcesses = 3 ;
G4int G4MuEnergyLoss::NbOfProcesses = 3 ; // !!!!!!!!!!!!!!!
G4PhysicsTable** G4MuEnergyLoss::RecorderOfmuplusProcess =
new G4PhysicsTable*[10] ;
@@ -74,9 +74,8 @@ G4PhysicsTable* G4MuEnergyLoss::themuplusRangeCoeffCTable = NULL ;
G4PhysicsTable* G4MuEnergyLoss::themuminusRangeCoeffATable = NULL ;
G4PhysicsTable* G4MuEnergyLoss::themuminusRangeCoeffBTable = NULL ;
G4PhysicsTable* G4MuEnergyLoss::themuminusRangeCoeffCTable = NULL ;
G4double G4MuEnergyLoss::CutInmupluslossTable = 0. ;
G4double G4MuEnergyLoss::CutInmuminuslossTable = 0. ;
G4EnergyLossMessenger* G4MuEnergyLoss::eLossMessenger = NULL ;
// constructor and destructor
@@ -94,7 +93,8 @@ G4MuEnergyLoss::G4MuEnergyLoss(const G4String& processName)
theRangeCoeffBTable(NULL),
theRangeCoeffCTable(NULL),
lastMaterial(NULL),
lastCutInRange(0.),
lastgammaCutInRange(0.),
lastelectronCutInRange(0.),
theElectron ( G4Electron::Electron() ),
thePositron ( G4Positron::Positron() ),
theMuonPlus ( G4MuonPlus::MuonPlus() ),
@@ -114,56 +114,39 @@ G4MuEnergyLoss::~G4MuEnergyLoss()
const G4ParticleDefinition& aParticleType)
{
// calculate data members TotBin,LOGRTable,RTable first
G4double lrate ;
G4int nbin ;
G4double binning = 2.*dRoverRange ;
lrate = log(HighestKineticEnergy/LowestKineticEnergy) ;
nbin = G4int((lrate/log(1.+binning) + lrate/log(1.+2.*binning))/2.);
nbin = (nbin+25)/50 ;
TotBin = 50*nbin ;
if(TotBin<50)
TotBin = 50 ;
if(TotBin>500)
TotBin = 500 ;
G4double binning = dRoverRange;
G4double lrate = log(HighestKineticEnergy/LowestKineticEnergy);
G4int nbin = G4int(lrate/log(1.+binning) + 0.5 );
nbin = (nbin+25)/50;
TotBin =50*nbin ;
if (TotBin<50) TotBin = 50;
if (TotBin>500) TotBin = 500;
LOGRTable=lrate/TotBin;
RTable =exp(LOGRTable);
G4bool MakeTable ;
ParticleMass = aParticleType.GetPDGMass() ;
G4double Charge = aParticleType.GetPDGCharge() ;
CutInRange = aParticleType.GetLengthCuts();
G4double gammaCutInRange = G4Gamma::Gamma()->GetCuts();
G4double electronCutInRange = G4Electron::Electron()->GetCuts();
// Create tables only if there is a new cut value !*************************
if( Charge > 0.)
MakeTable = false ;
// Create tables only if there are new cut values
if((gammaCutInRange == lastgammaCutInRange) &&
(electronCutInRange == lastelectronCutInRange))
{
if(CounterOfmuplusProcess==NbOfProcesses)
{
if(CutInRange != CutInmupluslossTable)
MakeTable = true ;
CutInmupluslossTable = CutInRange ;
}
else
{
MakeTable = false ;
}
;
}
else
{
if(CounterOfmuminusProcess==NbOfProcesses)
{
if(CutInRange != CutInmuminuslossTable)
MakeTable = true ;
CutInmuminuslossTable = CutInRange ;
}
else
{
MakeTable = false ;
}
if((Charge > 0.)&&(CounterOfmuplusProcess==NbOfProcesses))
MakeTable = true ;
if((Charge < 0.)&&(CounterOfmuminusProcess==NbOfProcesses))
MakeTable = true ;
}
if( MakeTable )
{
// Build energy loss table as a sum of the energy loss due to the
// different processes.
const G4MaterialTable* theMaterialTable=
@@ -203,66 +186,53 @@ G4MuEnergyLoss::~G4MuEnergyLoss()
if(CounterOfProcess == NbOfProcesses)
{
// loop for materials
G4double LowEdgeEnergy , Value ;
G4bool isOutRange ;
G4int J;
G4PhysicsTable* pointer ;
for (J=0; J<numOfMaterials; J++)
{
// create physics vector and fill it
G4PhysicsLogVector* aVector = new G4PhysicsLogVector(
LowestKineticEnergy, HighestKineticEnergy, TotBin);
// loop for the kinetic energy
for (G4int i=0; i<TotBin; i++)
{
LowEdgeEnergy = aVector->GetLowEdgeEnergy(i) ;
Value = 0. ;
for (G4int process=0; process < NbOfProcesses; process++)
{
pointer= RecorderOfProcess[process];
Value += (*pointer)[J]->
GetValue(LowEdgeEnergy,isOutRange) ;
}
aVector->PutValue(i,Value) ;
}
theDEDXTable->insert(aVector) ;
}
}
// reset counter to zero ..................
if( Charge >0.)
CounterOfmuplusProcess=0 ;
else
CounterOfmuminusProcess=0 ;
// reset counter to zero ..................
if( Charge >0.)
CounterOfmuplusProcess=0 ;
else
CounterOfmuminusProcess=0 ;
// Build range table
BuildRangeTable( aParticleType);
// Build range table
BuildRangeTable( aParticleType);
// Build lab/proper time tables
BuildTimeTables( aParticleType) ;
// Build lab/proper time tables
BuildTimeTables( aParticleType) ;
// Build coeff tables for the energy loss calculation
BuildRangeCoeffATable( aParticleType);
BuildRangeCoeffBTable( aParticleType);
BuildRangeCoeffCTable( aParticleType);
// invert the range table
BuildInverseRangeTable(aParticleType);
// Build coeff tables for the energy loss calculation
BuildRangeCoeffATable( aParticleType);
BuildRangeCoeffBTable( aParticleType);
BuildRangeCoeffCTable( aParticleType);
// invert the range table
BuildInverseRangeTable(aParticleType);
}
}
// make the energy loss and the range table available
const G4double lowestKineticEnergy(1.00*keV);
const G4double highestKineticEnergy(1000000.*TeV);
@@ -273,6 +243,10 @@ G4MuEnergyLoss::~G4MuEnergyLoss()
(Charge > 0)? theLabTimemuplusTable: theLabTimemuminusTable,
(Charge > 0)? theProperTimemuplusTable: theProperTimemuminusTable,
lowestKineticEnergy, highestKineticEnergy, 1.,TotBin);
lastgammaCutInRange = gammaCutInRange ;
lastelectronCutInRange = electronCutInRange ;
}
}
void G4MuEnergyLoss::BuildRangeTable(
@@ -1171,51 +1145,44 @@ G4VParticleChange* G4MuEnergyLoss::AlongStepDoIt(
// do not track further if kin.energy < 1. eV
const G4double MinKineticEnergy = 1.*eV;
const G4double linLossLimit = 0.02 ;
G4double MeanLoss, finalT;
if (E < MinKineticEnergy) { finalT = 0.; MeanLoss = E;}
else if (EnergyBinNumber <= 0)
{
if (Step >= fRangeNow) { finalT = 0.; MeanLoss = E;}
else
{
finalT = E*(1.-Step/fRangeNow)*(1.-Step/fRangeNow);
if (finalT < MinKineticEnergy) finalT = 0.;
MeanLoss = E - finalT;
}
}
if (E < MinKineticEnergy) finalT = 0.;
else if ( E<= LowestKineticEnergy)
{
if (Step >= fRangeNow) finalT = 0.;
else finalT = E - Step*fdEdx ;
}
else if (E>=HighestKineticEnergy) finalT = E - Step*fdEdx;
else if (EnergyBinNumber >= (TotBin-1))
{
// simple solution for the moment: loss = Step*dE/dx (dE/dx const)
MeanLoss = Step*fdEdx;
if (MeanLoss > E) MeanLoss = E;
finalT = E - MeanLoss;
if (finalT < MinKineticEnergy) { finalT = 0.; MeanLoss = E;}
}
else if (Step >= fRangeNow) { finalT = 0.; MeanLoss = E;}
else if (Step >= fRangeNow) finalT = 0.;
else
{
{
if(Step/fRangeNow < linLossLimit) finalT = E-Step*fdEdx ;
else
{
if (charge<0.) finalT = G4EnergyLossTables::GetPreciseEnergyFromRange(
theMuonMinus,fRangeNow-Step,aMaterial);
else finalT = G4EnergyLossTables::GetPreciseEnergyFromRange(
theMuonPlus,fRangeNow-Step,aMaterial);
if (finalT < MinKineticEnergy) finalT = 0.;
MeanLoss = E-finalT;
if (MeanLoss < 0.) { MeanLoss = 0.; finalT = E;}
//now the loss with fluctuation
if ((EnlossFlucFlag) && (MeanLoss > 0.) && (MeanLoss < E))
{
finalT = E-GetLossWithFluct(aParticle,aMaterial,MeanLoss);
if (finalT < 0.) finalT = E-MeanLoss;
}
}
}
if(finalT < MinKineticEnergy) finalT = 0. ;
MeanLoss = E-finalT ;
//now the loss with fluctuation
if ((EnlossFlucFlag) && (finalT > 0.) && (finalT < E)&&(E > LowestKineticEnergy))
{
finalT = E-GetLossWithFluct(aParticle,aMaterial,MeanLoss);
if (finalT < 0.) finalT = E-MeanLoss;
}
// kill the particle if the kinetic energy <= 0
if (finalT <= 0. )
@@ -1237,6 +1204,8 @@ G4double G4MuEnergyLoss::GetLossWithFluct(const G4DynamicParticle* aParticle,
// calculate actual loss from the mean loss
// The model used to get the fluctuation is the same as in Glandz in Geant3.
{
static const G4double Tlow=10.*keV ;
// check if the material has changed ( cache mechanism)
if (aMaterial != lastMaterial)
@@ -1265,8 +1234,7 @@ G4double G4MuEnergyLoss::GetLossWithFluct(const G4DynamicParticle* aParticle,
// get particle data
G4double Tkin = aParticle->GetKineticEnergy();
G4double charge = aParticle->GetDefinition()->GetPDGCharge();
if (charge<0.) threshold =((*G4Electron::Electron()).GetCutsInEnergy())[imat];
else threshold =((*G4Positron::Positron()).GetCutsInEnergy())[imat];
threshold =((*G4Electron::Electron()).GetCutsInEnergy())[imat];
G4double rmass = electron_mass_c2/ParticleMass;
G4double tau = Tkin/ParticleMass, tau1 = tau+1., tau2 = tau*(tau+2.);
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4MuIonisation.cc,v 2.6 1998/11/13 13:38:35 urban Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4MuIonisation.cc,v 1.3 1999/04/13 09:09:41 urban Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// --------------------------------------------------------------
@@ -30,6 +30,8 @@
#include "G4MuIonisation.hh"
#include "G4UnitsTable.hh"
#include "G4ios.hh"
// constructor and destructor
G4MuIonisation::G4MuIonisation(const G4String& processName)
@@ -37,11 +39,7 @@ G4MuIonisation::G4MuIonisation(const G4String& processName)
LowestKineticEnergy(1.00*keV),
HighestKineticEnergy(1000000.*TeV),
theMeanFreePathTable(NULL),
lastCutInRange(0.),
TotBin(100),
theElectron ( G4Electron::Electron() ),
theMuonPlus ( G4MuonPlus::MuonPlus() ),
theMuonMinus ( G4MuonMinus::MuonMinus() )
TotBin(100)
{ }
G4MuIonisation::~G4MuIonisation()
@@ -63,12 +61,9 @@ void G4MuIonisation::SetPhysicsTableBining(G4double lowE, G4double highE,
void G4MuIonisation::BuildPhysicsTable(const G4ParticleDefinition& aParticleType)
// just call BuildLossTable+BuildLambdaTable
{
BuildLossTable(aParticleType) ;
G4double Charge = aParticleType.GetPDGCharge();
CutInRange = aParticleType.GetLengthCuts();
BuildLossTable(aParticleType) ;
if(Charge>0.)
{
RecorderOfmuplusProcess[CounterOfmuplusProcess] = (*this).theLossTable ;
@@ -80,11 +75,9 @@ void G4MuIonisation::BuildPhysicsTable(const G4ParticleDefinition& aParticleType
CounterOfmuminusProcess++;
}
if(CutInRange != lastCutInRange)
{
lastCutInRange = CutInRange ;
G4double electronCutInRange = G4Electron::Electron()->GetCuts();
if(electronCutInRange != lastelectronCutInRange)
BuildLambdaTable(aParticleType) ;
}
G4MuEnergyLoss::BuildDEDXTable(aParticleType) ;
@@ -94,14 +87,7 @@ void G4MuIonisation::BuildPhysicsTable(const G4ParticleDefinition& aParticleType
void G4MuIonisation::BuildLossTable(const G4ParticleDefinition& aParticleType)
{
G4double Charge = aParticleType.GetPDGCharge() ;
if(Charge>0.)
ParticleCutInKineticEnergy = theMuonPlus->GetCutsInEnergy() ;
else
ParticleCutInKineticEnergy = theMuonMinus->GetCutsInEnergy() ;
DeltaCutInKineticEnergy = theElectron->GetCutsInEnergy() ;
DeltaCutInKineticEnergy = theElectron->GetCutsInEnergy() ;
G4double LowEdgeEnergy , ionloss ;
G4double RateMass ;
@@ -151,11 +137,9 @@ void G4MuIonisation::BuildLossTable(const G4ParticleDefinition& aParticleType)
material->GetAtomicNumDensityVector() ;
const G4int NumberOfElements=
material->GetNumberOfElements() ;
DeltaCutInKineticEnergyNow = DeltaCutInKineticEnergy[J] ;
G4double tau,tau0,Tmax,gamma,bg2,beta2,rcut,delta,x,sh ;
for (G4int i = 0 ; i < TotBin ; i++)
{
LowEdgeEnergy = aVector->GetLowEdgeEnergy(i) ;
@@ -248,7 +232,7 @@ void G4MuIonisation::BuildLossTable(const G4ParticleDefinition& aParticleType)
void G4MuIonisation::BuildLambdaTable(const G4ParticleDefinition& aParticleType)
{
// Build mean free path tables for the delta ray production process
G4double LowEdgeEnergy , Value ,sigma ;
G4double LowEdgeEnergy,Tmax , Value ,sigma ;
G4bool isOutRange ;
const G4MaterialTable* theMaterialTable=G4Material::GetMaterialTable();
@@ -263,7 +247,6 @@ void G4MuIonisation::BuildLambdaTable(const G4ParticleDefinition& aParticleType)
// get electron and particle cuts in kinetic energy
DeltaCutInKineticEnergy = theElectron->GetCutsInEnergy() ;
ParticleCutInKineticEnergy = aParticleType.GetEnergyCuts() ;
for (G4int J=0 ; J < numOfMaterials; J++)
{
@@ -282,13 +265,23 @@ void G4MuIonisation::BuildLambdaTable(const G4ParticleDefinition& aParticleType)
{
LowEdgeEnergy = aVector->GetLowEdgeEnergy(i) ;
sigma = 0. ;
for (G4int iel=0; iel<NumberOfElements; iel++ )
// check threshold here !
G4double Tmax = 2.*electron_mass_c2*LowEdgeEnergy*
(LowEdgeEnergy+2.*ParticleMass)/
(ParticleMass*ParticleMass+2.*electron_mass_c2*
(LowEdgeEnergy+ParticleMass)+
electron_mass_c2*electron_mass_c2) ;
if(Tmax > DeltaCutInKineticEnergyNow)
{
sigma += theAtomicNumDensityVector[iel]*
for (G4int iel=0; iel<NumberOfElements; iel++ )
{
sigma += theAtomicNumDensityVector[iel]*
ComputeMicroscopicCrossSection(aParticleType,
LowEdgeEnergy,
(*theElementVector)(iel)->GetZ() ) ;
}
}
Value = sigma<=0 ? DBL_MAX : 1./sigma ;
@@ -341,7 +334,6 @@ G4double G4MuIonisation::ComputeMicroscopicCrossSection(
}
}
}
return TotalCrossSection ;
}
@@ -430,10 +422,12 @@ G4VParticleChange* G4MuIonisation::PostStepDoIt(
(a0+log((2.*TotalEnergy-twoep)/ParticleMass)-
log(1.+twoep/electron_mass_c2)))
/grejc ;
} while( G4UniformRand()>grej );
}
DeltaKineticEnergy = x * MaxKineticEnergyTransfer ;
if(DeltaKineticEnergy <= 0.)
return G4VContinuousDiscreteProcess::PostStepDoIt(trackData,stepData);
@@ -467,15 +461,18 @@ G4VParticleChange* G4MuIonisation::PostStepDoIt(
finalKineticEnergy = KineticEnergy - DeltaKineticEnergy ;
if (finalKineticEnergy > 0. )
{
// changed energy and momentum of the actual particle
finalMomentum=sqrt(finalKineticEnergy*
(finalKineticEnergy+2.*ParticleMass)) ;
finalPx = (TotalMomentum*ParticleDirection.x()
-DeltaTotalMomentum*DeltaDirection.x())/finalMomentum ;
finalPy = (TotalMomentum*ParticleDirection.y()
-DeltaTotalMomentum*DeltaDirection.y())/finalMomentum ;
finalPz = (TotalMomentum*ParticleDirection.z()
-DeltaTotalMomentum*DeltaDirection.z())/finalMomentum ;
finalPx = TotalMomentum*ParticleDirection.x()
- DeltaTotalMomentum*DeltaDirection.x();
finalPy = TotalMomentum*ParticleDirection.y()
- DeltaTotalMomentum*DeltaDirection.y();
finalPz = TotalMomentum*ParticleDirection.z()
- DeltaTotalMomentum*DeltaDirection.z();
finalMomentum =
sqrt(finalPx*finalPx+finalPy*finalPy+finalPz*finalPz) ;
finalPx /= finalMomentum ;
finalPy /= finalMomentum ;
finalPz /= finalMomentum ;
aParticleChange.SetMomentumChange( finalPx,finalPy,finalPz );
}
else
@@ -5,10 +5,9 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4MuPairProduction.cc,v 2.10 1998/12/02 16:33:18 urban Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4MuPairProduction.cc,v 1.6 1999/06/14 13:26:35 urban Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
// $Id:
// --------------------------------------------------------------
// GEANT 4 class implementation file
//
@@ -21,6 +20,7 @@
// **************************************************************
// 04-06-98, in DoIt,secondary production condition:range>min(threshold,safety)
// 26/10/98, new stuff from R. Kokoulin + cleanup , L.Urban
// 06/05/99 , bug fixed , L.Urban
// --------------------------------------------------------------
#include "G4MuPairProduction.hh"
@@ -42,11 +42,7 @@ G4MuPairProduction::G4MuPairProduction(const G4String& processName)
theMeanFreePathTable(NULL),
LowestKineticEnergy (1.*GeV),
HighestKineticEnergy (1000000.*TeV),
TotBin(50),
theElectron (G4Electron::Electron() ),
thePositron (G4Positron::Positron() ),
theMuonMinus ( G4MuonMinus::MuonMinus() ),
theMuonPlus ( G4MuonPlus::MuonPlus() )
TotBin(50)
{ }
@@ -89,16 +85,16 @@ void G4MuPairProduction::BuildPhysicsTable(
if(theMeanFreePathTable == NULL)
MakeSamplingTables(&aParticleType) ;
BuildLambdaTable(aParticleType) ;
G4double electronCutInRange = G4Electron::Electron()->GetCuts();
if(electronCutInRange != lastelectronCutInRange)
BuildLambdaTable(aParticleType) ;
G4MuEnergyLoss::BuildDEDXTable(aParticleType) ;
if(&aParticleType==theMuonPlus)
PrintInfoDefinition() ;
}
void G4MuPairProduction::BuildLossTable(
const G4ParticleDefinition& aParticleType)
{
@@ -153,7 +149,6 @@ void G4MuPairProduction::BuildLossTable(
natom = theAtomicNumDensityVector[iel] ;
loss = ComputePairLoss(&aParticleType,
Z,KineticEnergy,eCut,pCut) ;
pairloss += natom*loss ;
}
if(pairloss<0.)
@@ -166,7 +161,6 @@ void G4MuPairProduction::BuildLossTable(
}
}
G4double G4MuPairProduction::ComputePairLoss(
const G4ParticleDefinition* ParticleType,
G4double AtomicNumber,
@@ -180,7 +174,7 @@ G4double G4MuPairProduction::ComputePairLoss(
wgi[] ={ 0.0506,0.1112,0.1569,0.1813,0.1813,0.1569,0.1112,0.0506 };
static const G4double ak1=6.9 ;
static const G4double ak2=1.0 ;
G4double sqrte = sqrt(exp(1.)) ;
static const G4double sqrte = sqrt(exp(1.)) ;
G4double z13 = exp(log(AtomicNumber)/3.) ;
G4double loss = 0.0 ;
@@ -236,6 +230,7 @@ void G4MuPairProduction::BuildLambdaTable(
}
theMeanFreePathTable = new
G4PhysicsTable( G4Material::GetNumberOfMaterials() ) ;
PartialSumSigma.resize(G4Material::GetNumberOfMaterials());
G4PhysicsLogVector* ptrVector;
for ( G4int J=0 ; J < G4Material::GetNumberOfMaterials(); J++ )
@@ -304,7 +299,7 @@ G4double G4MuPairProduction::ComputeMicroscopicCrossSection(
static const G4double ak1=6.9 ;
static const G4double ak2=1.0 ;
G4double sqrte = sqrt(exp(1.)) ;
static const G4double sqrte = sqrt(exp(1.)) ;
G4double z13 = exp(log(AtomicNumber)/3.) ;
G4double CrossSection = 0.0 ;
@@ -357,7 +352,7 @@ void G4MuPairProduction::MakeSamplingTables(
MinPairEnergy = 4.*electron_mass_c2 ;
G4double sqrte = sqrt(exp(1.)) ;
static const G4double sqrte = sqrt(exp(1.)) ;
for (G4int iz=0; iz<nzdat; iz++)
{
@@ -399,6 +394,7 @@ void G4MuPairProduction::MakeSamplingTables(
proba[iz][it][nbin] = CrossSection ;
}
}
ya[NBIN]=0. ;
if(CrossSection > 0.)
{
@@ -420,7 +416,7 @@ G4double G4MuPairProduction::ComputeDDMicroscopicCrossSection(
// Calculates the double differential (DD) microscopic cross section
// using the cross section formula of R.P. Kokoulin (18/01/98)
{
G4double sqrte = sqrt(exp(1.)) ;
static const G4double sqrte = sqrt(exp(1.)) ;
G4double bbbtf= 183. ;
G4double bbbh = 202.4 ;
@@ -595,23 +591,18 @@ G4VParticleChange* G4MuPairProduction::PostStepDoIt(const G4Track& trackData,
aDynamicParticle->GetMomentumDirection();
// e-e+ cut in this material
G4double ElectronEnergyCut =
(G4Electron::GetCutsInEnergy())[aMaterial->GetIndex()];
G4double PositronEnergyCut =
(G4Electron::GetCutsInEnergy())[aMaterial->GetIndex()];
G4double ElectronEnergyCut = electron_mass_c2+
((*G4Electron::Electron()).GetCutsInEnergy())[aMaterial->GetIndex()];
G4double PositronEnergyCut = electron_mass_c2+
((*G4Positron::Positron()).GetCutsInEnergy())[aMaterial->GetIndex()];
G4double CutInPairEnergy = ElectronEnergyCut + PositronEnergyCut ;
G4double MinPairEnergy = 4.*electron_mass_c2 ;
if (CutInPairEnergy < MinPairEnergy) CutInPairEnergy = MinPairEnergy ;
// check against insufficient energy
if (KineticEnergy < CutInPairEnergy )
{
aParticleChange.SetMomentumChange( ParticleDirection );
aParticleChange.SetEnergyChange( KineticEnergy );
aParticleChange.SetLocalEnergyDeposit (0.);
aParticleChange.SetNumberOfSecondaries(0);
return G4VContinuousDiscreteProcess::PostStepDoIt(trackData,stepData);
}
if(KineticEnergy < CutInPairEnergy )
return G4VContinuousDiscreteProcess::PostStepDoIt(trackData,stepData);
// select randomly one element constituing the material
G4Element* anElement = SelectRandomAtom(aMaterial);
@@ -650,7 +641,7 @@ G4VParticleChange* G4MuPairProduction::PostStepDoIt(const G4Track& trackData,
del = abs(log(KineticEnergy)-log(tdat[it])) ;
if(del<delmin)
{
del=delmin;
delmin=del;
itt=it ;
}
}
@@ -662,17 +653,17 @@ G4VParticleChange* G4MuPairProduction::PostStepDoIt(const G4Track& trackData,
do {
iy += 1 ;
} while ((ya[iy] < yc )&&(iy < NBINminus1)) ;
G4double norm = 1./(1.-proba[izz][itt][iy]) ;
G4double norm = proba[izz][itt][iy] ;
G4double r = G4UniformRand() ;
G4double r = norm+G4UniformRand()*(1.-norm) ;
iy = -1 ;
iy -= 1 ;
do {
iy += 1 ;
} while (((norm*proba[izz][itt][iy]) < r)&&(iy < NBINminus1)) ;
} while ((proba[izz][itt][iy] < r)&&(iy < NBINminus1)) ;
//sampling is uniformly in y in the bin
if( iy < NBINminus1 )
if( iy < NBIN )
y = ya[iy] + G4UniformRand() * ( ya[iy+1] - ya[iy]) ;
else
y = ya[iy] ;
@@ -801,7 +792,7 @@ G4Element* G4MuPairProduction::SelectRandomAtom(G4Material* aMaterial) const
}
void G4MuPairProduction::PrintInfoDefinition()
{
G4String comments = "cross sections from R. Kokoulin \n ";
G4String comments = "theoretical cross sections \n ";
comments += " Good description up to 1000 TeV.";
G4cout << endl << GetProcessName() << ": " << comments
@@ -1,4 +1,4 @@
# $Id: GNUmakefile,v 2.1 1998/10/20 03:49:09 asaim Exp $
# $Id: GNUmakefile,v 1.2 1999/06/05 12:45:59 stesting Exp $
# --------------------------------------------------------------------
# GNUmakefile for electromagnetic sub-library. John Allison, 25/6/98.
# --------------------------------------------------------------------
@@ -31,3 +31,24 @@ CPPFLAGS += -I$(G4BASE)/global/management/include \
-I$(G4BASE)/materials/include
include $(G4INSTALL)/config/common.gmk
CXXFLAGS_WITHOUT_O := $(filter-out -O% , $(CXXFLAGS))
CXXFLAGS_WITHOUT_O := $(filter-out +O% , $(CXXFLAGS_WITHOUT_O))
ifeq ($(G4SYSTEM),HP-aCC)
COMPILER := $(shell aCC -V 2>&1)
ifeq ($(COMPILER), aCC: HP ANSI C++ B3910B A.01.15)
$(G4TMP)/$(G4SYSTEM)/$(name)/G4IeEnergyLoss.o: src/G4IeEnergyLoss.cc
$(CXX) $(CXXFLAGS_WITHOUT_O) $(CPPFLAGS) -c $(OUT_OBJ)$@ src/G4IeEnergyLoss.cc
$(G4TMP)/$(G4SYSTEM)/$(name)/G4IhEnergyLoss.o: src/G4IhEnergyLoss.cc
$(CXX) $(CXXFLAGS_WITHOUT_O) $(CPPFLAGS) -c $(OUT_OBJ)$@ src/G4IhEnergyLoss.cc
$(G4TMP)/$(G4SYSTEM)/$(name)/G4eEnergyLoss.o: src/G4eEnergyLoss.cc
$(CXX) $(CXXFLAGS_WITHOUT_O) $(CPPFLAGS) -c $(OUT_OBJ)$@ src/G4eEnergyLoss.cc
$(G4TMP)/$(G4SYSTEM)/$(name)/G4eEnergyLossPlus.o: src/G4eEnergyLossPlus.cc
$(CXX) $(CXXFLAGS_WITHOUT_O) $(CPPFLAGS) -c $(OUT_OBJ)$@ src/G4eEnergyLossPlus.cc
$(G4TMP)/$(G4SYSTEM)/$(name)/G4hEnergyLoss.o: src/G4hEnergyLoss.cc
$(CXX) $(CXXFLAGS_WITHOUT_O) $(CPPFLAGS) -c $(OUT_OBJ)$@ src/G4hEnergyLoss.cc
$(G4TMP)/$(G4SYSTEM)/$(name)/G4hEnergyLossPlus.o: src/G4hEnergyLossPlus.cc
$(CXX) $(CXXFLAGS_WITHOUT_O) $(CPPFLAGS) -c $(OUT_OBJ)$@ src/G4hEnergyLossPlus.cc
endif
endif
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4ComptonScattering.hh,v 2.6 1998/10/06 15:34:46 maire Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4ComptonScattering.hh,v 1.1 1999/01/07 16:11:09 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// ------------------------------------------------------------
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4ComptonScattering.icc,v 2.6 1998/12/15 13:06:24 maire Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4ComptonScattering.icc,v 1.1 1999/01/07 16:11:09 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// ---------------------------------------------------------------
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4EnergyLossMessenger.hh,v 2.3 1998/10/20 12:23:47 maire Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4EnergyLossMessenger.hh,v 1.1 1999/01/07 16:11:09 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4GammaConversion.hh,v 2.6 1998/09/04 14:25:58 maire Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4GammaConversion.hh,v 1.1 1999/01/07 16:11:09 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// ------------------------------------------------------------
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4GammaConversion.icc,v 2.4 1998/09/04 14:25:59 maire Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4GammaConversion.icc,v 1.1 1999/01/07 16:11:10 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// ---------------------------------------------------------------
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4IMultipleScattering.hh,v 2.5 1998/12/09 09:17:31 urban Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4IMultipleScattering.hh,v 1.1 1999/01/07 16:11:10 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
// $Id:
// --------------------------------------------------------------
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4IMultipleScattering.icc,v 2.4 1998/11/13 08:00:07 urban Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4IMultipleScattering.icc,v 1.1 1999/01/07 16:11:10 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
// $Id:
// -------------------------------------------------------------
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4IeBremsstrahlung.hh,v 2.4 1998/10/29 13:56:48 urban Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4IeBremsstrahlung.hh,v 1.2 1999/05/04 14:29:35 urban Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
// $Id:
// ------------------------------------------------------------
@@ -82,6 +82,9 @@ class G4IeBremsstrahlung : public G4IeEnergyLoss
G4double PostStepGetPhysicalInteractionLength( const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition);
G4double GetNlambda(
G4double KineticEnergy,G4Material* material);
protected:
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4IeBremsstrahlung.icc,v 2.3 1998/10/29 13:56:49 urban Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4IeBremsstrahlung.icc,v 1.2 1999/05/04 14:29:35 urban Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
// $Id:
// ---------------------------------------------------------------
@@ -197,3 +197,18 @@ inline G4bool G4IeBremsstrahlung::IsApplicable(
) ;
}
inline G4double G4IeBremsstrahlung::GetNlambda(
G4double KineticEnergy,
G4Material* material)
{
G4bool isOut;
const G4MaterialTable* theMaterialTable =
G4Material::GetMaterialTable() ;
G4double lambda = (*theNlambdaTable)
[material->GetIndex()]->
GetValue(KineticEnergy,isOut);
return lambda;
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4IeEnergyLoss.hh,v 2.6 1998/10/29 13:56:45 urban Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4IeEnergyLoss.hh,v 1.1 1999/01/07 16:11:11 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
// $Id:
// ------------------------------------------------------------
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4IeEnergyLoss.icc,v 2.3 1998/10/29 13:56:46 urban Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4IeEnergyLoss.icc,v 1.1 1999/01/07 16:11:11 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
// $Id:
// ---------------------------------------------------------------
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4IeIonisation.hh,v 2.4 1998/10/29 13:56:47 urban Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4IeIonisation.hh,v 1.2 1999/05/04 14:29:34 urban Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
// $Id:
// ------------------------------------------------------------
@@ -72,6 +72,9 @@ class G4IeIonisation : public G4IeEnergyLoss
G4VParticleChange *PostStepDoIt(const G4Track& track,
const G4Step& Step ) ;
G4double GetNlambda(
G4double KineticEnergy,G4Material* material);
protected:
virtual G4double ComputeMicroscopicCrossSection(
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4IeIonisation.icc,v 2.3 1998/10/29 13:56:47 urban Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4IeIonisation.icc,v 1.2 1999/05/04 14:29:34 urban Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
// $Id:
// ---------------------------------------------------------------
@@ -146,3 +146,18 @@ inline G4bool G4IeIonisation::IsApplicable(
) ;
}
inline G4double G4IeIonisation::GetNlambda(
G4double KineticEnergy,
G4Material* material)
{
G4bool isOut;
const G4MaterialTable* theMaterialTable =
G4Material::GetMaterialTable() ;
G4double lambda = (*theNlambdaTable)
[material->GetIndex()]->
GetValue(KineticEnergy,isOut);
return lambda;
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4IeplusAnnihilation.hh,v 2.3 1998/10/29 13:56:49 urban Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4IeplusAnnihilation.hh,v 1.1 1999/01/07 16:11:12 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
// $Id:
// ------------------------------------------------------------
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4IeplusAnnihilation.icc,v 2.3 1998/10/29 13:56:50 urban Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4IeplusAnnihilation.icc,v 1.1 1999/01/07 16:11:12 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
// $Id:
// ---------------------------------------------------------------
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4IhEnergyLoss.hh,v 2.3 1998/12/07 15:50:21 urban Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4IhEnergyLoss.hh,v 1.1 1999/01/07 16:11:12 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
// $Id:
// ------------------------------------------------------------
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4IhEnergyLoss.icc,v 2.2 1998/10/29 13:56:52 urban Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4IhEnergyLoss.icc,v 1.1 1999/01/07 16:11:12 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
// $Id:
// ---------------------------------------------------------------
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4IhIonisation.hh,v 2.3 1998/10/29 13:56:50 urban Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4IhIonisation.hh,v 1.1 1999/01/07 16:11:13 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// ------------------------------------------------------------
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4IhIonisation.icc,v 2.2 1998/10/29 13:56:51 urban Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4IhIonisation.icc,v 1.1 1999/01/07 16:11:13 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// ---------------------------------------------------------------
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4MultipleScattering.hh,v 2.9 1998/12/09 09:17:31 urban Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4MultipleScattering.hh,v 1.2 1999/02/16 13:21:23 urban Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
// $Id:
// --------------------------------------------------------------
@@ -76,6 +76,12 @@ class G4MultipleScattering : public G4VContinuousDiscreteProcess
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 SetLateralDisplacementFlag(G4bool flag) {fLatDisplFlag = flag;};
protected:
G4double ComputeTransportCrossSection(
@@ -100,8 +106,10 @@ class G4MultipleScattering : public G4VContinuousDiscreteProcess
G4PhysicsTable* theTransportMeanFreePathTable ;
G4double fTransportMeanFreePath ;
G4double range,alpha1 ;
G4int stepFlag ;
G4double fMeanLateralDisplacement ;
G4double biglambda ;
G4double LowestKineticEnergy ;
G4double HighestKineticEnergy ;
@@ -109,14 +117,20 @@ class G4MultipleScattering : public G4VContinuousDiscreteProcess
const G4Electron* theElectron ;
const G4Positron* thePositron ;
G4Material* lastMaterial;
G4double lastKineticEnergy;
G4int materialIndex ;
G4double tLast ;
G4double zLast ;
G4double Tlimit ;
G4double scatteringparameter;
G4double tuning;
G4double cpar;
G4bool fLatDisplFlag ;
//New ParticleChange
G4ParticleChangeForMSC fParticleChange ;
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4MultipleScattering.icc,v 2.7 1998/12/02 16:47:12 urban Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4MultipleScattering.icc,v 1.2 1999/02/16 13:21:24 urban Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
// $Id:
// -------------------------------------------------------------
@@ -23,76 +23,6 @@
// 22/10/98: cleanup , L.Urban
//---------------------------------------------------------------
inline G4double G4MultipleScattering::TrueToGeomTransformation(
const G4DynamicParticle *aParticle,
G4Material *aMaterial,
G4double truePathLength)
// it sets the data member fTransportMeanFreePath and
// performs the true path length -> geometrical path length
// transformation
{
const G4double tausmall=5.e-5 , taubig = 50. ;
const G4double lowexp=0.4 ,biglambda = 1.e10;
G4double KineticEnergy,tau,etau,geomPathLength ;
G4int materialIndex ;
G4bool isOut ;
KineticEnergy = aParticle->GetKineticEnergy() ;
if((lastMaterial == aMaterial) && (lastKineticEnergy == KineticEnergy))
{
;
}
else
{
lastMaterial=aMaterial;
lastKineticEnergy=KineticEnergy;
materialIndex = aMaterial->GetIndex() ;
if(KineticEnergy<LowestKineticEnergy)
fTransportMeanFreePath =
exp(lowexp*log((KineticEnergy/LowestKineticEnergy)))*
(*theTransportMeanFreePathTable)
(materialIndex)->GetValue(LowestKineticEnergy,isOut);
else {
if(KineticEnergy>HighestKineticEnergy) KineticEnergy=HighestKineticEnergy;
fTransportMeanFreePath = (*theTransportMeanFreePathTable)
(materialIndex)->GetValue(KineticEnergy,isOut);
}
}
// do the true -> geom transformation
if( fTransportMeanFreePath > biglambda )
{
geomPathLength = truePathLength ;
}
else
{
tau = truePathLength/fTransportMeanFreePath ;
if(tau<tausmall)
etau = tau ;
else
{
if(tau>taubig)
etau = 1. ;
else
etau = 1.-exp(-tau) ;
}
geomPathLength = fTransportMeanFreePath*etau ;
}
tLast = truePathLength ;
zLast = geomPathLength ;
return geomPathLength ;
}
inline G4double G4MultipleScattering::GetContinuousStepLimit(
const G4Track& track,
G4double,
@@ -101,18 +31,69 @@ inline G4double G4MultipleScattering::GetContinuousStepLimit(
{
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() ;
zPathLength = TrueToGeomTransformation(aParticle,
track.GetMaterial(),
tPathLength);
return zPathLength ;
KineticEnergy = aParticle->GetKineticEnergy() ;
if((lastMaterial != aMaterial) || (lastKineticEnergy != KineticEnergy))
{
lastMaterial = aMaterial;
lastKineticEnergy = KineticEnergy ;
materialIndex = aMaterial->GetIndex() ;
if((KineticEnergy >= Tlimit)&&(stepFlag != 1))
fTransportMeanFreePath = (*theTransportMeanFreePathTable)
(materialIndex)->GetValue(KineticEnergy,isOut);
else if((KineticEnergy < Tlimit)&&(stepFlag != 1))
{
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 ;
zPathLength = fTransportMeanFreePath*(1.-exp(-tau)) ;
}
else
{
tau = tPathLength/range ;
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 G4MultipleScattering::GetMeanFreePath(
const G4Track& track,
G4double,
@@ -131,10 +112,7 @@ inline G4VParticleChange* G4MultipleScattering::AlongStepDoIt(
const G4Track& track,const G4Step& Step)
// only a geom path->true path transformation is performed
{
//!!! const G4double tausmall=5.e-5,taubig=0.9999,trueBig=5. ;
const G4double tausmall=5.e-5,taubig=0.9999,trueBig=9.21034 ;
const G4double biglambda=1.e10 ;
G4double tau ,geomPathLength, truePathLength ;
G4double tau,geomPathLength, truePathLength ;
fParticleChange.Initialize(track);
@@ -144,26 +122,19 @@ inline G4VParticleChange* G4MultipleScattering::AlongStepDoIt(
{
truePathLength = tLast ;
}
else
else if( fTransportMeanFreePath > biglambda )
{
if( fTransportMeanFreePath > biglambda )
{
truePathLength = track.GetStepLength() ;
}
else
{
tau = track.GetStepLength()/fTransportMeanFreePath ;
if(tau<tausmall)
truePathLength = fTransportMeanFreePath*tau*(1.+0.5*tau) ;
else
{
if(tau<taubig)
truePathLength = -fTransportMeanFreePath*log(1.-tau) ;
else
truePathLength = fTransportMeanFreePath*trueBig ;
}
}
truePathLength = geomPathLength ;
}
else if(stepFlag == 0)
{
tau = geomPathLength/fTransportMeanFreePath ;
truePathLength = -fTransportMeanFreePath*log(1.-tau) ;
}
else
{
truePathLength = range*(1.-exp(log(1.-alpha1*geomPathLength/range)/
alpha1)) ;
}
fParticleChange.SetTrueStepLength(truePathLength) ;
@@ -0,0 +1,300 @@
// This code implementation is the intellectual property of
// the RD44 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: G4PAIenergyLoss.hh,v 1.2 1999/04/16 09:06:01 grichine Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
// $Id:
// ------------------------------------------------------------
// GEANT 4 class header file
//
// For information related to this code contact:
// CERN, IT Division, ASD group
// History: first implementation, based on object model of
// 2nd December 1995, G.Cosmo
// ---------- G4PAIenergyLoss physics process -----------
// by V. Grichine, 30 Nov 97
// ************************************************************
// It is the first implementation of the NEW UNIFIED ENERGY LOSS PROCESS.
// It calculates the continuous energy loss for charged hadrons.
// Processes giving contribution to the continuous loss :
// ionisation (= cont.ion.loss + delta ray production)
// can be added more easily ..........
// This class creates static proton/antiproton dE/dx and range tables ,
// which tables can be used by other processes.
// The energy loss for other charged hadrons is calculated from the p/pbar
// tables with scaled kinetic energy.
//*******************************************************************************
//* It is assumed that the cut in range is the same for all the charged hadrons!*
//*******************************************************************************
// corrected by V. Grichine on 24/11/97
// corrected by L. Urban on 27/05/98 (other corrections come soon!)
// ------------------------------------------------------------
#ifndef G4PAIenergyLoss_h
#define G4PAIenergyLoss_h 1
#include "G4ios.hh"
#include <fstream.h>
#include <iomanip.h>
#include <rw/tpordvec.h>
#include "globals.hh"
#include "Randomize.hh"
#include "G4VContinuousDiscreteProcess.hh"
#include "G4MaterialTable.hh"
#include "G4ElementTable.hh"
#include "G4ElementVector.hh"
#include "G4VParticleChange.hh"
#include "globals.hh"
#include "G4Track.hh"
#include "G4Step.hh"
#include "G4Electron.hh"
#include "G4Proton.hh"
#include "G4AntiProton.hh"
#include "G4PhysicsLogVector.hh"
#include "G4PhysicsLinearVector.hh"
#include "G4PhysicsFreeVector.hh"
class G4PAIenergyLoss : public G4VContinuousDiscreteProcess
{
public:
G4PAIenergyLoss(const G4String& );
G4PAIenergyLoss(G4PAIenergyLoss &);
~G4PAIenergyLoss();
G4bool IsApplicable(const G4ParticleDefinition&);
private:
// hide assignment operator
G4PAIenergyLoss & operator=(const G4PAIenergyLoss &right);
public:
virtual G4double
GetContinuousStepLimit( const G4Track& track,
G4double previousStepSize,
G4double currentMinimumStep,
G4double& currentSafety )= 0 ;
/* *************************
G4VParticleChange* AlongStepDoIt(const G4Track& track ,const G4Step& Step)
{
// clear NumberOfInteractionLengthLeft
ClearNumberOfInteractionLengthLeft();
return pParticleChange;
} ;
**************************** */
virtual G4double GetMeanFreePath(
const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition
) = 0 ;
virtual G4VParticleChange* PostStepDoIt(const G4Track& track,const G4Step& Step) = 0 ;
// Build energy loss table (total continuous energy loss)
static void BuildDEDXTable(const G4ParticleDefinition& aParticleType);
//----------------------------------------------
// public functions .........................
// get the number of processes contributing to the cont.energy loss
static G4int GetNUMBEROFPROCESSES() { return NUMBEROFPROCESSES; };
// set the number of processes contributing to the cont.energy loss
static void SetNUMBEROFPROCESSES(G4int number)
{ NUMBEROFPROCESSES=number ; };
// Increment the number of processes contributing to the cont.energy loss
static void PlusNUMBEROFPROCESSES()
{ NUMBEROFPROCESSES++ ; };
// decrement the number of processes contributing to the cont.energy loss
static void MinusNUMBEROFPROCESSES()
{ NUMBEROFPROCESSES-- ; };
//*****************************************************************************
//
G4double GetcurrentInteractionLength() const { return currentInteractionLength; } ;
// returns the actual dE/dx in internal GEANT4 units
G4double GetdEdx() const { return fdEdx; };
// returns the actual range of the particle
G4double GetRangeNow() const { return fRangeNow; } ;
// returns the mean energy loss (i.e. the loss
// without fluctuations
G4double GetMeanLoss() const { return fMeanLoss; } ;
// don't use!
G4double OldGetRange(const G4DynamicParticle *aParticle,
G4Material *aMaterial);
G4double GetConstraints(const G4DynamicParticle *aParticle,
G4Material *aMaterial);
// static
G4PhysicsTable* GetPAItransferBank(){ return fPAItransferBank ; } ;
static G4double GetMaxKineticEnergy() { return HighestKineticEnergy ; } ;
static G4double GetMinKineticEnergy() { return LowestKineticEnergy ; } ;
static G4int GetBinNumber() { return TotBin ; } ;
protected:
// fRangeNow is the actual range of the particle
// computed in GetConstraints
G4double fRangeNow ;
// fMeanLoss is the energyloss without fluctuation
// computed in AlongStepDoIt ;
G4double fMeanLoss ;
G4PhysicsTable* theLossTable ;
static G4PhysicsTable* theDEDXpTable ;
static G4PhysicsTable* theDEDXpbarTable ;
static G4PhysicsTable* theRangepTable ;
static G4PhysicsTable* theRangepbarTable ;
static G4PhysicsTable* theInverseRangepTable ;
static G4PhysicsTable* theInverseRangepbarTable ;
static G4PhysicsTable* theLabTimepTable ;
static G4PhysicsTable* theLabTimepbarTable ;
static G4PhysicsTable* theProperTimepTable ;
static G4PhysicsTable* theProperTimepbarTable ;
// bank of PAI energy transfer data
// static
G4PhysicsTable* fPAItransferBank ;
// processes inherited from G4hEnergyLoss
// register themselves in the static array Recorder
// nb of contributing processes = NUMBEROFPROCESSES
static G4int NUMBEROFPROCESSES ;
static G4PhysicsTable** RecorderOfpProcess;
static G4PhysicsTable** RecorderOfpbarProcess;
static G4int CounterOfpProcess ;
static G4int CounterOfpbarProcess ;
private:
// private functions ..................................
static void BuildRangeTable(const G4ParticleDefinition& aParticleType);
static void BuildRangeVector(G4int materialIndex,
G4PhysicsLogVector* rangeVector);
static G4double RangeIntLin(G4PhysicsVector* physicsVector,G4int nbin);
static G4double RangeIntLog(G4PhysicsVector* physicsVector,G4int nbin);
static void BuildRangeCoeffATable(const G4ParticleDefinition& aParticleType);
static void BuildRangeCoeffBTable(const G4ParticleDefinition& aParticleType);
static void BuildRangeCoeffCTable(const G4ParticleDefinition& aParticleType);
private:
static G4PhysicsTable* theDEDXTable;
// G4PhysicsTable* theRangeTable;
// private data members ...............................
// fdEdx=(-dE/dx)
// computed in GetConstraints at every call;
// it can be used by other processes ( Cherenkov, ...)
G4double fdEdx;
// EnergyBinNumber,RangeCoeffA,... are needed to compute range
G4int EnergyBinNumber ;
G4double RangeCoeffA,RangeCoeffB,RangeCoeffC ;
//................................................................
static G4PhysicsTable* thepRangeCoeffATable;
static G4PhysicsTable* thepRangeCoeffBTable;
static G4PhysicsTable* thepRangeCoeffCTable;
static G4PhysicsTable* thepbarRangeCoeffATable;
static G4PhysicsTable* thepbarRangeCoeffBTable;
static G4PhysicsTable* thepbarRangeCoeffCTable;
//................................................................
// G4PhysicsTable* theRangeCoeffATable;
// G4PhysicsTable* theRangeCoeffBTable;
// G4PhysicsTable* theRangeCoeffCTable;
// dToverTini is the maximum allowed relative energy loss in one Step
// ( set in this class for the moment)
const G4double dToverTini;
// LowestKineticEnergy = lower limit of particle kinetic energy
// HighestKineticEnergy = upper limit of particle kinetic energy
// TotBin = number of bins calculated in BuildPhysicsTable
// from LowestKineticEnergy,HighestKineticEnergy and
// dToverTini
// ---------in the energy loss/range tables-------------------
static const G4double LowestKineticEnergy;
static const G4double HighestKineticEnergy;
static G4int TotBin;
static G4double RTable,LOGRTable; // LOGRTable=log(HighestKineticEnergy
// /LowestKineticEnergy)/TotBin
// RTable = exp(LOGRTable)
// variables for the integration routines
static G4double Mass,taulow,tauhigh,ltaulow,ltauhigh;
// cut in range
static G4double CutInRange;
// cuts in kinetic energy ........
G4double* ParticleCutInKineticEnergy ;
G4double ParticleCutInKineticEnergyNow ;
// ...............
const G4Electron* theElectron;
const G4Proton* theProton;
const G4AntiProton* theAntiProton;
// data members to speed up the fluctuation calculation
G4Material *lastMaterial ;
G4double f1Fluct,f2Fluct,e1Fluct,e2Fluct,rateFluct,ipotFluct;
G4double e1LogFluct,e2LogFluct,ipotLogFluct;
const G4double MaxExcitationNumber ;
const G4double probLimFluct ;
const long nmaxDirectFluct,nmaxCont1,nmaxCont2 ;
};
#include "G4PAIenergyLoss.icc"
#endif
@@ -0,0 +1,70 @@
// This code implementation is the intellectual property of
// the RD44 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: G4PAIenergyLoss.icc,v 1.3 1999/05/26 13:56:55 maire Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
// $Id:
// ---------------------------------------------------------------
// GEANT 4 class inlined methods file
//
// For information related to this code contact:
// CERN, IT Division, ASD group
// History: based on object model of
// 2nd December 1995, G.Cosmo
// ------------ G4PAIenergyLoss physics process ------------
// by Laszlo Urban, 30 May 1997
// ***************************************************************
// It is the first implementation of the NEW UNIFIED ENERGY LOSS PROCESS.
// It calculates the energy loss of charged hadrons.
// ***************************************************************
// corrected by L.Urban on 24/09/97
//
//
////////////////////////////////////////////////////////////////////
//
//
inline G4double
G4PAIenergyLoss::GetConstraints(const G4DynamicParticle *aParticle,
G4Material *aMaterial )
{
// G4cout<<"G4PAIenergyLoss::GetConstraints is called"<<endl ;
return 2*mm ;
}
//////////////////////////////////////////////////////////////////////////
//
//
/* ***********************************************************************
inline G4double G4PAIenergyLoss::GetContinuousStepLimit(
const G4Track& track,
G4double,
G4double currentMinimumStep,
G4double&)
{
G4double Step =
GetConstraints(track.GetDynamicParticle(),track.GetMaterial()) ;
if( (Step > 0.0) && (Step < currentMinimumStep) ) currentMinimumStep = Step ;
return Step ;
}
*********************************************************** */
inline G4bool G4PAIenergyLoss::IsApplicable(const G4ParticleDefinition&
particle)
{
return(particle.GetPDGCharge()!= 0.);
}
@@ -0,0 +1,179 @@
// This code implementation is the intellectual property of
// the RD44 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: G4PAIonisation.hh,v 1.2 1999/04/16 09:06:02 grichine Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// ------------------------------------------------------------
// GEANT 4 class header file
//
// For information related to this code contact:
// CERN, IT Division, ASD group
// History: based on object model of
// 2nd December 1995, G.Cosmo
// ---------- G4hIonisation physics process -----------
// by V. Grichine, 30 Nov 1997
// ************************************************************
// It is the first implementation of the NEW IONISATION
// PROCESS. ( delta rays + continuous energy loss)
// It calculates the ionisation for charged hadrons.
// ************************************************************
//
// corrected by V. Grichine on 24/11/97
//
//
#ifndef G4PAIonisation_h
#define G4PAIonisation_h 1
#include "G4ios.hh"
#include "globals.hh"
#include "Randomize.hh"
#include "G4PAIenergyLoss.hh"
#include "globals.hh"
#include "G4Track.hh"
#include "G4Step.hh"
#include "G4Electron.hh"
#include "G4PhysicsLogVector.hh"
#include "G4PhysicsLinearVector.hh"
#include "G4PhysicsFreeVector.hh"
#include "G4PhysicsVector.hh"
class G4PAIonisation : public G4PAIenergyLoss
{
public:
G4PAIonisation( const G4String& materialName,
const G4String& processName = "PAIonisation");
~G4PAIonisation();
G4bool IsApplicable(const G4ParticleDefinition&);
private:
// hide assignment operator
G4PAIonisation & operator=(const G4PAIonisation &right);
G4PAIonisation(const G4PAIonisation&);
public:
// post Step functions .......................................
G4double GetConstraints(const G4DynamicParticle *aParticle,
G4Material *aMaterial);
G4VParticleChange *PostStepDoIt( const G4Track& track,
const G4Step& Step ) ;
void BuildLossTable(const G4ParticleDefinition& aParticleType);
void BuildLambdaTable(const G4ParticleDefinition& aParticleType);
void BuildPhysicsTable(const G4ParticleDefinition& aParticleType);
// void BuildPAIonisationTable() ;
virtual G4double ComputeMicroscopicCrossSection(
const G4ParticleDefinition& aParticleType,
G4double KineticEnergy,
G4double AtomicNumber);
// Along step DoIt stuff
G4double GetContinuousStepLimit(
const G4Track& track,
G4double previousStepSize,
G4double currentMinimumStep,
G4double& currentSafety) ;
G4double GetMeanFreePath( const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition ) ;
G4VParticleChange* AlongStepDoIt(const G4Track& track ,const G4Step& Step) ;
// static
G4double GetLossWithFluct(G4double Step,
const G4DynamicParticle *aParticle,
G4Material *aMaterial) ;
static G4double GetMaxKineticEnergy() { return HighestKineticEnergy ; } ;
static G4double GetMinKineticEnergy() { return LowestKineticEnergy ; } ;
static G4int GetBinNumber() { return TotBin ; } ;
// Access to Sandia table coefficients
G4int GetSandiaIntervalNumber() const {return fSandiaIntervalNumber;};
G4double GetSandiaPhotoAbsCof(G4int, G4int) const;
// Compute Sandia photoabsorption coefficient matrix
void ComputeSandiaPhotoAbsCof() ;
private:
// private data members
G4int fMatIndex ; // index of material, where dE/dx is calculated
G4PhysicsTable* theMeanFreePathTable;
// LowestKineticEnergy = lower limit of particle kinetic energy
// HighestKineticEnergy = upper limit of particle kinetic energy
// TotBin = number of bins in the energy ionisation loss table
//
static const G4double LowestKineticEnergy;
static const G4double HighestKineticEnergy;
static G4int TotBin;
static G4PhysicsLogVector* fProtonEnergyVector ;
// cut in range
G4double CutInRange ;
G4double lastCutInRange ;
// particles , cuts in kinetic energy
const G4Electron* theElectron;
const G4Proton* theProton;
const G4AntiProton* theAntiProton;
const G4double* ParticleCutInKineticEnergy;
const G4double* DeltaCutInKineticEnergy ;
G4double ParticleCutInKineticEnergyNow ;
G4double DeltaCutInKineticEnergyNow ;
// Sandia Photo Absorption Coefficients
G4double** fSandiaPhotoAbsCof ;
G4int fSandiaIntervalNumber ;
};
#include "G4PAIonisation.icc"
#endif
@@ -0,0 +1,131 @@
// This code implementation is the intellectual property of
// the RD44 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: G4PAIonisation.icc,v 1.3 1999/05/26 13:56:56 maire Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// ---------------------------------------------------------------
// GEANT 4 class inlined methods file
//
// For information related to this code contact:
// CERN, IT Division, ASD group
// ------------ G4PAIonisation physics process ------------
// by Laszlo Urban, 30 May 1997
// ***************************************************************
// It is the first implementation of the NEW IONISATION PROCESS.
// It calculates the ionisation of charged hadrons.
// ***************************************************************
// corrected by L.Urban on 24/09/97
// ---------------------------------------------------------------
////////////////////////////////////////////////////////////////////
//
//
inline G4double
G4PAIonisation::GetConstraints(const G4DynamicParticle *aParticle,
G4Material *aMaterial )
{
G4int index = aMaterial->GetIndex() ;
// G4cout<<"G4PAIonisation::GetConstraints is called"<<endl ;
if(index != fMatIndex)
{
return DBL_MAX ;
}
else
{
if(aMaterial->GetState() == kStateGas)
{
return 10*mm ;
}
else
{
return 0.01*mm ;
}
}
}
//////////////////////////////////////////////////////////////////////////
//
//
inline G4double
G4PAIonisation::GetContinuousStepLimit( const G4Track& track ,
G4double ,
G4double currentMinimumStep ,
G4double& )
{
G4double Step =
GetConstraints(track.GetDynamicParticle(),track.GetMaterial()) ;
if( (Step > 0.0) && (Step < currentMinimumStep) ) currentMinimumStep = Step ;
return Step ;
}
/////////////////////////////////////////////////////////////////////////
//
//
inline G4double G4PAIonisation::GetMeanFreePath(
const G4Track& trackData,
G4double previousStepSize,
G4ForceCondition* condition)
{
// G4cout<<"G4PAIonisation::GetMeanFreePath is called"<<endl ;
*condition = NotForced ;
G4Material* aMaterial = trackData.GetMaterial() ;
if( aMaterial->GetIndex() != fMatIndex )
{
return DBL_MAX;
}
else
{
return 1*mm ;
}
}
//////////////////////////////////////////////////////////////////////
//
//
inline G4bool G4PAIonisation::IsApplicable(
const G4ParticleDefinition& particle)
{
return(particle.GetPDGCharge() != 0.);
}
//////////////////////////////////////////////////////////////////////////
//
//
inline
G4double G4PAIonisation::GetSandiaPhotoAbsCof(G4int i, G4int j) const
{
if(i < 0 || i >= fSandiaIntervalNumber || j < 0 || j > 4)
{
G4Exception("Invalid arguments in G4Material::GetSandiaPhotoAbsCof") ;
}
return fSandiaPhotoAbsCof[i][j] ;
}
//
//
/////////////////////////////////////////////////////////////////////////
@@ -0,0 +1,192 @@
// This code implementation is the intellectual property of
// the RD44 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: G4PAIxSection.hh,v 1.2 1999/04/16 09:06:02 grichine Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// G4PAIxSection.hh -- header file
//
// GEANT 4 class header file --- Copyright CERN 1995
// CERB Geneva Switzerland
//
// for information related to this code, please, contact
// CERN, CN Division, ASD Group
//
// Preparation of ionizing collision cross section according to Photo Absorption
// Ionization (PAI) model for simulation of ionization energy losses in very thin
// absorbers
//
// History:
// 1st version 11.06.97, V. Grichine
// 2nd version 30.11.97, V. Grichine
#ifndef G4PAIXSECTION_HH
#define G4PAIXSECTION_HH
#include"G4SandiaTable.hh"
class G4PAIxSection
{
public:
// Constructors
G4PAIxSection( G4int materialIndex,
G4double maxEnergyTransfer ) ;
G4PAIxSection( G4int materialIndex, // for proton loss table
G4double maxEnergyTransfer,
G4double betaGammaSq ,
G4double** photoAbsCof, G4int intNumber ) ;
// G4PAIxSection(const G4PAIxSection& right) ;
// Destructor
~G4PAIxSection() ;
// Operators
// G4PAIxSection& operator=(const G4PAIxSection& right) ;
// G4int operator==(const G4PAIxSection& right)const ;
// G4int operator!=(const G4PAIxSection& right)const ;
// Methods
// General control functions
void InitPAI() ;
void NormShift( G4double betaGammaSq ) ;
void SplainPAI( G4double betaGammaSq ) ;
// Physical methods
void IntegralPAIxSection() ;
G4double RutherfordIntegral( G4int intervalNumber,
G4double limitLow,
G4double limitHigh ) ;
G4double ImPartDielectricConst( G4int intervalNumber,
G4double energy ) ;
G4double RePartDielectricConst(G4double energy) ;
G4double DifPAIxSection( G4int intervalNumber,
G4double betaGammaSq ) ;
G4double SumOverInterval(G4int intervalNumber) ;
G4double SumOverBorder( G4int intervalNumber,
G4double energy ) ;
// Inline access functions
G4int GetNumberOfGammas() const { return fNumberOfGammas ; }
G4int GetSplineSize() const { return fSplineNumber ; }
G4double GetMeanEnergyLoss() const {return fIntegralPAIxSection[0] ; }
G4double GetNormalizationCof() const { return fNormalizationCof ; }
inline G4double GetPAItable(G4int i,G4int j) const ;
inline G4double GetLorentzFactor(G4int i) const ;
inline G4double GetSplineEnergy(G4int i) const ;
inline G4double GetIntegralPAIxSection(G4int i) const ;
protected :
private :
// Local class constants
static const G4double fDelta ; // energy shift from interval border = 0.001
static const G4double fError ; // error in lin-log approximation = 0.005
static G4int fNumberOfGammas ; // = 111 ;
static const G4double fLorentzFactor[112] ; // static gamma array
static
const G4int fRefGammaNumber ; // The number of gamma for creation of spline (15)
G4int fIntervalNumber ; // The number of energy intervals
G4double fNormalizationCof ; // Normalization cof for PhotoAbsorptionXsection
// G4double fBetaGammaSq ; // (beta*gamma)^2
G4double fDensity ; // Current density
G4double fElectronDensity ; // Current electron (number) density
G4int fSplineNumber ; // Current size of spline
// Arrays of Sandia coefficients
G4double* fEnergyInterval ;
G4double* fA1 ;
G4double* fA2 ;
G4double* fA3 ;
G4double* fA4 ;
static
const G4int fMaxSplineSize ; // Max size of output splain arrays = 500
/* ******************
G4double* fSplineEnergy ; // energy points of splain
G4double* fRePartDielectricConst ; // Real part of dielectric const
G4double* fImPartDielectricConst ; // Imaginary part of dielectric const
G4double* fIntegralTerm ; // Integral term in PAI cross section
G4double* fDifPAIxSection ; // Differential PAI cross section
G4double* fIntegralPAIxSection ; // Integral PAI cross section ?
*/ ///////////////
G4double fSplineEnergy[500] ; // energy points of splain
G4double fRePartDielectricConst[500] ; // Real part of dielectric const
G4double fImPartDielectricConst[500] ; // Imaginary part of dielectric const
G4double fIntegralTerm[500] ; // Integral term in PAI cross section
G4double fDifPAIxSection[500] ; // Differential PAI cross section
G4double fIntegralPAIxSection[500] ; // Integral PAI cross section ?
G4double fPAItable[500][112] ; // Output array
} ;
// ............................ INLINE METHODS ....................................
inline G4double G4PAIxSection::GetPAItable(G4int i, G4int j) const
{
return fPAItable[i][j] ;
}
inline G4double G4PAIxSection::GetLorentzFactor(G4int j) const
{
return fLorentzFactor[j] ;
}
inline G4double G4PAIxSection::GetSplineEnergy(G4int i) const
{
if(i < 1 || i > fSplineNumber)
{
G4Exception("Invalid argument in G4PAIxSection::GetSplineEnergy");
}
return fSplineEnergy[i] ;
}
inline G4double G4PAIxSection::GetIntegralPAIxSection(G4int i) const
{
if(i < 1 || i > fSplineNumber)
{
G4Exception("Invalid argument in G4PAIxSection::GetIntegralPAIxSection");
}
return fIntegralPAIxSection[i] ;
}
#endif
// ----------------- end of G4PAIxSection header file -------------------

Some files were not shown because too many files have changed in this diff Show More