Commit ad089acd authored by adelmann's avatar adelmann 🎗
Browse files

add pSqr, to propperly calculate p*p NOT only dot(p,p)

parent d817082f
......@@ -369,7 +369,7 @@ double ParallelTTracker::schottkyLoop(double rescale_coeff) {
before they are allocated when increasing the timestep in the gun.
*/
itsBunch->get_bounds(rmin, rmax);
margin = 10. * RefPartP_suv_m(2) * scaleFactor_m / sqrt(1.0 + dot(RefPartP_suv_m, RefPartP_suv_m));
margin = 10. * RefPartP_suv_m(2) * scaleFactor_m / sqrt(1.0 + pSqr(RefPartP_suv_m, RefPartP_suv_m));
margin = 0.01 > margin ? 0.01 : margin;
itsOpalBeamline_m.switchElements(rmin(2) - margin, rmax(2) + margin);
}
......
......@@ -432,10 +432,11 @@ private:
double calcG(); // Time step chooser for adaptive variant
Vector_t calcMeanR() const;
Vector_t calcMeanP() const;
double pSqr(Vector_t p1, Vector_t p2);
};
inline double ParallelTTracker::p2(Vector_t p) {
return p[0]*p[0] + p[0]*p[1] + p[0]*p[2] + p[1]*p[0] + p[1]*p[1]+ p[1]*p[2] + p[2]*p[0] + p[2]*p[1]+ p[2]*p[2];
inline double ParallelTTracker::pSqr(Vector_t p1, Vector_t p2) {
return p1[0]*p2[0] + p1[0]*p2[1] + p1[0]*p2[2] + p1[1]*p2[0] + p1[1]*p2[1] + p1[1]*p2[2] + p1[2]*p2[0] + p1[2]*p2[1] + p1[2]*p2[2];
}
inline double ParallelTTracker::ptoEMeV(Vector_t p) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment