Garfield++ v2r0
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 ()
 Default constructor.
 
 HeedParticle (manip_absvol *primvol, const point &pt, const vec &vel, vfloat time, particle_def *fpardef, HeedFieldMap *fieldmap, const bool fs_loss_only=false, const bool fs_print_listing=false)
 
virtual ~HeedParticle ()
 Destructor.
 
virtual void physics (std::vector< gparticle * > &secondaries)
 
virtual HeedParticlecopy () const
 
virtual void print (std::ostream &file, int l) const
 
- Public Member Functions inherited from Heed::eparticle
 eparticle ()
 Default constructor.
 
 eparticle (manip_absvol *primvol, const point &pt, const vec &vel, vfloat time, particle_def *fpardef, HeedFieldMap *fieldmap)
 Constructor using velocity vector.
 
virtual ~eparticle ()
 Destructor.
 
virtual eparticlecopy () const
 
virtual void print (std::ostream &file, int l) const
 
virtual int force (const point &pt, vec &f, vec &f_perp, vfloat &mrange)
 Calculate force components.
 
- Public Member Functions inherited from Heed::mparticle
void check_consistency () const
 Check consistency of kin_energy, gamma_1, speed, speed_of_light and mass.
 
virtual void step (std::vector< gparticle * > &secondaries)
 
virtual void curvature (int &fs_cf, vec &frelcen, vfloat &fmrange, vfloat prec)
 
virtual int force (const point &pt, vec &f, vec &f_perp, vfloat &mrange)
 
void new_speed ()
 Set new speed, direction and time for currpos.
 
 mparticle ()
 Default constructor.
 
 mparticle (manip_absvol *primvol, const point &pt, const vec &vel, vfloat time, double fmass)
 Constructor, $\gamma - 1$ calculated from the from velocity vector.
 
virtual void print (std::ostream &file, int l) const
 
virtual mparticlecopy () const
 
virtual ~mparticle ()
 Destructor.
 
- Public Member Functions inherited from Heed::gparticle
 gparticle ()
 Default constructor.
 
 gparticle (manip_absvol *primvol, const point &pt, const vec &vel, vfloat time)
 Constructor.
 
virtual ~gparticle ()
 Destructor.
 
virtual void step (std::vector< gparticle * > &secondaries)
 
virtual void change_vol (void)
 
virtual void curvature (int &fs_cf, vec &frelcen, vfloat &fmrange, vfloat prec)
 
virtual void physics_after_new_speed (std::vector< gparticle * > &)
 
virtual void physics (std::vector< gparticle * > &)
 
virtual void physics_mrange (double &fmrange)
 
virtual stvpoint calc_step_to_bord ()
 Produces nextpos.
 
stvpoint switch_new_vol ()
 
virtual void fly (std::vector< gparticle * > &secondaries)
 Transport the particle.
 
virtual void print (std::ostream &file, int l) const
 
virtual gparticlecopy () const
 
- Public Member Functions inherited from Heed::RegPassivePtr
 RegPassivePtr (void)
 
 RegPassivePtr (char fs_ban_del, char fs_ban_sub, char fs_ban_cop=0)
 
 RegPassivePtr (const RegPassivePtr &f)
 
RegPassivePtroperator= (const RegPassivePtr &f)
 
CountPP_ns::CountPassivePtrbook (void) const
 
void clear_pointers (void) const
 
virtual RegPassivePtrcopy () const
 
virtual ~RegPassivePtr ()
 
virtual void print (std::ostream &file, int l=1) const
 
void set_s_ban_del (char fs_ban_del)
 
char get_s_ban_del (void) const
 
void set_s_ban_sub (char fs_ban_sub)
 
char get_s_ban_sub (void) const
 
void set_s_ban_cop (char fs_ban_cop)
 
char get_s_ban_cop (void) const
 
void set_s_allow_del_at_zero_count (char fs_allow_del_at_zero_count)
 
char get_s_allow_del_at_zero_count (void) const
 
long get_total_number_of_references (void) const
 
- Public Member Functions inherited from Heed::particle_type
 particle_type ()
 
 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
 

Additional Inherited Members

- Static Public Member Functions inherited from Heed::RegPassivePtr
static void set_s_ban_del_ignore (char fs_ban_del_ignore)
 
static char get_s_ban_del_ignore (void)
 
static void set_s_print_adr_cpp (char fs_print_adr_cpp)
 
static char get_s_print_adr_cpp (void)
 
- 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 Heed::gparticle
bool s_life
 
long nstep
 Step number.
 
double total_range_from_origin
 Range from origin to currpos.
 
long n_zero_step
 Number of previous steps with zero range (including this step).
 
stvpoint origin
 
stvpoint prevpos
 
stvpoint currpos
 
stvpoint nextpos
 
vec curr_relcen
 
- Public Attributes inherited from Heed::particle_type
PassivePtr< particle_defpardef
 
- Static Public Attributes inherited from Heed::gparticle
static long max_q_zero_step = 100
 
- Protected Attributes inherited from Heed::eparticle
HeedFieldMapm_fieldMap
 

Detailed Description

Definition of the particle which can be traced through the geometry. Also the definition of cluster (energy transfer), and particle bank.

2003, I. Smirnov

Definition at line 16 of file HeedParticle.h.

Constructor & Destructor Documentation

◆ HeedParticle() [1/2]

Heed::HeedParticle::HeedParticle ( )
inline

Default constructor.

Definition at line 19 of file HeedParticle.h.

19: eparticle() {}
eparticle()
Default constructor.
Definition: eparticle.h:18

Referenced by copy().

◆ HeedParticle() [2/2]

Heed::HeedParticle::HeedParticle ( manip_absvol primvol,
const point pt,
const vec vel,
vfloat  time,
particle_def fpardef,
HeedFieldMap fieldmap,
const bool  fs_loss_only = false,
const bool  fs_print_listing = false 
)

Constructor. If fs_loss_only == false only transferred energy is simulated: no deposition of clusters, no generation of virtual photons.

Definition at line 22 of file HeedParticle.cpp.

26 : eparticle(primvol, pt, vel, time, fpardef, fieldmap),
27 s_print_listing(fs_print_listing),
28 particle_number(last_particle_number++),
29 s_loss_only(fs_loss_only),
30 s_store_clusters(false) {
31
32 mfunname("HeedParticle::HeedParticle(...)");
33 etransf.reserve(100);
34 natom.reserve(100);
35 nshell.reserve(100);
36}
#define mfunname(string)
Definition: FunNameStack.h:45
long last_particle_number
Definition: HeedParticle.h:9

◆ ~HeedParticle()

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

Destructor.

Definition at line 29 of file HeedParticle.h.

29{}

Member Function Documentation

◆ copy()

virtual HeedParticle * Heed::HeedParticle::copy ( ) const
inlinevirtual

Reimplemented from Heed::eparticle.

Definition at line 32 of file HeedParticle.h.

32{ return new HeedParticle(*this); }
HeedParticle()
Default constructor.
Definition: HeedParticle.h:19

◆ physics()

void Heed::HeedParticle::physics ( std::vector< gparticle * > &  secondaries)
virtual

Reimplemented from Heed::gparticle.

Definition at line 38 of file HeedParticle.cpp.

38 {
39 mfunname("void HeedParticle::physics()");
40 if (s_print_listing) {
41 mcout << "HeedParticle::physics is started\n";
43 }
44 etransf.clear();
45 natom.clear();
46 nshell.clear();
47 if (currpos.prange <= 0.0) return;
48 // Get local volume.
49 const absvol* av = currpos.tid.G_lavol();
50 const EnTransfCS* etcs = dynamic_cast<const EnTransfCS*>(av);
51 if (!etcs) return;
52 HeedMatterDef* hmd = etcs->hmd.getver();
53 MatterDef* matter = hmd->matter.getver();
54 EnergyMesh* emesh = hmd->energy_mesh.getver();
55 const double* aetemp = hmd->energy_mesh->get_ae();
56 PointCoorMesh<double, const double*> pcm(emesh->get_q() + 1, &(aetemp));
57 const long qa = matter->qatom();
58 if (s_print_listing) Iprintn(mcout, qa);
59 basis tempbas(currpos.dir, "tempbas");
60 for (long na = 0; na < qa; ++na) {
61 if (s_print_listing) Iprintn(mcout, na);
62 const long qs = hmd->apacs[na]->get_qshell();
63 for (long ns = 0; ns < qs; ++ns) {
64 if (s_print_listing) Iprintn(mcout, ns);
65 if (etcs->quan[na][ns] <= 0.0) continue;
66 // Sample the number of collisions for this shell.
67 int ierror = 0;
68 const long qt = pois(etcs->quan[na][ns] * currpos.prange / cm, ierror);
69 check_econd11a(ierror, == 1,
70 " etcs->quan[na][ns]=" << etcs->quan[na][ns]
71 << " currpos.prange/cm="
72 << currpos.prange / cm << '\n',
73 mcerr);
74 if (s_print_listing) Iprintn(mcout, qt);
75 if (qt <= 0) continue;
76 point curpt = prevpos.pt;
77 vec dir = unit_vec(currpos.pt - prevpos.pt);
78 const double range = (currpos.pt - prevpos.pt).length();
79 if (s_print_listing) Iprint3n(mcout, curpt, dir, range);
80 for (long nt = 0; nt < qt; ++nt) {
81 // Sample the energy transfer in this collision.
82 const double rn = SRANLUX();
83 if (s_print_listing) Iprint3n(mcout, rn, etcs, etcs->fadda[na][ns][1]);
84 const double r = t_hisran_step_ar<
85 double, std::vector<double>, PointCoorMesh<double, const double*> >(
86 pcm, etcs->fadda[na][ns], rn);
87
88 // Convert to internal units.
89 const double et = r * MeV;
90 etransf.push_back(et);
91 natom.push_back(na);
92 nshell.push_back(ns);
93 if (s_print_listing) Iprint2n(mcout, nt, et);
94 // Sample the position of the collision.
95 const double arange = SRANLUX() * range;
96 point pt = curpt + dir * arange;
97 point ptloc = pt;
98 prevpos.tid.up_absref(&ptloc);
99 if (s_loss_only) continue;
100 if (s_print_listing) mcout << "generating new cluster\n";
101 if (s_store_clusters) {
102 m_clusterBank.push_back(
103 HeedCluster(et, 0, pt, ptloc, prevpos.tid, na, ns));
104 }
105 // Generate a virtual photon.
106 const double Ep0 = mass * c_squared + curr_kin_energy;
107 const double Ep1 = Ep0 - etransf.back();
108 const double Mp = mass * c_squared;
109 const double Mt = electron_def.mass * c_squared;
110 double theta_p, theta_t;
111 theta_two_part(Ep0, Ep1, Mp, Mt, theta_p, theta_t);
112 vec vel;
113 vel.random_conic_vec(fabs(theta_t));
114 vel.down(&tempbas); // direction is OK
115 vel *= c_light;
116 // HS
117 double speed = vel.length();
118 double time = arange / speed;
119 if (s_print_listing) mcout << "generating new virtual photon\n";
120 HeedPhoton* hp = new HeedPhoton(currpos.tid.eid[0].getver(), pt, vel,
121 time, particle_number, et, m_fieldMap);
122 hp->s_photon_absorbed = true;
123 hp->s_delta_generated = false;
124 hp->na_absorbing = na;
125 hp->ns_absorbing = ns;
126 secondaries.push_back(hp);
127 }
128 }
129 }
130 if (s_print_listing) {
131 const double sum = std::accumulate(etransf.begin(), etransf.end(), 0.);
132 Iprint2n(mcout, etransf.size(), sum);
133 mcout << "Exiting HeedParticle::physics\n";
134 }
135}
#define check_econd11a(a, signb, add, stream)
Definition: FunNameStack.h:172
HeedFieldMap * m_fieldMap
Definition: eparticle.h:33
stvpoint prevpos
Definition: gparticle.h:176
stvpoint currpos
Definition: gparticle.h:177
void up_absref(absref *f)
Definition: volume.cpp:26
std::vector< PassivePtr< manip_absvol > > eid
List of volumes.
Definition: volume.h:37
absvol * G_lavol() const
Get last address of volume.
Definition: volume.cpp:17
double curr_kin_energy
Definition: mparticle.h:32
double mass
Mass (not mass * speed_of_light^2)
Definition: mparticle.h:26
vec dir
Unit vector, in the first system in the tree.
Definition: gparticle.h:25
vfloat prange
Range from previous point.
Definition: gparticle.h:46
point pt
Coordinates in the first system in the tree.
Definition: gparticle.h:23
manip_absvol_treeid tid
Definition: gparticle.h:32
long pois(const double amu, int &ierror)
Definition: pois.cpp:9
void theta_two_part(const double Ep0, const double Ep1, const double Mp, const double Mt, double &theta_p, double &theta_t)
Scattering angles as function of incident and final projectile energy.
Definition: kinem.cpp:28
T t_hisran_step_ar(const M &mesh, const D &integ_y, T rannum)
Definition: tline.h:1404
DoubleAc fabs(const DoubleAc &f)
Definition: DoubleAc.h:615
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:110
#define mcout
Definition: prstream.h:126
#define Iprint3n(file, name1, name2, name3)
Definition: prstream.h:233
#define mcerr
Definition: prstream.h:128
#define Iprintn(file, name)
Definition: prstream.h:205
#define Iprint2n(file, name1, name2)
Definition: prstream.h:220

◆ print()

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

Reimplemented from Heed::eparticle.

Definition at line 137 of file HeedParticle.cpp.

137 {
138 if (l < 0) return;
139 Ifile << "HeedParticle (l=" << l << "): particle_number=" << particle_number
140 << " type=";
141 print_notation(file);
142 file << std::endl;
143 if (l == 1) return;
144 mparticle::print(file, l - 1);
145 const double sum = std::accumulate(etransf.begin(), etransf.end(), 0.);
146 Iprintn(mcout, sum);
147 Iprintn(mcout, etransf.size());
148 if (l >= 5) {
149 Ifile << " nt natom nshell transferred energy\n";
150 const long qt = etransf.size();
151 for (long nt = 0; nt < qt; nt++) {
152 Ifile << std::setw(3) << nt << ' ' << std::setw(3) << natom[nt] << ' '
153 << std::setw(3) << nshell[nt] << ' ' << std::setw(12) << etransf[nt]
154 << '\n';
155 }
156 }
157}
virtual void print(std::ostream &file, int l) const
Definition: mparticle.cpp:242
void print_notation(std::ostream &file) const
#define Ifile
Definition: prstream.h:196

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