20using CLHEP::electron_mass_c2;
24 vfloat time,
long fparent_particle_number,
26 const bool fs_print_listing)
29 parent_particle_number(fparent_particle_number),
31 s_photon_absorbed(false),
35 s_delta_generated(false),
36 s_print_listing(fs_print_listing),
37 m_fieldMap(fieldmap) {
38 mfunname(
"HeedPhoton::HeedPhoton(...)");
39 double length_vel = vel.
length();
45 mfunname(
"void HeedPhoton::physics()");
46 if (s_print_listing)
mcout <<
"HeedPhoton::physics() starts\n";
55 hmd = etcs->
hmd.getver();
59 if (hdecs) hmd = hdecs->
hmd.get();
64 std::vector<double> cs;
65 std::vector<long> nat;
66 std::vector<long> nsh;
68 const long qa = hmd->
matter->qatom();
69 for (
long na = 0; na < qa; na++) {
70 const long qs = hmd->
apacs[na]->get_qshell();
71 const double awq = hmd->
matter->weight_quan(na);
72 for (
long ns = 0; ns < qs; ns++) {
73 cs.push_back(hmd->
apacs[na]->get_ICS(ns,
energy) * awq);
83 s = s * 1.0e-18 * Avogadro / (hmd->
matter->A_mean() / (gram / mole)) *
84 hmd->
matter->density() / (gram / cm3);
86 const double path_length = 1.0 / s;
89 const double xleng = -path_length * log(1.0 - SRANLUX());
100 const double r =
chisran(SRANLUX(), cs);
101 const long n = std::min(std::max(
long(r), 0L),
long(cs.size() - 1));
113 mfunname(
"void HeedPhoton::physics_after_new_speed()");
114 if (s_print_listing)
mcout <<
"HeedPhoton::physics_after_new_speed starts\n";
124 hmd = etcs->
hmd.getver();
128 if (hdecs) hmd = hdecs->
hmd.get();
133 std::vector<double> el_energy;
134 std::vector<double> ph_energy;
137 if (s_print_listing) {
138 mcout <<
"The condition:\n";
140 mcout <<
"The decay products:\n";
141 for (
unsigned int k = 0; k < el_energy.size(); ++k)
142 mcout << el_energy[k] <<
"\n";
143 for (
unsigned int k = 0; k < ph_energy.size(); ++k)
144 mcout << ph_energy[k] <<
"\n";
146 const long qel = el_energy.size();
147 for (
long nel = 0; nel < qel; nel++) {
152 if (s_sfer_photoel == 1) {
163 const double gam_1 = el_energy[nel] / electron_mass_c2;
164 const double inv = 1.0 / (gam_1 + 1.0);
165 const double beta =
sqrt(1.0 - inv * inv);
166 const double mod_v = beta * c_light;
168 if (s_print_listing) {
169 mcout <<
"Initializing delta electron\n";
175 secondaries.push_back(hd);
177 const long qph = ph_energy.size();
178 for (
long nph = 0; nph < qph; nph++) {
182 if (s_print_listing) {
183 mcout <<
"Initializing photon\n";
188 ph_energy[nph], m_fieldMap);
189 secondaries.push_back(hp);
193 if (s_print_listing)
mcout <<
"HeedPhoton::physics_after_new_speed exited\n";
199 <<
" energy=" <<
energy <<
"MeV\n";
206 <<
" s_sfer_photoel=" << s_sfer_photoel
209 <<
" s_print_listing=" << s_print_listing <<
'\n';
#define check_econd11(a, signb, stream)
PassivePtr< HeedMatterDef > hmd
PassivePtr< HeedMatterDef > hmd
Retrieve electric and magnetic field from Sensor.
std::vector< PassivePtr< const AtomPhotoAbsCS > > apacs
PassivePtr< MatterDef > matter
virtual void physics(std::vector< gparticle * > &secondaries)
double energy
Photon energy [MeV].
virtual void physics_after_new_speed(std::vector< gparticle * > &secondaries)
HeedPhoton()
Default constructor.
bool s_delta_generated
Flag that delta-electrons are already generated (or cannot be created).
virtual void print(std::ostream &file, int l) const
long ns_absorbing
Index of absorbing shell.
long parent_particle_number
long na_absorbing
Index of absorbing atom.
virtual void print(std::ostream &file, int l) const
void up_absref(absref *f)
std::vector< PassivePtr< manip_absvol > > eid
List of volumes.
absvol * G_lavol() const
Get last address of volume.
Abstract base classs for volume "manipulators".
vec dir
Unit vector, in the first system in the tree.
vfloat prange
Range from previous point.
point pt
Coordinates in the first system in the tree.
point ptloc
Coordinates in the local system (last system in the tree).
float chispre(float *x, float *p, float *f, long q)
long last_particle_number
float chisran(float flat_random_number, float *x, float *f, long q)
DoubleAc fabs(const DoubleAc &f)
DoubleAc sqrt(const DoubleAc &f)
#define Iprintn(file, name)
#define Iprint2n(file, name1, name2)
#define Iprint4n(file, name1, name2, name3, name4)