18using CLHEP::c_squared;
25 mfunname(
"mparticle::mparticle(...)");
37 mfunname(
"void mparticle::check_consistency() const");
44 > 1.0e-10, (*
this),
mcerr);
47 > 1.0e-10, (*
this),
mcerr);
49 if (kin_ener > 1000.0 * DBL_MIN) {
52 > 1.0e-9,
"kin_ener=" << kin_ener <<
'\n' << (*
this),
mcerr);
55 if (kin_ener > 1000.0 * DBL_MIN) {
58 > 1.0e-9,
"kin_ener=" << kin_ener <<
'\n' << (*
this),
mcerr);
61 if (kin_ener > 1000.0 * DBL_MIN) {
64 > 1.0e-9,
"kin_ener=" << kin_ener <<
'\n' << (*
this),
mcerr);
70 mfunname(
"void mparticle::step(...)");
81 "too many zero steps, possible infinite loop\n";
100 "void mparticle::curvature(int& fs_cf, vec& frelcen, vfloat& fmrange)");
106 if (i == 0 || f ==
dv0) {
116 const int j = check_par(
currpos.
dir, f, prec);
123 if (fmrange > ran) fmrange = ran;
128 frelcen = unit_vec(fn);
140 f_perp =
vec(0, 0, 0);
146 pvecerror(
"void mparticle::new_speed(void)");
151 vec f1, f2, f_perp1, f_perp2, f_perp_fl1, f_perp_fl2;
160 f_mean = 0.5 * (f1 + f2);
163 if ((i == 0 && j == 0) || f_mean ==
dv0) {
171 if (r !=
dv0) W = f_mean * r;
185 double resten =
mass * c_squared;
191 if (!(i == 0 && j == 0)) {
196 vec mean_fn = 0.5 * (fn1 + fn2);
197 double mean_fn_len = mean_fn.
length();
199 if (mean_fn_len > 0.0) {
200 vec relcen = unit_vec(mean_fn);
202 vfloat new_rad = (mean_speed * mean_speed *
211 vec mean_f_perp_fl = 0.5 * (f_perp_fl1 + f_perp_fl2);
212 double len_mean_f_perp_fl = mean_f_perp_fl.
length();
214 double mean_f_perp = 0.5 * (f_perp1.
length() + f_perp2.
length());
216 if (len_mean_f_perp_fl > 0.0) {
225 double new_rad =
pow(mean_speed * fdir_proj.
length(), 2) / acc;
226 double ang = length_proj / new_rad;
227 if (new_rad > 0 && ang > 0) {
228 fdir.
turn(mean_f_perp_fl, -ang);
244 Ifile <<
"mparticle: mass=" <<
mass <<
" (" <<
mass / CLHEP::kg <<
" kg, "
245 <<
mass* c_squared / CLHEP::GeV <<
" GeV)\n";
259 (&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
static long max_q_zero_step
virtual void change_vol(void)
virtual void physics_after_new_speed(std::vector< gparticle * > &)
double total_range_from_origin
Range from origin to currpos.
virtual stvpoint calc_step_to_bord()
Produces nextpos.
long n_zero_step
Number of previous steps with zero range (including this step).
void up_absref(absref *f)
Abstract base classs for volume "manipulators".
Massive particle. A force can be applied.
void check_consistency() const
Check consistency of kin_energy, gamma_1, speed, speed_of_light and mass.
mparticle()
Default constructor.
virtual int force(const point &pt, vec &f, vec &f_perp, vfloat &mrange)
virtual void step(std::vector< gparticle * > &secondaries)
double mass
Mass (not mass * speed_of_light^2)
virtual void print(std::ostream &file, int l) const
virtual void curvature(int &fs_cf, vec &frelcen, vfloat &fmrange, vfloat prec)
void new_speed()
Set new speed, direction and time for currpos.
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.
void turn(const vec &dir, vfloat angle)
Turn this vector.
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)