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 
14  typedef T Scalar;
16 
17  std::pair< Vector, T>
18  operator()( Scalar startPar, const Vector& startState,
19  const RKDerivative<T,N>& deriv,
20  const RKDistance<T,N>& dist, 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) return std::pair<Vector, Scalar>(one,hugediff);
27 
28  Vector firstHalf( solver(startPar, startState, deriv, step/2));
29  Vector secondHalf(solver(startPar+step/2, firstHalf, deriv, step/2));
30  Scalar diff = dist(one, secondHalf, startPar+step);
31  return std::pair<Vector, Scalar>(secondHalf,diff);
32  }
33 };
34 #endif
ROOT::Math::SVector< T, N > RKSmallVector
Definition: RKSmallVector.h:13
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)
step
Definition: StallMonitor.cc:94
long double T