CMS 3D CMS Logo

CartesianLorentzForce.h
Go to the documentation of this file.
1 #ifndef CartesianLorentzForce_H
2 #define CartesianLorentzForce_H
3 
5 #include "RKDerivative.h"
6 #include "RKLocalFieldProvider.h"
7 
9 
10 class dso_internal CartesianLorentzForce final : public RKDerivative<double,6> {
11 public:
12 
16 
17  CartesianLorentzForce( const RKLocalFieldProvider& field, float ch) :
18  theField(field), theCharge(ch) {}
19 
20  Vector operator()( Scalar z, const Vector& state) const override;
21 
22 private:
23 
25  float theCharge;
26 
27 };
28 
29 
30 #include "CartesianStateAdaptor.h"
31 inline
34 {
35  // derivatives in case S is the free parameter
37  auto bfield = theField.inTesla( RKLocalFieldProvider::LocalPoint(start.position()));
38  constexpr float k = 2.99792458e-3; // conversion to [cm]
39 
41  auto dpos = start.momentum().unit();
42 
44  auto dmom = (k*theCharge) * dpos.cross( bfield);
45 
46  return CartesianStateAdaptor::rkstate( dpos, dmom);
47 }
48 
49 #endif
virtual Vector operator()(Scalar startPar, const Vector &startState) const =0
Basic3DVector unit() const
Vector operator()(Scalar z, const Vector &state) const override
Basic3DVector cross(const Basic3DVector &lh) const
Vector product, or "cross" product, with a vector of same type.
RKDerivative< double, 6 > Base
Derivative calculation for the 6D cartesian case.
static RKSmallVector< double, 6 > rkstate(const Vector3D &pos, const Vector3D &mom)
const Vector3D & momentum() const
#define dso_internal
Definition: Visibility.h:13
Base class for derivative calculation.
Definition: RKDerivative.h:13
int k[5][pyjets_maxn]
CartesianLorentzForce(const RKLocalFieldProvider &field, float ch)
RKSmallVector< double, N > Vector
Definition: RKDerivative.h:17
const Vector3D & position() const
const RKLocalFieldProvider & theField
#define constexpr