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:
15 
16  CartesianLorentzForce(const RKLocalFieldProvider& field, float ch) : theField(field), theCharge(ch) {}
17 
18  Vector operator()(Scalar z, const Vector& state) const override;
19 
20 private:
22  float theCharge;
23 };
24 
25 #include "CartesianStateAdaptor.h"
27  // derivatives in case S is the free parameter
29  auto bfield = theField.inTesla(RKLocalFieldProvider::LocalPoint(start.position()));
30  constexpr float k = 2.99792458e-3; // conversion to [cm]
31 
33  auto dpos = start.momentum().unit();
34 
36  auto dmom = (k * theCharge) * dpos.cross(bfield);
37 
38  return CartesianStateAdaptor::rkstate(dpos, dmom);
39 }
40 
41 #endif
Definition: start.py:1
double Scalar
Definition: Definitions.h:25
ROOT::Math::Plane3D::Vector Vector
Definition: EcalHitMaker.cc:29
float float float z
RKSmallVector< double, N > Vector
Definition: RKDerivative.h:13
Derivative calculation for the 6D cartesian case.
RKDerivative< double, 6 > Base
#define dso_internal
Definition: Visibility.h:13
Base class for derivative calculation.
Definition: RKDerivative.h:10
CartesianLorentzForce(const RKLocalFieldProvider &field, float ch)
virtual Vector operator()(Scalar startPar, const Vector &startState) const =0
Vector operator()(Scalar z, const Vector &state) const override
Vector inTesla(const LocalPoint &lp) const
the argument lp is in the local frame specified in the constructor
static RKSmallVector< double, 6 > rkstate(const Vector3D &pos, const Vector3D &mom)
const RKLocalFieldProvider & theField