GGEMS  1.1
GPU GEant4-based Monte Carlo Simulations
GGEMSPhotoElectricEffect.cc
Go to the documentation of this file.
1 // ************************************************************************
2 // * This file is part of GGEMS. *
3 // * *
4 // * GGEMS is free software: you can redistribute it and/or modify *
5 // * it under the terms of the GNU General Public License as published by *
6 // * the Free Software Foundation, either version 3 of the License, or *
7 // * (at your option) any later version. *
8 // * *
9 // * GGEMS is distributed in the hope that it will be useful, *
10 // * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 // * GNU General Public License for more details. *
13 // * *
14 // * You should have received a copy of the GNU General Public License *
15 // * along with GGEMS. If not, see <https://www.gnu.org/licenses/>. *
16 // * *
17 // ************************************************************************
18 
34 
38 
39 GGEMSPhotoElectricEffect::GGEMSPhotoElectricEffect(std::string const& primary_particle, bool const& is_secondary)
41 {
42  GGcout("GGEMSPhotoElectricEffect", "GGEMSPhotoElectricEffect", 3) << "GGEMSPhotoElectricEffect creating..." << GGendl;
43 
44  process_name_ = "Photoelectric";
45 
46  // Check type of primary particle
47  if (primary_particle != "gamma") {
48  std::ostringstream oss(std::ostringstream::out);
49  oss << "For PhotoElectric effect, incident particle has to be a 'gamma'";
50  GGEMSMisc::ThrowException("GGEMSPhotoElectricEffect", "GGEMSPhotoElectricEffect", oss.str());
51  }
52 
54  primary_particle_ = "gamma";
55  secondary_particle_ = "e-";
56  is_secondaries_ = is_secondary;
57 
58  GGcout("GGEMSPhotoElectricEffect", "GGEMSPhotoElectricEffect", 3) << "GGEMSPhotoElectricEffect created!!!" << GGendl;
59 }
60 
64 
66 {
67  GGcout("GGEMSPhotoElectricEffect", "~GGEMSPhotoElectricEffect", 3) << "GGEMSPhotoElectricEffect erasing..." << GGendl;
68 
69  GGcout("GGEMSPhotoElectricEffect", "~GGEMSPhotoElectricEffect", 3) << "GGEMSPhotoElectricEffect erased!!!" << GGendl;
70 }
71 
75 
77 {
78  // Threshold at 10 eV
79  GGfloat e_min = std::fmax(GGEMSSandiaTable::kIonizationPotentials[atomic_number], 10.0f)*eV;
80  if (energy < e_min) return 0.0f;
81 
82  GGint start = GGEMSSandiaTable::kCumulativeIntervals[atomic_number-1];
83  GGint stop = start + GGEMSSandiaTable::kNumberOfIntervals[atomic_number];
84 
85  GGint pos = stop;
86  while (energy < static_cast<GGfloat>(GGEMSSandiaTable::kSandiaTable[pos][0])*keV) --pos;
87 
88  GGfloat aover_avo = ATOMIC_MASS_UNIT * static_cast<GGfloat>(atomic_number) / GGEMSSandiaTable::kZtoARatio[atomic_number];
89 
90  GGfloat energy_inv = 1.0f / energy;
91  GGfloat energy_inv2 = energy_inv * energy_inv;
92 
93  return static_cast<GGfloat>(
94  energy_inv * GGEMSSandiaTable::kSandiaTable[pos][1] * aover_avo * 0.160217648e-22 +
95  energy_inv2 * GGEMSSandiaTable::kSandiaTable[pos][2] * aover_avo * 0.160217648e-25 +
96  energy_inv * energy_inv2 * GGEMSSandiaTable::kSandiaTable[pos][3] * aover_avo * 0.160217648e-28 +
97  energy_inv2 * energy_inv2 * GGEMSSandiaTable::kSandiaTable[pos][4] * aover_avo * 0.160217648e-31);
98 }
GGEMSSandiaTable::kNumberOfIntervals
__constant GGshort kNumberOfIntervals[101]
Definition: GGEMSSandiaTable.hh:82
GGEMSEMProcess::primary_particle_
std::string primary_particle_
Definition: GGEMSEMProcess.hh:127
GGEMSPhotoElectricEffect::~GGEMSPhotoElectricEffect
~GGEMSPhotoElectricEffect(void)
GGEMSPhotoElectricEffect destructor.
Definition: GGEMSPhotoElectricEffect.cc:65
GGEMSEMProcess::secondary_particle_
std::string secondary_particle_
Definition: GGEMSEMProcess.hh:128
GGEMSEMProcess::process_name_
std::string process_name_
Definition: GGEMSEMProcess.hh:126
PHOTOELECTRIC_EFFECT
__constant GGchar PHOTOELECTRIC_EFFECT
Definition: GGEMSProcessConstants.hh:44
eV
__constant GGfloat eV
Definition: GGEMSSystemOfUnits.hh:101
GGEMSSandiaTable.hh
Sandia table useful for photoelectric effect.
GGint
#define GGint
Definition: GGEMSTypes.hh:224
keV
__constant GGfloat keV
Definition: GGEMSSystemOfUnits.hh:102
GGEMSSandiaTable::kSandiaTable
__constant GGfloat kSandiaTable[981][5]
Definition: GGEMSSandiaTable.hh:204
GGEMSEMProcess
GGEMS mother class for electromagnectic process.
Definition: GGEMSEMProcess.hh:47
GGEMSEMProcess::is_secondaries_
bool is_secondaries_
Definition: GGEMSEMProcess.hh:129
ATOMIC_MASS_UNIT
__constant GGfloat ATOMIC_MASS_UNIT
Definition: GGEMSConstants.hh:59
GGcout
GGEMSStream GGcout
Definition: GGEMSPrint.cc:34
GGEMSPhotoElectricEffect.hh
Photoelectric Effect process using Sandia table.
GGEMSPhotoElectricEffect::GGEMSPhotoElectricEffect
GGEMSPhotoElectricEffect(std::string const &primary_particle="gamma", bool const &is_secondary=false)
GGEMSPhotoElectricEffect constructor.
Definition: GGEMSPhotoElectricEffect.cc:39
GGEMSSandiaTable::kIonizationPotentials
__constant GGfloat kIonizationPotentials[101]
Definition: GGEMSSandiaTable.hh:42
GGEMSEMProcess::process_id_
GGchar process_id_
Definition: GGEMSEMProcess.hh:125
GGendl
#define GGendl
overload C++ std::endl
Definition: GGEMSPrint.hh:60
GGEMSMaterials.hh
GGEMS class handling material(s) for a specific navigator.
GGEMSSandiaTable::kZtoARatio
__constant GGfloat kZtoARatio[101]
Definition: GGEMSSandiaTable.hh:163
GGuchar
#define GGuchar
Definition: GGEMSTypes.hh:203
GGEMSSandiaTable::kCumulativeIntervals
__constant GGshort kCumulativeIntervals[101]
Definition: GGEMSSandiaTable.hh:122
GGEMSPhotoElectricEffect::ComputeCrossSectionPerAtom
GGfloat ComputeCrossSectionPerAtom(GGfloat const &energy, GGuchar const &atomic_number) const override
compute Compton cross section for an atom with Klein-Nishina
Definition: GGEMSPhotoElectricEffect.cc:76
GGEMSMisc::ThrowException
void ThrowException(std::string const &class_name, std::string const &method_name, std::string const &message)
Throw a C++ exception.
Definition: GGEMSTools.cc:61
GGfloat
#define GGfloat
Definition: GGEMSTypes.hh:273