ACTS
Experiment-independent tracking
Loading...
Searching...
No Matches
pdg_particle.hpp
1// This file is part of the ACTS project.
2//
3// Copyright (C) 2016 CERN for the benefit of the ACTS project
4//
5// This Source Code Form is subject to the terms of the Mozilla Public
6// License, v. 2.0. If a copy of the MPL was not distributed with this
7// file, You can obtain one at https://mozilla.org/MPL/2.0/.
8
9#pragma once
10
11// Project include(s).
12#include "detray/definitions/algebra.hpp"
13#include "detray/definitions/detail/qualifiers.hpp"
14#include "detray/definitions/units.hpp"
15
16// System include(s).
17#include <cstdint>
18
19namespace detray {
20
23template <concepts::scalar scalar_t>
26 using scalar_type = scalar_t;
27
32 template <typename T>
33 DETRAY_HOST_DEVICE constexpr pdg_particle(const std::int32_t pdg_num,
34 const T mass, const T charge)
35 : m_pdg_num(pdg_num),
36 m_mass(static_cast<scalar_t>(mass)),
37 m_charge(static_cast<scalar_t>(charge)) {}
38
40 DETRAY_HOST_DEVICE
41 constexpr std::int32_t pdg_num() const { return m_pdg_num; }
42
44 DETRAY_HOST_DEVICE
45 constexpr scalar_type mass() const { return m_mass; }
46
48 DETRAY_HOST_DEVICE
49 constexpr scalar_type charge() const { return m_charge; }
50
52 DETRAY_HOST_DEVICE
53 constexpr bool is_valid() const { return m_pdg_num != 0; }
54
55 private:
56 std::int32_t m_pdg_num;
57 scalar_type m_mass;
58 scalar_type m_charge;
59};
60
64template <concepts::scalar scalar_t>
65DETRAY_HOST_DEVICE constexpr pdg_particle<scalar_t> charge_conjugation(
66 const pdg_particle<scalar_t>& ptc) {
67 return (ptc.charge() != 0)
69 -ptc.charge()}
70 : ptc;
71}
72
77template <concepts::scalar scalar_t, typename track_t>
79 const pdg_particle<scalar_t>& ptc, const track_t& params) {
80 return (ptc.charge() * params.qop() > 0.f) ? ptc : charge_conjugation(ptc);
81}
82
88#define DETRAY_DECLARE_PARTICLE(PARTICLE_NAME, PDG_NUM, MASS, CHARGE) \
89 template <concepts::scalar scalar_t> \
90 struct PARTICLE_NAME final : public pdg_particle<scalar_t> { \
91 \
92 using base_type = pdg_particle<scalar_t>; \
93 DETRAY_HOST_DEVICE \
94 constexpr PARTICLE_NAME() : base_type(PDG_NUM, MASS, CHARGE) {} \
95 }
96
97// Declare PDG number 0 to be invalid
99DETRAY_DECLARE_PARTICLE(invalid, 0, 0.f, 0.f);
100// Declare some predefined particles
102DETRAY_DECLARE_PARTICLE(electron, 11, constant<float>::m_e,
105DETRAY_DECLARE_PARTICLE(positron, -11, constant<float>::m_e,
107// Muon mass from: https://physics.nist.gov/cgi-bin/cuu/Value?mmuc2mev (Visited
108// Aug 1st, 2024)
110DETRAY_DECLARE_PARTICLE(muon, 13, 105.6583755f * unit<float>::MeV,
113DETRAY_DECLARE_PARTICLE(antimuon, -13, 105.6583755f * unit<float>::MeV,
115// Pion mass from: PDG 2024
117DETRAY_DECLARE_PARTICLE(pion_zero, 111, 134.9768 * unit<float>::MeV, 0.f);
119DETRAY_DECLARE_PARTICLE(pion_plus, 211, 139.57039f * unit<float>::MeV,
122DETRAY_DECLARE_PARTICLE(pion_minus, -211, 139.57039f * unit<float>::MeV,
125DETRAY_DECLARE_PARTICLE(photon, 22, 0.f, 0.f);
126
127} // namespace detray
Detray include(s).
Definition array_operators.hpp:18
constexpr pdg_particle< scalar_t > charge_conjugation(const pdg_particle< scalar_t > &ptc)
Apply the charge conjugation operator to a particle hypothesis ptc.
Definition pdg_particle.hpp:65
constexpr pdg_particle< scalar_t > update_particle_hypothesis(const pdg_particle< scalar_t > &ptc, const track_t &params)
Select the hypothesis matching the sign of the track charge over momentum.
Definition pdg_particle.hpp:78
Positive muon hypothesis.
Definition pdg_particle.hpp:114
static constexpr scalar_t m_e
Electron rest energy expressed in the internal energy unit.
Definition units.hpp:168
Electron hypothesis.
Definition pdg_particle.hpp:103
Negative muon hypothesis.
Definition pdg_particle.hpp:111
Particle hypothesis identified by PDG number, mass, and electric charge.
Definition pdg_particle.hpp:24
constexpr bool is_valid() const
Definition pdg_particle.hpp:53
constexpr std::int32_t pdg_num() const
Definition pdg_particle.hpp:41
constexpr pdg_particle(const std::int32_t pdg_num, const T mass, const T charge)
Construct a particle hypothesis.
Definition pdg_particle.hpp:33
constexpr scalar_type mass() const
Definition pdg_particle.hpp:45
constexpr scalar_type charge() const
Definition pdg_particle.hpp:49
scalar_t scalar_type
Scalar representation of mass and charge.
Definition pdg_particle.hpp:26
Negative pion hypothesis.
Definition pdg_particle.hpp:123
Positive pion hypothesis.
Definition pdg_particle.hpp:120
Positron hypothesis.
Definition pdg_particle.hpp:106
static constexpr scalar_t e
Charge, native unit e (elementary charge).
Definition units.hpp:105
static constexpr scalar_t MeV
Megaelectronvolt expressed in GeV.
Definition units.hpp:79