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

#include <HeedParticle.h>

+ Inheritance diagram for Heed::HeedParticle:

Public Member Functions

 HeedParticle (void)
 Constructors.
 
 HeedParticle (manip_absvol *primvol, const point &pt, const vec &vel, vfloat time, particle_def *fpardef, int fs_loss_only=0, int fs_print_listing=0)
 
 macro_copy_total (HeedParticle)
 
virtual ~HeedParticle ()
 Destructor.
 
virtual void physics (void)
 
virtual void print (std::ostream &file, int l) const
 
- Public Member Functions inherited from Heed::eparticle
 eparticle (void)
 Constructors.
 
 eparticle (manip_absvol *primvol, const point &pt, const vec &vel, vfloat time, particle_def *fpardef)
 
 eparticle (manip_absvol *primvol, const point &pt, const vec &vel, vfloat time, particle_def *fpardef, double gamma_1)
 
 AnyType_copy (eparticle, gparticle)
 
virtual ~eparticle ()
 Destructor.
 
virtual void print (std::ostream &file, int l) const
 
virtual int force (const point &pt, vec &f, vec &f_perp, vfloat &mrange)
 
- Public Member Functions inherited from Heed::mparticle
void check_consistency (void) const
 
virtual void step (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 int force (const point &pt, vec &f, vec &f_perp, vfloat &mrange)
 
void new_speed (void)
 
 mparticle (void)
 
 mparticle (gparticle const &gp, double fmass)
 
 mparticle (gparticle const &gp, double fmass, double gamma_1)
 
 mparticle (manip_absvol *primvol, const point &pt, const vec &vel, vfloat time, double fmass, double gamma_1)
 
virtual void print (std::ostream &file, int l) const
 
 macro_copy_total (gparticle)
 
virtual ~mparticle ()
 
- 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 Member Functions inherited from Heed::particle_type
 particle_type (void)
 
 particle_type (particle_def *f)
 
 particle_type (const char *name, int s=0)
 
int operator== (const particle_type &f)
 
int operator!= (const particle_type &f)
 
void print_notation (std::ostream &file) const
 

Public Attributes

int s_print_listing
 
long particle_number
 
double transferred_energy_in_step
 
long qtransfer
 
int s_loss_only
 
BlkArr< double > transferred_energy
 
BlkArr< long > natom
 
BlkArr< long > nshell
 
- Public Attributes inherited from Heed::mparticle
double mass
 Mass (not mass * speed_of_light^2)
 
double orig_kin_energy
 
double orig_gamma_1
 
double prev_kin_energy
 
double prev_gamma_1
 
double curr_kin_energy
 
double curr_gamma_1
 
- 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
 
- Public Attributes inherited from Heed::particle_type
PassivePtr< particle_defpardef
 

Additional Inherited Members

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

Detailed Description

Definition at line 30 of file HeedParticle.h.

Constructor & Destructor Documentation

◆ HeedParticle() [1/2]

Heed::HeedParticle::HeedParticle ( void  )
inline

Constructors.

Definition at line 33 of file HeedParticle.h.

33: eparticle() {}
eparticle(void)
Constructors.
Definition: eparticle.h:19

◆ HeedParticle() [2/2]

Heed::HeedParticle::HeedParticle ( manip_absvol primvol,
const point pt,
const vec vel,
vfloat  time,
particle_def fpardef,
int  fs_loss_only = 0,
int  fs_print_listing = 0 
)

Definition at line 19 of file HeedParticle.cpp.

22 : eparticle(primvol, pt, vel, time, fpardef),
23 s_print_listing(fs_print_listing),
25 qtransfer(0),
26 s_loss_only(fs_loss_only) {
27
28 mfunname("HeedParticle::HeedParticle(...)");
34
35}
#define mfunname(string)
Definition: FunNameStack.h:67
void allocate_block(long fqel)
Definition: BlkArr.h:231
BlkArr< long > natom
Definition: HeedParticle.h:54
double transferred_energy_in_step
Definition: HeedParticle.h:50
BlkArr< long > nshell
Definition: HeedParticle.h:55
BlkArr< double > transferred_energy
Definition: HeedParticle.h:53
long last_particle_number
Definition: HeedParticle.h:26

◆ ~HeedParticle()

virtual Heed::HeedParticle::~HeedParticle ( )
inlinevirtual

Destructor.

Definition at line 42 of file HeedParticle.h.

42{}

Member Function Documentation

◆ macro_copy_total()

Heed::HeedParticle::macro_copy_total ( HeedParticle  )

◆ physics()

void Heed::HeedParticle::physics ( void  )
virtual

Reimplemented from Heed::mparticle.

Definition at line 37 of file HeedParticle.cpp.

37 {
38 mfunname("void HeedParticle::physics(void)");
39 if (s_print_listing == 1) {
40 mcout << "HeedParticle::physics is started\n";
42 }
44 qtransfer = 0;
48 if (currpos.prange <= 0.0) return;
49 // Get least address of volume
50 const absvol* av = currpos.G_lavol();
51 const EnTransfCSType* etcst = dynamic_cast<const EnTransfCSType*>(av);
52 // Check if dynamic cast was successful.
53 if (etcst == NULL) return;
54
55 EnTransfCS* aetcs = etcst->etcs.getver();
56 HeedMatterDef* ahmd = aetcs->hmd.getver();
57 MatterDef* amatter = ahmd->matter.getver();
58 EnergyMesh* a_energy_mesh = ahmd->energy_mesh.getver();
59 const double* aetemp = ahmd->energy_mesh->get_ae();
60 PointCoorMesh<double, const double*> pcm_e(a_energy_mesh->get_q() + 1,
61 &(aetemp));
62 long qa = amatter->qatom();
63 if (s_print_listing == 1) Iprintn(mcout, qa);
64 basis tempbas(currpos.dir, "tempbas");
65 for (long na = 0; na < qa; ++na) {
66 if (s_print_listing == 1) Iprintn(mcout, na);
67 long qs = ahmd->apacs[na]->get_qshell();
68 for (long ns = 0; ns < qs; ++ns) {
69 if (s_print_listing == 1) Iprintn(mcout, ns);
70 long qt = 0;
71#ifdef SINGLE_TRANSFER
72 if (aetcs == aetcs_single_transf && na == na_single_transf &&
73 ns == ns_single_transf) {
74 qt = 1;
75 }
76#else
77 if (aetcs->quan[na][ns] > 0.0) {
78 int ierror;
79 qt = pois(aetcs->quan[na][ns] * currpos.prange / cm, ierror);
81 ierror, == 1,
82 " aetcs->quan[na][ns]=" << aetcs->quan[na][ns]
83 << " currpos.prange/cm=" << currpos.prange /
84 cm << '\n',
85 mcerr);
86 }
87#endif
88 if (s_print_listing == 1) Iprintn(mcout, qt);
89 if (qt > 0) {
90 point curpt = prevpos.pt;
91 vec dir = unit_vec(currpos.pt - prevpos.pt);
92 double range = length(currpos.pt - prevpos.pt);
93 if (s_print_listing == 1) {
94 Iprint(mcout, curpt);
95 Iprint(mcout, dir);
96 Iprintn(mcout, range);
97 }
98 for (long nt = 0; nt < qt; ++nt) {
99#ifdef SINGLE_TRANSFER
100 transferred_energy.append(ener_single_transf);
101#else
102 double rn = SRANLUX();
103 if (s_print_listing == 1) {
104 Iprintn(mcout, rn);
105 Iprintn(mcout, aetcs);
106 Iprintn(mcout, aetcs->fadda[na][ns][1]);
107 }
108 double r = t_hisran_step_ar<double, DynLinArr<double>,
110 pcm_e, aetcs->fadda[na][ns], rn);
111
112 // Convert to internal units.
113 transferred_energy.append(r * MeV);
114#endif
115 if (s_print_listing == 1) {
117 }
119 natom.append(na);
120 nshell.append(ns);
121#ifdef SINGLE_TRANSFER
122 double arange = 0.5 * range;
123#else
124 double arange = SRANLUX() * range;
125#endif
126 point pt = curpt + dir * arange;
127 point ptloc = pt;
128 prevpos.tid.up_absref(&ptloc);
129 qtransfer++;
130 if (s_loss_only == 0) {
131 if (s_print_listing == 1) {
132 mcout << "generating new cluster\n";
133 }
134 cluster_bank.append(HeedCluster(transferred_energy[qtransfer - 1],
135 0, pt, ptloc, prevpos.tid, na, ns));
136
137 double Ep0 = mass * c_squared + curr_kin_energy;
138 double Ep1 = Ep0 - transferred_energy[qtransfer - 1];
139 double Mp = mass;
140 double Mt = electron_def.mass;
141 double theta_p, theta_t;
142 theta_two_part(Ep0, Ep1, Mp, Mt, theta_p, theta_t);
143 vec vel;
144 vel.random_conic_vec(fabs(theta_t));
145 vel.down(&tempbas); // direction is OK
146 vel *= c_light;
147 // HS
148 double speed = length(vel);
149 double time = arange / speed;
150 if (s_print_listing == 1) {
151 mcout << "generating new virtual photon\n";
152 }
153 HeedPhoton hp(currpos.tid.eid[0].amvol.getver(), pt, vel, time,
155 0);
156 hp.s_photon_absorbed = 1;
157 hp.s_delta_generated = 0;
158 hp.na_absorbing = na;
159 hp.ns_absorbing = ns;
160 ActivePtr<gparticle> ac;
161 ac.put(&hp);
162 particle_bank.insert_after(particle_bank.get_last_node(), ac);
163 }
164 }
165 }
166 }
167 }
168 if (s_print_listing == 1) {
170 mcout << "Exiting HeedParticle::physics\n";
171 }
172}
DoubleAc fabs(const DoubleAc &f)
Definition: DoubleAc.h:616
#define check_econd11a(a, signb, add, stream)
Definition: FunNameStack.h:395
void append(const T &val)
Definition: BlkArr.h:205
double curr_kin_energy
Definition: mparticle.h:31
double mass
Mass (not mass * speed_of_light^2)
Definition: mparticle.h:25
Definition: volume.h:91
Definition: vec.h:397
stvpoint currpos
Definition: gparticle.h:188
stvpoint prevpos
Definition: gparticle.h:187
PassivePtr< manip_absvol > amvol
Definition: volume.h:39
manip_absvol_eid eid[pqamvol]
Definition: volume.h:52
void up_absref(absref *f)
Definition: volume.cpp:37
Definition: vec.h:477
point pt
Definition: gparticle.h:33
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
Definition: vec.h:248
void random_conic_vec(double theta)
Definition: vec.cpp:322
void down(const basis *fabas)
Definition: vec.cpp:247
BlkArr< HeedCluster > cluster_bank
Definition: TrackHeed.cc:41
AbsList< ActivePtr< gparticle > > particle_bank
Definition: TrackHeed.cc:42
particle_def electron_def("electron", "e-", electron_mass_c2/c_squared, electron_charge, 1, 0, 0.5, spin_def(0.0, 0.0))
Definition: particle_def.h:122
void theta_two_part(double Ep0, double Ep1, double Mp, double Mt, double &theta_p, double &theta_t)
Definition: kinem.cpp:31
long pois(double AMU, int &IERROR)
Definition: pois.cpp:17
#define mcout
Definition: prstream.h:133
#define Iprint(file, name)
Definition: prstream.h:209
#define mcerr
Definition: prstream.h:135
#define Iprintn(file, name)
Definition: prstream.h:216
#define Iprint2n(file, name1, name2)
Definition: prstream.h:236
ffloat SRANLUX(void)
Definition: ranluxint.h:262

◆ print()

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

Reimplemented from Heed::eparticle.

Definition at line 174 of file HeedParticle.cpp.

174 {
175 if (l >= 0) {
176 Ifile << "HeedParticle (l=" << l << "): particle_number=" << particle_number
177 << " type=";
178 print_notation(file);
179 file << std::endl;
180 if (l == 1) return;
181 mparticle::print(file, l - 1);
184 if (l >= 5) {
185 Ifile << " nt natom nshell transferred_energy\n";
186 for (long nt = 0; nt < qtransfer; nt++) {
187 Ifile << std::setw(3) << nt << ' ' << std::setw(3) << natom[nt] << ' '
188 << std::setw(3) << nshell[nt] << ' ' << std::setw(12)
189 << transferred_energy[nt] << '\n';
190 }
191 }
192 }
193
194}
virtual void print(std::ostream &file, int l) const
Definition: mparticle.cpp:308
void print_notation(std::ostream &file) const
#define Ifile
Definition: prstream.h:207

Member Data Documentation

◆ natom

BlkArr<long> Heed::HeedParticle::natom

Definition at line 54 of file HeedParticle.h.

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

◆ nshell

BlkArr<long> Heed::HeedParticle::nshell

Definition at line 55 of file HeedParticle.h.

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

◆ particle_number

long Heed::HeedParticle::particle_number

Definition at line 48 of file HeedParticle.h.

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

◆ qtransfer

long Heed::HeedParticle::qtransfer

Definition at line 51 of file HeedParticle.h.

Referenced by physics(), and print().

◆ s_loss_only

int Heed::HeedParticle::s_loss_only

Definition at line 52 of file HeedParticle.h.

Referenced by physics().

◆ s_print_listing

int Heed::HeedParticle::s_print_listing

Definition at line 47 of file HeedParticle.h.

Referenced by physics().

◆ transferred_energy

BlkArr<double> Heed::HeedParticle::transferred_energy

Definition at line 53 of file HeedParticle.h.

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

◆ transferred_energy_in_step

double Heed::HeedParticle::transferred_energy_in_step

Definition at line 50 of file HeedParticle.h.

Referenced by physics(), and print().


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