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

#include <PhotoAbsCS.h>

Public Member Functions

 AtomicSecondaryProducts ()
 Constructor.
 
 ~AtomicSecondaryProducts ()
 Destructor.
 
int get_channel (std::vector< double > &felectron_energy, std::vector< double > &fphoton_energy) const
 
void add_channel (double fchannel_prob_dens, const std::vector< double > &felectron_energy, const std::vector< double > &fphoton_energy, int s_all_rest=0)
 
void print (std::ostream &file, int l) const
 

Protected Attributes

std::vector< double > channel_prob_dens
 
std::vector< std::vector< double > > electron_energy
 
std::vector< std::vector< double > > photon_energy
 

Detailed Description

Sampling of secondary particles. The initial photo-electron is not included. The photo-electron is completely independent on the secondary channel and it always has an energy equal to transferred energy minus shell energy. This class proposes particles which can be emitted at filling this shell. This class can be interpreted as an additional channels for the default one. The sum of channel_prob_dens may be less than unity. The concrete channel for the particular event is sampled by get_channel(). If the random sampling does not point to one of the channels registering in this class, get_channel returns 0, which must be interpreted as the use of standard channel.

Definition at line 250 of file PhotoAbsCS.h.

Constructor & Destructor Documentation

◆ AtomicSecondaryProducts()

Heed::AtomicSecondaryProducts::AtomicSecondaryProducts ( )
inline

Constructor.

Definition at line 253 of file PhotoAbsCS.h.

std::vector< std::vector< double > > electron_energy
Definition: PhotoAbsCS.h:281
std::vector< std::vector< double > > photon_energy
Definition: PhotoAbsCS.h:282
std::vector< double > channel_prob_dens
Definition: PhotoAbsCS.h:279

◆ ~AtomicSecondaryProducts()

Heed::AtomicSecondaryProducts::~AtomicSecondaryProducts ( )
inline

Destructor.

Definition at line 256 of file PhotoAbsCS.h.

256{}

Member Function Documentation

◆ add_channel()

void Heed::AtomicSecondaryProducts::add_channel ( double  fchannel_prob_dens,
const std::vector< double > &  felectron_energy,
const std::vector< double > &  fphoton_energy,
int  s_all_rest = 0 
)

Add new decay channel. Should be used at initialization.

Parameters
fchannel_prob_densprobability for this channel.
felectron_energyelectron energies [MeV]
fphoton_energyphoton energies [MeV]
s_all_restif 1, the probability of this channel is assigned to that what is left to 1. fchannel_prob_dens is then ignored, it can be just 0.

Definition at line 469 of file PhotoAbsCS.cpp.

471 {
472 mfunnamep("void AtomicSecondaryProducts::add_channel(...)");
473 check_econd21(fchannel_prob_dens, < 0.0 ||, > 1.0, mcerr);
474 long q_old = channel_prob_dens.size();
475 long q_new = q_old + 1;
476 channel_prob_dens.resize(q_new);
477 electron_energy.resize(q_new);
478 photon_energy.resize(q_new);
479 if (s_all_rest == 1) {
480 double s = 0.0;
481 for (long n = 0; n < q_old; ++n) {
482 s += channel_prob_dens[n];
483 }
484 check_econd21(s, < 0.0 ||, > 1.0, mcerr);
485 fchannel_prob_dens = 1.0 - s;
486 }
487 channel_prob_dens[q_old] = fchannel_prob_dens;
488 electron_energy[q_old] = felectron_energy;
489 photon_energy[q_old] = fphoton_energy;
490 double s = 0.0;
491 for (long n = 0; n < q_new; ++n) {
492 s += channel_prob_dens[n];
493 }
494 if (s > 1.0) {
495 funnw.ehdr(mcerr);
496 mcerr << "s > 1.0, s=" << s << '\n';
497 Iprintn(mcerr, q_new);
498 for (long n = 0; n < q_new; ++n) {
499 mcerr << "n=" << n << " channel_prob_dens[n]=" << channel_prob_dens[n]
500 << '\n';
501 }
502 spexit(mcerr);
503 }
504}
#define check_econd21(a, sign1_b1_sign0, sign2_b2, stream)
Definition: FunNameStack.h:191
#define mfunnamep(string)
Definition: FunNameStack.h:49
#define spexit(stream)
Definition: FunNameStack.h:256
#define mcerr
Definition: prstream.h:128
#define Iprintn(file, name)
Definition: prstream.h:204

◆ get_channel()

int Heed::AtomicSecondaryProducts::get_channel ( std::vector< double > &  felectron_energy,
std::vector< double > &  fphoton_energy 
) const

Sample a channel (photon and electron energies in MeV). Return 1 if the channel is generated and 0 if not.

Definition at line 506 of file PhotoAbsCS.cpp.

508 {
509 mfunname("int AtomicSecondaryProducts::get_channel(...)");
510#ifdef DEBUG_PRINT_get_escape_particles
511 mcout << "AtomicSecondaryProducts::get_channel is started\n";
513#endif
514 if (channel_prob_dens.empty()) return 0;
515 int ir = 0;
516 double rn = SRANLUX();
517#ifdef DEBUG_PRINT_get_escape_particles
518 Iprintn(mcout, rn);
519#endif
520 if (channel_prob_dens.size() == 1) {
521 if (rn < channel_prob_dens[0]) {
522 felectron_energy = electron_energy[0];
523 fphoton_energy = photon_energy[0];
524 ir = 1;
525 }
526 } else {
527 long q = channel_prob_dens.size();
528 double s = 0.0;
529 for (long n = 0; n < q; ++n) {
530 s += channel_prob_dens[n];
531 if (rn <= s) {
532 felectron_energy = electron_energy[n];
533 fphoton_energy = photon_energy[n];
534 ir = 1;
535#ifdef DEBUG_PRINT_get_escape_particles
536 Iprint2n(mcout, n, s);
537#endif
538 break;
539 }
540 }
541 }
542#ifdef DEBUG_PRINT_get_escape_particles
543 mcout << "AtomicSecondaryProducts::get_channel is finishing\n";
544 Iprintn(mcout, ir);
545#endif
546 return ir;
547}
#define mfunname(string)
Definition: FunNameStack.h:45
#define mcout
Definition: prstream.h:126
#define Iprint2n(file, name1, name2)
Definition: prstream.h:219

◆ print()

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

Definition at line 549 of file PhotoAbsCS.cpp.

549 {
550 if (l <= 0) return;
551 Ifile << "AtomicSecondaryProducts(l=" << l << "):\n";
552 const long q = channel_prob_dens.size();
553 Ifile << "number of channels=" << q << '\n';
554 indn.n += 2;
555 for (long n = 0; n < q; ++n) {
556 Ifile << "n_channel=" << n << " probability=" << channel_prob_dens[n]
557 << '\n';
558 indn.n += 2;
559 long qel = electron_energy[n].size();
560 Ifile << "number of electrons=" << qel << '\n';
561 indn.n += 2;
562 for (long nel = 0; nel < qel; ++nel) {
563 Ifile << "nel=" << nel << " electron_energy=" << electron_energy[n][nel]
564 << '\n';
565 }
566 indn.n -= 2;
567 long qph = photon_energy[n].size();
568 Ifile << "number of photons=" << qph << '\n';
569 indn.n += 2;
570 for (long nph = 0; nph < qph; ++nph) {
571 Ifile << "nph=" << nph << " photon_energy=" << photon_energy[n][nph]
572 << '\n';
573 }
574 indn.n -= 2;
575 indn.n -= 2;
576 }
577 indn.n -= 2;
578}
indentation indn
Definition: prstream.cpp:15
#define Ifile
Definition: prstream.h:195

Member Data Documentation

◆ channel_prob_dens

std::vector<double> Heed::AtomicSecondaryProducts::channel_prob_dens
protected

Definition at line 279 of file PhotoAbsCS.h.

Referenced by add_channel(), get_channel(), and print().

◆ electron_energy

std::vector<std::vector<double> > Heed::AtomicSecondaryProducts::electron_energy
protected

Definition at line 281 of file PhotoAbsCS.h.

Referenced by add_channel(), get_channel(), and print().

◆ photon_energy

std::vector<std::vector<double> > Heed::AtomicSecondaryProducts::photon_energy
protected

Definition at line 282 of file PhotoAbsCS.h.

Referenced by add_channel(), get_channel(), and print().


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