FairShip
Loading...
Searching...
No Matches
ActsFrame.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-3.0-or-later
2// SPDX-FileCopyrightText: Copyright CERN for the benefit of the SHiP
3// Collaboration
4
5#ifndef ACTSTRACKING_ACTSFRAME_HPP_
6#define ACTSTRACKING_ACTSFRAME_HPP_
7
8#include "Acts/Definitions/Algebra.hpp"
9#include "Acts/Definitions/Units.hpp"
10
19namespace SHiP::ActsFrame {
20
22inline Acts::RotationMatrix3 toShipRotation() {
23 Acts::RotationMatrix3 rotation;
24 rotation << 0, 0, -1, //
25 0, 1, 0, //
26 1, 0, 0;
27 return rotation;
28}
29
31inline Acts::RotationMatrix3 toActsRotation() {
32 return toShipRotation().transpose();
33}
34
36inline constexpr double kShipLength = Acts::UnitConstants::cm;
37
38inline Acts::Vector3 positionToActs(double x, double y, double z) {
39 return toActsRotation() * Acts::Vector3(x, y, z) * kShipLength;
40}
41
42inline Acts::Vector3 positionToShip(const Acts::Vector3& position) {
43 return toShipRotation() * position / kShipLength;
44}
45
46inline Acts::Vector3 momentumToActs(double px, double py, double pz) {
47 return toActsRotation() * Acts::Vector3(px, py, pz) *
48 Acts::UnitConstants::GeV;
49}
50
51inline Acts::Vector3 momentumToShip(const Acts::Vector3& momentum) {
52 return toShipRotation() * momentum / Acts::UnitConstants::GeV;
53}
54
56inline Acts::Transform3 transformToActs(const Acts::Transform3& shipTransform) {
57 Acts::Transform3 transform = Acts::Transform3::Identity();
58 transform.linear() = toActsRotation() * shipTransform.linear();
59 transform.translation() =
60 toActsRotation() * shipTransform.translation() * kShipLength;
61 return transform;
62}
63
64} // namespace SHiP::ActsFrame
65
66#endif // ACTSTRACKING_ACTSFRAME_HPP_
Acts::Vector3 momentumToShip(const Acts::Vector3 &momentum)
Definition ActsFrame.hpp:51
Acts::RotationMatrix3 toShipRotation()
Rotation taking ACTS-frame vectors to the SHiP frame.
Definition ActsFrame.hpp:22
Acts::Transform3 transformToActs(const Acts::Transform3 &shipTransform)
Transform of a TGeo placement (SHiP frame, cm) in the ACTS frame.
Definition ActsFrame.hpp:56
Acts::RotationMatrix3 toActsRotation()
Rotation taking SHiP-frame vectors to the ACTS frame.
Definition ActsFrame.hpp:31
Acts::Vector3 positionToShip(const Acts::Vector3 &position)
Definition ActsFrame.hpp:42
Acts::Vector3 positionToActs(double x, double y, double z)
Definition ActsFrame.hpp:38
Acts::Vector3 momentumToActs(double px, double py, double pz)
Definition ActsFrame.hpp:46
constexpr double kShipLength
Length unit of the SHiP frame, in ACTS units.
Definition ActsFrame.hpp:36