Kinematics tools
From Charm-Tau Detector
(Difference between revisions)
V.S.Vorobev (Talk | contribs) |
V.S.Vorobev (Talk | contribs) |
||
Line 3: | Line 3: | ||
Kinematic tools are defined in [https://git.inp.nsk.su/sctau/aurora/-/blob/master/Common/Kinematics/Kinematics| Common/Kinematics] package. SCT kinematics classes are based on <code>Eigen3</code> library. ROOT implementation of vectors and matrices is abandoned intentionally as too slow. | Kinematic tools are defined in [https://git.inp.nsk.su/sctau/aurora/-/blob/master/Common/Kinematics/Kinematics| Common/Kinematics] package. SCT kinematics classes are based on <code>Eigen3</code> library. ROOT implementation of vectors and matrices is abandoned intentionally as too slow. | ||
+ | == Main definitions == | ||
+ | Main set of aliases for basic kinematic entities in namespace <code>sct</code> is located in [https://git.inp.nsk.su/sctau/aurora/-/blob/master/Common/Kinematics/Kinematics/KineTypedefs.h| KineTypedefs.h]. These aliases are to be used at maximum extent in the Aurora framework. | ||
− | == ThreeVector == | + | {|class="wikitable" style="text-align: center; color: black;" width=700 |
+ | ! Entity || Alias || Source | ||
+ | |- | ||
+ | | 1D vector || Vector1D || Eigen::Matrix<ftype, 1, S> | ||
+ | |- | ||
+ | | Three-vector || ThreeVector || sct::kine::ThreeVector<> | ||
+ | |- | ||
+ | | Lorentz-vector || FourVector || sct::kine::FourVector<> | ||
+ | |- | ||
+ | | Matrix || template<size_t D1, size_t D2> Matrix || Eigen::Matrix<ftype, D1, D2> | ||
+ | |- | ||
+ | | Square Matrix || template<size_t S> SquareMatrix || Eigen::Matrix<ftype, S, S> | ||
+ | |- | ||
+ | | 3x3 matrix || ThreeMatrix || SquareMatrix<3> | ||
+ | |- | ||
+ | | 4x4 matrix || FourMatrix || SquareMatrix<4> | ||
+ | |} | ||
+ | |||
+ | Several APIs are described in detail below. | ||
+ | |||
+ | == sct::kine::ThreeVector == | ||
[https://git.inp.nsk.su/sctau/aurora/-/blob/master/Common/Kinematics/Kinematics/ThreeVector.h | ThreeVector.h] (contributors: D. Yakovlev, V. Vorobyev) | [https://git.inp.nsk.su/sctau/aurora/-/blob/master/Common/Kinematics/Kinematics/ThreeVector.h | ThreeVector.h] (contributors: D. Yakovlev, V. Vorobyev) | ||
− | The ThreeVector class inherits from <code>Eigen::Matrix<ftype, 1, 3></code> | + | The ThreeVector class is a template class inherits from <code>Eigen::Matrix<ftype, 1, 3></code> |
<code> | <code> | ||
Line 43: | Line 65: | ||
| Rotation around z axis || RotateZ(double) || RotateZ (Double_t) | | Rotation around z axis || RotateZ(double) || RotateZ (Double_t) | ||
|} | |} | ||
+ | |||
+ | The angle between two vectors can be obtained with | ||
+ | <code> | ||
+ | template <typename ftype> | ||
+ | inline ftype angle(const ThreeVector<ftype>& v1, const ThreeVector<ftype> v2) | ||
+ | |||
+ | </code> | ||
--[[User:V.S.Vorobev|V.S.Vorobev]] ([[User talk:V.S.Vorobev|talk]]) 21:53, 25 April 2020 (+07) | --[[User:V.S.Vorobev|V.S.Vorobev]] ([[User talk:V.S.Vorobev|talk]]) 21:53, 25 April 2020 (+07) |
Revision as of 22:40, 25 April 2020
Kinematic tools are defined in Common/Kinematics package. SCT kinematics classes are based on Eigen3
library. ROOT implementation of vectors and matrices is abandoned intentionally as too slow.
Main definitions
Main set of aliases for basic kinematic entities in namespace sct
is located in KineTypedefs.h. These aliases are to be used at maximum extent in the Aurora framework.
Entity | Alias | Source |
---|---|---|
1D vector | Vector1D | Eigen::Matrix<ftype, 1, S> |
Three-vector | ThreeVector | sct::kine::ThreeVector<> |
Lorentz-vector | FourVector | sct::kine::FourVector<> |
Matrix | template<size_t D1, size_t D2> Matrix | Eigen::Matrix<ftype, D1, D2> |
Square Matrix | template<size_t S> SquareMatrix | Eigen::Matrix<ftype, S, S> |
3x3 matrix | ThreeMatrix | SquareMatrix<3> |
4x4 matrix | FourMatrix | SquareMatrix<4> |
Several APIs are described in detail below.
sct::kine::ThreeVector
| ThreeVector.h (contributors: D. Yakovlev, V. Vorobyev)
The ThreeVector class is a template class inherits from Eigen::Matrix<ftype, 1, 3>
template <typename ftype = double> class ThreeVector : public Eigen::Matrix<ftype, 1, 3>
ThreeVector can be initialized with Cartesian or polar coordinates:
ThreeVector v1(x, y, z); ThreeVector v2 = ThreeVector::fromRPhiCosth(r, phi, costh)
Operation | ThreeVector API | TVector3 API |
---|---|---|
x component | x(), px() | X(), Px() |
y component | y(), py() | Y(), Py() |
z component | z(), pz() | Z(), Pz() |
Transverse momentum | pt() | Pt(), Perp() |
Norm | norm() | Mag() |
Squared norm | norm2(), squaredNorm() | Mag2() |
Rotation around x axis | RotateX(double) | RotateX (Double_t) |
Rotation around y axis | RotateY(double) | RotateY (Double_t) |
Rotation around z axis | RotateZ(double) | RotateZ (Double_t) |
The angle between two vectors can be obtained with
template <typename ftype> inline ftype angle(const ThreeVector<ftype>& v1, const ThreeVector<ftype> v2)
--V.S.Vorobev (talk) 21:53, 25 April 2020 (+07)