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
change_name.diff
diff
Definition: change_name.py:13
Visibility.h
SiPixelPI::one
Definition: SiPixelPayloadInspectorHelper.h:39
step
step
Definition: StallMonitor.cc:94
RKOne4OrderStep::Scalar
T Scalar
Definition: RKOne4OrderStep.h:13
RKSmallVector
ROOT::Math::SVector< T, N > RKSmallVector
Definition: RKSmallVector.h:13
RKOne4OrderStep
Definition: RKOne4OrderStep.h:11
RK4OneStepTempl.h
RK4OneStepTempl
Definition: RK4OneStepTempl.h:9
dso_internal
#define dso_internal
Definition: Visibility.h:13
RKOne4OrderStep::Vector
RKSmallVector< T, N > Vector
Definition: RKOne4OrderStep.h:14
RKDerivative
Base class for derivative calculation.
Definition: RKDerivative.h:10
RKOne4OrderStep::operator()
std::pair< Vector, T > operator()(Scalar startPar, const Vector &startState, const RKDerivative< T, N > &deriv, const RKDistance< T, N > &dist, Scalar step)
Definition: RKOne4OrderStep.h:16
RKDistance.h
T
long double T
Definition: Basic3DVectorLD.h:48
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
RKDistance
Definition: RKDistance.h:8