8 double step,
double eps)
const 10 const double Safety = 0.9;
11 double remainigStep =
step;
12 double stepSize =
step;
15 std::pair<CartesianState, double> tryStep;
20 if (tryStep.second <eps) {
21 if (remainigStep - stepSize < eps/2) {
23 << nsteps <<
" steps" << std::endl;
27 remainigStep -= stepSize;
29 double factor =
std::min( Safety *
pow( fabs(eps/tryStep.second),0.2), 4.);
30 stepSize =
std::min( stepSize*factor, remainigStep);
31 currentStart = tryStep.first;
33 <<
" remain after " << nsteps <<
" steps. Step size increased by " 34 << factor <<
" to " << stepSize << std::endl;
39 double factor =
std::max( Safety *
pow( fabs(eps/tryStep.second),0.25), 0.1);
41 if (
verbose())
std::cout <<
"Accuracy not yet reached: delta = " << tryStep.second
42 <<
", step reduced by " << factor <<
" to " << stepSize
44 <<
", " << currentStart.
position().
z() << std::endl;
46 }
while (remainigStep > eps/2);
51 std::pair<CartesianState, double>
60 return std::pair<CartesianState, double>(secondHalf,
diff);
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
double distance(const CartesianState &a, const CartesianState &b) const
CartesianState operator()(const CartesianState &start, const RKCartesianDerivative &deriv, double step, double eps) const
T z() const
Cartesian z coordinate.
std::pair< CartesianState, double > stepWithAccuracy(const CartesianState &start, const RKCartesianDerivative &deriv, double step) const
T perp() const
Magnitude of transverse component.
const Vector3D & momentum() const
const Vector3D & position() const
Power< A, B >::type pow(const A &a, const B &b)