Go to the documentation of this file.00001 #ifndef RKOne4OrderStep_H
00002 #define RKOne4OrderStep_H
00003
00004 #include "TrackPropagation/RungeKutta/interface/RK4OneStepTempl.h"
00005
00006 #include <utility>
00007
00008 template <typename T, int N>
00009 class RKOne4OrderStep {
00010 public:
00011
00012 typedef T Scalar;
00013 typedef RKSmallVector<T,N> Vector;
00014
00015 std::pair< Vector, T>
00016 operator()( Scalar startPar, const Vector& startState,
00017 const RKDerivative<T,N>& deriv,
00018 const RKDistance<T,N>& dist, Scalar step) {
00019 const Scalar huge = 1.e5;
00020 const Scalar hugediff = 100.;
00021
00022 RK4OneStepTempl<T,N> solver;
00023 Vector one( solver(startPar, startState, deriv, step));
00024 if (std::abs(one[0])>huge || std::abs(one(1)>huge)) return std::pair<Vector, Scalar>(one,hugediff);
00025
00026 Vector firstHalf( solver(startPar, startState, deriv, step/2));
00027 Vector secondHalf(solver(startPar+step/2, firstHalf, deriv, step/2));
00028 Scalar diff = dist(one, secondHalf, startPar+step);
00029 return std::pair<Vector, Scalar>(secondHalf,diff);
00030 }
00031 };
00032 #endif