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_BGM Class Reference

#include <HeedParticle_BGM.h>

+ Inheritance diagram for Heed::HeedParticle_BGM:

Public Member Functions

 HeedParticle_BGM ()
 Default constructor.
 
 HeedParticle_BGM (manip_absvol *primvol, const point &pt, const vec &vel, vfloat time, particle_def *fpardef, HeedFieldMap *fieldmap, bool fs_loss_only=false, bool fs_print_listing=false)
 
virtual ~HeedParticle_BGM ()
 Destructor.
 
virtual void physics (std::vector< gparticle * > &secondaries)
 
virtual void print (std::ostream &file, int l) const
 
virtual HeedParticle_BGMcopy () 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. 2003, I. Smirnov

Definition at line 14 of file HeedParticle_BGM.h.

Constructor & Destructor Documentation

◆ HeedParticle_BGM() [1/2]

Heed::HeedParticle_BGM::HeedParticle_BGM ( )
inline

Default constructor.

Definition at line 17 of file HeedParticle_BGM.h.

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

Referenced by copy().

◆ HeedParticle_BGM() [2/2]

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

Constructor. if fs_loss_only == 1 - only transfer energy and no other physics: no deposition of clusters, no generation of virtual photons. Thus it is just a PAI without even clusters

Definition at line 22 of file HeedParticle_BGM.cpp.

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

◆ ~HeedParticle_BGM()

virtual Heed::HeedParticle_BGM::~HeedParticle_BGM ( )
inlinevirtual

Destructor.

Definition at line 27 of file HeedParticle_BGM.h.

27{}

Member Function Documentation

◆ copy()

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

Reimplemented from Heed::eparticle.

Definition at line 31 of file HeedParticle_BGM.h.

31{ return new HeedParticle_BGM(*this); }
HeedParticle_BGM()
Default constructor.

◆ physics()

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

Reimplemented from Heed::gparticle.

Definition at line 39 of file HeedParticle_BGM.cpp.

39 {
40 mfunname("void HeedParticle_BGM::physics()");
41 if (s_print_listing) {
42 mcout << "HeedParticle_BGM::physics is started\n";
44 }
45 etransf.clear();
46 natom.clear();
47 nshell.clear();
48 if (currpos.prange <= 0.0) return;
49 // Get least address of volume
50 const absvol* av = currpos.tid.G_lavol();
51 const EnTransfCS_BGM* etcs = dynamic_cast<const EnTransfCS_BGM*>(av);
52 // Check if dynamic cast was successful.
53 if (!etcs) return;
54 HeedMatterDef* hmd = etcs->hmd.getver();
55 MatterDef* matter = hmd->matter.getver();
56 EnergyMesh* emesh = hmd->energy_mesh.getver();
57 const double* aetemp = hmd->energy_mesh->get_ae();
58 PointCoorMesh<double, const double*> pcm_e(emesh->get_q() + 1, &(aetemp));
59
60 const double bg = sqrt(curr_gamma_1 * (curr_gamma_1 + 2.0));
61 PointCoorMesh<double, std::vector<double> > pcm(etcs->mesh->q,
62 &(etcs->mesh->x));
63 long n1, n2;
64 double b1, b2;
65 int s_ret = pcm.get_interval(bg, n1, b1, n2, b2);
66 if (s_ret != 1) {
67 mcerr << "ERROR in void HeedParticle_BGM::physics()\n";
68 mcerr << "beta*gamma is outside range of cross-section table\n";
69 std::streamsize old_prec = mcerr.precision(15);
71 mcerr.precision(old_prec);
72 Iprint2n(mcerr, n1, n2);
73 Iprint2n(mcerr, b1, b2);
74 Iprintn(mcerr, etcs->mesh);
75 mcerr << "This particle is:\n";
76 print(mcerr, 2);
77 mcerr << "This volume is:\n";
78 av->print(mcerr, 2);
80 return;
81 }
82
83 const long qa = matter->qatom();
84 if (s_print_listing) Iprintn(mcout, qa);
85 basis tempbas(currpos.dir, "tempbas");
86 for (long na = 0; na < qa; ++na) {
87 if (s_print_listing) Iprintn(mcout, na);
88 long qs = hmd->apacs[na]->get_qshell();
89 for (long ns = 0; ns < qs; ++ns) {
90 if (s_print_listing) Iprintn(mcout, ns);
91 const double y1 = etcs->etcs_bgm[n1].quan[na][ns];
92 const double y2 = etcs->etcs_bgm[n2].quan[na][ns];
93 const double mean_pois = y1 + (bg - b1) * (y2 - y1) / (b2 - b1);
94 if (mean_pois <= 0.) continue;
95 int ierror;
96 long qt = pois(mean_pois * currpos.prange / cm, ierror);
97 check_econd11a(ierror, == 1, " mean_pois=" << mean_pois
98 << " currpos.prange/cm="
99 << currpos.prange / cm << '\n',
100 mcerr);
101 if (s_print_listing) Iprintn(mcout, qt);
102 if (qt <= 0) continue;
103 point curpt = prevpos.pt;
104 vec dir = unit_vec(currpos.pt - prevpos.pt);
105 // This approximation ignores curvature
106 const double range = (currpos.pt - prevpos.pt).length();
107 if (s_print_listing) Iprint3n(mcout, curpt, dir, range);
108 for (long nt = 0; nt < qt; nt++) {
109 // Sample the energy transfer in this collision.
110 double rn = SRANLUX();
111 const double r1 = t_hisran_step_ar<
112 double, std::vector<double>, PointCoorMesh<double, const double*> >(
113 pcm_e, etcs->etcs_bgm[n1].fadda[na][ns], rn);
114 const double r2 = t_hisran_step_ar<
115 double, std::vector<double>, PointCoorMesh<double, const double*> >(
116 pcm_e, etcs->etcs_bgm[n2].fadda[na][ns], rn);
117 const double r = r1 + (bg - b1) * (r2 - r1) / (b2 - b1);
118 if (s_print_listing) {
119 Iprintn(mcout, rn);
120 Iprint3n(mcout, r1, r2, r);
121 }
122 // Convert to internal units.
123 const double et = r * MeV;
124 etransf.push_back(et);
125 natom.push_back(na);
126 nshell.push_back(ns);
127 if (s_print_listing) Iprint2n(mcout, nt, et);
128 // Sample the position of the collision.
129 const double arange = SRANLUX() * range;
130 point pt = curpt + dir * arange;
131 point ptloc = pt;
132 prevpos.tid.up_absref(&ptloc);
133 if (s_loss_only) continue;
134 if (s_print_listing) mcout << "generating new cluster\n";
135 m_clusterBank.push_back(
136 HeedCluster(et, 0, pt, ptloc, prevpos.tid, na, ns));
137 // Generate a virtual photon.
138 const double Ep0 = mass * c_squared + curr_kin_energy;
139 const double Ep1 = Ep0 - etransf.back();
140 const double Mp = mass * c_squared;
141 const double Mt = electron_def.mass * c_squared;
142 double theta_p, theta_t;
143 theta_two_part(Ep0, Ep1, Mp, Mt, theta_p, theta_t);
144 vec vel;
145 vel.random_conic_vec(fabs(theta_t));
146 vel.down(&tempbas); // direction is OK
147 vel *= c_light;
148 if (s_print_listing) mcout << "generating new virtual photon\n";
149 HeedPhoton* hp =
150 new HeedPhoton(currpos.tid.eid[0].getver(), pt, vel, currpos.time,
151 particle_number, et, m_fieldMap);
152 hp->s_photon_absorbed = true;
153 hp->s_delta_generated = false;
154 hp->na_absorbing = na;
155 hp->ns_absorbing = ns;
156 secondaries.push_back(hp);
157 }
158 }
159 }
160 if (s_print_listing) {
161 const double sum = std::accumulate(etransf.begin(), etransf.end(), 0.);
162 Iprint2n(mcout, etransf.size(), sum);
163 mcout << "Exiting HeedParticle_BGM::physics\n";
164 }
165}
#define check_econd11a(a, signb, add, stream)
Definition: FunNameStack.h:172
#define spexit(stream)
Definition: FunNameStack.h:256
virtual void print(std::ostream &file, int l) const
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
double curr_gamma_1
Definition: mparticle.h:33
vfloat time
Definition: gparticle.h:47
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
DoubleAc sqrt(const DoubleAc &f)
Definition: DoubleAc.cpp:314
#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_BGM::print ( std::ostream &  file,
int  l 
) const
virtual

Reimplemented from Heed::eparticle.

Definition at line 167 of file HeedParticle_BGM.cpp.

167 {
168 if (l < 0) return;
169 Ifile << "HeedParticle_BGM (l=" << l
170 << "): particle_number=" << particle_number << " type=";
171 print_notation(file);
172 file << std::endl;
173 if (l == 1) return;
174 mparticle::print(file, l - 1);
175 const double sum = std::accumulate(etransf.begin(), etransf.end(), 0.);
176 Iprintn(mcout, sum);
177 Iprintn(mcout, etransf.size());
178 if (l >= 5) {
179 Ifile << " nt natom nshell etransf\n";
180 const long qt = etransf.size();
181 for (long nt = 0; nt < qt; nt++) {
182 Ifile << std::setw(3) << nt << ' ' << std::setw(3) << natom[nt] << ' '
183 << std::setw(3) << nshell[nt] << ' ' << std::setw(12) << etransf[nt]
184 << '\n';
185 }
186 }
187}
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

Referenced by physics().


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