18using CLHEP::c_squared;
21 vfloat ftime,
double fmass)
25 mfunname(
"mparticle::mparticle(...)");
27 const double mc2 =
m_mass * c_squared;
37void mparticle::check_consistency()
const {
38 mfunname(
"void mparticle::check_consistency() const");
53 const double mc2 =
m_mass * c_squared;
55 if (ek > 1000.0 * DBL_MIN) {
57 "ek=" << ek <<
'\n' << (*
this),
mcerr);
60 if (ek > 1000.0 * DBL_MIN) {
62 "ek=" << ek <<
'\n' << (*
this),
mcerr);
65 if (ek > 1000.0 * DBL_MIN) {
67 "ek=" << ek <<
'\n' << (*
this),
mcerr);
73 mfunname(
"void mparticle::step(...)");
83 "too many zero steps, possible infinite loop\n";
101 pvecerror(
"void mparticle::curvature(...)");
107 if (i == 0 || f ==
dv0) {
124 if (fmrange > ran) fmrange = ran;
129 frelcen = unit_vec(fn);
147void mparticle::new_speed() {
148 pvecerror(
"void mparticle::new_speed(void)");
153 vec f1, f2, f_perp1, f_perp2, f_perp_fl1, f_perp_fl2;
161 vec f_mean = 0.5 * (f1 + f2);
164 if ((i == 0 && j == 0) || f_mean ==
dv0) {
172 if (r !=
dv0) W = f_mean * r;
186 double resten =
m_mass * c_squared;
192 if (!(i == 0 && j == 0)) {
197 vec mean_fn = 0.5 * (fn1 + fn2);
198 double mean_fn_len = mean_fn.length();
200 if (mean_fn_len > 0.0) {
201 vec relcen = unit_vec(mean_fn);
203 vfloat new_rad = (mean_speed * mean_speed *
212 vec mean_f_perp_fl = 0.5 * (f_perp_fl1 + f_perp_fl2);
213 double len_mean_f_perp_fl = mean_f_perp_fl.length();
215 double mean_f_perp = 0.5 * (f_perp1.length() + f_perp2.length());
217 if (len_mean_f_perp_fl > 0.0) {
219 if (!
apeq(fdir_proj.length(), 0.0)) {
226 double new_rad =
pow(mean_speed * fdir_proj.length(), 2) / acc;
227 double ang = length_proj / new_rad;
228 if (new_rad > 0 && ang > 0) {
229 fdir.turn(mean_f_perp_fl, -ang);
246 <<
m_mass * c_squared / CLHEP::GeV <<
" GeV)\n";
260 (&f)->print(file, 10);
#define check_econd11(a, signb, stream)
#define check_econd11a(a, signb, add, stream)
#define check_econd12a(a, sign, b, add, stream)
virtual void print(std::ostream &file, int l) const
Print-out.
virtual void physics_after_new_speed(std::vector< gparticle * > &)
Apply any other processes (turn the trajectory, kill the particle, ...).
stvpoint m_nextpos
Next point.
double m_total_range_from_origin
Range from origin to current position.
virtual stvpoint calc_step_to_bord()
Determine next position.
stvpoint m_prevpos
Previous point.
static constexpr long m_max_qzero_step
Max. number of zero-steps allowed.
stvpoint m_currpos
Current point.
virtual void change_vol()
Move from one volume to another.
long m_nzero_step
Number of previous steps with zero range (including this step).
stvpoint m_origin
Original point.
bool m_alive
Status flag whether the particle is active.
void up_absref(absref *f)
Abstract base classs for volume "manipulators".
Massive particle. A force can be applied.
double m_prev_ekin
Previous kinetic energy.
double m_curr_ekin
Current kinetic energy.
virtual int force(const point &pt, vec &f, vec &f_perp, vfloat &mrange)
void step(std::vector< gparticle * > &secondaries) override
void print(std::ostream &file, int l) const override
Print-out.
double m_curr_gamma_1
Current .
mparticle()=default
Default constructor.
double m_orig_ekin
Original kinetic energy.
double m_prev_gamma_1
Previous .
double m_orig_gamma_1
Original .
double m_mass
Mass (not mass * speed_of_light^2)
void curvature(bool &curved, vec &frelcen, vfloat &fmrange, vfloat prec) override
vec dirloc
Unit vector, in the local system (last system in the tree).
vec dir
Unit vector, in the first system in the tree.
vfloat prange
Range from previous point.
vfloat speed
Longitudinal velocity.
point pt
Coordinates in the first system in the tree.
std::ostream & operator<<(std::ostream &file, const BGMesh &bgm)
double lorbeta(const double gamma_1)
as function of .
vec project_to_plane(const vec &r, const vec &normal)
DoubleAc pow(const DoubleAc &f, double p)
bool apeq(const circumf &f1, const circumf &f2, vfloat prec)
double lorgamma_1(double beta)
as function of .
vfloat cos2vec(const vec &r1, const vec &r2)
DoubleAc fabs(const DoubleAc &f)
#define pvecerror(string)