CMS 3D CMS Logo

RKOne4OrderStep.h
Go to the documentation of this file.
1 #ifndef RKOne4OrderStep_H
2 #define RKOne4OrderStep_H
3 
5 #include "RKDistance.h"
6 #include "RK4OneStepTempl.h"
7 
8 #include <utility>
9 
10 template <typename T, int N>
12 public:
13  typedef T Scalar;
15 
16  std::pair<Vector, T> operator()(Scalar startPar,
17  const Vector& startState,
18  const RKDerivative<T, N>& deriv,
19  const RKDistance<T, N>& dist,
20  Scalar step) {
21  const Scalar huge = 1.e5; // ad hoc protection against infinities, must be done better!
22  const Scalar hugediff = 100.;
23 
24  RK4OneStepTempl<T, N> solver;
25  Vector one(solver(startPar, startState, deriv, step));
26  if (std::abs(one[0]) > huge || std::abs(one(1)) > huge)
27  return std::pair<Vector, Scalar>(one, hugediff);
28 
29  Vector firstHalf(solver(startPar, startState, deriv, step / 2));
30  Vector secondHalf(solver(startPar + step / 2, firstHalf, deriv, step / 2));
31  Scalar diff = dist(one, secondHalf, startPar + step);
32  return std::pair<Vector, Scalar>(secondHalf, diff);
33  }
34 };
35 #endif
std::pair< Vector, T > operator()(Scalar startPar, const Vector &startState, const RKDerivative< T, N > &deriv, const RKDistance< T, N > &dist, Scalar step)
ROOT::Math::SVector< T, N > RKSmallVector
Definition: RKSmallVector.h:13
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
#define dso_internal
Definition: Visibility.h:13
Base class for derivative calculation.
Definition: RKDerivative.h:10
step
Definition: StallMonitor.cc:98
RKSmallVector< T, N > Vector
long double T