CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
RKOne4OrderStep.h
Go to the documentation of this file.
1 #ifndef RKOne4OrderStep_H
2 #define RKOne4OrderStep_H
3 
5 #include "RK4OneStepTempl.h"
6 
7 #include <utility>
8 
9 template <typename T, int N>
11 public:
12 
13  typedef T Scalar;
15 
16  std::pair< Vector, T>
17  operator()( Scalar startPar, const Vector& startState,
18  const RKDerivative<T,N>& deriv,
19  const RKDistance<T,N>& dist, Scalar step) {
20  const Scalar huge = 1.e5; // ad hoc protection against infinities, must be done better!
21  const Scalar hugediff = 100.;
22 
23  RK4OneStepTempl<T,N> solver;
24  Vector one( solver(startPar, startState, deriv, step));
25  if (std::abs(one[0])>huge || std::abs(one(1)>huge)) return std::pair<Vector, Scalar>(one,hugediff);
26 
27  Vector firstHalf( solver(startPar, startState, deriv, step/2));
28  Vector secondHalf(solver(startPar+step/2, firstHalf, deriv, step/2));
29  Scalar diff = dist(one, secondHalf, startPar+step);
30  return std::pair<Vector, Scalar>(secondHalf,diff);
31  }
32 };
33 #endif
ROOT::Math::SVector< T, N > RKSmallVector
Definition: RKSmallVector.h:12
RKSmallVector< T, N > Vector
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:13
std::pair< Vector, T > operator()(Scalar startPar, const Vector &startState, const RKDerivative< T, N > &deriv, const RKDistance< T, N > &dist, Scalar step)
long double T