Import Geant4 10.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-10 12:08:39 +02:00
parent 286caacf06
commit c9b32a6c0a
5770 changed files with 1050949 additions and 367105 deletions
@@ -1,4 +1,4 @@
# $Id: GNUmakefile 71326 2013-06-13 17:08:23Z gcosmo $
# $Id: GNUmakefile 79068 2014-02-14 09:50:29Z gcosmo $
# --------------------------------------------------------------------
# GNUmakefile for electromagnetic sub-library. John Allison, 25/6/98.
# --------------------------------------------------------------------
@@ -16,6 +16,8 @@ CPPFLAGS += -I$(G4BASE)/global/management/include \
-I$(G4BASE)/global/HEPNumerics/include \
-I$(G4BASE)/global/HEPGeometry/include \
-I$(G4BASE)/geometry/management/include \
-I$(G4BASE)/geometry/volumes/include \
-I$(G4BASE)/geometry/navigation/include \
-I$(G4BASE)/track/include \
-I$(G4BASE)/processes/management/include \
-I$(G4BASE)/processes/cuts/include \
@@ -1,4 +1,4 @@
$Id: History 77345 2013-11-22 16:00:21Z gcosmo $
$Id: History 86755 2014-11-17 15:15:09Z gcosmo $
-------------------------------------------------------------------
=========================================================
@@ -17,6 +17,112 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
14.11.2014 G4MicroElecInelasticModel from M. Raine, tag emlowen-V10-00-22
- fix of loop
31.10.2014 G4MicroElecInelasticModel from M. Raine, tag emlowen-V10-00-21
-change in angular generator, to use G4DeltaAngle model
28.10.2014 G4MicroElecInelastic and G4MicroElecInelasticModel from M. Raine, tag emlowen-V10-00-20
- better treatment of GenericIon
- MT compatibility improved
22.10.2014 M. Karamitros (committer), M.Raine (author), tag emlowen-V10-00-19
G4MicroElecElasticModel from M. Raine:
- uses cumulated cross-sections
- MT compatibility improved
- uses LinLinInterpolate instead of LinLog
Should use G4EMLOW6.41
01.10.2014 L. Pandola et al, tag emlowen-V10-00-18
Fix of bugzilla 1612
02.09.2014 L. Pandola, tag emlowen-V10-00-17
Coverity fix. Restored deletion of G4Physics*Vector
objects at the destructor (as for ref-07)
28.08.2014 S. Incerti, tag emlowen-V10-00-16
Coverity fix.
07.08.2014 S. Incerti, tag emlowen-V10-00-15
Removed unused code for atomic deexcitation.
30.07.2014 V. Ivanchenko, tag emlowen-V10-00-14
G4LivermorePhotoElectricModel, G4LivermoreGammaConversionModel,
G4LivermoreRayleighModel, G4LivermoreComptonModel,
G4IonParameterisedLossModel - added proper deletion
of G4PhysicsVectors end of run
15.07.2014 V. Ivanchenko/L. Pandola, tag emlowen-V10-00-13
LivermorePhotoElectricModel - keep cross section const
below lowest shell energy (as in Penelope model)
Changed Livermore, LivemorePolarized, LivemoreModified and
Penelope Compton to unify the treatment for
energy < LowEnergyLimit(). Null cross
section and no change in the gamma state.
03.06.2014 V. Ivanchenko tag emlowen-V10-00-12
G4LowEWentzelVIModel - cosmetic change trying to avoid
compillation problem for strict compiler
19.05.2014 V. Ivanchenko/L. Pandola, tag emlowen-V10-00-11
Bug fix in G4PenelopePhotoElectric effect (no fluorescence in
MT mode). Some cosmetics to G4PenelopeRayleigh.
G4LowEWentzelVIModel - set single scattering factor 0.5
11.05.2014 V. Ivanchenko, tag emlowen-V10-00-10
G4LowEWentzelVIModel - set single scattering factor 0.7
(was 1.0 before) - increasing accuracy but more slow
G4AtomicTransitionManager, G4UAtomicDeexcitation,
G4FluoData, G4LivermoreIonisationModel,
G4PenelopeOscillatorManager - G4AtomicTransitionManager
become pure singleton shared between threads, all
run time methods are const;
Initilise() method should be called in the beginning
of the run.
25.04.2014 S. Incerti, tag emlowen-V10-00-09
Updated G4UAtomicDeexcitation according to previous tag
21.04.2014 S. Incerti, tag emlowen-V10-00-08
Fix of G4empCrossSection
19.04.2014 S. Incerti, tag emlowen-V10-00-07
Update of G4empCrossSection for Miranda et al. model
15.04.2014 S. Incerti, tag emlowen-V10-00-06
New class for ionisation cs model from Miranda et al.
07.04.2014 V. Ivanchenko, tag emlowen-V10-00-05
G4LowEWentzelVIModel - fixed initialisation
27.02.2014 V. Ivanchenko, tag emlowen-V10-00-04
G4LivermorePhotoElectricModel - added low-energy cross
section for water
G4IonParametrisedLossModel, G4LivermoreIonisationModel -
added G4DeltaAngle generator for angular distribution
13.02.2014 V. Ivanchenko, tag emlowen-V10-00-03
G4LowEWentzelVIModel - new class
24.01.2014 V. Ivanchenko, tag emlowen-V10-00-02
G4LivermorePhotoElectricModel - fixed Coverity report
10.01.2014 L. Pandola, tag emlowen-V10-00-01
Suppress G4Exception (JustWarning) issued by some Penelope
models in UnitTests. Controlled by verbosity flag now (for
diagnostic).
11.12.2013 L. Pandola, tag emlowen-V10-00-00
Allow for (AutoLock-protected) creation on-the-fly of
tables in SampleSecondaries(). Nothing changes for loops driven
by the RunManager. Avoid crash when the loop of SampleSecondaries()
is inkoved in a unit test.
22.11.2013 M. Karamitros, tag emlowen-V09-06-49
Remove creation of material in G4MuElect*
and G4MicroElec* models
21.11.2013 V. Ivanchenko, tag emlowen-V09-06-48
G4QAOLowEnergyLoss, G4hICRU49He, G4hICRU49p,
G4hParametrisedLossModel - removed G4ThreadLocal
@@ -48,14 +48,14 @@
#define G4AtomicTransitionManager_h 1
#include "G4ShellData.hh"
#include "G4FluoData.hh"
#include "G4AugerData.hh"
#include "G4FluoTransition.hh"
#include "G4AugerTransition.hh"
#include "G4AtomicShell.hh"
// #include "g4std/map"
#include <vector>
#include "globals.hh"
class G4AugerData;
// This class is a singleton
class G4AtomicTransitionManager {
@@ -64,6 +64,9 @@ public:
// The only way to get an instance of this class is to call the
// function Instance()
static G4AtomicTransitionManager* Instance();
// needs to be called once from other code before start of run
void Initialise();
// Z is the atomic number of the element, shellIndex is the
// index (in EADL) of the shell
@@ -71,15 +74,17 @@ public:
// Z is the atomic number of the element, shellIndex is the
// index (in EADL) of the final shell for the transition
// This function gives, upon Z and the Index of the initial shell where te vacancy is,
// the radiative transition that can happen (originating shell, energy, probability)
const G4FluoTransition* ReachableShell(G4int Z, size_t shellIndex) const ;
// This function gives, upon Z and the Index of the initial shell where
// the vacancy is, the radiative transition that can happen (originating
// shell, energy, probability)
const G4FluoTransition* ReachableShell(G4int Z, size_t shellIndex) const;
// This function gives, upon Z and the Index of the initial shell where te vacancy is,
// the NON-radiative transition that can happen with originating shell for the transition, and the
// data for the possible auger electrons emitted (originating vacancy, energy amnd probability)
// This function gives, upon Z and the Index of the initial shell where
// the vacancy is, the NON-radiative transition that can happen with
// originating shell for the transition, and the data for the possible
// auger electrons emitted (originating vacancy, energy amnd probability)
const G4AugerTransition* ReachableAugerShell(G4int Z, G4int shellIndex) const ;
const G4AugerTransition* ReachableAugerShell(G4int Z, G4int shellIndex) const;
// This function returns the number of shells of the element
// whose atomic number is Z
@@ -88,37 +93,37 @@ public:
// This function returns the number of those shells of the element
// whose atomic number is Z which are reachable through a radiative
// transition
// This function returns the number of possible radiative transitions for the atom with atomic number Z
// i.e. the number of shell in wich a vacancy can be filled with a radiative transition
G4int NumberOfReachableShells(G4int Z)const ;
G4int NumberOfReachableShells(G4int Z) const;
// This function returns the number of possible NON-radiative transitions for the atom with atomic number Z
// i.e. the number of shell in wich a vacancy can be filled by a NON-radiative transition
// This function returns the number of possible NON-radiative transitions
// for the atom with atomic number Z i.e. the number of shell in wich
// a vacancy can be filled by a NON-radiative transition
G4int NumberOfReachableAugerShells(G4int Z)const ;
G4int NumberOfReachableAugerShells(G4int Z) const;
// Gives the sum of the probabilities of radiative transition towards the
// shell whose index is shellIndex
G4double TotalRadiativeTransitionProbability(G4int Z, size_t shellIndex);
G4double
TotalRadiativeTransitionProbability(G4int Z, size_t shellIndex) const;
// Gives the sum of the probabilities of non radiative transition from the
// shell whose index is shellIndex
G4double TotalNonRadiativeTransitionProbability(G4int Z, size_t shellIndex);
protected:
G4double
TotalNonRadiativeTransitionProbability(G4int Z, size_t shellIndex) const;
void SetFluoDirectory(const G4String& ss);
private:
G4AtomicTransitionManager();
G4AtomicTransitionManager(G4int minZ = 1, G4int maxZ = 100,
G4int limitInfTable = 6, G4int limitSupTable=100 );
~G4AtomicTransitionManager();
private:
// Hide copy constructor and assignment operator
G4AtomicTransitionManager& operator=(const G4AtomicTransitionManager& right);
G4AtomicTransitionManager(const G4AtomicTransitionManager&);
static G4ThreadLocal G4AtomicTransitionManager* instance;
static G4AtomicTransitionManager* instance;
// the first element of the map is the atomic number Z.
// the second element is a vector of G4AtomicShell*.
@@ -128,8 +133,8 @@ private:
// the second element is a vector of G4AtomicTransition*.
std::map<G4int,std::vector<G4FluoTransition*>,std::less<G4int> > transitionTable;
// since Augereffect data r stored as a table in G4AugerData, we have here a pointer to an element of that class itself.
// since Augereffect data r stored as a table in G4AugerData, we have
// here a pointer to an element of that class itself.
G4AugerData* augerData;
// Minimum and maximum Z in EADL table containing identities and binding
@@ -142,7 +147,8 @@ private:
G4int infTableLimit;
G4int supTableLimit;
G4bool isInitialized;
G4String fluoDirectory;
};
#endif
@@ -53,7 +53,7 @@ class G4FluoData
{
public:
G4FluoData();
G4FluoData(const G4String& dir);
~G4FluoData();
@@ -101,6 +101,7 @@ private:
std::vector<G4int> nInitShells;
G4int numberOfVacancies;
std::map<G4int,std::vector<G4FluoTransition*>,std::less<G4int> > fluoTransitionTable;
G4String fluoDirectory;
};
#endif
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4LivermoreComptonModel.hh 76220 2013-11-08 10:15:00Z gcosmo $
// $Id: G4LivermoreComptonModel.hh 82874 2014-07-15 15:25:29Z gcosmo $
// GEANT4 tag $Name: not supported by cvs2svn $
//
//
@@ -85,8 +85,6 @@ private:
G4bool isInitialised;
G4int verboseLevel;
G4double lowestEnergy;
G4ParticleChangeForGamma* fParticleChange;
G4VAtomDeexcitation* fAtomDeexcitation;
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4LivermoreComptonModifiedModel.hh 66241 2012-12-13 18:34:42Z gunter $
// $Id: G4LivermoreComptonModifiedModel.hh 82874 2014-07-15 15:25:29Z gcosmo $
//
// Author: Sebastien Incerti
// 30 October 2008
@@ -75,9 +75,6 @@ protected:
G4ParticleChangeForGamma* fParticleChange;
private:
G4double lowEnergyLimit;
G4double highEnergyLimit;
G4bool isInitialised;
G4int verboseLevel;
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4LivermoreIonisationModel.hh 66241 2012-12-13 18:34:42Z gunter $
// $Id: G4LivermoreIonisationModel.hh 80788 2014-05-12 09:07:49Z gcosmo $
//
// Author: Luciano Pandola
// on base of G4LowEnergyIonisation developed by A.Forti and V.Ivanchenko
@@ -109,7 +109,7 @@ private:
G4eIonisationCrossSectionHandler* crossSectionHandler;
G4VEnergySpectrum* energySpectrum;
const G4AtomicTransitionManager* transitionManager;
G4AtomicTransitionManager* transitionManager;
};
#endif
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4LivermorePhotoElectricModel.hh 72941 2013-08-14 13:32:37Z gcosmo $
// $Id: G4LivermorePhotoElectricModel.hh 79446 2014-02-28 14:29:47Z gcosmo $
//
// Author: Sebastien Incerti
// 30 October 2008
@@ -58,9 +58,15 @@ public:
virtual void Initialise(const G4ParticleDefinition*, const G4DataVector&);
virtual G4double CrossSectionPerVolume(const G4Material*,
const G4ParticleDefinition*,
G4double energy,
G4double cutEnergy = 0.0,
G4double maxEnergy = DBL_MAX);
virtual G4double ComputeCrossSectionPerAtom(
const G4ParticleDefinition*,
G4double kinEnergy,
G4double energy,
G4double Z,
G4double A=0,
G4double cut=0,
@@ -103,9 +109,13 @@ private:
static G4int fNShells[99];
static G4int fNShellsUsed[99];
static G4ElementData* fShellCrossSection;
static G4Material* fWater;
static G4double fWaterEnergyLimit;
G4VAtomDeexcitation* fAtomDeexcitation;
G4double fCurrSection;
std::vector<G4double> fSandiaCof;
};
inline
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4LivermorePolarizedComptonModel.hh 66241 2012-12-13 18:34:42Z gunter $
// $Id: G4LivermorePolarizedComptonModel.hh 82874 2014-07-15 15:25:29Z gcosmo $
//
// Authors: G.Depaola & F.Longo
//
@@ -78,9 +78,7 @@ protected:
G4ForceCondition* condition);
*/
private:
G4double lowEnergyLimit;
G4double highEnergyLimit;
G4bool isInitialised;
G4int verboseLevel;
@@ -0,0 +1,81 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4LowEWentzelVIModel.hh 74697 2013-10-19 16:15:25Z vnivanch $
//
// -------------------------------------------------------------------
//
//
// GEANT4 Class header file
//
//
// File name: G4LowEWentzelVIModel
//
// Author: V.Ivanchenko
//
// Creation date: 11.02.2014 from G4WentzelVIModel
//
// Modifications:
//
// Class Description:
//
// Implementation of the model of multiple scattering for low-energy e-
// -------------------------------------------------------------------
//
#ifndef G4LowEWentzelVIModel_h
#define G4LowEWentzelVIModel_h 1
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4WentzelVIModel.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class G4LowEWentzelVIModel : public G4WentzelVIModel
{
public:
G4LowEWentzelVIModel();
virtual ~G4LowEWentzelVIModel();
virtual G4double ComputeTruePathLengthLimit(const G4Track& track,
G4double& currentMinimalStep);
private:
// hide assignment operator
G4LowEWentzelVIModel & operator=(const G4LowEWentzelVIModel &right);
G4LowEWentzelVIModel(const G4LowEWentzelVIModel&);
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -101,6 +101,8 @@ private:
G4double Theta(G4ParticleDefinition * aParticleDefinition, G4double k, G4double integrDiff);
G4double LinLinInterpolate(G4double e1, G4double e2, G4double e, G4double xs1, G4double xs2);
G4double LogLogInterpolate(G4double e1, G4double e2, G4double e, G4double xs1, G4double xs2);
G4double LinLogInterpolate(G4double e1, G4double e2, G4double e, G4double xs1, G4double xs2);
@@ -142,7 +144,7 @@ inline void G4MicroElecElasticModel::SetKillBelowThreshold (G4double threshold)
if (threshold < 5*CLHEP::eV)
{
G4Exception ("*** WARNING : the G4MicroElecElasticModel class is not validated below 5 eV !","",JustWarning,"") ;
threshold = 0.025*CLHEP::eV;
threshold = 5*CLHEP::eV;
}
}
@@ -131,7 +131,7 @@ private:
G4UAtomicDeexcitation(G4UAtomicDeexcitation &);
G4UAtomicDeexcitation & operator=(const G4UAtomicDeexcitation &right);
const G4AtomicTransitionManager* transitionManager;
G4AtomicTransitionManager* transitionManager;
// Data member which stores the shells to be filled by
// the radiative transition
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4empCrossSection.hh 66241 2012-12-13 18:34:42Z gunter $
// $Id: G4empCrossSection.hh 83410 2014-08-21 15:17:53Z gcosmo $
//
//
//
@@ -45,7 +45,9 @@
#include "globals.hh"
#include "G4VhShellCrossSection.hh"
#include "G4PaulKxsModel.hh"
#include "G4OrlicLiXsModel.hh"
class G4empCrossSection : public G4VhShellCrossSection
@@ -81,6 +83,7 @@ public:
private:
G4double totalCS;
G4int flag; // Flag to select Li XS set (orlic or other)
G4PaulKxsModel* paulShellK;
G4OrlicLiXsModel* orlicShellLi;
@@ -11,7 +11,7 @@
#
# Generated on : 24/9/2010
#
# $Id: sources.cmake 75171 2013-10-29 09:24:43Z gcosmo $
# $Id: sources.cmake 83410 2014-08-21 15:17:53Z gcosmo $
#
#------------------------------------------------------------------------------
@@ -20,6 +20,8 @@ include_directories(${CLHEP_INCLUDE_DIRS})
# List internal includes needed.
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/navigation/include)
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/volumes/include)
include_directories(${CMAKE_SOURCE_DIR}/source/global/HEPGeometry/include)
include_directories(${CMAKE_SOURCE_DIR}/source/global/HEPNumerics/include)
include_directories(${CMAKE_SOURCE_DIR}/source/global/HEPRandom/include)
@@ -78,6 +80,7 @@ GEANT4_DEFINE_MODULE(NAME G4emlowenergy
G4hIonEffChargeSquare.hh
G4hNuclearStoppingModel.hh
G4hParametrisedLossModel.hh
G4hSRIM2000p.hh
G4hZiegler1985Nuclear.hh
G4hZiegler1985p.hh
G4IonChuFluctuationModel.hh
@@ -105,6 +108,7 @@ GEANT4_DEFINE_MODULE(NAME G4emlowenergy
G4LivermoreRayleighModel.hh
G4LogLogInterpolation.hh
G4LowEPComptonModel.hh
G4LowEWentzelVIModel.hh
G4MicroElecCrossSectionDataSet.hh
G4MicroElecElastic.hh
G4MicroElecElasticModel.hh
@@ -193,6 +197,7 @@ GEANT4_DEFINE_MODULE(NAME G4emlowenergy
G4hIonEffChargeSquare.cc
G4hNuclearStoppingModel.cc
G4hParametrisedLossModel.cc
G4hSRIM2000p.cc
G4hZiegler1985Nuclear.cc
G4hZiegler1985p.cc
G4IonChuFluctuationModel.cc
@@ -219,6 +224,7 @@ GEANT4_DEFINE_MODULE(NAME G4emlowenergy
G4LivermoreRayleighModel.cc
G4LogLogInterpolation.cc
G4LowEPComptonModel.cc
G4LowEWentzelVIModel.cc
G4MicroElecCrossSectionDataSet.cc
G4MicroElecElastic.cc
G4MicroElecElasticModel.cc
@@ -284,9 +290,11 @@ GEANT4_DEFINE_MODULE(NAME G4emlowenergy
G4leptons
G4materials
G4mesons
G4navigation
G4partman
G4procman
G4track
G4volumes
GLOBAL_DEPENDENCIES
G4geometry
G4global
@@ -36,32 +36,280 @@
// -------------------------------------------------------------------
#include "G4AtomicTransitionManager.hh"
#include "G4FluoData.hh"
#include "G4AugerData.hh"
G4AtomicTransitionManager::G4AtomicTransitionManager(G4int minZ, G4int maxZ,
G4int limitInfTable,G4int limitSupTable)
:zMin(minZ),
zMax(maxZ),
infTableLimit(limitInfTable),
supTableLimit(limitSupTable)
G4AtomicTransitionManager* G4AtomicTransitionManager::instance = 0;
G4AtomicTransitionManager* G4AtomicTransitionManager::Instance()
{
if (instance == 0) {
instance = new G4AtomicTransitionManager();
}
return instance;
}
G4AtomicTransitionManager::G4AtomicTransitionManager()
: augerData(0),
zMin(1),
zMax(100),
infTableLimit(6),
supTableLimit(100),
isInitialized(false),
fluoDirectory("/fluor")
{}
G4AtomicTransitionManager::~G4AtomicTransitionManager()
{
delete augerData;
std::map<G4int,std::vector<G4AtomicShell*>,std::less<G4int> >::iterator pos;
for(pos = shellTable.begin(); pos != shellTable.end(); ++pos){
std::vector<G4AtomicShell*>vec = (*pos).second;
G4int vecSize = vec.size();
for (G4int i=0; i< vecSize; ++i){
G4AtomicShell* shell = vec[i];
delete shell;
}
}
std::map<G4int,std::vector<G4FluoTransition*>,std::less<G4int> >::iterator ppos;
for (ppos = transitionTable.begin(); ppos != transitionTable.end(); ++ppos){
std::vector<G4FluoTransition*>vec = (*ppos).second;
G4int vecSize=vec.size();
for (G4int i=0; i< vecSize; i++){
G4FluoTransition* transition = vec[i];
delete transition;
}
}
}
G4AtomicShell*
G4AtomicTransitionManager::Shell(G4int Z, size_t shellIndex) const
{
std::map<G4int,std::vector<G4AtomicShell*>,std::less<G4int> >::const_iterator pos;
pos = shellTable.find(Z);
if (pos!= shellTable.end())
{
std::vector<G4AtomicShell*> v = (*pos).second;
if (shellIndex < v.size()) { return v[shellIndex]; }
else
{
size_t lastShell = v.size();
G4ExceptionDescription ed;
ed << "No de-excitation for Z= " << Z
<< " shellIndex= " << shellIndex
<< ">= numberOfShells= " << lastShell;
G4Exception("G4AtomicTransitionManager::Shell()","de0001",
JustWarning,ed,"AtomicShell not found");
if (lastShell > 0) { return v[lastShell - 1]; }
}
}
else
{
G4ExceptionDescription ed;
ed << "No de-excitation for Z= " << Z
<< " shellIndex= " << shellIndex;
G4Exception("G4AtomicTransitionManager::Shell()","de0001",
FatalException,ed,"AtomicShell not found");
}
return 0;
}
// This function gives, upon Z and the Index of the initial shell where
// the vacancy is, the radiative transition that can happen (originating
// shell, energy, probability)
const G4FluoTransition*
G4AtomicTransitionManager::ReachableShell(G4int Z,size_t shellIndex) const
{
std::map<G4int,std::vector<G4FluoTransition*>,std::less<G4int> >::const_iterator pos;
pos = transitionTable.find(Z);
if (pos!= transitionTable.end())
{
std::vector<G4FluoTransition*> v = (*pos).second;
if (shellIndex < v.size()) { return(v[shellIndex]); }
else {
G4ExceptionDescription ed;
ed << "No fluo transition for Z= " << Z
<< " shellIndex= " << shellIndex;
G4Exception("G4AtomicTransitionManager::ReachebleShell()","de0002",
FatalException,ed,"");
}
}
else
{
G4ExceptionDescription ed;
ed << "No transition table for Z= " << Z
<< " shellIndex= " << shellIndex;
G4Exception("G4AtomicTransitionManager::ReachableShell()","de0001",
FatalException,ed,"");
}
return 0;
}
const G4AugerTransition*
G4AtomicTransitionManager::ReachableAugerShell(G4int Z,
G4int vacancyShellIndex) const
{
return augerData->GetAugerTransition(Z,vacancyShellIndex);
}
G4int G4AtomicTransitionManager::NumberOfShells (G4int Z) const
{
std::map<G4int,std::vector<G4AtomicShell*>,std::less<G4int> >::const_iterator pos;
pos = shellTable.find(Z);
G4int res = 0;
if (pos != shellTable.end()){
res = ((*pos).second).size();
} else {
G4ExceptionDescription ed;
ed << "No deexcitation for Z= " << Z;
G4Exception("G4AtomicTransitionManager::NumberOfShells()","de0001",
FatalException, ed, "");
}
return res;
}
// This function returns the number of possible radiative transitions for
// the atom with atomic number Z i.e. the number of shell in wich a vacancy
// can be filled with a radiative transition
G4int G4AtomicTransitionManager::NumberOfReachableShells(G4int Z) const
{
std::map<G4int,std::vector<G4FluoTransition*>,std::less<G4int> >::const_iterator pos;
pos = transitionTable.find(Z);
G4int res = 0;
if (pos!= transitionTable.end())
{
res = ((*pos).second).size();
}
else
{
G4ExceptionDescription ed;
ed << "No deexcitation for Z= " << Z
<< ", so energy deposited locally";
G4Exception("G4AtomicTransitionManager::NumberOfReachebleShells()",
"de0001",FatalException,ed,"");
}
return res;
}
// This function returns the number of possible NON-radiative transitions
// for the atom with atomic number Z i.e. the number of shell in wich a
// vacancy can be filled with a NON-radiative transition
G4int G4AtomicTransitionManager::NumberOfReachableAugerShells(G4int Z)const
{
return augerData->NumberOfVacancies(Z);
}
G4double G4AtomicTransitionManager::TotalRadiativeTransitionProbability(
G4int Z, size_t shellIndex) const
{
std::map<G4int,std::vector<G4FluoTransition*>,std::less<G4int> >::const_iterator pos;
pos = transitionTable.find(Z);
G4double totalRadTransProb = 0.0;
if (pos!= transitionTable.end())
{
std::vector<G4FluoTransition*> v = (*pos).second;
if (shellIndex < v.size())
{
G4FluoTransition* transition = v[shellIndex];
G4DataVector transProb = transition->TransitionProbabilities();
for (size_t j=0; j<transProb.size(); ++j) // AM -- corrected, it was 1
{
totalRadTransProb += transProb[j];
}
}
else
{
G4ExceptionDescription ed;
ed << "Zero transition probability for Z=" << Z
<< " shellIndex= " << shellIndex;
G4Exception(
"G4AtomicTransitionManager::TotalRadiativeTransitionProbability()",
"de0002",FatalException,"Incorrect de-excitation");
}
}
else
{
G4ExceptionDescription ed;
ed << "No deexcitation for Z=" << Z
<< " shellIndex= " << shellIndex;
G4Exception(
"G4AtomicTransitionManager::TotalRadiativeTransitionProbability()",
"de0001",FatalException,ed,"Cannot compute transition probability");
}
return totalRadTransProb;
}
G4double G4AtomicTransitionManager::TotalNonRadiativeTransitionProbability(
G4int Z, size_t shellIndex) const
{
G4double prob = 1.0 - TotalRadiativeTransitionProbability(Z, shellIndex);
if(prob > 1.0 || prob < 0.0) {
G4ExceptionDescription ed;
ed << "Total probability mismatch Z= " << Z
<< " shellIndex= " << shellIndex
<< " prob= " << prob;
G4Exception(
"G4AtomicTransitionManager::TotalNonRadiativeTransitionProbability()",
"de0003",FatalException,ed,"Cannot compute non-radiative probability");
return 0.0;
}
return prob;
}
void G4AtomicTransitionManager::SetFluoDirectory(const G4String& ss)
{
fluoDirectory = ss;
}
#include "G4AutoLock.hh"
namespace { G4Mutex AtomicTransitionManagerMutex = G4MUTEX_INITIALIZER; }
void G4AtomicTransitionManager::Initialise()
{
G4AutoLock l(&AtomicTransitionManagerMutex);
//G4cout << "!!! G4AtomicTransitionManager::Initialise " << isInitialized
// << G4endl;
if(isInitialized) { return; }
isInitialized = true;
// infTableLimit is initialized to 6 because EADL lacks data for Z<=5
G4ShellData* shellManager = new G4ShellData;
shellManager->LoadData(fluoDirectory+"/binding");
// initialization of the data for auger effect
augerData = new G4AugerData;
shellManager->LoadData("/fluor/binding");
// Fills shellTable with the data from EADL, identities and binding
// energies of shells
for (G4int Z = zMin; Z<= zMax; Z++)
for (G4int Z = zMin; Z<= zMax; ++Z)
{
std::vector<G4AtomicShell*> vectorOfShells;
size_t shellIndex = 0;
size_t numberOfShells=shellManager->NumberOfShells(Z);
for (shellIndex = 0; shellIndex<numberOfShells; shellIndex++)
size_t numberOfShells = shellManager->NumberOfShells(Z);
for (shellIndex = 0; shellIndex<numberOfShells; ++shellIndex)
{
G4int shellId = shellManager->ShellId(Z,shellIndex);
G4double bindingEnergy = shellManager->BindingEnergy(Z,shellIndex);
@@ -77,344 +325,49 @@ G4AtomicTransitionManager::G4AtomicTransitionManager(G4int minZ, G4int maxZ,
// Fills transitionTable with the data from EADL, identities, transition
// energies and transition probabilities
for (G4int Znum= infTableLimit; Znum<=supTableLimit; Znum++)
{ G4FluoData* fluoManager = new G4FluoData;
std::vector<G4FluoTransition*> vectorOfTransitions;
fluoManager->LoadData(Znum);
for (G4int Znum= infTableLimit; Znum<=supTableLimit; ++Znum)
{
G4FluoData* fluoManager = new G4FluoData(fluoDirectory);
std::vector<G4FluoTransition*> vectorOfTransitions;
fluoManager->LoadData(Znum);
size_t numberOfVacancies = fluoManager-> NumberOfVacancies();
size_t numberOfVacancies = fluoManager-> NumberOfVacancies();
for (size_t vacancyIndex = 0; vacancyIndex<numberOfVacancies; vacancyIndex++)
{
std::vector<G4int> vectorOfIds;
G4DataVector vectorOfEnergies;
G4DataVector vectorOfProbabilities;
for(size_t vacancyIndex = 0; vacancyIndex<numberOfVacancies;
++vacancyIndex)
{
std::vector<G4int> vectorOfIds;
G4DataVector vectorOfEnergies;
G4DataVector vectorOfProbabilities;
G4int finalShell = fluoManager->VacancyId(vacancyIndex);
size_t numberOfTransitions = fluoManager->NumberOfTransitions(vacancyIndex);
for (size_t origShellIndex = 0; origShellIndex < numberOfTransitions;
origShellIndex++)
G4int finalShell = fluoManager->VacancyId(vacancyIndex);
size_t numberOfTransitions =
fluoManager->NumberOfTransitions(vacancyIndex);
for (size_t origShellIndex = 0; origShellIndex < numberOfTransitions;
++origShellIndex)
{
G4int originatingShellId =
fluoManager->StartShellId(origShellIndex,vacancyIndex);
vectorOfIds.push_back(originatingShellId);
{
G4int originatingShellId = fluoManager->StartShellId(origShellIndex,vacancyIndex);
vectorOfIds.push_back(originatingShellId);
G4double transitionEnergy = fluoManager->StartShellEnergy(origShellIndex,vacancyIndex);
vectorOfEnergies.push_back(transitionEnergy);
G4double transitionProbability = fluoManager->StartShellProb(origShellIndex,vacancyIndex);
vectorOfProbabilities.push_back(transitionProbability);
}
G4FluoTransition * transition = new G4FluoTransition (finalShell,vectorOfIds,
vectorOfEnergies,vectorOfProbabilities);
G4double transitionEnergy =
fluoManager->StartShellEnergy(origShellIndex,vacancyIndex);
vectorOfEnergies.push_back(transitionEnergy);
G4double transitionProbability =
fluoManager->StartShellProb(origShellIndex,vacancyIndex);
vectorOfProbabilities.push_back(transitionProbability);
}
G4FluoTransition* transition =
new G4FluoTransition (finalShell,vectorOfIds,
vectorOfEnergies,vectorOfProbabilities);
vectorOfTransitions.push_back(transition);
}
// transitionTable.insert(std::make_pair(Znum, vectorOfTransitions));
transitionTable[Znum] = vectorOfTransitions;
}
transitionTable[Znum] = vectorOfTransitions;
delete fluoManager;
}
delete shellManager;
}
G4AtomicTransitionManager::~G4AtomicTransitionManager()
{
delete augerData;
std::map<G4int,std::vector<G4AtomicShell*>,std::less<G4int> >::iterator pos;
for (pos = shellTable.begin(); pos != shellTable.end(); pos++){
std::vector< G4AtomicShell*>vec = (*pos).second;
G4int vecSize=vec.size();
for (G4int i=0; i< vecSize; i++){
G4AtomicShell* shell = vec[i];
delete shell;
}
}
std::map<G4int,std::vector<G4FluoTransition*>,std::less<G4int> >::iterator ppos;
for (ppos = transitionTable.begin(); ppos != transitionTable.end(); ppos++){
std::vector<G4FluoTransition*>vec = (*ppos).second;
G4int vecSize=vec.size();
for (G4int i=0; i< vecSize; i++){
G4FluoTransition* transition = vec[i];
delete transition;
}
}
}
G4ThreadLocal G4AtomicTransitionManager* G4AtomicTransitionManager::instance = 0;
G4AtomicTransitionManager* G4AtomicTransitionManager::Instance()
{
if (instance == 0)
{
instance = new G4AtomicTransitionManager;
}
return instance;
}
G4AtomicShell* G4AtomicTransitionManager::Shell(G4int Z, size_t shellIndex) const
{
std::map<G4int,std::vector<G4AtomicShell*>,std::less<G4int> >::const_iterator pos;
pos = shellTable.find(Z);
if (pos!= shellTable.end())
{
std::vector<G4AtomicShell*> v = (*pos).second;
if (shellIndex<v.size())
{
return(v[shellIndex]);
}
else
{
size_t lastShell = v.size();
G4cout << "G4AtomicTransitionManager::Shell - Z = "
<< Z << ", shellIndex = " << shellIndex
<< " not found; number of shells = " << lastShell << G4endl;
// G4Exception("G4AtomicTransitionManager:shell not found");
if (lastShell > 0)
{
return v[lastShell - 1];
}
else
{
return 0;
}
}
}
else
{
G4Exception("G4AtomicTransitionManager::Shell()","de0001",FatalErrorInArgument,"Z not found");
return 0;
}
}
// This function gives, upon Z and the Index of the initial shell where te vacancy is,
// the radiative transition that can happen (originating shell, energy, probability)
const G4FluoTransition* G4AtomicTransitionManager::ReachableShell(G4int Z,size_t shellIndex) const
{
std::map<G4int,std::vector<G4FluoTransition*>,std::less<G4int> >::const_iterator pos;
pos = transitionTable.find(Z);
if (pos!= transitionTable.end())
{
std::vector<G4FluoTransition*> v = (*pos).second;
if (shellIndex < v.size()) return(v[shellIndex]);
else {
G4Exception("G4AtomicTransitionManager::ReachebleShell()","de0002", JustWarning,"Energy Deposited Locally.");
return 0;
}
}
else{
// G4cout << "G4AtomicTransitionMagare warning: No fluorescence or Auger for Z=" << Z << G4endl;
// G4cout << "Absorbed enrgy deposited locally" << G4endl;
// G4String pippo = (G4String(Z));
G4String msg = "No deexcitation for Z=" + (G4String(Z))+ ". Energy Deposited Locally.";
G4Exception("G4AtomicTransitionManager::ReachableShell()","de0001",JustWarning,msg);
//"No deexcitation for Z=" + (G4String(Z))+". Energy Deposited Locally.");
return 0;
}
}
const G4AugerTransition* G4AtomicTransitionManager::ReachableAugerShell(G4int Z, G4int vacancyShellIndex) const
{
G4AugerTransition* augerTransition = augerData->GetAugerTransition(Z,vacancyShellIndex);
return augerTransition;
}
G4int G4AtomicTransitionManager::NumberOfShells (G4int Z) const
{
std::map<G4int,std::vector<G4AtomicShell*>,std::less<G4int> >::const_iterator pos;
pos = shellTable.find(Z);
if (pos!= shellTable.end()){
std::vector<G4AtomicShell*> v = (*pos).second;
return v.size();
}
else{
// G4cout << "G4AtomicTransitionMagare warning: No fluorescence or Auger for Z=" << Z << G4endl;
// G4cout << "Absorbed enrgy deposited locally" << G4endl;
G4String msg = "No deexcitation for Z=" + (G4String(Z))+ ". Energy Deposited Locally.";
G4Exception("G4AtomicTransitionManager::NumberOfShells()","de0001",JustWarning,msg);
//"No deexcitation for Z=" + (G4String(Z))+". Energy Deposited Locally.");
return 0;
}
}
// This function returns the number of possible radiative transitions for the atom with atomic number Z
// i.e. the number of shell in wich a vacancy can be filled with a radiative transition
G4int G4AtomicTransitionManager::NumberOfReachableShells(G4int Z) const
{
std::map<G4int,std::vector<G4FluoTransition*>,std::less<G4int> >::const_iterator pos;
pos = transitionTable.find(Z);
if (pos!= transitionTable.end())
{
std::vector<G4FluoTransition*> v = (*pos).second;
return v.size();
}
else
{
// G4cout << "G4AtomicTransitionMagare warning: No fluorescence or Auger for Z=" << Z << G4endl;
// G4cout << "Absorbed enrgy deposited locally" << G4endl;
G4String msg = "No deexcitation for Z=" + (G4String(Z))+ ". Energy Deposited Locally.";
G4Exception("G4AtomicTransitionManager::NumberOfReachebleShells()","de0001",JustWarning,msg);
//"No deexcitation for Z=" + (G4String(Z))+". Energy Deposited Locally.");
return 0;
}
}
// This function returns the number of possible NON-radiative transitions for the atom with atomic number Z
// i.e. the number of shell in wich a vacancy can be filled with a NON-radiative transition
G4int G4AtomicTransitionManager::NumberOfReachableAugerShells(G4int Z)const
{
G4int n = augerData->NumberOfVacancies(Z);
return n;
}
G4double G4AtomicTransitionManager::TotalRadiativeTransitionProbability(G4int Z,
size_t shellIndex)
{
std::map<G4int,std::vector<G4FluoTransition*>,std::less<G4int> >::iterator pos;
pos = transitionTable.find(Z);
if (pos!= transitionTable.end())
{
std::vector<G4FluoTransition*> v = (*pos).second;
if (shellIndex < v.size())
{
G4FluoTransition* transition = v[shellIndex];
G4DataVector transProb = transition->TransitionProbabilities();
G4double totalRadTransProb = 0;
for (size_t j = 0; j<transProb.size(); j++) // AM -- corrected, it was 1
{
totalRadTransProb = totalRadTransProb + transProb[j];
}
return totalRadTransProb;
}
else {
G4Exception("G4AtomicTransitionManager::TotalRadiativeTransitionProbability()","de0002", JustWarning,"Energy Deposited Locally.");
return 0;
}
}
else{
//G4cout << "G4AtomicTransitionMagare warning: No fluorescence or Auger for Z=" << Z << G4endl;
//G4cout << "Absorbed enrgy deposited locally" << G4endl;
G4String msg = "No deexcitation for Z=" + (G4String(Z))+ ". Energy Deposited Locally.";
G4Exception("G4AtomicTransitionManager::TotalRadiativeTransitionProbability()","de0001",JustWarning,msg);
//"No deexcitation for Z=" + (G4String(Z))+". Energy Deposited Locally.");
return 0;
}
}
G4double G4AtomicTransitionManager::TotalNonRadiativeTransitionProbability(G4int Z, size_t shellIndex)
{
std::map<G4int,std::vector<G4FluoTransition*>,std::less<G4int> >::iterator pos;
pos = transitionTable.find(Z);
if (pos!= transitionTable.end()){
std::vector<G4FluoTransition*> v = (*pos).second;
if (shellIndex<v.size()){
G4FluoTransition* transition=v[shellIndex];
G4DataVector transProb = transition->TransitionProbabilities();
G4double totalRadTransProb = 0;
for(size_t j = 0; j<transProb.size(); j++) // AM -- Corrected, was 1
{
totalRadTransProb = totalRadTransProb + transProb[j];
}
if (totalRadTransProb > 1) {
G4Exception( "G4AtomicTransitionManager::TotalNonRadiativeTransitionProbability()","de0003",FatalException,"Total probability mismatch");
return 0;
}
G4double totalNonRadTransProb= (1 - totalRadTransProb);
return totalNonRadTransProb; }
else {
G4Exception("G4AtomicTransitionManager::TotalNonRadiativeTransitionProbability()","de0002", JustWarning,"Energy Deposited Locally.");
return 0;
}
}
else{
// G4cout << "G4AtomicTransitionMagare warning: No fluorescence or Auger for Z=" << Z << G4endl;
// G4cout << "Absorbed enrgy deposited locally" << G4endl;
G4String msg = "No deexcitation for Z=" + (G4String(Z))+ ". Energy Deposited Locally.";
G4Exception("G4AtomicTransitionManager::TotalNonRadiativeTransitionProbability()","de0001",JustWarning,msg);
//"No deexcitation for Z=" + (G4String(Z))+ ". Energy Deposited Locally.");
return 0;
}
}
@@ -41,9 +41,10 @@
#include "G4DataVector.hh"
#include "G4FluoTransition.hh"
G4FluoData::G4FluoData()
G4FluoData::G4FluoData(const G4String& dir)
{
numberOfVacancies=0;
fluoDirectory = dir;
}
G4FluoData::~G4FluoData()
@@ -76,7 +77,10 @@ G4int G4FluoData::VacancyId(G4int vacancyIndex) const
{
G4int n = -1;
if (vacancyIndex<0 || vacancyIndex>=numberOfVacancies)
{G4Exception("G4FluoData::vacancyId()","de0002",FatalErrorInArgument,"vacancyIndex outside boundaries");}
{
G4Exception("G4FluoData::vacancyId()","de0002",FatalErrorInArgument,
"vacancyIndex outside boundaries");
}
else
{
std::map<G4int,G4DataVector*,std::less<G4int> >::const_iterator pos;
@@ -95,7 +99,8 @@ size_t G4FluoData::NumberOfTransitions(G4int vacancyIndex) const
G4int n = 0;
if (vacancyIndex<0 || vacancyIndex>=numberOfVacancies)
{
G4Exception("G4FluoData::NumberOfTransitions()","de0002",JustWarning,"vacancyIndex outside boundaries, energy deposited locally");
G4Exception("G4FluoData::NumberOfTransitions()","de0002",JustWarning,
"vacancyIndex outside boundaries, energy deposited locally");
return 0;
}
else
@@ -112,8 +117,10 @@ G4int G4FluoData::StartShellId(G4int initIndex, G4int vacancyIndex) const
G4int n = -1;
if (vacancyIndex<0 || vacancyIndex>=numberOfVacancies)
{G4Exception("G4FluoData::StartShellId()","de0002",FatalErrorInArgument,"vacancyIndex outside boundaries");
}
{
G4Exception("G4FluoData::StartShellId()","de0002",FatalErrorInArgument,
"vacancyIndex outside boundaries");
}
else
{
std::map<G4int,G4DataVector*,std::less<G4int> >::const_iterator pos;
@@ -123,13 +130,12 @@ G4int G4FluoData::StartShellId(G4int initIndex, G4int vacancyIndex) const
G4DataVector dataSet = *((*pos).second);
G4int nData = dataSet.size();
//The first Element of idMap's dataSets is the original shell of the vacancy,
//so we must start from the first element of dataSet
if (initIndex >= 0 && initIndex < nData)
{
n = (G4int) dataSet[initIndex+1];
}
// The first Element of idMap's dataSets is the original shell of
// the vacancy, so we must start from the first element of dataSet
if (initIndex >= 0 && initIndex < nData)
{
n = (G4int) dataSet[initIndex+1];
}
}
return n;
}
@@ -139,22 +145,23 @@ G4double G4FluoData::StartShellEnergy(G4int initIndex, G4int vacancyIndex) const
G4double n = -1;
if (vacancyIndex<0 || vacancyIndex>=numberOfVacancies)
{G4Exception("G4FluoData::StartShellEnergy()","de0002",FatalErrorInArgument,"vacancyIndex outside boundaries");}
else
{
std::map<G4int,G4DataVector*,std::less<G4int> >::const_iterator pos;
{
G4Exception("G4FluoData::StartShellEnergy()","de0002",FatalErrorInArgument,
"vacancyIndex outside boundaries");}
else
{
std::map<G4int,G4DataVector*,std::less<G4int> >::const_iterator pos;
pos = energyMap.find(vacancyIndex);
pos = energyMap.find(vacancyIndex);
G4DataVector dataSet = *((*pos).second);
G4DataVector dataSet = *((*pos).second);
G4int nData = dataSet.size();
if (initIndex >= 0 && initIndex < nData)
{
n = dataSet[initIndex];
}
}
G4int nData = dataSet.size();
if (initIndex >= 0 && initIndex < nData)
{
n = dataSet[initIndex];
}
}
return n;
}
@@ -164,23 +171,23 @@ G4double G4FluoData::StartShellProb(G4int initIndex, G4int vacancyIndex) const
if (vacancyIndex<0 || vacancyIndex>=numberOfVacancies)
{
G4Exception("G4FluoData::StartShellEnergy()","de0002",JustWarning,"vacancyIndex outside boundaries, energy deposited locally");
G4Exception("G4FluoData::StartShellEnergy()","de0002",JustWarning,
"vacancyIndex outside boundaries, energy deposited locally");
return 0;
}
}
else
{
std::map<G4int,G4DataVector*,std::less<G4int> >::const_iterator pos;
std::map<G4int,G4DataVector*,std::less<G4int> >::const_iterator pos;
pos = probabilityMap.find(vacancyIndex);
pos = probabilityMap.find(vacancyIndex);
G4DataVector dataSet = *((*pos).second);
G4DataVector dataSet = *((*pos).second);
G4int nData = dataSet.size();
if (initIndex >= 0 && initIndex < nData)
{
n = dataSet[initIndex];
}
G4int nData = dataSet.size();
if (initIndex >= 0 && initIndex < nData)
{
n = dataSet[initIndex];
}
}
return n;
}
@@ -188,13 +195,12 @@ G4double G4FluoData::StartShellProb(G4int initIndex, G4int vacancyIndex) const
void G4FluoData::LoadData(G4int Z)
{
// Build the complete string identifying the file with the data set
std::ostringstream ost;
if(Z != 0){
ost << "fl-tr-pr-"<< Z << ".dat";
ost << "/fl-tr-pr-"<< Z << ".dat";
}
else{
ost << "fl-tr-pr-"<<".dat";
ost << "/fl-tr-pr-"<<".dat";
}
G4String name(ost.str());
@@ -207,8 +213,7 @@ void G4FluoData::LoadData(G4int Z)
}
G4String pathString(path);
G4String fluor("/fluor/");
G4String dirFile = pathString + fluor + name;
G4String dirFile = pathString + fluoDirectory + name;
std::ifstream file(dirFile);
std::filebuf* lsdp = file.rdbuf();
@@ -267,8 +272,7 @@ void G4FluoData::LoadData(G4int Z)
delete transProbabilities;
}*/
else
{
{
if(k%nColumns == 2)
{
// 2nd column is transition probabilities
@@ -299,7 +303,7 @@ void G4FluoData::LoadData(G4int Z)
if (a != -1)
{G4double e = a * MeV;
transEnergies->push_back(e);}
transEnergies->push_back(e);}
k=1;
}
@@ -315,7 +319,6 @@ void G4FluoData::LoadData(G4int Z)
void G4FluoData::PrintData()
{
for (G4int i = 0; i <numberOfVacancies; i++)
{
G4cout << "---- TransitionData for the vacancy nb "
@@ -339,42 +342,3 @@ void G4FluoData::PrintData()
<< G4endl;
}
}
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4IonParametrisedLossModel.cc 76243 2013-11-08 11:11:38Z gcosmo $
// $Id: G4IonParametrisedLossModel.cc 87443 2014-12-04 12:26:31Z gunter $
//
// ===========================================================================
// GEANT4 class source file
@@ -93,6 +93,7 @@
#include "G4LossTableManager.hh"
#include "G4GenericIon.hh"
#include "G4Electron.hh"
#include "G4DeltaAngle.hh"
#include "Randomize.hh"
//#define PRINT_TABLE_BUILT
@@ -153,6 +154,9 @@ G4IonParametrisedLossModel::G4IonParametrisedLossModel(
dedxCacheTransitionEnergy = 0.0;
dedxCacheTransitionFactor = 0.0;
dedxCacheGenIonMassRatio = 0.0;
// default generator
SetAngularDistribution(new G4DeltaAngle());
}
// #########################################################################
@@ -163,8 +167,21 @@ G4IonParametrisedLossModel::~G4IonParametrisedLossModel() {
LossTableList::iterator iterTables = lossTableList.begin();
LossTableList::iterator iterTables_end = lossTableList.end();
for(;iterTables != iterTables_end; iterTables++) delete *iterTables;
for(;iterTables != iterTables_end; ++iterTables) { delete *iterTables; }
lossTableList.clear();
// range table
RangeEnergyTable::iterator itr = r.begin();
RangeEnergyTable::iterator itr_end = r.end();
for(;itr != itr_end; ++itr) { delete itr->second; }
r.clear();
// inverse range
EnergyRangeTable::iterator ite = E.begin();
EnergyRangeTable::iterator ite_end = E.end();
for(;ite != ite_end; ++ite) { delete ite->second; }
E.clear();
}
// #########################################################################
@@ -272,13 +289,17 @@ void G4IonParametrisedLossModel::Initialise(
RangeEnergyTable::iterator iterRange = r.begin();
RangeEnergyTable::iterator iterRange_end = r.end();
for(;iterRange != iterRange_end; iterRange++) delete iterRange -> second;
for(;iterRange != iterRange_end; iterRange++) {
delete iterRange->second;
}
r.clear();
EnergyRangeTable::iterator iterEnergy = E.begin();
EnergyRangeTable::iterator iterEnergy_end = E.end();
for(;iterEnergy != iterEnergy_end; iterEnergy++) delete iterEnergy -> second;
for(;iterEnergy != iterEnergy_end; iterEnergy++) {
delete iterEnergy->second;
}
E.clear();
// The cut energies are (re)loaded
@@ -672,7 +693,7 @@ void G4IonParametrisedLossModel::PrintDEDXTableHandlers(
void G4IonParametrisedLossModel::SampleSecondaries(
std::vector<G4DynamicParticle*>* secondaries,
const G4MaterialCutsCouple*,
const G4MaterialCutsCouple* couple,
const G4DynamicParticle* particle,
G4double cutKinEnergySec,
G4double userMaxKinEnergySec) {
@@ -710,11 +731,10 @@ void G4IonParametrisedLossModel::SampleSecondaries(
if(cutKinEnergySec >= maxKinEnergySec) return;
G4double kineticEnergy = particle -> GetKineticEnergy();
G4ThreeVector direction = particle ->GetMomentumDirection();
G4double energy = kineticEnergy + cacheMass;
G4double betaSquared = kineticEnergy *
(energy + cacheMass) / (energy * energy);
G4double betaSquared = kineticEnergy * (energy + cacheMass)
/ (energy * energy);
G4double kinEnergySec;
G4double grej;
@@ -739,34 +759,30 @@ void G4IonParametrisedLossModel::SampleSecondaries(
} while( G4UniformRand() >= grej );
G4double momentumSec =
std::sqrt(kinEnergySec * (kinEnergySec + 2.0 * electron_mass_c2));
const G4Material* mat = couple->GetMaterial();
G4int Z = SelectRandomAtomNumber(mat);
G4double totMomentum = energy*std::sqrt(betaSquared);
G4double cost = kinEnergySec * (energy + electron_mass_c2) /
(momentumSec * totMomentum);
if(cost > 1.0) cost = 1.0;
G4double sint = std::sqrt((1.0 - cost)*(1.0 + cost));
const G4ParticleDefinition* electron = G4Electron::Electron();
G4DynamicParticle* delta = new G4DynamicParticle(electron,
GetAngularDistribution()->SampleDirection(particle, kinEnergySec,
Z, mat),
kinEnergySec);
G4double phi = twopi * G4UniformRand() ;
G4ThreeVector directionSec(sint*std::cos(phi),sint*std::sin(phi), cost) ;
directionSec.rotateUz(direction);
// create G4DynamicParticle object for delta ray
G4DynamicParticle* delta = new G4DynamicParticle(G4Electron::Definition(),
directionSec,
kinEnergySec);
secondaries -> push_back(delta);
secondaries->push_back(delta);
// Change kinematics of primary particle
kineticEnergy -= kinEnergySec;
G4ThreeVector finalP = direction*totMomentum - directionSec*momentumSec;
G4ThreeVector direction = particle ->GetMomentumDirection();
G4double totalMomentum = std::sqrt(kineticEnergy*(energy + cacheMass));
G4ThreeVector finalP = totalMomentum*direction - delta->GetMomentum();
finalP = finalP.unit();
particleChangeLoss -> SetProposedKineticEnergy(kineticEnergy);
particleChangeLoss -> SetProposedMomentumDirection(finalP);
kineticEnergy -= kinEnergySec;
particleChangeLoss->SetProposedKineticEnergy(kineticEnergy);
particleChangeLoss->SetProposedMomentumDirection(finalP);
}
// #########################################################################
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4LivermoreComptonModel.cc 76988 2013-11-20 09:54:40Z gcosmo $
// $Id: G4LivermoreComptonModel.cc 84216 2014-10-10 14:51:51Z gcosmo $
// GEANT4 tag $Name: not supported by cvs2svn $
//
//
@@ -69,9 +69,7 @@ static const G4double ln10 = G4Log(10.);
G4LivermoreComptonModel::G4LivermoreComptonModel(const G4ParticleDefinition*,
const G4String& nam)
: G4VEmModel(nam),isInitialised(false)
{
lowestEnergy = 10 * eV;
{
verboseLevel=1 ;
// Verbosity scale:
// 0 = nothing
@@ -100,6 +98,12 @@ G4LivermoreComptonModel::~G4LivermoreComptonModel()
shellData = 0;
delete profileData;
profileData = 0;
for(G4int i=0; i<maxZ; ++i) {
if(data[i]) {
delete data[i];
data[i] = 0;
}
}
}
}
@@ -244,7 +248,7 @@ G4LivermoreComptonModel::ComputeCrossSectionPerAtom(const G4ParticleDefinition*,
}
G4double cs = 0.0;
if (GammaEnergy < lowestEnergy) { return 0.0; }
if (GammaEnergy < LowEnergyLimit()) { return 0.0; }
G4int intZ = G4lrint(Z);
if(intZ < 1 || intZ > maxZ) { return cs; }
@@ -302,15 +306,11 @@ void G4LivermoreComptonModel::SampleSecondaries(
<< photonEnergy0/MeV << " in " << couple->GetMaterial()->GetName()
<< G4endl;
}
// low-energy gamma is absorpted by this process
if (photonEnergy0 <= lowestEnergy)
{
fParticleChange->ProposeTrackStatus(fStopAndKill);
fParticleChange->SetProposedKineticEnergy(0.);
fParticleChange->ProposeLocalEnergyDeposit(photonEnergy0);
return ;
}
// do nothing below the threshold
// should never get here because the XS is zero below the limit
if (photonEnergy0 < LowEnergyLimit())
return ;
G4double e0m = photonEnergy0 / electron_mass_c2 ;
G4ParticleMomentum photonDirection0 = aDynamicGamma->GetMomentumDirection();
@@ -508,12 +508,28 @@ void G4LivermoreComptonModel::SampleSecondaries(
size_t nafter = fvect->size();
if(nafter > nbefore) {
for (size_t i=nbefore; i<nafter; ++i) {
bindingE -= ((*fvect)[i])->GetKineticEnergy();
//Check if there is enough residual energy
if (bindingE >= ((*fvect)[i])->GetKineticEnergy())
{
//Ok, this is a valid secondary: keep it
bindingE -= ((*fvect)[i])->GetKineticEnergy();
}
else
{
//Invalid secondary: not enough energy to create it!
//Keep its energy in the local deposit
delete (*fvect)[i];
(*fvect)[i]=0;
}
}
}
}
}
if(bindingE < 0.0) { bindingE = 0.0; }
//This should never happen
if(bindingE < 0.0)
G4Exception("G4LivermoreComptonModel::SampleSecondaries()",
"em2050",FatalException,"Negative local energy deposit");
fParticleChange->ProposeLocalEnergyDeposit(bindingE);
}
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4LivermoreComptonModifiedModel.cc 66241 2012-12-13 18:34:42Z gunter $
// $Id: G4LivermoreComptonModifiedModel.cc 82874 2014-07-15 15:25:29Z gcosmo $
//
//
// Author: Sebastien Incerti
@@ -66,9 +66,6 @@ G4LivermoreComptonModifiedModel::G4LivermoreComptonModifiedModel(const G4Particl
scatterFunctionData(0),
crossSectionHandler(0),fAtomDeexcitation(0)
{
lowEnergyLimit = 250 * eV;
highEnergyLimit = 100 * GeV;
verboseLevel=0 ;
// Verbosity scale:
// 0 = nothing
@@ -77,13 +74,8 @@ G4LivermoreComptonModifiedModel::G4LivermoreComptonModifiedModel(const G4Particl
// 3 = calculation of cross sections, file openings, sampling of atoms
// 4 = entering in methods
if( verboseLevel>0 ) {
G4cout << "Livermore Modified Compton model is constructed " << G4endl
<< "Energy range: "
<< lowEnergyLimit / eV << " eV - "
<< highEnergyLimit / GeV << " GeV"
<< G4endl;
}
if( verboseLevel>0 )
G4cout << "Livermore Modified Compton model is constructed " << G4endl;
//Mark this model as "applicable" for atomic deexcitation
SetDeexcitationFlag(true);
@@ -143,7 +135,7 @@ void G4LivermoreComptonModifiedModel::Initialise(const G4ParticleDefinition* par
fAtomDeexcitation = G4LossTableManager::Instance()->AtomDeexcitation();
if( verboseLevel>0 ) {
G4cout << "Livermore Compton model is initialized " << G4endl
G4cout << "Livermore modified Compton model is initialized " << G4endl
<< "Energy range: "
<< LowEnergyLimit() / eV << " eV - "
<< HighEnergyLimit() / GeV << " GeV"
@@ -162,7 +154,8 @@ G4double G4LivermoreComptonModifiedModel::ComputeCrossSectionPerAtom(
if (verboseLevel > 3) {
G4cout << "Calling ComputeCrossSectionPerAtom() of G4LivermoreComptonModifiedModel" << G4endl;
}
if (GammaEnergy < lowEnergyLimit || GammaEnergy > highEnergyLimit) { return 0.0; }
if (GammaEnergy < LowEnergyLimit())
{ return 0.0; }
G4double cs = crossSectionHandler->FindValue(G4int(Z), GammaEnergy);
return cs;
@@ -197,15 +190,11 @@ void G4LivermoreComptonModifiedModel::SampleSecondaries(std::vector<G4DynamicPar
<< photonEnergy0/MeV << " in " << couple->GetMaterial()->GetName()
<< G4endl;
}
// low-energy gamma is absorpted by this process
if (photonEnergy0 <= lowEnergyLimit)
{
fParticleChange->ProposeTrackStatus(fStopAndKill);
fParticleChange->SetProposedKineticEnergy(0.);
fParticleChange->ProposeLocalEnergyDeposit(photonEnergy0);
return ;
}
// do nothing below the threshold
// should never get here because the XS is zero below the limit
if (photonEnergy0 < LowEnergyLimit())
return ;
G4double e0m = photonEnergy0 / electron_mass_c2 ;
G4ParticleMomentum photonDirection0 = aDynamicGamma->GetMomentumDirection();
@@ -66,7 +66,16 @@ G4LivermoreGammaConversionModel::G4LivermoreGammaConversionModel
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4LivermoreGammaConversionModel::~G4LivermoreGammaConversionModel()
{}
{
if(IsMaster()) {
for(G4int i=0; i<maxZ; ++i) {
if(data[i]) {
delete data[i];
data[i] = 0;
}
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -116,9 +125,6 @@ void G4LivermoreGammaConversionModel::Initialise(
}
}
}
//
if(isInitialised) { return; }
fParticleChange = GetParticleChangeForGamma();
isInitialised = true;
@@ -126,8 +132,8 @@ void G4LivermoreGammaConversionModel::Initialise(
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4LivermoreGammaConversionModel::InitialiseLocal(const G4ParticleDefinition*,
G4VEmModel* masterModel)
void G4LivermoreGammaConversionModel::InitialiseLocal(
const G4ParticleDefinition*, G4VEmModel* masterModel)
{
SetElementSelectors(masterModel->GetElementSelectors());
}
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4LivermoreIonisationModel.cc 74822 2013-10-22 14:42:13Z gcosmo $
// $Id: G4LivermoreIonisationModel.cc 87443 2014-12-04 12:26:31Z gunter $
//
// Author: Luciano Pandola
// on base of G4LowEnergyIonisation developed by A.Forti and V.Ivanchenko
@@ -84,7 +84,7 @@ G4LivermoreIonisationModel::G4LivermoreIonisationModel(const G4ParticleDefinitio
fIntrinsicHighEnergyLimit = 100.0*GeV;
verboseLevel = 0;
//SetAngularDistribution(new G4DeltaAngle());
SetAngularDistribution(new G4DeltaAngle());
transitionManager = G4AtomicTransitionManager::Instance();
}
@@ -110,6 +110,8 @@ void G4LivermoreIonisationModel::Initialise(const G4ParticleDefinition* particle
"Livermore Ionisation Model is applicable only to electrons");
}
transitionManager->Initialise();
//Read energy spectrum
if (energySpectrum)
{
@@ -281,58 +283,21 @@ void G4LivermoreIonisationModel::SampleSecondaries(
if (energyDelta == 0.) //nothing happens
{ return; }
// Transform to shell potential
G4double deltaKinE = energyDelta + 2.0*bindingEnergy;
G4double primaryKinE = kineticEnergy + 2.0*bindingEnergy;
const G4ParticleDefinition* electron = G4Electron::Electron();
G4DynamicParticle* delta = new G4DynamicParticle(electron,
GetAngularDistribution()->SampleDirectionForShell(aDynamicParticle, energyDelta,
Z, shellIndex,
couple->GetMaterial()),
energyDelta);
// sampling of scattering angle neglecting atomic motion
G4double deltaMom = std::sqrt(deltaKinE*(deltaKinE + 2.0*electron_mass_c2));
G4double primaryMom = std::sqrt(primaryKinE*(primaryKinE + 2.0*electron_mass_c2));
fvect->push_back(delta);
G4double cost = deltaKinE * (primaryKinE + 2.0*electron_mass_c2)
/ (deltaMom * primaryMom);
if (cost > 1.) { cost = 1.; }
G4double sint = std::sqrt((1. - cost)*(1. + cost));
G4double phi = twopi * G4UniformRand();
G4double dirx = sint * std::cos(phi);
G4double diry = sint * std::sin(phi);
G4double dirz = cost;
// Rotate to incident electron direction
G4ThreeVector primaryDirection = aDynamicParticle->GetMomentumDirection();
G4ThreeVector deltaDir(dirx,diry,dirz);
deltaDir.rotateUz(primaryDirection);
//Updated components
dirx = deltaDir.x();
diry = deltaDir.y();
dirz = deltaDir.z();
// Change kinematics of primary particle
G4ThreeVector direction = aDynamicParticle->GetMomentumDirection();
G4double totalMomentum = std::sqrt(kineticEnergy*(kineticEnergy + 2*electron_mass_c2));
// Take into account atomic motion del is relative momentum of the motion
// kinetic energy of the motion == bindingEnergy in V.Ivanchenko model
cost = 2.0*G4UniformRand() - 1.0;
sint = std::sqrt(1. - cost*cost);
phi = twopi * G4UniformRand();
G4double del = std::sqrt(bindingEnergy *(bindingEnergy + 2.0*electron_mass_c2))
/ deltaMom;
dirx += del* sint * std::cos(phi);
diry += del* sint * std::sin(phi);
dirz += del* cost;
// Find out new primary electron direction
G4double finalPx = primaryMom*primaryDirection.x() - deltaMom*dirx;
G4double finalPy = primaryMom*primaryDirection.y() - deltaMom*diry;
G4double finalPz = primaryMom*primaryDirection.z() - deltaMom*dirz;
//Ok, ready to create the delta ray
G4DynamicParticle* theDeltaRay = new G4DynamicParticle();
theDeltaRay->SetKineticEnergy(energyDelta);
G4double norm = 1.0/std::sqrt(dirx*dirx + diry*diry + dirz*dirz);
dirx *= norm;
diry *= norm;
dirz *= norm;
theDeltaRay->SetMomentumDirection(dirx, diry, dirz);
theDeltaRay->SetDefinition(G4Electron::Electron());
fvect->push_back(theDeltaRay);
G4ThreeVector finalP = totalMomentum*direction - delta->GetMomentum();
finalP = finalP.unit();
//This is the amount of energy available for fluorescence
G4double theEnergyDeposit = bindingEnergy;
@@ -347,11 +312,7 @@ void G4LivermoreIonisationModel::SampleSecondaries(
}
else
{
G4double normLocal = 1.0/std::sqrt(finalPx*finalPx+finalPy*finalPy+finalPz*finalPz);
finalPx *= normLocal;
finalPy *= normLocal;
finalPz *= normLocal;
fParticleChange->ProposeMomentumDirection(finalPx, finalPy, finalPz);
fParticleChange->ProposeMomentumDirection(finalP);
}
fParticleChange->SetProposedKineticEnergy(finalKinEnergy);
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4LivermorePhotoElectricModel.cc 76882 2013-11-18 12:49:10Z gcosmo $
// $Id: G4LivermorePhotoElectricModel.cc 83410 2014-08-21 15:17:53Z gcosmo $
//
//
// Author: Sebastien Incerti
@@ -35,6 +35,7 @@
#include "G4LivermorePhotoElectricModel.hh"
#include "G4SystemOfUnits.hh"
#include "G4PhysicalConstants.hh"
#include "G4LossTableManager.hh"
#include "G4Electron.hh"
#include "G4Gamma.hh"
@@ -53,6 +54,8 @@ std::vector<G4double>* G4LivermorePhotoElectricModel::fParam[] = {0};
G4int G4LivermorePhotoElectricModel::fNShells[] = {0};
G4int G4LivermorePhotoElectricModel::fNShellsUsed[] = {0};
G4ElementData* G4LivermorePhotoElectricModel::fShellCrossSection = 0;
G4Material* G4LivermorePhotoElectricModel::fWater = 0;
G4double G4LivermorePhotoElectricModel::fWaterEnergyLimit = 0.0;
using namespace std;
@@ -85,6 +88,8 @@ G4LivermorePhotoElectricModel::G4LivermorePhotoElectricModel(
//Mark this model as "applicable" for atomic deexcitation
SetDeexcitationFlag(true);
fSandiaCof.resize(4,0.0);
fCurrSection = 0.0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -95,6 +100,11 @@ G4LivermorePhotoElectricModel::~G4LivermorePhotoElectricModel()
delete fShellCrossSection;
for(G4int i=0; i<maxZ; ++i) {
delete fParam[i];
fParam[i] = 0;
delete fCrossSection[i];
fCrossSection[i] = 0;
delete fCrossSectionLE[i];
fCrossSectionLE[i] = 0;
}
}
}
@@ -111,6 +121,11 @@ G4LivermorePhotoElectricModel::Initialise(const G4ParticleDefinition*,
if(IsMaster()) {
if(!fWater) {
fWater = G4Material::GetMaterial("G4_WATER", false);
if(fWater) { fWaterEnergyLimit = 13.6*eV; }
}
if(!fShellCrossSection) { fShellCrossSection = new G4ElementData(); }
char* path = getenv("G4LEDATA");
@@ -158,6 +173,35 @@ G4LivermorePhotoElectricModel::Initialise(const G4ParticleDefinition*,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4LivermorePhotoElectricModel::CrossSectionPerVolume(
const G4Material* material,
const G4ParticleDefinition* p,
G4double energy,
G4double, G4double)
{
fCurrSection = 0.0;
if(fWater && (material == fWater ||
material->GetBaseMaterial() == fWater)) {
if(energy <= fWaterEnergyLimit) {
fWater->GetSandiaTable()->GetSandiaCofWater(energy, fSandiaCof);
G4double energy2 = energy*energy;
G4double energy3 = energy*energy2;
G4double energy4 = energy2*energy2;
fCurrSection = material->GetDensity()*
(fSandiaCof[0]/energy + fSandiaCof[1]/energy2 +
fSandiaCof[2]/energy3 + fSandiaCof[3]/energy4);
}
}
if(0.0 == fCurrSection) {
fCurrSection = G4VEmModel::CrossSectionPerVolume(material, p, energy);
}
return fCurrSection;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4LivermorePhotoElectricModel::ComputeCrossSectionPerAtom(
const G4ParticleDefinition*,
G4double energy,
@@ -169,8 +213,6 @@ G4double G4LivermorePhotoElectricModel::ComputeCrossSectionPerAtom(
<< " Z= " << ZZ << " R(keV)= " << energy/keV << G4endl;
}
G4double cs = 0.0;
G4double gammaEnergy = energy;
G4int Z = G4lrint(ZZ);
if(Z < 1 || Z >= maxZ) { return cs; }
@@ -182,28 +224,28 @@ G4double G4LivermorePhotoElectricModel::ComputeCrossSectionPerAtom(
}
G4int idx = fNShells[Z]*6 - 4;
if (gammaEnergy <= (*(fParam[Z]))[idx-1]) { return cs; }
if (energy < (*(fParam[Z]))[idx-1]) { energy = (*(fParam[Z]))[idx-1]; }
G4double x1 = 1.0/gammaEnergy;
G4double x1 = 1.0/energy;
G4double x2 = x1*x1;
G4double x3 = x2*x1;
// parameterisation
if(gammaEnergy >= (*(fParam[Z]))[0]) {
if(energy >= (*(fParam[Z]))[0]) {
G4double x4 = x2*x2;
cs = x1*((*(fParam[Z]))[idx] + x1*(*(fParam[Z]))[idx+1]
+ x2*(*(fParam[Z]))[idx+2] + x3*(*(fParam[Z]))[idx+3]
+ x4*(*(fParam[Z]))[idx+4]);
// high energy part
} else if(gammaEnergy >= (*(fParam[Z]))[1]) {
cs = x3*(fCrossSection[Z])->Value(gammaEnergy);
} else if(energy >= (*(fParam[Z]))[1]) {
cs = x3*(fCrossSection[Z])->Value(energy);
// low energy part
} else {
cs = x3*(fCrossSectionLE[Z])->Value(gammaEnergy);
cs = x3*(fCrossSectionLE[Z])->Value(energy);
}
if (verboseLevel > 1) {
G4cout << "LivermorePhotoElectricModel: E(keV)= " << gammaEnergy/keV
G4cout << "LivermorePhotoElectricModel: E(keV)= " << energy/keV
<< " Z= " << Z << " cross(barn)= " << cs/barn << G4endl;
}
return cs;
@@ -226,16 +268,25 @@ G4LivermorePhotoElectricModel::SampleSecondaries(
}
// kill incident photon
fParticleChange->SetProposedKineticEnergy(0.);
fParticleChange->ProposeTrackStatus(fStopAndKill);
fParticleChange->SetProposedKineticEnergy(0.);
// low-energy photo-effect in water - full absorption
const G4Material* material = couple->GetMaterial();
if(fWater && (material == fWater ||
material->GetBaseMaterial() == fWater)) {
if(gammaEnergy <= fWaterEnergyLimit) {
fParticleChange->ProposeLocalEnergyDeposit(gammaEnergy);
return;
}
}
// Returns the normalized direction of the momentum
G4ThreeVector photonDirection = aDynamicGamma->GetMomentumDirection();
// Select randomly one element in the current material
//G4cout << "Select random atom Egamma(keV)= " << gammaEnergy/keV << G4endl;
const G4Element* elm = SelectRandomAtom(couple->GetMaterial(),theGamma,
gammaEnergy);
const G4Element* elm = SelectRandomAtom(material, theGamma, gammaEnergy);
G4int Z = G4lrint(elm->GetZ());
// Select the ionised shell in the current atom according to shell
@@ -434,11 +485,11 @@ G4LivermorePhotoElectricModel::ReadData(G4int Z, const char* path)
}
fin1 >> n1;
if(fin1.fail()) { return; }
if(0 > n1) { n1 = 0; }
if(0 > n1 || n1 >= INT_MAX) { n1 = 0; }
fin1 >> n2;
if(fin1.fail()) { return; }
if(0 > n2) { n2 = 0; }
if(0 > n2 || n2 >= INT_MAX) { n2 = 0; }
fin1 >> x;
if(fin1.fail()) { return; }
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4LivermorePolarizedComptonModel.cc 66241 2012-12-13 18:34:42Z gunter $
// $Id: G4LivermorePolarizedComptonModel.cc 82874 2014-07-15 15:25:29Z gcosmo $
//
// Authors: G.Depaola & F.Longo
//
@@ -52,12 +52,7 @@ G4LivermorePolarizedComptonModel::G4LivermorePolarizedComptonModel(const G4Parti
const G4String& nam)
:G4VEmModel(nam),fParticleChange(0),isInitialised(false),
meanFreePathTable(0),scatterFunctionData(0),crossSectionHandler(0)
{
lowEnergyLimit = 250 * eV;
highEnergyLimit = 100 * GeV;
//SetLowEnergyLimit(lowEnergyLimit);
SetHighEnergyLimit(highEnergyLimit);
{
verboseLevel= 0;
// Verbosity scale:
// 0 = nothing
@@ -66,13 +61,9 @@ G4LivermorePolarizedComptonModel::G4LivermorePolarizedComptonModel(const G4Parti
// 3 = calculation of cross sections, file openings, sampling of atoms
// 4 = entering in methods
if( verboseLevel>0 ) {
G4cout << "Livermore Polarized Compton is constructed " << G4endl
<< "Energy range: "
<< lowEnergyLimit / eV << " eV - "
<< highEnergyLimit / GeV << " GeV"
<< G4endl;
}
if( verboseLevel>0 )
G4cout << "Livermore Polarized Compton is constructed " << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -149,7 +140,8 @@ G4double G4LivermorePolarizedComptonModel::ComputeCrossSectionPerAtom(
if (verboseLevel > 3)
G4cout << "Calling ComputeCrossSectionPerAtom() of G4LivermorePolarizedComptonModel" << G4endl;
if (GammaEnergy < lowEnergyLimit || GammaEnergy > highEnergyLimit) return 0.0;
if (GammaEnergy < LowEnergyLimit())
return 0.0;
G4double cs = crossSectionHandler->FindValue(G4int(Z), GammaEnergy);
return cs;
@@ -173,6 +165,13 @@ void G4LivermorePolarizedComptonModel::SampleSecondaries(std::vector<G4DynamicPa
G4cout << "Calling SampleSecondaries() of G4LivermorePolarizedComptonModel" << G4endl;
G4double gammaEnergy0 = aDynamicGamma->GetKineticEnergy();
// do nothing below the threshold
// should never get here because the XS is zero below the limit
if (gammaEnergy0 < LowEnergyLimit())
return ;
G4ThreeVector gammaPolarization0 = aDynamicGamma->GetPolarization();
// Protection: a polarisation parallel to the
@@ -198,16 +197,6 @@ void G4LivermorePolarizedComptonModel::SampleSecondaries(std::vector<G4DynamicPa
// End of Protection
// Within energy limit?
if(gammaEnergy0 <= lowEnergyLimit)
{
fParticleChange->ProposeTrackStatus(fStopAndKill);
fParticleChange->SetProposedKineticEnergy(0.);
fParticleChange->ProposeLocalEnergyDeposit(gammaEnergy0);
return;
}
G4double E0_m = gammaEnergy0 / electron_mass_c2 ;
// Select randomly one element in the current material
@@ -64,7 +64,16 @@ G4LivermoreRayleighModel::G4LivermoreRayleighModel()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4LivermoreRayleighModel::~G4LivermoreRayleighModel()
{}
{
if(IsMaster()) {
for(G4int i=0; i<maxZ; ++i) {
if(dataCS[i]) {
delete dataCS[i];
dataCS[i] = 0;
}
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -533,12 +533,29 @@ void G4LowEPComptonModel::SampleSecondaries(std::vector<G4DynamicParticle*>* fve
size_t nafter = fvect->size();
if(nafter > nbefore) {
for (size_t i=nbefore; i<nafter; ++i) {
bindingE -= ((*fvect)[i])->GetKineticEnergy();
//Check if there is enough residual energy
if (bindingE >= ((*fvect)[i])->GetKineticEnergy())
{
//Ok, this is a valid secondary: keep it
bindingE -= ((*fvect)[i])->GetKineticEnergy();
}
else
{
//Invalid secondary: not enough energy to create it!
//Keep its energy in the local deposit
delete (*fvect)[i];
(*fvect)[i]=0;
}
}
}
}
}
if(bindingE < 0.0) { bindingE = 0.0; }
//This should never happen
if(bindingE < 0.0)
G4Exception("G4LowEPComptonModel::SampleSecondaries()",
"em2051",FatalException,"Negative local energy deposit");
fParticleChange->ProposeLocalEnergyDeposit(bindingE);
}
@@ -0,0 +1,165 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4LowEWentzelVIModel.cc 74528 2013-10-12 17:24:24Z vnivanch $
//
// -------------------------------------------------------------------
//
// GEANT4 Class file
//
//
// File name: G4LowEWentzelVIModel
//
// Author: V.Ivanchenko
//
// Creation date: 11.02.2014 from G4WentzelVIModel
//
// Modifications:
//
// Class Description:
//
// -------------------------------------------------------------------
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4LowEWentzelVIModel.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
using namespace std;
G4LowEWentzelVIModel::G4LowEWentzelVIModel() :
G4WentzelVIModel(false,"LowEnWentzelVI")
{
SetSingleScatteringFactor(0.5);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4LowEWentzelVIModel::~G4LowEWentzelVIModel()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4LowEWentzelVIModel::ComputeTruePathLengthLimit(
const G4Track& track,
G4double& currentMinimalStep)
{
G4double tlimit = currentMinimalStep;
const G4DynamicParticle* dp = track.GetDynamicParticle();
G4StepPoint* sp = track.GetStep()->GetPreStepPoint();
G4StepStatus stepStatus = sp->GetStepStatus();
singleScatteringMode = false;
//G4cout << "G4LowEWentzelVIModel::ComputeTruePathLengthLimit stepStatus= "
// << stepStatus << " " << track.GetDefinition()->GetParticleName()
// << G4endl;
// initialisation for each step, lambda may be computed from scratch
preKinEnergy = dp->GetKineticEnergy();
DefineMaterial(track.GetMaterialCutsCouple());
lambdaeff = GetTransportMeanFreePath(particle,preKinEnergy);
currentRange = GetRange(particle,preKinEnergy,currentCouple);
cosTetMaxNuc = wokvi->SetupKinematic(preKinEnergy, currentMaterial);
/*
G4cout << "lambdaeff= " << lambdaeff << " Range= " << currentRange
<< " tlimit= " << tlimit << " 1-cost= " << 1 - cosTetMaxNuc << G4endl;
*/
// extra check for abnormal situation
// this check needed to run MSC with eIoni and eBrem inactivated
tlimit = std::min(tlimit, currentRange);
// stop here if small range particle
if(inside || tlimit < tlimitminfix) {
return ConvertTrueToGeom(tlimit, currentMinimalStep);
}
// pre step
G4double presafety = sp->GetSafety();
// far from geometry boundary
if(currentRange < presafety) {
inside = true;
return ConvertTrueToGeom(tlimit, currentMinimalStep);
}
// compute presafety again if presafety <= 0 and no boundary
// i.e. when it is needed for optimization purposes
if(stepStatus != fGeomBoundary && presafety < tlimitminfix) {
presafety = ComputeSafety(sp->GetPosition(), tlimit);
if(currentRange < presafety) {
inside = true;
return ConvertTrueToGeom(tlimit, currentMinimalStep);
}
}
/*
G4cout << "e(MeV)= " << preKinEnergy/MeV
<< " " << particle->GetParticleName()
<< " CurLimit(mm)= " << tlimit/mm <<" safety(mm)= " << presafety/mm
<< " R(mm)= " <<currentRange/mm
<< " L0(mm^-1)= " << lambdaeff*mm
<<G4endl;
*/
// natural limit for high energy
G4double rlimit = std::max(facrange*currentRange, lambdaeff);
//G4double rlimit = std::max(facrange*currentRange,
// 0.7*(1.0 - cosTetMaxNuc)*lambdaeff);
// low-energy e-
rlimit = std::max(rlimit, facsafety*presafety);
// cut correction
//G4double rcut = currentCouple->GetProductionCuts()->GetProductionCut(1);
//G4cout << "rcut= " << rcut << " rlimit= " << rlimit << " presafety= "
// << presafety << " 1-cosThetaMax= " <<1-cosThetaMax
//<< " 1-cosTetMaxNuc= " << 1-cosTetMaxNuc << G4endl;
//if(rcut > rlimit) { rlimit = std::min(rlimit, rcut*sqrt(rlimit/rcut)); }
tlimit = std::min(tlimit, rlimit);
tlimit = std::max(tlimit, tlimitminfix);
// step limit in infinite media
tlimit = std::min(tlimit, 50*currentMaterial->GetRadlen()/facgeom);
//compute geomlimit and force few steps within a volume
if (steppingAlgorithm == fUseDistanceToBoundary
&& stepStatus == fGeomBoundary) {
G4double geomlimit = ComputeGeomLimit(track, presafety, currentRange);
tlimit = std::min(tlimit, geomlimit/facgeom);
}
/*
G4cout << particle->GetParticleName() << " E(MeV)= " << preKinEnergy
<< " L0= " << lambdaeff << " R= " << currentRange
<< " tlimit= " << tlimit
<< " currentMinimalStep= " << currentMinimalStep << G4endl;
*/
return ConvertTrueToGeom(tlimit, currentMinimalStep);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -71,7 +71,7 @@ G4MicroElecElasticModel::G4MicroElecElasticModel(const G4ParticleDefinition*,
G4cout << "MicroElec Elastic model is constructed " << G4endl
<< "Energy range: "
<< lowEnergyLimit / eV << " eV - "
<< highEnergyLimit / keV << " keV"
<< highEnergyLimit / MeV << " MeV"
<< G4endl;
}
fParticleChangeForGamma = 0;
@@ -151,12 +151,23 @@ void G4MicroElecElasticModel::Initialise(const G4ParticleDefinition* /*particle*
}
std::ostringstream eFullFileName;
eFullFileName << path << "/microelec/sigmadiff_elastic_e_Si.dat";
eFullFileName << path << "/microelec/sigmadiff_cumulated_elastic_e_Si.dat";
std::ifstream eDiffCrossSection(eFullFileName.str().c_str());
if (!eDiffCrossSection)
G4Exception("G4MicroElecElasticModel::Initialise","em0003",FatalException,"Missing data file: /microelec/sigmadiff_elastic_e_Si.dat");
G4Exception("G4MicroElecElasticModel::Initialise","em0003",FatalException,"Missing data file: /microelec/sigmadiff_cumulated_elastic_e_Si.dat");
// October 21th, 2014 - Melanie Raine
// Added clear for MT
eTdummyVec.clear();
eVecm.clear();
eDiffCrossSectionData.clear();
//
eTdummyVec.push_back(0.);
while(!eDiffCrossSection.eof())
@@ -166,6 +177,7 @@ void G4MicroElecElasticModel::Initialise(const G4ParticleDefinition* /*particle*
eDiffCrossSection>>tDummy>>eDummy;
// SI : mandatory eVecm initialization
if (tDummy != eTdummyVec.back())
{
eTdummyVec.push_back(tDummy);
@@ -173,9 +185,6 @@ void G4MicroElecElasticModel::Initialise(const G4ParticleDefinition* /*particle*
}
eDiffCrossSection>>eDiffCrossSectionData[tDummy][eDummy];
// SI : only if not end of file reached !
if (!eDiffCrossSection.eof()) eDiffCrossSectionData[tDummy][eDummy]*=scaleFactor;
if (eDummy != eVecm[tDummy].back()) eVecm[tDummy].push_back(eDummy);
@@ -191,7 +200,7 @@ void G4MicroElecElasticModel::Initialise(const G4ParticleDefinition* /*particle*
G4cout << "MicroElec Elastic model is initialized " << G4endl
<< "Energy range: "
<< LowEnergyLimit() / eV << " eV - "
<< HighEnergyLimit() / keV << " keV"
<< HighEnergyLimit() / MeV << " MeV"
<< G4endl;
}
@@ -199,7 +208,6 @@ void G4MicroElecElasticModel::Initialise(const G4ParticleDefinition* /*particle*
fParticleChangeForGamma = GetParticleChangeForGamma();
isInitialised = true;
// InitialiseElementSelectors(particle,cuts);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -226,7 +234,7 @@ G4double G4MicroElecElasticModel::CrossSectionPerVolume(const G4Material* materi
if (ekin < highEnergyLimit)
{
//SI : XS must not be zero otherwise sampling of secondaries method ignored
if (ekin < lowEnergyLimitOfModel) ekin = lowEnergyLimitOfModel;
if (ekin < killBelowEnergy) return DBL_MAX;
//
std::map< G4String,G4MicroElecCrossSectionDataSet*,std::less<G4String> >::iterator pos;
@@ -274,6 +282,7 @@ void G4MicroElecElasticModel::SampleSecondaries(std::vector<G4DynamicParticle*>*
if (electronEnergy0 < killBelowEnergy)
{
fParticleChangeForGamma->SetProposedKineticEnergy(0.);
fParticleChangeForGamma->ProposeTrackStatus(fStopAndKill);
fParticleChangeForGamma->ProposeLocalEnergyDeposit(electronEnergy0);
return ;
@@ -375,6 +384,20 @@ G4double G4MicroElecElasticModel::LinLogInterpolate(G4double e1,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4MicroElecElasticModel::LinLinInterpolate(G4double e1,
G4double e2,
G4double e,
G4double xs1,
G4double xs2)
{
G4double d1 = xs1;
G4double d2 = xs2;
G4double value = (d1 + (d2 - d1)*(e - e1)/ (e2 - e1));
return value;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4MicroElecElasticModel::LogLogInterpolate(G4double e1,
G4double e2,
G4double e,
@@ -397,10 +420,24 @@ G4double G4MicroElecElasticModel::QuadInterpolator(G4double e11, G4double e12,
G4double t1, G4double t2,
G4double t, G4double e)
{
// Lin-Log
// Log-Log
/*
G4double interpolatedvalue1 = LogLogInterpolate(e11, e12, e, xs11, xs12);
G4double interpolatedvalue2 = LogLogInterpolate(e21, e22, e, xs21, xs22);
G4double value = LogLogInterpolate(t1, t2, t, interpolatedvalue1, interpolatedvalue2);
// Lin-Log
G4double interpolatedvalue1 = LinLogInterpolate(e11, e12, e, xs11, xs12);
G4double interpolatedvalue2 = LinLogInterpolate(e21, e22, e, xs21, xs22);
G4double value = LinLogInterpolate(t1, t2, t, interpolatedvalue1, interpolatedvalue2);
*/
// Lin-Lin
G4double interpolatedvalue1 = LinLinInterpolate(e11, e12, e, xs11, xs12);
G4double interpolatedvalue2 = LinLinInterpolate(e21, e22, e, xs21, xs22);
G4double value = LinLinInterpolate(t1, t2, t, interpolatedvalue1, interpolatedvalue2);
return value;
}
@@ -44,13 +44,15 @@
#include "G4MicroElecInelastic.hh"
#include "G4SystemOfUnits.hh"
#include "G4GenericIon.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
using namespace std;
G4MicroElecInelastic::G4MicroElecInelastic(const G4String& processName,
G4ProcessType type):G4VEmProcess (processName, type),
isInitialised(false)
G4ProcessType type):G4VEmProcess (processName, type),
isInitialised(false)
{
SetProcessSubType(53);
}
@@ -65,8 +67,8 @@ G4MicroElecInelastic::~G4MicroElecInelastic()
G4bool G4MicroElecInelastic::IsApplicable(const G4ParticleDefinition& p)
{
return (&p == G4Electron::Electron() ||
&p == G4Proton::Proton() ||
(p.GetPDGCharge() != 0.0 && !p.IsShortLived() && p.GetParticleType() == "nucleus"));
&p == G4Proton::Proton() ||
&p == G4GenericIon::GenericIonDefinition());
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -101,7 +103,7 @@ void G4MicroElecInelastic::InitialiseProcess(const G4ParticleDefinition* p)
{
if(!EmModel()) SetEmModel(new G4MicroElecInelasticModel);
EmModel()->SetLowEnergyLimit(50.*keV);
EmModel()->SetHighEnergyLimit(10000.*GeV);
EmModel()->SetHighEnergyLimit(p->GetAtomicMass()*10.*GeV);
AddEmModel(1, EmModel());
}
@@ -120,7 +122,7 @@ void G4MicroElecInelastic::PrintInfo()
{
G4cout
<< " Total cross sections computed from "
<< EmModel(1)->GetName()
<< EmModel(1)->GetName()
<< " and "
<< EmModel(2)->GetName()
<< " models"
File diff suppressed because it is too large Load Diff
@@ -71,7 +71,7 @@ G4MuElecInelasticModel::G4MuElecInelasticModel(const G4ParticleDefinition*,
G4cout << "*******************************************************************************" << G4endl;
G4cout << G4endl;
nistSi = G4NistManager::Instance()->FindOrBuildMaterial("G4_Si");
nistSi = G4NistManager::Instance()->FindOrBuildMaterial("G4_Si");
verboseLevel= 0;
// Verbosity scale:
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4PenelopeBremsstrahlungModel.cc 76220 2013-11-08 10:15:00Z gcosmo $
// $Id: G4PenelopeBremsstrahlungModel.cc 78631 2014-01-13 11:15:27Z gcosmo $
//
// Author: Luciano Pandola
//
@@ -640,12 +640,16 @@ G4PenelopeBremsstrahlungModel::GetCrossSectionTableForCouple(const G4ParticleDef
{
//If we are here, it means that Initialize() was inkoved, but the MaterialTable was
//not filled up. This can happen in a UnitTest or via G4EmCalculator
G4ExceptionDescription ed;
ed << "Unable to find e- table for " << mat->GetName() << " at Ecut(gamma)= "
<< cut/keV << " keV " << G4endl;
ed << "This can happen only in Unit Tests or via G4EmCalculator" << G4endl;
G4Exception("G4PenelopeBremsstrahlungModel::GetCrossSectionTableForCouple()",
"em2009",JustWarning,ed);
if (verboseLevel > 0)
{
//G4Exception (warning) is issued only in verbose mode
G4ExceptionDescription ed;
ed << "Unable to find e- table for " << mat->GetName() << " at Ecut(gamma)= "
<< cut/keV << " keV " << G4endl;
ed << "This can happen only in Unit Tests or via G4EmCalculator" << G4endl;
G4Exception("G4PenelopeBremsstrahlungModel::GetCrossSectionTableForCouple()",
"em2009",JustWarning,ed);
}
//protect file reading via autolock
G4AutoLock lock(&PenelopeBremsstrahlungModelMutex);
fPenelopeFSHelper->BuildScaledXSTable(mat,cut,true); //pretend to be a master
@@ -682,12 +686,16 @@ G4PenelopeBremsstrahlungModel::GetCrossSectionTableForCouple(const G4ParticleDef
{
//If we are here, it means that Initialize() was inkoved, but the MaterialTable was
//not filled up. This can happen in a UnitTest or via G4EmCalculator
G4ExceptionDescription ed;
ed << "Unable to find e+ table for " << mat->GetName() << " at Ecut(gamma)= "
<< cut/keV << " keV " << G4endl;
ed << "This can happen only in Unit Tests or via G4EmCalculator" << G4endl;
G4Exception("G4PenelopeBremsstrahlungModel::GetCrossSectionTableForCouple()",
"em2009",JustWarning,ed);
if (verboseLevel > 0)
{
//Issue a G4Exception (warning) only in verbose mode
G4ExceptionDescription ed;
ed << "Unable to find e+ table for " << mat->GetName() << " at Ecut(gamma)= "
<< cut/keV << " keV " << G4endl;
ed << "This can happen only in Unit Tests or via G4EmCalculator" << G4endl;
G4Exception("G4PenelopeBremsstrahlungModel::GetCrossSectionTableForCouple()",
"em2009",JustWarning,ed);
}
//protect file reading via autolock
G4AutoLock lock(&PenelopeBremsstrahlungModelMutex);
fPenelopeFSHelper->BuildScaledXSTable(mat,cut,true); //pretend to be a master
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4PenelopeComptonModel.cc 75180 2013-10-29 10:11:24Z gcosmo $
// $Id: G4PenelopeComptonModel.cc 82874 2014-07-15 15:25:29Z gcosmo $
//
// Author: Luciano Pandola
//
@@ -32,9 +32,10 @@
// 15 Feb 2010 L Pandola Implementation
// 18 Mar 2010 L Pandola Removed GetAtomsPerMolecule(), now demanded
// to G4PenelopeOscillatorManager
// 01 Feb 2011 L Pandola Suppress fake energy-violation warning when Auger is active.
// Make sure that fluorescence/Auger is generated only if
// above threshold
// 01 Feb 2011 L Pandola Suppress fake energy-violation warning when Auger is
// active.
// Make sure that fluorescence/Auger is generated only
// if above threshold
// 24 May 2011 L Pandola Renamed (make v2008 as default Penelope)
// 10 Jun 2011 L Pandola Migrate atomic deexcitation interface
// 09 Oct 2013 L Pandola Migration to MT
@@ -67,7 +68,6 @@ G4PenelopeComptonModel::G4PenelopeComptonModel(const G4ParticleDefinition* part,
{
fIntrinsicLowEnergyLimit = 100.0*eV;
fIntrinsicHighEnergyLimit = 100.0*GeV;
// SetLowEnergyLimit(fIntrinsicLowEnergyLimit);
SetHighEnergyLimit(fIntrinsicHighEnergyLimit);
//
oscManager = G4PenelopeOscillatorManager::GetOscillatorManager();
@@ -125,6 +125,20 @@ void G4PenelopeComptonModel::Initialise(const G4ParticleDefinition* part,
<< LowEnergyLimit() / keV << " keV - "
<< HighEnergyLimit() / GeV << " GeV";
}
//Issue a warning, if the model is going to be used down to a
//energy which is outside the validity of the model itself
if (LowEnergyLimit() < fIntrinsicLowEnergyLimit)
{
G4ExceptionDescription ed;
ed << "Using the Penelope Compton model outside its intrinsic validity range. "
<< G4endl;
ed << "-> LowEnergyLimit() in process = " << LowEnergyLimit()/keV << "keV " << G4endl;
ed << "-> Instrinsic low-energy limit = " << fIntrinsicLowEnergyLimit/keV << "keV "
<< G4endl;
ed << "Result of the simulation have to be taken with care" << G4endl;
G4Exception("G4PenelopeComptonModel::Initialise()",
"em2100",JustWarning,ed);
}
}
if(isInitialised) return;
@@ -182,10 +196,14 @@ G4double G4PenelopeComptonModel::CrossSectionPerVolume(const G4Material* materia
G4cout << "Calling CrossSectionPerVolume() of G4PenelopeComptonModel" << G4endl;
SetupForMaterial(p, material, energy);
//Retrieve the oscillator table for this material
G4PenelopeOscillatorTable* theTable = oscManager->GetOscillatorTableCompton(material);
G4double cs = 0;
//Force null cross-section if below the low-energy edge of the table
if (energy < LowEnergyLimit())
return cs;
//Retrieve the oscillator table for this material
G4PenelopeOscillatorTable* theTable = oscManager->GetOscillatorTableCompton(material);
if (energy < 5*MeV) //explicit calculation for E < 5 MeV
{
@@ -279,13 +297,10 @@ void G4PenelopeComptonModel::SampleSecondaries(std::vector<G4DynamicParticle*>*
G4double photonEnergy0 = aDynamicGamma->GetKineticEnergy();
if (photonEnergy0 <= fIntrinsicLowEnergyLimit)
{
fParticleChange->ProposeTrackStatus(fStopAndKill);
fParticleChange->SetProposedKineticEnergy(0.);
fParticleChange->ProposeLocalEnergyDeposit(photonEnergy0);
return ;
}
// do nothing below the threshold
// should never get here because the XS is zero below the limit
if(photonEnergy0 < LowEnergyLimit())
return;
G4ParticleMomentum photonDirection0 = aDynamicGamma->GetMomentumDirection();
const G4Material* material = couple->GetMaterial();
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4PenelopeGammaConversionModel.cc 76220 2013-11-08 10:15:00Z gcosmo $
// $Id: G4PenelopeGammaConversionModel.cc 83584 2014-09-02 08:45:37Z gcosmo $
//
// Author: Luciano Pandola
//
@@ -87,14 +87,12 @@ G4PenelopeGammaConversionModel::~G4PenelopeGammaConversionModel()
{
//Delete shared tables, they exist only in the master model
if (IsMaster() || fLocalTable)
{
//std::map <G4int,G4PhysicsFreeVector*>::iterator i;
{
if (logAtomicCrossSection)
{
/*
{
std::map <G4int,G4PhysicsFreeVector*>::iterator i;
for (i=logAtomicCrossSection->begin();i != logAtomicCrossSection->end();i++)
if (i->second) delete i->second;
*/
if (i->second) delete i->second;
delete logAtomicCrossSection;
}
if (fEffectiveCharge)
@@ -250,14 +248,18 @@ G4double G4PenelopeGammaConversionModel::ComputeCrossSectionPerAtom(
{
//If we are here, it means that Initialize() was inkoved, but the MaterialTable was
//not filled up. This can happen in a UnitTest or via G4EmCalculator
G4ExceptionDescription ed;
ed << "Unable to retrieve the cross section table for Z=" << iZ << G4endl;
ed << "This can happen only in Unit Tests or via G4EmCalculator" << G4endl;
G4Exception("G4PenelopeGammaConversionModel::ComputeCrossSectionPerAtom()",
"em2018",JustWarning,ed);
if (verboseLevel > 0)
{
//Issue a G4Exception (warning) only in verbose mode
G4ExceptionDescription ed;
ed << "Unable to retrieve the cross section table for Z=" << iZ << G4endl;
ed << "This can happen only in Unit Tests or via G4EmCalculator" << G4endl;
G4Exception("G4PenelopeGammaConversionModel::ComputeCrossSectionPerAtom()",
"em2018",JustWarning,ed);
}
//protect file reading via autolock
G4AutoLock lock(&PenelopeGammaConversionModelMutex);
ReadDataFile(iZ);
ReadDataFile(iZ);
lock.unlock();
}
@@ -314,13 +316,36 @@ G4PenelopeGammaConversionModel::SampleSecondaries(std::vector<G4DynamicParticle*
G4ParticleMomentum photonDirection = aDynamicGamma->GetMomentumDirection();
const G4Material* mat = couple->GetMaterial();
//Either Initialize() was not called, or we are in a slave and InitializeLocal() was
//not invoked
if (!fEffectiveCharge)
{
//create a **thread-local** version of the table. Used only for G4EmCalculator and
//Unit Tests
fLocalTable = true;
fEffectiveCharge = new std::map<const G4Material*,G4double>;
fMaterialInvScreeningRadius = new std::map<const G4Material*,G4double>;
fScreeningFunction = new std::map<const G4Material*,std::pair<G4double,G4double> >;
}
if (!fEffectiveCharge->count(mat))
{
G4ExceptionDescription ed;
ed << "Unable to allocate the EffectiveCharge data for " <<
mat->GetName() << G4endl;
G4Exception("G4PenelopeGammaConversion::SampleSecondaries()",
"em2019",FatalException,ed);
//If we are here, it means that Initialize() was inkoved, but the MaterialTable was
//not filled up. This can happen in a UnitTest or via G4EmCalculator
if (verboseLevel > 0)
{
//Issue a G4Exception (warning) only in verbose mode
G4ExceptionDescription ed;
ed << "Unable to allocate the EffectiveCharge data for " <<
mat->GetName() << G4endl;
ed << "This can happen only in Unit Tests" << G4endl;
G4Exception("G4PenelopeGammaConversionModel::SampleSecondaries()",
"em2019",JustWarning,ed);
}
//protect file reading via autolock
G4AutoLock lock(&PenelopeGammaConversionModelMutex);
InitializeScreeningFunctions(mat);
lock.unlock();
}
// eps is the fraction of the photon energy assigned to e- (including rest mass)
@@ -609,10 +634,12 @@ void G4PenelopeGammaConversionModel::InitializeScreeningRadii()
void G4PenelopeGammaConversionModel::InitializeScreeningFunctions(const G4Material* material)
{
/*
if (!IsMaster())
//Should not be here!
G4Exception("G4PenelopeGammaConversionModel::InitializeScreeningFunctions()",
"em01001",FatalException,"Worker thread in this method");
*/
// This is subroutine GPPa0 of Penelope
//
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4PenelopeIonisationModel.cc 75573 2013-11-04 11:48:15Z gcosmo $
// $Id: G4PenelopeIonisationModel.cc 78631 2014-01-13 11:15:27Z gcosmo $
//
// Author: Luciano Pandola
//
@@ -263,12 +263,16 @@ G4double G4PenelopeIonisationModel::CrossSectionPerVolume(const G4Material* mate
{
//If we are here, it means that Initialize() was inkoved, but the MaterialTable was
//not filled up. This can happen in a UnitTest or via G4EmCalculator
G4ExceptionDescription ed;
ed << "Unable to retrieve the cross section table for " << theParticle->GetParticleName() <<
" in " << material->GetName() << ", cut = " << cutEnergy/keV << " keV " << G4endl;
ed << "This can happen only in Unit Tests or via G4EmCalculator" << G4endl;
G4Exception("G4PenelopeIonisationModel::CrossSectionPerVolume()",
"em2038",JustWarning,ed);
if (verboseLevel > 0)
{
//Issue a G4Exception (warning) only in verbose mode
G4ExceptionDescription ed;
ed << "Unable to retrieve the cross section table for " << theParticle->GetParticleName() <<
" in " << material->GetName() << ", cut = " << cutEnergy/keV << " keV " << G4endl;
ed << "This can happen only in Unit Tests or via G4EmCalculator" << G4endl;
G4Exception("G4PenelopeIonisationModel::CrossSectionPerVolume()",
"em2038",JustWarning,ed);
}
//protect file reading via autolock
G4AutoLock lock(&PenelopeIonisationModelMutex);
theCrossSectionHandler->BuildXSTable(material,cutEnergy,theParticle);
@@ -372,12 +376,16 @@ G4double G4PenelopeIonisationModel::ComputeDEDXPerVolume(const G4Material* mater
{
//If we are here, it means that Initialize() was inkoved, but the MaterialTable was
//not filled up. This can happen in a UnitTest or via G4EmCalculator
G4ExceptionDescription ed;
ed << "Unable to retrieve the cross section table for " << theParticle->GetParticleName() <<
" in " << material->GetName() << ", cut = " << cutEnergy/keV << " keV " << G4endl;
ed << "This can happen only in Unit Tests or via G4EmCalculator" << G4endl;
G4Exception("G4PenelopeIonisationModel::ComputeDEDXPerVolume()",
"em2038",JustWarning,ed);
if (verboseLevel > 0)
{
//Issue a G4Exception (warning) only in verbose mode
G4ExceptionDescription ed;
ed << "Unable to retrieve the cross section table for " << theParticle->GetParticleName() <<
" in " << material->GetName() << ", cut = " << cutEnergy/keV << " keV " << G4endl;
ed << "This can happen only in Unit Tests or via G4EmCalculator" << G4endl;
G4Exception("G4PenelopeIonisationModel::ComputeDEDXPerVolume()",
"em2038",JustWarning,ed);
}
//protect file reading via autolock
G4AutoLock lock(&PenelopeIonisationModelMutex);
theCrossSectionHandler->BuildXSTable(material,cutEnergy,theParticle);
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4PenelopeIonisationXSHandler.cc 76882 2013-11-18 12:49:10Z gcosmo $
// $Id: G4PenelopeIonisationXSHandler.cc 83584 2014-09-02 08:45:37Z gcosmo $
//
// Author: Luciano Pandola
//
@@ -94,18 +94,16 @@ G4PenelopeIonisationXSHandler::~G4PenelopeIonisationXSHandler()
std::map<const G4Material*,G4PhysicsFreeVector*>::iterator k;
if (theDeltaTable)
{
/*
{
for (k=theDeltaTable->begin();k!=theDeltaTable->end();k++)
delete k->second;
*/
delete theDeltaTable;
theDeltaTable = 0;
}
/*
}
if (energyGrid)
delete energyGrid;
*/
if (verboseLevel > 2)
G4cout << "G4PenelopeIonisationXSHandler. Tables have been cleared"
<< G4endl;
@@ -1084,7 +1084,9 @@ void G4PenelopeOscillatorManager::ReadElementData()
G4AtomicTransitionManager* theTransitionManager =
G4AtomicTransitionManager::Instance();
theTransitionManager->Initialise();
//Read header (22 lines)
G4String theHeader;
for (G4int iline=0;iline<22;iline++)
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4PenelopePhotoElectricModel.cc 76220 2013-11-08 10:15:00Z gcosmo $
// $Id: G4PenelopePhotoElectricModel.cc 81067 2014-05-20 09:19:32Z gcosmo $
//
// Author: Luciano Pandola
//
@@ -118,6 +118,17 @@ void G4PenelopePhotoElectricModel::Initialise(const G4ParticleDefinition* partic
if (verboseLevel > 3)
G4cout << "Calling G4PenelopePhotoElectricModel::Initialise()" << G4endl;
fAtomDeexcitation = G4LossTableManager::Instance()->AtomDeexcitation();
//Issue warning if the AtomicDeexcitation has not been declared
if (!fAtomDeexcitation)
{
G4cout << G4endl;
G4cout << "WARNING from G4PenelopePhotoElectricModel " << G4endl;
G4cout << "Atomic de-excitation module is not instantiated, so there will not be ";
G4cout << "any fluorescence/Auger emission." << G4endl;
G4cout << "Please make sure this is intended" << G4endl;
}
SetParticle(particle);
//Only the master model creates/fills/destroys the tables
@@ -147,18 +158,7 @@ void G4PenelopePhotoElectricModel::Initialise(const G4ParticleDefinition* partic
}
InitialiseElementSelectors(particle,cuts);
fAtomDeexcitation = G4LossTableManager::Instance()->AtomDeexcitation();
//Issue warning if the AtomicDeexcitation has not been declared
if (!fAtomDeexcitation)
{
G4cout << G4endl;
G4cout << "WARNING from G4PenelopePhotoElectricModel " << G4endl;
G4cout << "Atomic de-excitation module is not instantiated, so there will not be ";
G4cout << "any fluorescence/Auger emission." << G4endl;
G4cout << "Please make sure this is intended" << G4endl;
}
InitialiseElementSelectors(particle,cuts);
if (verboseLevel > 0) {
G4cout << "Penelope Photo-Electric model v2008 is initialized " << G4endl
@@ -193,7 +193,7 @@ void G4PenelopePhotoElectricModel::InitialiseLocal(const G4ParticleDefinition* p
static_cast<G4PenelopePhotoElectricModel*> (masterModel);
logAtomicShellXS = theModel->logAtomicShellXS;
//Same verbosity for all workers, as the master
verboseLevel = theModel->verboseLevel;
}
@@ -233,11 +233,15 @@ G4double G4PenelopePhotoElectricModel::ComputeCrossSectionPerAtom(
{
//If we are here, it means that Initialize() was inkoved, but the MaterialTable was
//not filled up. This can happen in a UnitTest or via G4EmCalculator
G4ExceptionDescription ed;
ed << "Unable to retrieve the shell cross section table for Z=" << iZ << G4endl;
ed << "This can happen only in Unit Tests or via G4EmCalculator" << G4endl;
G4Exception("G4PenelopePhotoElectricModel::ComputeCrossSectionPerAtom()",
"em2038",JustWarning,ed);
if (verboseLevel > 0)
{
//Issue a G4Exception (warning) only in verbose mode
G4ExceptionDescription ed;
ed << "Unable to retrieve the shell cross section table for Z=" << iZ << G4endl;
ed << "This can happen only in Unit Tests or via G4EmCalculator" << G4endl;
G4Exception("G4PenelopePhotoElectricModel::ComputeCrossSectionPerAtom()",
"em2038",JustWarning,ed);
}
//protect file reading via autolock
G4AutoLock lock(&PenelopePhotoElectricModelMutex);
ReadDataFile(iZ);
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4PenelopeRayleighModel.cc 76220 2013-11-08 10:15:00Z gcosmo $
// $Id: G4PenelopeRayleighModel.cc 83584 2014-09-02 08:45:37Z gcosmo $
//
// Author: Luciano Pandola
//
@@ -100,25 +100,20 @@ G4PenelopeRayleighModel::~G4PenelopeRayleighModel()
std::map <G4int,G4PhysicsFreeVector*>::iterator i;
if (logAtomicCrossSection)
{
/*
for (i=logAtomicCrossSection->begin();i != logAtomicCrossSection->end();i++)
if (i->second) delete i->second;
*/
delete logAtomicCrossSection;
}
}
if (IsMaster())
{
std::map <G4int,G4PhysicsFreeVector*>::iterator i;
logAtomicCrossSection = 0;
}
if (atomicFormFactor)
{
/*
{
for (i=atomicFormFactor->begin();i != atomicFormFactor->end();i++)
if (i->second) delete i->second;
*/
if (i->second) delete i->second;
delete atomicFormFactor;
atomicFormFactor = 0;
}
ClearTables();
}
}
@@ -126,29 +121,27 @@ G4PenelopeRayleighModel::~G4PenelopeRayleighModel()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4PenelopeRayleighModel::ClearTables()
{
/*
if (!IsMaster())
//Should not be here!
G4Exception("G4PenelopeRayleighModel::ClearTables()",
"em0100",FatalException,"Worker thread in this method");
*/
std::map <const G4Material*,G4PhysicsFreeVector*>::iterator i;
std::map <const G4Material*,G4PhysicsFreeVector*>::iterator i;
if (logFormFactorTable)
{
/*
{
for (i=logFormFactorTable->begin(); i != logFormFactorTable->end(); i++)
if (i->second) delete i->second;
*/
if (i->second) delete i->second;
delete logFormFactorTable;
logFormFactorTable = 0; //zero explicitely
}
if (pMaxTable)
{
/*
{
for (i=pMaxTable->begin(); i != pMaxTable->end(); i++)
if (i->second) delete i->second;
*/
if (i->second) delete i->second;
delete pMaxTable;
pMaxTable = 0; //zero explicitely
}
@@ -156,10 +149,8 @@ void G4PenelopeRayleighModel::ClearTables()
std::map<const G4Material*,G4PenelopeSamplingData*>::iterator ii;
if (samplingTable)
{
/*
for (ii=samplingTable->begin(); ii != samplingTable->end(); ii++)
if (ii->second) delete ii->second;
*/
delete samplingTable;
samplingTable = 0; //zero explicitely
}
@@ -182,6 +173,9 @@ void G4PenelopeRayleighModel::Initialise(const G4ParticleDefinition* part,
{
//clear tables depending on materials, not the atomic ones
ClearTables();
if (verboseLevel > 3)
G4cout << "Calling G4PenelopeRayleighModel::Initialise() [master]" << G4endl;
//create new tables
//
@@ -227,7 +221,7 @@ void G4PenelopeRayleighModel::Initialise(const G4ParticleDefinition* part,
//3) retrieve or build the pMax data
if (!pMaxTable->count(material))
GetPMaxTable(material);
GetPMaxTable(material);
}
@@ -313,11 +307,15 @@ G4double G4PenelopeRayleighModel::ComputeCrossSectionPerAtom(const G4ParticleDef
{
//If we are here, it means that Initialize() was inkoved, but the MaterialTable was
//not filled up. This can happen in a UnitTest or via G4EmCalculator
G4ExceptionDescription ed;
ed << "Unable to retrieve the cross section table for Z=" << iZ << G4endl;
ed << "This can happen only in Unit Tests or via G4EmCalculator" << G4endl;
G4Exception("G4PenelopeRayleighModel::ComputeCrossSectionPerAtom()",
"em2040",JustWarning,ed);
if (verboseLevel > 0)
{
//Issue a G4Exception (warning) only in verbose mode
G4ExceptionDescription ed;
ed << "Unable to retrieve the cross section table for Z=" << iZ << G4endl;
ed << "This can happen only in Unit Tests or via G4EmCalculator" << G4endl;
G4Exception("G4PenelopeRayleighModel::ComputeCrossSectionPerAtom()",
"em2040",JustWarning,ed);
}
//protect file reading via autolock
G4AutoLock lock(&PenelopeRayleighModelMutex);
ReadDataFile(iZ);
@@ -349,10 +347,6 @@ G4double G4PenelopeRayleighModel::ComputeCrossSectionPerAtom(const G4ParticleDef
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4PenelopeRayleighModel::BuildFormFactorTable(const G4Material* material)
{
if (!IsMaster())
//Should not be here!
G4Exception("G4PenelopeRayleighModel::BuildFormFactorTable()",
"em0100",FatalException,"Worker thread in this method");
/*
1) get composition and equivalent molecular density
@@ -460,16 +454,71 @@ void G4PenelopeRayleighModel::SampleSecondaries(std::vector<G4DynamicParticle*>*
//1) Verify if tables are ready
if (!pMaxTable || !samplingTable)
//Either Initialize() was not called, or we are in a slave and InitializeLocal() was
//not invoked
if (!pMaxTable || !samplingTable || !logAtomicCrossSection || !atomicFormFactor ||
!logFormFactorTable)
{
G4Exception("G4PenelopeRayleighModel::SampleSecondaries()",
"em2043",FatalException,"Invalid model initialization");
return;
//create a **thread-local** version of the table. Used only for G4EmCalculator and
//Unit Tests
fLocalTable = true;
if (!logAtomicCrossSection)
logAtomicCrossSection = new std::map<G4int,G4PhysicsFreeVector*>;
if (!atomicFormFactor)
atomicFormFactor = new std::map<G4int,G4PhysicsFreeVector*>;
if (!logFormFactorTable)
logFormFactorTable = new std::map<const G4Material*,G4PhysicsFreeVector*>;
if (!pMaxTable)
pMaxTable = new std::map<const G4Material*,G4PhysicsFreeVector*>;
if (!samplingTable)
samplingTable = new std::map<const G4Material*,G4PenelopeSamplingData*>;
}
G4PenelopeSamplingData* theDataTable = samplingTable->find(theMat)->second;
if (!samplingTable->count(theMat))
{
//If we are here, it means that Initialize() was inkoved, but the MaterialTable was
//not filled up. This can happen in a UnitTest
if (verboseLevel > 0)
{
//Issue a G4Exception (warning) only in verbose mode
G4ExceptionDescription ed;
ed << "Unable to find the samplingTable data for " <<
theMat->GetName() << G4endl;
ed << "This can happen only in Unit Tests" << G4endl;
G4Exception("G4PenelopeRayleighModel::SampleSecondaries()",
"em2019",JustWarning,ed);
}
const G4ElementVector* theElementVector = theMat->GetElementVector();
//protect file reading via autolock
G4AutoLock lock(&PenelopeRayleighModelMutex);
for (size_t j=0;j<theMat->GetNumberOfElements();j++)
{
G4int iZ = (G4int) theElementVector->at(j)->GetZ();
if (!logAtomicCrossSection->count(iZ))
{
lock.lock();
ReadDataFile(iZ);
lock.unlock();
}
}
lock.lock();
//1) If the table has not been built for the material, do it!
if (!logFormFactorTable->count(theMat))
BuildFormFactorTable(theMat);
//2) retrieve or build the sampling table
if (!(samplingTable->count(theMat)))
InitializeSamplingAlgorithm(theMat);
//3) retrieve or build the pMax data
if (!pMaxTable->count(theMat))
GetPMaxTable(theMat);
lock.unlock();
}
//Ok, restart the job
G4PenelopeSamplingData* theDataTable = samplingTable->find(theMat)->second;
G4PhysicsFreeVector* thePMax = pMaxTable->find(theMat)->second;
G4double cosTheta = 1.0;
@@ -540,10 +589,6 @@ void G4PenelopeRayleighModel::SampleSecondaries(std::vector<G4DynamicParticle*>*
void G4PenelopeRayleighModel::ReadDataFile(const G4int Z)
{
if (!IsMaster())
//Should not be here!
G4Exception("G4PenelopeRayleighModel::ReadDataFile()",
"em0100",FatalException,"Worker thread in this method");
if (verboseLevel > 2)
{
@@ -727,10 +772,6 @@ G4double G4PenelopeRayleighModel::GetFSquared(const G4Material* mat, const G4dou
void G4PenelopeRayleighModel::InitializeSamplingAlgorithm(const G4Material* mat)
{
if (!IsMaster())
//Should not be here!
G4Exception("G4PenelopeRayleighModel::InitializeSamplingAlgorithm()",
"em0100",FatalException,"Worker thread in this method");
G4double q2min = 0;
G4double q2max = 0;
@@ -1159,10 +1200,6 @@ void G4PenelopeRayleighModel::InitializeSamplingAlgorithm(const G4Material* mat)
void G4PenelopeRayleighModel::GetPMaxTable(const G4Material* mat)
{
if (!IsMaster())
//Should not be here!
G4Exception("G4PenelopeRayleighModel::GetPMaxTable()",
"em0100",FatalException,"Worker thread in this method");
if (!pMaxTable)
{
@@ -1184,9 +1221,17 @@ void G4PenelopeRayleighModel::GetPMaxTable(const G4Material* mat)
return;
}
//This should not be: the sampling table is built before the p-table
if (!samplingTable->count(mat))
InitializeSamplingAlgorithm(mat);
{
G4ExceptionDescription ed;
ed << "Sampling table for material " << mat->GetName() << " not found";
G4Exception("G4PenelopeRayleighModel::GetPMaxTable()",
"em2052",FatalException,
ed);
return;
}
G4PenelopeSamplingData *theTable = samplingTable->find(mat)->second;
size_t tablePoints = theTable->GetNumberOfStoredPoints();
@@ -83,7 +83,7 @@ G4UAtomicDeexcitation::G4UAtomicDeexcitation():
emcorr = G4LossTableManager::Instance()->EmCorrections();
theElectron = G4Electron::Electron();
thePositron = G4Positron::Positron();
transitionManager = 0;
transitionManager = G4AtomicTransitionManager::Instance();
anaPIXEshellCS = 0;
}
@@ -97,7 +97,7 @@ G4UAtomicDeexcitation::~G4UAtomicDeexcitation()
void G4UAtomicDeexcitation::InitialiseForNewRun()
{
if(!IsFluoActive()) { return; }
transitionManager = G4AtomicTransitionManager::Instance();
transitionManager->Initialise();
if(IsPIXEActive()) {
G4cout << G4endl;
G4cout << "### === G4UAtomicDeexcitation::InitialiseForNewRun()" << G4endl;
@@ -225,7 +225,8 @@ void G4UAtomicDeexcitation::InitialiseForNewRun()
void G4UAtomicDeexcitation::InitialiseForExtraAtom(G4int /*Z*/)
{}
const G4AtomicShell* G4UAtomicDeexcitation::GetAtomicShell(G4int Z, G4AtomicShellEnumerator shell)
const G4AtomicShell*
G4UAtomicDeexcitation::GetAtomicShell(G4int Z, G4AtomicShellEnumerator shell)
{
return transitionManager->Shell(Z, size_t(shell));
}
@@ -240,7 +241,8 @@ void G4UAtomicDeexcitation::GenerateParticles(
// Defined initial conditions
G4int givenShellId = atomicShell->ShellId();
//G4cout << "generating particles for vacancy in shellId: " << givenShellId << G4endl; // debug
//G4cout << "generating particles for vacancy in shellId: "
// << givenShellId << G4endl; // debug
minGammaEnergy = gammaCut;
minElectronEnergy = eCut;
@@ -269,17 +271,21 @@ void G4UAtomicDeexcitation::GenerateParticles(
if ( provShellId >0)
{
aParticle = GenerateFluorescence(Z,givenShellId,provShellId);
//if (aParticle != 0) { G4cout << "****FLUO!_1**** " << aParticle->GetParticleDefinition()->GetParticleType() << " " << aParticle->GetKineticEnergy()/keV << G4endl ;} //debug
//if (aParticle != 0) {
// G4cout << "****FLUO!_1**** "
// << aParticle->GetParticleDefinition()->GetParticleType()
// << " " << aParticle->GetKineticEnergy()/keV << G4endl ;}
}
else if ( provShellId == -1)
{
// G4cout << "Try to generate Auger 1" << G4endl; //debug
// G4cout << "Try to generate Auger 1" << G4endl;
aParticle = GenerateAuger(Z, givenShellId);
// if (aParticle != 0) { G4cout << "****AUGER!****" << G4endl;} //debug
// if (aParticle != 0) { G4cout << "****AUGER!****" << G4endl;}
}
else
{
G4Exception("G4UAtomicDeexcitation::GenerateParticles()","de0002",JustWarning, "Energy deposited locally");
G4Exception("G4UAtomicDeexcitation::GenerateParticles()",
"de0002",JustWarning, "Energy deposited locally");
}
}
else
@@ -149,7 +149,7 @@ G4double G4ecpssrFormFactorMixsModel::CalculateMiCrossSection(G4int zTarget,G4do
else if (massIncident == aAlpha->GetPDGMass())
{
sigma = alphaMiXsVector[mShellIndex][zTarget]->FindValue(energyIncident/MeV);
if (sigma !=0 && energyIncident > protonMiXsVector[mShellIndex][zTarget]->GetEnergies(0).back()*MeV) return 0.;
if (sigma !=0 && energyIncident > alphaMiXsVector[mShellIndex][zTarget]->GetEnergies(0).back()*MeV) return 0.;
}
else
{
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4empCrossSection.cc 66241 2012-12-13 18:34:42Z gunter $
// $Id: G4empCrossSection.cc 83410 2014-08-21 15:17:53Z gcosmo $
//
//
//
@@ -43,9 +43,19 @@
G4empCrossSection::G4empCrossSection(const G4String& nam)
:G4VhShellCrossSection(nam),totalCS(0.0)
{
paulShellK = new G4PaulKxsModel();
orlicShellLi = new G4OrlicLiXsModel();
if (nam == "Empirical")
{
paulShellK = new G4PaulKxsModel();
orlicShellLi = new G4OrlicLiXsModel();
flag=0;
}
else
{
G4cout << "ERROR in G4empCrossSection name ; Paul+Orlic is selected." << G4endl;
paulShellK = new G4PaulKxsModel();
orlicShellLi = new G4OrlicLiXsModel();
flag=0;
}
}
@@ -53,7 +63,7 @@ G4empCrossSection::~G4empCrossSection()
{
delete paulShellK;
delete orlicShellLi;
if (orlicShellLi) delete orlicShellLi;
}
@@ -74,9 +84,14 @@ std::vector<G4double> G4empCrossSection::GetCrossSection(G4int Z,
// so it can hadle the responsibility of this check too
if (mass == aProton->GetPDGMass()) {
crossSections.push_back( orlicShellLi->CalculateL1CrossSection(Z, incidentEnergy) );
crossSections.push_back( orlicShellLi->CalculateL2CrossSection(Z, incidentEnergy) );
crossSections.push_back( orlicShellLi->CalculateL3CrossSection(Z, incidentEnergy) );
if (flag==0)
{
crossSections.push_back( orlicShellLi->CalculateL1CrossSection(Z, incidentEnergy) );
crossSections.push_back( orlicShellLi->CalculateL2CrossSection(Z, incidentEnergy) );
crossSections.push_back( orlicShellLi->CalculateL3CrossSection(Z, incidentEnergy) );
}
}
else {
@@ -93,11 +108,9 @@ G4double G4empCrossSection::CrossSection(G4int Z, G4AtomicShellEnumerator shell,
G4double mass,
const G4Material*)
{
//let's reproduce
G4double res = 0.0;
G4ParticleDefinition* aProton = G4Proton::Proton();
if(fKShell == shell) {
res = paulShellK->CalculateKCrossSection(Z, mass, incidentEnergy);
}
@@ -106,17 +119,16 @@ G4double G4empCrossSection::CrossSection(G4int Z, G4AtomicShellEnumerator shell,
// moreover, at the present time,this class handles explicitly Paul and Orlic models,
// so it can hadle the responsibility of this check too
else if (mass == aProton->GetPDGMass()) {
if(fL1Shell == shell) {
res = orlicShellLi->CalculateL1CrossSection(Z, incidentEnergy);
if (flag==0) res = orlicShellLi->CalculateL1CrossSection(Z, incidentEnergy);
}
else if(fL2Shell == shell) {
res = orlicShellLi->CalculateL2CrossSection(Z, incidentEnergy);
if (flag==0) res = orlicShellLi->CalculateL2CrossSection(Z, incidentEnergy);
}
else if(fL3Shell == shell) {
res = orlicShellLi->CalculateL3CrossSection(Z, incidentEnergy);
if (flag==0) res = orlicShellLi->CalculateL3CrossSection(Z, incidentEnergy);
}
}
return res;