|
||||
File indexing completed on 2025-01-18 09:28:03
0001 // This file is part of the Acts project. 0002 // 0003 // Copyright (C) 2020 CERN for the benefit of the Acts project 0004 // 0005 // This Source Code Form is subject to the terms of the Mozilla Public 0006 // License, v. 2.0. If a copy of the MPL was not distributed with this 0007 // file, You can obtain one at http://mozilla.org/MPL/2.0/. 0008 0009 #pragma once 0010 0011 #include "Acts/Definitions/Algebra.hpp" 0012 #include "Acts/Definitions/Common.hpp" 0013 #include "Acts/Geometry/GeometryIdentifier.hpp" 0014 #include "ActsFatras/EventData/Barcode.hpp" 0015 0016 #include <cstdint> 0017 0018 namespace ActsFatras { 0019 0020 /// A simulation hit on a surface. 0021 /// 0022 /// This is the undigitized, truth hit, i.e. just a recording of the particle 0023 /// state at the surface intersection. Since Fatras is surface-based, the hit 0024 /// position is always constrained to a surface. Depending on the simulated 0025 /// interactions the momentum state before and after might differ and is 0026 /// thus stored as two separate four-vectors. 0027 class Hit { 0028 public: 0029 using Scalar = Acts::ActsScalar; 0030 using Vector3 = Acts::ActsVector<3>; 0031 using Vector4 = Acts::ActsVector<4>; 0032 0033 /// Construct default hit with (mostly) invalid information. 0034 Hit() = default; 0035 /// Construct from four-position and four-momenta. 0036 /// 0037 /// @param geometryId Geometry identifier of the surface 0038 /// @param particleId Particle identifier of the particle that created the hit 0039 /// @param pos4 Particle space-time four-vector on the surface 0040 /// @param before4 Particle four-momentum before the interaction 0041 /// @param after4 Particle four-momentum after the interaction 0042 /// @param index_ Hit index along the particle trajectory 0043 /// 0044 /// All quantities are given in the global coordinate system. It is the 0045 /// users responsibility to ensure that the position correspond to a 0046 /// position on the given surface. 0047 Hit(Acts::GeometryIdentifier geometryId, Barcode particleId, 0048 const Vector4& pos4, const Vector4& before4, const Vector4& after4, 0049 int32_t index_ = -1) 0050 : m_geometryId(geometryId), 0051 m_particleId(particleId), 0052 m_index(index_), 0053 m_pos4(pos4), 0054 m_before4(before4), 0055 m_after4(after4) {} 0056 Hit(const Hit&) = default; 0057 Hit(Hit&&) = default; 0058 Hit& operator=(const Hit&) = default; 0059 Hit& operator=(Hit&&) = default; 0060 0061 /// Geometry identifier of the hit surface. 0062 constexpr Acts::GeometryIdentifier geometryId() const { return m_geometryId; } 0063 /// Particle identifier of the particle that generated the hit. 0064 constexpr Barcode particleId() const { return m_particleId; } 0065 /// Hit index along the particle trajectory. 0066 /// 0067 /// @retval negative if the hit index is undefined. 0068 constexpr int32_t index() const { return m_index; } 0069 0070 /// Space-time position four-vector. 0071 const Vector4& fourPosition() const { return m_pos4; } 0072 /// Three-position, i.e. spatial coordinates without the time. 0073 auto position() const { return m_pos4.segment<3>(Acts::ePos0); } 0074 /// Time coordinate. 0075 Scalar time() const { return m_pos4[Acts::eTime]; } 0076 0077 /// Particle four-momentum before the hit. 0078 const Vector4& momentum4Before() const { return m_before4; } 0079 /// Particle four-momentum after the hit. 0080 const Vector4& momentum4After() const { return m_after4; } 0081 /// Normalized particle direction vector before the hit. 0082 Vector3 directionBefore() const { 0083 return m_before4.segment<3>(Acts::eMom0).normalized(); 0084 } 0085 /// Normalized particle direction vector the hit. 0086 Vector3 directionAfter() const { 0087 return m_after4.segment<3>(Acts::eMom0).normalized(); 0088 } 0089 /// Average normalized particle direction vector through the surface. 0090 Vector3 direction() const { 0091 auto dir0 = m_before4.segment<3>(Acts::eMom0).normalized(); 0092 auto dir1 = m_after4.segment<3>(Acts::eMom0).normalized(); 0093 return ((dir0 + dir1) / 2.).segment<3>(Acts::eMom0).normalized(); 0094 } 0095 /// Energy deposited by the hit. 0096 /// 0097 /// @retval positive if the particle lost energy when it passed the surface 0098 /// @retval negative if magic was involved 0099 Scalar depositedEnergy() const { 0100 return m_before4[Acts::eEnergy] - m_after4[Acts::eEnergy]; 0101 } 0102 0103 private: 0104 /// Identifier of the surface. 0105 Acts::GeometryIdentifier m_geometryId; 0106 /// Identifier of the generating particle. 0107 Barcode m_particleId; 0108 /// Index of the hit along the particle trajectory. 0109 int32_t m_index = -1; 0110 /// Global space-time position four-vector. 0111 Vector4 m_pos4 = Vector4::Zero(); 0112 /// Global particle energy-momentum four-vector before the hit. 0113 Vector4 m_before4 = Vector4::Zero(); 0114 /// Global particle energy-momentum four-vector after the hit. 0115 Vector4 m_after4 = Vector4::Zero(); 0116 }; 0117 0118 } // namespace ActsFatras
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |