Garfield++ v1r0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
eiparticle.cpp
Go to the documentation of this file.
1#include <iomanip>
8/*
91998 - 2002, I. Smirnov
10*/
11
12namespace Heed {
13
15
16 mfunname("double eiparticle::Bethe_Bloch_energy_loss()");
17 // Get least address of volume
18 const absvol* av = currpos.G_lavol();
19 const MatterType* amt = dynamic_cast<const MatterType*>(av);
20 if (amt == NULL) return 0.;
21 MatterDef* amd = amt->matdef.get();
22 const double beta = lorbeta(curr_gamma_1);
23 const double loss =
24 Bethe_Bloch_energy_loss(amd->Z_mean() / amd->A_mean(), amd->I_eff(), beta,
25 pardef->charge / eplus);
26 return loss * amd->density();
27}
28
30 mfunname("void eiparticle::physics_after_new_speed(void)");
31 double loss = Bethe_Bloch_en_loss();
32 loss *= currpos.prange;
33 total_loss += loss;
34 if (s_add_loss == 0) {
35 curr_kin_energy -= loss;
36 if (curr_kin_energy <= 0.0) {
37 curr_kin_energy = 0.0;
38 curr_gamma_1 = 0.0;
39 currpos.speed = 0.0;
40 s_life = 0;
41 } else {
42 const double resten = mass * c_squared;
44 currpos.speed = c_light * lorbeta(curr_gamma_1);
45 }
46 } else {
47 curr_kin_energy += loss;
48 const double resten = mass * c_squared;
50 currpos.speed = c_light * lorbeta(curr_gamma_1);
51 }
52}
53
54void eiparticle::print(std::ostream& file, int l) const {
55 if (l >= 0) {
56 Ifile << "eiparticle: s_add_loss=" << s_add_loss
57 << " total_loss/keV=" << total_loss / keV << '\n';
58 eparticle::print(file, l);
59 }
60}
61
62}
#define mfunname(string)
Definition: FunNameStack.h:67
double A_mean(void) const
Definition: AtomDef.h:150
double Z_mean(void) const
Definition: AtomDef.h:149
double I_eff(void) const
Definition: MatterDef.h:54
double density(void) const
Definition: MatterDef.h:52
PassivePtr< MatterDef > matdef
Definition: MatterDef.h:72
double Bethe_Bloch_en_loss(void)
Energy loss per unit length.
Definition: eiparticle.cpp:14
virtual void print(std::ostream &file, int l) const
Definition: eiparticle.cpp:54
virtual void physics_after_new_speed(void)
Definition: eiparticle.cpp:29
double total_loss
Definition: eiparticle.h:40
virtual void print(std::ostream &file, int l) const
Definition: eparticle.cpp:33
double curr_kin_energy
Definition: mparticle.h:31
double mass
Mass (not mass * speed_of_light^2)
Definition: mparticle.h:25
double curr_gamma_1
Definition: mparticle.h:32
PassivePtr< particle_def > pardef
Definition: particle_def.h:150
Definition: volume.h:91
stvpoint currpos
Definition: gparticle.h:188
int s_life
Definition: gparticle.h:180
absvol * G_lavol() const
Definition: gparticle.h:63
vfloat prange
Definition: gparticle.h:54
vfloat speed
Definition: gparticle.h:41
Definition: BGMesh.cpp:3
double lorbeta(const double gamma_1)
Definition: lorgamma.cpp:22
double Bethe_Bloch_energy_loss(const double ratio_Z_to_A, const double I_eff, const double beta, const double z)
Definition: bethe_bloch.cpp:14
#define Ifile
Definition: prstream.h:207