GGEMS  1.1
GPU GEant4-based Monte Carlo Simulations
GGEMSComptonScattering.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 
33 
37 
38 GGEMSComptonScattering::GGEMSComptonScattering(std::string const& primary_particle, bool const& is_secondary)
40 {
41  GGcout("GGEMSComptonScattering", "GGEMSComptonScattering", 3) << "GGEMSComptonScattering creating..." << GGendl;
42 
43  process_name_ = "Compton";
44 
45  // Check type of primary particle
46  if (primary_particle != "gamma") {
47  std::ostringstream oss(std::ostringstream::out);
48  oss << "For Compton scattering, incident particle has to be a 'gamma'";
49  GGEMSMisc::ThrowException("GGEMSComptonScattering", "GGEMSComptonScattering", oss.str());
50  }
51 
53  primary_particle_ = "gamma";
54  secondary_particle_ = "e-";
55  is_secondaries_ = is_secondary;
56 
57  GGcout("GGEMSComptonScattering", "GGEMSComptonScattering", 3) << "GGEMSComptonScattering created!!!" << GGendl;
58 }
59 
63 
65 {
66  GGcout("GGEMSComptonScattering", "~GGEMSComptonScattering", 3) << "GGEMSComptonScattering erasing..." << GGendl;
67 
68  GGcout("GGEMSComptonScattering", "~GGEMSComptonScattering", 3) << "GGEMSComptonScattering erased!!!" << GGendl;
69 }
70 
74 
76 {
77  GGfloat cross_section_by_atom = 0.0f;
78 
79  if (atomic_number < 1 || energy < 1e-4f) {return cross_section_by_atom;}
80 
81  GGfloat p1Z = atomic_number * ( 2.7965e-23f + 1.9756e-27f*atomic_number + -3.9178e-29f*atomic_number*atomic_number);
82  GGfloat p2Z = atomic_number * (-1.8300e-23f + -1.0205e-24f*atomic_number + 6.8241e-27f*atomic_number*atomic_number);
83  GGfloat p3Z = atomic_number * ( 6.7527e-22f + -7.3913e-24f*atomic_number + 6.0480e-27f*atomic_number*atomic_number);
84  GGfloat p4Z = atomic_number * (-1.9798e-21f + 2.7079e-24f*atomic_number + 3.0274e-26f*atomic_number*atomic_number);
85  GGfloat T0 = (atomic_number < 1.5f)? 40.0e-3f : 15.0e-3f;
86  GGfloat d1, d2, d3, d4, d5;
87 
88  d1 = fmaxf(energy, T0) / ELECTRON_MASS_C2;
89  cross_section_by_atom = p1Z*logf(1.0f+2.0f*d1)/d1+(p2Z+p3Z*d1+p4Z*d1*d1)/(1.0f+20.0f*d1+230.0f*d1*d1+440.0f*d1*d1*d1);
90 
91  if (energy < T0) {
92  d1 = (T0+1.0e-3f) / ELECTRON_MASS_C2;
93  d2 = p1Z*logf(1.0f+2.0f*d1)/d1+(p2Z+p3Z*d1+p4Z*d1*d1)/(1.0f+20.0f*d1+230.0f*d1*d1+440.0f*d1*d1*d1);
94  d3 = (-T0 * (d2 - cross_section_by_atom)) / (cross_section_by_atom*1.0e-3f);
95  d4 = (atomic_number > 1.5f)? 0.375f-0.0556f*logf(atomic_number) : 0.15f;
96  d5 = logf(energy / T0);
97  cross_section_by_atom *= expf(-d5 * (d3 + d4*d5));
98  }
99 
100  return cross_section_by_atom; // in mm2
101 }
GGEMSComptonScattering.hh
Compton Scattering process from standard model for Geant4 (G4KleinNishinaCompton)
GGEMSEMProcess::primary_particle_
std::string primary_particle_
Definition: GGEMSEMProcess.hh:127
COMPTON_SCATTERING
__constant GGchar COMPTON_SCATTERING
Definition: GGEMSProcessConstants.hh:43
GGEMSEMProcess::secondary_particle_
std::string secondary_particle_
Definition: GGEMSEMProcess.hh:128
GGEMSEMProcess::process_name_
std::string process_name_
Definition: GGEMSEMProcess.hh:126
ELECTRON_MASS_C2
__constant GGfloat ELECTRON_MASS_C2
Definition: GGEMSConstants.hh:53
GGEMSEMProcess
GGEMS mother class for electromagnectic process.
Definition: GGEMSEMProcess.hh:47
GGEMSEMProcess::is_secondaries_
bool is_secondaries_
Definition: GGEMSEMProcess.hh:129
GGcout
GGEMSStream GGcout
Definition: GGEMSPrint.cc:34
GGEMSComptonScattering::GGEMSComptonScattering
GGEMSComptonScattering(std::string const &primary_particle="gamma", bool const &is_secondary=false)
GGEMSComptonScattering constructor.
Definition: GGEMSComptonScattering.cc:38
GGEMSEMProcess::process_id_
GGchar process_id_
Definition: GGEMSEMProcess.hh:125
GGEMSComptonScattering::~GGEMSComptonScattering
~GGEMSComptonScattering(void)
GGEMSComptonScattering destructor.
Definition: GGEMSComptonScattering.cc:64
GGendl
#define GGendl
overload C++ std::endl
Definition: GGEMSPrint.hh:60
GGEMSMaterials.hh
GGEMS class handling material(s) for a specific navigator.
GGuchar
#define GGuchar
Definition: GGEMSTypes.hh:203
GGEMSComptonScattering::ComputeCrossSectionPerAtom
GGfloat ComputeCrossSectionPerAtom(GGfloat const &energy, GGuchar const &atomic_number) const override
compute Compton cross section for an atom with Klein-Nishina
Definition: GGEMSComptonScattering.cc:75
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