File indexing completed on 2025-08-05 08:09:09
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011 #include "Acts/Geometry/GeometryID.hpp"
0012 #include "Acts/Surfaces/Surface.hpp"
0013 #include "Acts/Utilities/Definitions.hpp"
0014 #include "Acts/Utilities/Helpers.hpp"
0015 #include "Acts/Utilities/Units.hpp"
0016 #include <cmath>
0017
0018 namespace Fatras {
0019
0020
0021 typedef int pdg_type;
0022
0023
0024 typedef unsigned int process_code;
0025
0026
0027 typedef unsigned int barcode_type;
0028
0029 namespace Test {
0030
0031
0032 class Particle {
0033
0034 public:
0035
0036 Particle() = default;
0037
0038
0039
0040
0041
0042
0043
0044
0045 Particle(const Acts::Vector3D &position, const Acts::Vector3D &momentum,
0046 double m, double q, pdg_type pdg = 0, barcode_type barcode = 0,
0047 double startTime = 0.)
0048 : m_position(position), m_momentum(momentum), m_m(m), m_q(q),
0049 m_p(momentum.norm()), m_pT(Acts::VectorHelpers::perp(momentum)),
0050 m_pdg(pdg), m_barcode(barcode), m_timeStamp(startTime) {
0051 m_E = std::sqrt(m_p * m_p + m_m * m_m);
0052 m_beta = (m_p / m_E);
0053 m_gamma = (m_E / m_m);
0054 }
0055
0056
0057
0058
0059
0060
0061 void setLimits(double x0Limit, double l0Limit,
0062 double timeLimit = std::numeric_limits<double>::max()) {
0063 m_limitInX0 = x0Limit;
0064 m_limitInL0 = l0Limit;
0065 m_timeLimit = timeLimit;
0066 }
0067
0068
0069
0070
0071 void scatter(Acts::Vector3D nmomentum) {
0072 m_momentum = std::move(nmomentum);
0073 m_pT = Acts::VectorHelpers::perp(m_momentum);
0074 }
0075
0076
0077
0078
0079 void energyLoss(double deltaE) {
0080
0081 if (m_E - deltaE < m_m) {
0082 m_E = m_m;
0083 m_p = 0.;
0084 m_pT = 0.;
0085 m_beta = 0.;
0086 m_gamma = 1.;
0087 m_momentum = Acts::Vector3D(0., 0., 0.);
0088 m_alive = false;
0089 }
0090
0091 m_E -= deltaE;
0092 m_p = std::sqrt(m_E * m_E - m_m * m_m);
0093 m_momentum = m_p * m_momentum.normalized();
0094 m_pT = Acts::VectorHelpers::perp(m_momentum);
0095 m_beta = (m_p / m_E);
0096 m_gamma = (m_E / m_m);
0097 }
0098
0099
0100
0101
0102
0103
0104
0105
0106
0107
0108
0109 bool update(const Acts::Vector3D &position, const Acts::Vector3D &momentum,
0110 double deltaPahtX0 = 0., double deltaPahtL0 = 0.,
0111 double deltaTime = 0.) {
0112 m_position = position;
0113 m_momentum = momentum;
0114 m_p = momentum.norm();
0115 if (m_p) {
0116 m_pT = Acts::VectorHelpers::perp(momentum);
0117 m_E = std::sqrt(m_p * m_p + m_m * m_m);
0118 m_timeStamp += deltaTime;
0119 m_beta = (m_p / m_E);
0120 m_gamma = (m_E / m_m);
0121
0122
0123 m_pathInX0 += deltaPahtX0;
0124 m_pathInL0 += deltaPahtL0;
0125 m_timeStamp += deltaTime;
0126 if (m_pathInX0 >= m_limitInX0 || m_pathInL0 >= m_limitInL0 ||
0127 m_timeStamp > m_timeLimit) {
0128 m_alive = false;
0129 }
0130 }
0131 return !m_alive;
0132 }
0133
0134
0135 const Acts::Vector3D &position() const { return m_position; }
0136
0137
0138 const Acts::Vector3D &momentum() const { return m_momentum; }
0139
0140
0141 const double p() const { return m_p; }
0142
0143
0144 const double pT() const { return m_pT; }
0145
0146
0147 const double E() const { return m_E; }
0148
0149
0150 const double m() const { return m_m; }
0151
0152
0153 const double beta() const { return m_beta; }
0154
0155
0156 const double gamma() const { return m_gamma; }
0157
0158
0159 const double q() const { return m_q; }
0160
0161
0162 const pdg_type pdg() const { return m_pdg; }
0163
0164
0165 const barcode_type barcode() const { return m_barcode; }
0166
0167
0168 const double pathInX0() const { return m_pathInX0; }
0169
0170
0171 const double limitInX0() const { return m_limitInX0; }
0172
0173
0174 const double pathInL0() const { return m_limitInX0; }
0175
0176
0177 const double limitInL0() const { return m_limitInL0; }
0178
0179
0180 operator bool() { return m_alive; }
0181
0182 private:
0183 Acts::Vector3D m_position = Acts::Vector3D(0., 0., 0.);
0184 Acts::Vector3D m_momentum = Acts::Vector3D(0., 0., 0.);
0185
0186 double m_m = 0.;
0187 double m_E = 0.;
0188 double m_q = 0.;
0189 double m_beta = 0.;
0190 double m_gamma = 1.;
0191 double m_p = 0.;
0192 double m_pT = 0.;
0193 pdg_type m_pdg = 0;
0194 barcode_type m_barcode = 0;
0195
0196 double m_pathInX0 = 0.;
0197 double m_limitInX0 = std::numeric_limits<double>::max();
0198
0199 double m_pathInL0 = 0.;
0200 double m_limitInL0 = std::numeric_limits<double>::max();
0201
0202 double m_timeStamp = 0.;
0203 double m_timeLimit = std::numeric_limits<double>::max();
0204
0205 bool m_alive = true;
0206 };
0207
0208 }
0209 }