Garfield++ v1r0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
Heed::HeedPhoton Class Reference

#include <HeedPhoton.h>

+ Inheritance diagram for Heed::HeedPhoton:

Public Member Functions

 HeedPhoton (manip_absvol *primvol, const point &pt, const vec &vel, vfloat time, long fparent_particle_number, double fenergy, int fs_print_listing=0)
 
void physics_after_new_speed (void)
 
virtual void physics (void)
 
 HeedPhoton (void)
 
virtual void print (std::ostream &file, int l) const
 
 macro_copy_total (HeedPhoton)
 
virtual ~HeedPhoton ()
 
- Public Member Functions inherited from gparticle
 gparticle (void)
 
 gparticle (const stvpoint &sp)
 
 gparticle (manip_absvol *primvol, const point &pt, const vec &vel, vfloat time)
 
virtual void step (void)
 
virtual void change_vol (void)
 
virtual void curvature (int &fs_cf, vec &frelcen, vfloat &fmrange, vfloat prec)
 
virtual void physics_after_new_speed (void)
 
virtual void physics (void)
 
virtual void physics_mrange (double &fmrange)
 
virtual stvpoint calc_step_to_bord ()
 
stvpoint switch_new_vol (void)
 
virtual void fly (void)
 
virtual void print (std::ostream &file, int l) const
 
 macro_copy_total (gparticle)
 
virtual ~gparticle ()
 

Public Attributes

long particle_number
 
long parent_particle_number
 
int s_print_listing
 
double energy
 
int s_photon_absorbed
 
long na_absorbing
 
long ns_absorbing
 
int s_delta_generated
 
- Public Attributes inherited from gparticle
int s_life
 
long nstep
 
double total_range_from_origin
 
long n_zero_step
 
stvpoint origin
 
stvpoint prevpos
 
stvpoint currpos
 
stvpoint nextpos
 
vec curr_relcen
 

Additional Inherited Members

- Static Public Attributes inherited from gparticle
static long max_q_zero_step = 100
 

Detailed Description

Definition at line 17 of file HeedPhoton.h.

Constructor & Destructor Documentation

◆ HeedPhoton() [1/2]

Heed::HeedPhoton::HeedPhoton ( manip_absvol primvol,
const point pt,
const vec vel,
vfloat  time,
long  fparent_particle_number,
double  fenergy,
int  fs_print_listing = 0 
)

Definition at line 18 of file HeedPhoton.cpp.

21 : gparticle(primvol, pt, vel, time),
22 parent_particle_number(fparent_particle_number),
23 s_print_listing(fs_print_listing),
24 energy(fenergy),
26#ifdef SFER_PHOTOEL
27 s_sfer_photoel(0),
28#endif
30 mfunname("HeedPhoton::HeedPhoton(...)");
32 //set_count_references();
34 double length_vel = length(vel);
35 check_econd11(fabs(length_vel - c_light) / (length_vel + c_light), > 1.0e-10,
36 mcerr);
37}
DoubleAc fabs(const DoubleAc &f)
Definition: DoubleAc.h:616
#define check_econd11(a, signb, stream)
Definition: FunNameStack.h:366
#define mfunname(string)
Definition: FunNameStack.h:67
long particle_number
Definition: HeedPhoton.h:19
long parent_particle_number
Definition: HeedPhoton.h:20
gparticle(void)
Definition: gparticle.h:194
long last_particle_number
Definition: HeedParticle.h:26
#define mcerr
Definition: prstream.h:135

◆ HeedPhoton() [2/2]

Heed::HeedPhoton::HeedPhoton ( void  )
inline

Definition at line 39 of file HeedPhoton.h.

39: gparticle() { ; }

Referenced by physics_after_new_speed().

◆ ~HeedPhoton()

virtual Heed::HeedPhoton::~HeedPhoton ( )
inlinevirtual

Definition at line 42 of file HeedPhoton.h.

42{ ; }

Member Function Documentation

◆ macro_copy_total()

Heed::HeedPhoton::macro_copy_total ( HeedPhoton  )

◆ physics()

void Heed::HeedPhoton::physics ( void  )
virtual

Reimplemented from gparticle.

Definition at line 39 of file HeedPhoton.cpp.

39 {
40 mfunname("void HeedPhoton::physics(void)");
41
42 if (s_print_listing == 1) {
43 mcout << "void HeedPhoton::physics(void) is starting\n";
44 }
45 if (s_photon_absorbed == 0) // still not absorbed
46 {
47 if (nextpos.prange > 0.0) {
48 const absvol* av = currpos.G_lavol(); // get least address of volume
49 HeedMatterDef* hmd = NULL;
50 const EnTransfCSType* etcst = dynamic_cast<const EnTransfCSType*>(av);
51 if (etcst != NULL) {
52 hmd = etcst->etcs->hmd.getver();
53 } else {
54 const HeedDeltaElectronCSType* hmecst =
55 dynamic_cast<const HeedDeltaElectronCSType*>(av);
56 if (hmecst != NULL) {
57 hmd = hmecst->hdecs->hmd.get();
58 }
59 }
60 if (hmd != NULL) {
61 // calculate cross section
62 // First to count shells
63 long qst = 0;
64 long qa = hmd->matter->qatom();
65 long na;
66 for (na = 0; na < qa; na++) {
67 long qs = hmd->apacs[na]->get_qshell();
68 qst += qs;
69 }
70 DynLinArr<double> cs(qst);
71 DynLinArr<long> nat(qst);
72 DynLinArr<long> nsh(qst);
73 double s = 0.0;
74 long nst = 0;
75 for (na = 0; na < qa; na++) {
76 long qs = hmd->apacs[na]->get_qshell();
77 long ns;
78 double at_weight_quan = hmd->matter->weight_quan(na);
79 for (ns = 0; ns < qs; ns++) {
80 cs[nst] = hmd->apacs[na]->get_ICS(ns, energy) * at_weight_quan;
81 // threshold is taken into account in apacs[na]->get_ACS(ns,..
82 nat[nst] = na;
83 nsh[nst] = ns;
84 s += cs[nst];
85 //Imcout<<"na="<<na<<" ns="<<ns<<" cs[nst]="<<cs[nst]<<'\n';
86 nst++;
87 }
88 }
89 if (s_print_listing == 1) {
90 Iprintn(mcout, s);
91 }
92 //s=s * hmd->eldens / hmd->matter->Z_mean() * C1_MEV_CM;
93 s = s * 1.0e-18 * AVOGADRO / (hmd->matter->A_mean() / (gram / mole)) *
94 hmd->matter->density() / (gram / cm3);
95 if (s_print_listing == 1) {
96 Iprintn(mcout, s);
97 }
98 double path_length = 1.0 / s; // cm
99 if (s_print_listing == 1) {
100 Iprint2n(mcout, energy, path_length);
101 }
102 double xleng = -path_length * log(1.0 - SRANLUX());
103 // computing randon length
104 if (s_print_listing == 1) {
105 Iprintn(mcout, xleng);
107 }
108 if (xleng * cm < nextpos.prange) {
110#ifdef SFER_PHOTOEL
111 s_sfer_photoel = 1; // assumes that virtual photons are already
112 // absorbed and s_sfer_photoel is 0 for them
113#endif
114
115 //s_life = 0;
116 chispre(cs);
117 double r = chisran(SRANLUX(), cs);
118 //Iprintn(mcout, r);
119 long n = long(r);
120 if (n < 0) n = 0;
121 if (n > nst - 1) n = nst - 1;
122 if (s_print_listing == 1) {
123 Iprintn(mcout, n);
124 }
125 na_absorbing = nat[n];
126 ns_absorbing = nsh[n];
127 nextpos.prange = xleng * cm;
131 }
132 }
133 }
134 }
135}
float chispre(float *x, float *p, float *f, long q)
Definition: chisran.cpp:7
float chisran(float flat_random_number, float *x, float *f, long q)
Definition: chisran.cpp:22
Definition: volume.h:91
stvpoint currpos
Definition: gparticle.h:188
stvpoint nextpos
Definition: gparticle.h:189
void up_absref(absref *f)
Definition: volume.cpp:37
point pt
Definition: gparticle.h:33
point ptloc
Definition: gparticle.h:37
absvol * G_lavol() const
Definition: gparticle.h:63
vfloat prange
Definition: gparticle.h:54
manip_absvol_treeid tid
Definition: gparticle.h:43
vec dir
Definition: gparticle.h:35
const double AVOGADRO
#define mcout
Definition: prstream.h:133
#define Iprintn(file, name)
Definition: prstream.h:216
#define Iprint2n(file, name1, name2)
Definition: prstream.h:236
ffloat SRANLUX(void)
Definition: ranluxint.h:262

◆ physics_after_new_speed()

void Heed::HeedPhoton::physics_after_new_speed ( void  )
virtual

Reimplemented from gparticle.

Definition at line 137 of file HeedPhoton.cpp.

137 {
138 mfunname("void HeedPhoton::physics_after_new_speed(void)");
139 if (s_print_listing == 1) {
140 mcout << "HeedPhoton::physics_after_new_speed is started\n";
141 }
142 if (s_photon_absorbed == 1 && s_delta_generated == 0) {
143 const absvol* av = currpos.G_lavol(); // get least address of volume
144
145 HeedMatterDef* hmd = NULL;
146 const EnTransfCSType* etcst = dynamic_cast<const EnTransfCSType*>(av);
147 if (etcst != NULL) {
148 hmd = etcst->etcs->hmd.getver();
149 } else {
150 const HeedDeltaElectronCSType* hmecst =
151 dynamic_cast<const HeedDeltaElectronCSType*>(av);
152 if (hmecst != NULL) {
153 hmd = hmecst->hdecs->hmd.get();
154 }
155 }
156 check_econd11(hmd, == NULL, mcerr);
157 // generate delta-electrons
158 DynLinArr<double> el_energy;
159 DynLinArr<double> ph_energy;
160 hmd->apacs[na_absorbing]
161 ->get_escape_particles(ns_absorbing, energy, el_energy, ph_energy);
162 if (s_print_listing == 1) {
163 mcout << "The condition:\n";
165 mcout << "The decay products:\n";
166 Iprintn(mcout, el_energy);
167 Iprintn(mcout, ph_energy);
168 }
169 long qel = el_energy.get_qel();
170 long nel;
171 for (nel = 0; nel < qel; nel++) {
172 vec vel;
173 if (nel == 0) { // assumed it is photoelectron
174#ifdef SFER_PHOTOEL
175 if (s_sfer_photoel == 1) {
176 vel.random_sfer_vec();
177 } else {
178 vel = currpos.dir;
179 }
180#else
181 vel = currpos.dir; // direction is OK
182#endif
183 } else {
184 vel.random_sfer_vec();
185 }
186 double gam_1 = el_energy[nel] / ELMAS;
187 double betta = sqrt(1.0 - pow(1.0 / (gam_1 + 1.0), 2.0));
188 double mod_v = betta * c_light;
189 vel = vel * mod_v;
190 if (s_print_listing == 1) {
191 mcout << "Initializing delta electron\n";
192 Iprint4n(mcout, el_energy[nel], gam_1, betta, mod_v);
193 }
194 ActivePtr<gparticle> ac;
195 ac.pass(
196 new HeedDeltaElectron(currpos.tid.eid[0].amvol.getver(), currpos.pt,
198 particle_bank.insert_after(particle_bank.get_last_node(), ac);
199 }
200 long qph = ph_energy.get_qel();
201 long nph;
202 for (nph = 0; nph < qph; nph++) {
203 vec vel;
204 vel.random_sfer_vec();
205 vel *= c_light;
206 if (s_print_listing == 1) {
207 mcout << "Initializing photon\n";
208 Iprint2n(mcout, el_energy[nph], vel);
209 }
210 ActivePtr<gparticle> ac;
211 ac.pass(new HeedPhoton(currpos.tid.eid[0].amvol.getver(), currpos.pt, vel,
212 currpos.time, particle_number, ph_energy[nph]));
213 particle_bank.insert_after(particle_bank.get_last_node(), ac);
214 }
216 s_life = 0;
217 }
218 if (s_print_listing == 1) {
219 mcout << "HeedPhoton::physics_after_new_speed is exitted\n";
220 }
221}
DoubleAc pow(const DoubleAc &f, double p)
Definition: DoubleAc.cpp:336
DoubleAc sqrt(const DoubleAc &f)
Definition: DoubleAc.cpp:313
long get_qel(void) const
Definition: AbsArr.h:420
int s_life
Definition: gparticle.h:180
PassivePtr< manip_absvol > amvol
Definition: volume.h:39
manip_absvol_eid eid[pqamvol]
Definition: volume.h:52
vfloat time
Definition: gparticle.h:55
Definition: vec.h:248
void random_sfer_vec(void)
Definition: vec.cpp:334
const double ELMAS
AbsList< ActivePtr< gparticle > > particle_bank
Definition: TrackHeed.cc:42
#define Iprint4n(file, name1, name2, name3, name4)
Definition: prstream.h:260

◆ print()

void Heed::HeedPhoton::print ( std::ostream &  file,
int  l 
) const
virtual

Reimplemented from gparticle.

Definition at line 223 of file HeedPhoton.cpp.

223 {
224 if (l >= 0) {
225 Ifile << "HeedPhoton (l=" << l << "): particle_number=" << particle_number
226 << " energy=" << energy << "MeV\n";
227 if (l == 1) return;
228 indn.n += 2;
229 Ifile << "s_photon_absorbed=" << s_photon_absorbed
230 << " na_absorbing=" << na_absorbing
231 << " ns_absorbing=" << ns_absorbing
232 << " s_delta_generated=" << s_delta_generated
233#ifdef SFER_PHOTOEL
234 << " s_sfer_photoel=" << s_sfer_photoel
235#endif
236 << " parent_particle_number=" << parent_particle_number
237 << " s_print_listing=" << s_print_listing << '\n';
238 gparticle::print(file, l - 1);
239 indn.n -= 2;
240 }
241}
virtual void print(std::ostream &file, int l) const
Definition: gparticle.cpp:312
indentation indn
Definition: prstream.cpp:13
#define Ifile
Definition: prstream.h:207

Member Data Documentation

◆ energy

double Heed::HeedPhoton::energy

◆ na_absorbing

long Heed::HeedPhoton::na_absorbing

◆ ns_absorbing

long Heed::HeedPhoton::ns_absorbing

◆ parent_particle_number

long Heed::HeedPhoton::parent_particle_number

◆ particle_number

long Heed::HeedPhoton::particle_number

◆ s_delta_generated

int Heed::HeedPhoton::s_delta_generated

◆ s_photon_absorbed

int Heed::HeedPhoton::s_photon_absorbed

◆ s_print_listing

int Heed::HeedPhoton::s_print_listing

Definition at line 21 of file HeedPhoton.h.

Referenced by physics(), physics_after_new_speed(), and print().


The documentation for this class was generated from the following files: