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

#include <HeedParticle_BGM.h>

+ Inheritance diagram for Heed::HeedParticle_BGM:

Public Member Functions

 HeedParticle_BGM (manip_absvol *primvol, const point &pt, const vec &vel, vfloat time, particle_def *fpardef, int fs_loss_only=0, int fs_print_listing=0)
 
virtual void physics (void)
 
 HeedParticle_BGM (void)
 
virtual void print (std::ostream &file, int l) const
 
 macro_copy_total (HeedParticle_BGM)
 
virtual ~HeedParticle_BGM ()
 
- 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_BGM.h.

Constructor & Destructor Documentation

◆ HeedParticle_BGM() [1/2]

Heed::HeedParticle_BGM::HeedParticle_BGM ( 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 20 of file HeedParticle_BGM.cpp.

24 : eparticle(primvol, pt, vel, time, fpardef),
25 transferred_energy_in_step(0.0), // tnpi_in_step(0),
26 qtransfer(0),
27 s_loss_only(fs_loss_only),
28 s_print_listing(fs_print_listing) {
29 mfunname("HeedParticle_BGM::HeedParticle_BGM(...)");
32 //set_count_references();
36}
#define mfunname(string)
Definition: FunNameStack.h:67
void allocate_block(long fqel)
Definition: BlkArr.h:231
BlkArr< double > transferred_energy
eparticle(void)
Constructors.
Definition: eparticle.h:19
long last_particle_number
Definition: HeedParticle.h:26

◆ HeedParticle_BGM() [2/2]

Heed::HeedParticle_BGM::HeedParticle_BGM ( void  )
inline

Definition at line 43 of file HeedParticle_BGM.h.

43: eparticle() { ; }

◆ ~HeedParticle_BGM()

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

Definition at line 46 of file HeedParticle_BGM.h.

46{ ; }

Member Function Documentation

◆ macro_copy_total()

Heed::HeedParticle_BGM::macro_copy_total ( HeedParticle_BGM  )

◆ physics()

void Heed::HeedParticle_BGM::physics ( void  )
virtual

Reimplemented from Heed::mparticle.

Definition at line 38 of file HeedParticle_BGM.cpp.

38 {
39 mfunname("void HeedParticle_BGM::physics(void)");
40 if (s_print_listing == 1) {
41 mcout << "HeedParticle_BGM::physics is started\n";
43 }
45 //tnpi_in_step = 0;
46 qtransfer = 0;
50 if (currpos.prange <= 0.0) return;
51 const absvol* av = currpos.G_lavol(); // get least address of volume
52 const EnTransfCS_BGM_Type* etcs_bgm_t =
53 dynamic_cast<const EnTransfCS_BGM_Type*>(av);
54 if (etcs_bgm_t == NULL) {
55 //mcout<<"HeedParticle_BGM::physics: "
56 //<<"dynamic_cast is not successful, return 0\n";
57 //av->chname(name);
58 //mcout<<"name="<<name<<'\n';
59 return;
60 } else {
61 //mcout<<"HeedParticle_BGM::physics: proceeding well\n";
62 // All these objects are expected to exist till the end of this function,
63 // if they exist now:
64 EnTransfCS_BGM* aetcs_bgm = etcs_bgm_t->etcs_bgm.getver();
65 HeedMatterDef* ahmd = aetcs_bgm->hmd.getver();
66 MatterDef* amatter = ahmd->matter.getver();
67 EnergyMesh* a_energy_mesh = ahmd->energy_mesh.getver();
68 const double* aetemp = ahmd->energy_mesh->get_ae();
69 PointCoorMesh<double, const double*> pcm_e(a_energy_mesh->get_q() + 1,
70 &(aetemp));
71 //double emin = hmd->energy_mesh->get_emin();
72 //double emax = hmd->energy_mesh->get_emax();
73
74 //transferred_energy.put_qel(10, 0.0);
75 //natom.put_qel(100, 0);
76 //nshell.put_qel(100, 0);
77 long qa = amatter->qatom();
78 //long qa = etcst->etcs->hmd->matter->qatom();
79 if (s_print_listing == 1) {
80 Iprintn(mcout, qa);
81 }
82 long na;
83 long qe = a_energy_mesh->get_q();
84 //long qe = ahmd->energy_mesh->get_q();
85 //long qe = etcst->etcs->hmd->energy_mesh->get_q();
86 basis tempbas(currpos.dir, "tempbas");
87 for (na = 0; na < qa; na++) {
88 if (s_print_listing == 1) {
89 Iprintn(mcout, na);
90 }
91 long qs = ahmd->apacs[na]->get_qshell();
92 //long qs = etcst->etcs->hmd->apacs[na]->get_qshell();
93 long ns;
94 for (ns = 0; ns < qs; ns++) {
95 if (s_print_listing == 1) {
96 Iprintn(mcout, ns);
97 }
98 long qt = 0;
99
100#ifdef SINGLE_TRANSFER
101 if (aetcs == aetcs_single_transf && na == na_single_transf &&
102 ns == ns_single_transf) {
103 qt = 1;
104 }
105#else
106 double bg = sqrt(curr_gamma_1 * (curr_gamma_1 + 2.0));
107
108 //streamsize old_prec = mcout.precision(15);
109 //Iprint2n(mcout, curr_gamma_1, bg);
110 //mcout.precision(old_prec);
111
112 PointCoorMesh<double, DynLinArr<double> > pcm(aetcs_bgm->mesh->q,
113 &(aetcs_bgm->mesh->x));
114
115 long n1;
116 long n2;
117 double b1;
118 double b2;
119
120 int s_ret = pcm.get_interval(bg, n1, b1, n2, b2);
121 if (s_ret != 1) {
122 mcerr << "ERROR in void HeedParticle_BGM::physics(void)\n";
123 mcerr << "betta*gamma is outside range of Cross Section table\n";
124
125 std::streamsize old_prec = mcerr.precision(15);
127 mcerr.precision(old_prec);
128 Iprint2n(mcerr, n1, n2);
129 Iprint2n(mcerr, b1, b2);
130 Iprintn(mcerr, aetcs_bgm->mesh);
131 mcerr << "This particle is:\n";
132 print(mcerr, 2);
133 mcerr << "This volume is:\n";
134 av->print(mcerr, 2);
135 funnw.ehdr(mcerr);
136 spexit(mcerr);
137 }
138
139 //check_econd11a(s_ret , != 1 ,
140 // "bg="<<bg<<" n1="<<n1<<" n2="<<n2<<" b1="<<b1<<" b2="<<b2<<"
141 //aetcs_bgm->mesh="<<aetcs_bgm->mesh<<'\n',
142 // mcerr);
143 double y1 = aetcs_bgm->etcs_bgm[n1].quan[na][ns];
144 double y2 = aetcs_bgm->etcs_bgm[n2].quan[na][ns];
145
146 double mean_pois = y1 + (bg - b1) * (y2 - y1) / (b2 - b1);
147
148 if (mean_pois > 0.0)
149 //if(etcst->etcs->quan[na][ns] > 0.0)
150 {
151 int ierror;
152 //Iprintn(mcout, etcst->etcs->quan[na][ns]);
153 qt = pois(mean_pois * currpos.prange / cm, ierror);
154 //qt = pois( etcst->etcs->quan[na][ns] * currpos.prange/cm, ierror);
155 //Iprintn(mcout, qt);
156 check_econd11a(ierror, == 1,
157 " mean_pois=" << mean_pois << " currpos.prange/cm="
158 << currpos.prange / cm << '\n',
159 mcerr);
160 }
161#endif
162 if (s_print_listing == 1) {
163 Iprintn(mcout, qt);
164 }
165
166 if (qt > 0) {
167 point curpt = prevpos.pt;
168 //Iprint(mcout, curpt);
169 vec dir = unit_vec(currpos.pt - prevpos.pt);
170 //Iprint(mcout, dir);
171 // this approximation ignores curvature
172 double range = length(currpos.pt - prevpos.pt);
173 //Iprintn(mcout, range);
174 if (s_print_listing == 1) {
175 Iprint(mcout, curpt);
176 Iprint(mcout, dir);
177 Iprintn(mcout, range);
178 }
179 long nt;
180 for (nt = 0; nt < qt; nt++) {
181//if(s_print_listing == 1)
182//{
183// Iprintn(mcout, nt);
184//}
185//if(qtransfer == transferred_energy.get_qel())
186//{
187// transferred_energy.put_qel(2 * qtransfer);
188// natom.put_qel(2 * qtransfer);
189// nshell.put_qel(2 * qtransfer);
190//}
191#ifdef SINGLE_TRANSFER
192 transferred_energy.append(ener_single_transf);
193#else
194 double rn = SRANLUX();
195 /*
196 double r = chisran(rn, aetcs->fadda[na][ns]);
197 //double r = chisran(rn, etcst->etcs->fadda[na][ns]);
198 long nr = left_round(r);
199 check_econd21( nr , < 0 || , > qe , mcout);
200 double e1 = a_energy_mesh->get_e(nr);
201 double e2 = a_energy_mesh->get_e(nr+1);
202 //double e1 = etcst->etcs->hmd->energy_mesh->get_e(nr);
203 //double e2 = etcst->etcs->hmd->energy_mesh->get_e(nr+1);
204 double dr = r - nr;
205 transferred_energy.append( (e1 + (e2 - e1) * dr) * MeV );
206 //transferred_energy[qtransfer] = (e1 + (e2 - e1) * dr) * MeV;
207 if(s_print_listing == 1)
208 {
209 Iprint2n(mcout, r, nr);
210 Iprint2n(mcout, e1, e2);
211 Iprintn(mcout, dr);
212 }
213 */
214
215 double r1 = t_hisran_step_ar<double, DynLinArr<double>,
217 pcm_e, aetcs_bgm->etcs_bgm[n1].fadda[na][ns], rn);
218 double r2 = t_hisran_step_ar<double, DynLinArr<double>,
220 pcm_e, aetcs_bgm->etcs_bgm[n2].fadda[na][ns], rn);
221 double r = r1 + (bg - b1) * (r2 - r1) / (b2 - b1);
222 if (s_print_listing == 1) {
223 Iprintn(mcout, rn);
224 Iprint3n(mcout, r1, r2, r);
225 //Iprintn(mcout, aetcs->fadda[na][ns][1]);
226 }
227 transferred_energy.append(r * MeV); // and passing to
228 // internal units
229#endif
230 if (s_print_listing == 1) {
232 }
234 natom.append(na);
235 nshell.append(ns);
236//natom[qtransfer] = na;
237//nshell[qtransfer] = ns;
238#ifdef SINGLE_TRANSFER
239 double arange = 0.5 * range;
240#else
241 double arange = SRANLUX() * range;
242#endif
243 point pt = curpt + dir * arange;
244 //Iprint(mcout, pt);
245 point ptloc = pt;
246 prevpos.tid.up_absref(&ptloc);
247 qtransfer++;
248 if (s_loss_only == 0) {
249 if (s_print_listing == 1) {
250 mcout << "generating new cluster\n";
251 }
252 cluster_bank.append(
253 HeedCluster(transferred_energy[qtransfer - 1], 0, pt, ptloc,
254 prevpos.tid, na, ns));
255 /*
256 cluster_bank.insert_after
257 ( cluster_bank.get_last_node(),
258 HeedCluster( transferred_energy[qtransfer-1],
259 0,
260 pt,
261 ptloc,
262 prevpos.tid,
263 na,
264 ns) );
265 */
266 vec vel;
267 double Ep0 = mass * c_squared + curr_kin_energy;
268 double Ep1 = Ep0 - transferred_energy[qtransfer - 1];
269 double Mp = mass;
270 double Mt = electron_def.mass;
271 double theta_p, theta_t;
272 //mcout<<"Ep0/MeV="<<Ep0/MeV<<" Ep1/MeV="<<Ep1/MeV
273 // <<" (Ep0 - Ep1)/MeV="<<(Ep0 - Ep1)/MeV
274 // <<" Mp*c_squared/MeV="<<Mp*c_squared/MeV
275 // <<" Mt*c_squared/MeV="<<Mt*c_squared/MeV<<endl;
276 theta_two_part(Ep0, Ep1, Mp, Mt, theta_p, theta_t);
277 //mcout<<"theta_p/M_PI * 180.0="<<theta_p/M_PI * 180.0
278 // <<" theta_t/M_PI * 180.0="<<theta_t/M_PI * 180.0<<endl;
279 vel.random_conic_vec(fabs(theta_t));
280 vel.down(&tempbas); // direction is OK
281 vel *= c_light;
282 if (s_print_listing == 1) {
283 mcout << "generating new virtual photon\n";
284 }
285 HeedPhoton hp(currpos.tid.eid[0].amvol.getver(),
286 //currpos.tid.eid[0].amvol.get(),
287 pt, vel, currpos.time, particle_number,
288 //PassivePtr< gparticle > (this),
290 hp.s_photon_absorbed = 1;
291 hp.s_delta_generated = 0;
292 hp.na_absorbing = na;
293 hp.ns_absorbing = ns;
294 ActivePtr<gparticle> ac;
295 ac.put(&hp);
296
297 particle_bank.insert_after(particle_bank.get_last_node(), ac);
298 }
299 }
300 }
301 }
302 }
303 }
304 if (s_print_listing == 1) {
306 mcout << "Exiting HeedParticle_BGM::physics\n";
307 }
308}
DoubleAc sqrt(const DoubleAc &f)
Definition: DoubleAc.cpp:313
DoubleAc fabs(const DoubleAc &f)
Definition: DoubleAc.h:616
#define check_econd11a(a, signb, add, stream)
Definition: FunNameStack.h:395
#define spexit(stream)
Definition: FunNameStack.h:536
void append(const T &val)
Definition: BlkArr.h:205
virtual void print(std::ostream &file, int l) const
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
Definition: volume.h:91
virtual void print(std::ostream &file, int l) const
Definition: volume.cpp:144
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
vfloat time
Definition: gparticle.h:55
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 Iprint3n(file, name1, name2, name3)
Definition: prstream.h:249
#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_BGM::print ( std::ostream &  file,
int  l 
) const
virtual

Reimplemented from Heed::eparticle.

Definition at line 310 of file HeedParticle_BGM.cpp.

310 {
311 if (l >= 0) {
312 Ifile << "HeedParticle_BGM (l=" << l
313 << "): particle_number=" << particle_number << " type=";
314 print_notation(file);
315 file << std::endl;
316 if (l == 1) return;
317 //file<<'\n';
318 mparticle::print(file, l - 1);
321 if (l >= 5) {
322 long nt;
323 Ifile << " nt natom nshell transferred_energy\n";
324
325 for (nt = 0; nt < qtransfer; nt++) {
326 Ifile << std::setw(3) << nt << ' ' << std::setw(3) << natom[nt] << ' ' << std::setw(3)
327 << nshell[nt] << ' ' << std::setw(12) << transferred_energy[nt]
328 << '\n';
329 }
330 }
331 }
332
333}
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

Referenced by physics().

Member Data Documentation

◆ natom

BlkArr<long> Heed::HeedParticle_BGM::natom

Definition at line 52 of file HeedParticle_BGM.h.

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

◆ nshell

BlkArr<long> Heed::HeedParticle_BGM::nshell

Definition at line 53 of file HeedParticle_BGM.h.

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

◆ particle_number

long Heed::HeedParticle_BGM::particle_number

Definition at line 33 of file HeedParticle_BGM.h.

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

◆ qtransfer

long Heed::HeedParticle_BGM::qtransfer

Definition at line 49 of file HeedParticle_BGM.h.

Referenced by physics(), and print().

◆ s_loss_only

int Heed::HeedParticle_BGM::s_loss_only

Definition at line 50 of file HeedParticle_BGM.h.

Referenced by physics().

◆ s_print_listing

int Heed::HeedParticle_BGM::s_print_listing

Definition at line 32 of file HeedParticle_BGM.h.

Referenced by physics().

◆ transferred_energy

BlkArr<double> Heed::HeedParticle_BGM::transferred_energy

Definition at line 51 of file HeedParticle_BGM.h.

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

◆ transferred_energy_in_step

double Heed::HeedParticle_BGM::transferred_energy_in_step

Definition at line 47 of file HeedParticle_BGM.h.

Referenced by physics(), and print().


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