![]() |
|
|||
File indexing completed on 2025-10-17 07:59:51
0001 // This file is part of the ACTS project. 0002 // 0003 // Copyright (C) 2016 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 https://mozilla.org/MPL/2.0/. 0008 0009 #pragma once 0010 0011 #include "Acts/Utilities/VectorHelpers.hpp" 0012 #include "ActsFatras/EventData/Particle.hpp" 0013 0014 #include <cmath> 0015 0016 namespace ActsFatras::Casts { 0017 0018 /// Retrieve the transverse absolute distance of the position to the origin. 0019 struct Vrho { 0020 /// @brief Extract transverse distance from origin 0021 /// @param particle The particle to extract from 0022 /// @return Transverse distance rho = sqrt(x² + y²) from particle position 0023 double operator()(const Particle& particle) const { 0024 return std::hypot(particle.position().x(), particle.position().y()); 0025 } 0026 }; 0027 0028 /// Retrieve the longitudinal distance of the position to the origin. 0029 struct Vz { 0030 /// @brief Extract longitudinal distance from origin 0031 /// @param particle The particle to extract from 0032 /// @return Z-coordinate of particle position 0033 double operator()(const Particle& particle) const { 0034 return particle.position().z(); 0035 } 0036 }; 0037 0038 /// Retrieve the longitudinal absolute distance of the position to the origin. 0039 struct AbsVz { 0040 /// @brief Extract absolute longitudinal distance from origin 0041 /// @param particle The particle to extract from 0042 /// @return Absolute value of Z-coordinate of particle position 0043 double operator()(const Particle& particle) const { 0044 return std::abs(particle.position().z()); 0045 } 0046 }; 0047 0048 /// Retrieve the direction pseudo-rapidity. 0049 struct Eta { 0050 /// @brief Extract direction pseudo-rapidity 0051 /// @param particle The particle to extract from 0052 /// @return Pseudo-rapidity η = atanh(p_z/p) from particle direction 0053 double operator()(const Particle& particle) const { 0054 // particle direction is always normalized, i.e. dz = pz / p 0055 return std::atanh(particle.direction().z()); 0056 } 0057 }; 0058 0059 /// Retrieve the direction absolute pseudo-rapidity. 0060 struct AbsEta { 0061 /// @brief Extract absolute direction pseudo-rapidity 0062 /// @param particle The particle to extract from 0063 /// @return Absolute pseudo-rapidity |η| = atanh(|p_z|/p) from particle direction 0064 double operator()(const Particle& particle) const { 0065 // particle direction is always normalized, i.e. dz = pz / p 0066 return std::atanh(std::abs(particle.direction().z())); 0067 } 0068 }; 0069 0070 /// Retrieve the transverse momentum. 0071 struct Pt { 0072 /// @brief Extract transverse momentum 0073 /// @param particle The particle to extract from 0074 /// @return Transverse momentum p_T = p × sin(θ) from particle momentum 0075 double operator()(const Particle& particle) const { 0076 // particle direction is always normalized, i.e. dt²+dz²=1 w/ dt²=dx²+dy² 0077 return particle.absoluteMomentum() * 0078 Acts::VectorHelpers::perp(particle.direction()); 0079 } 0080 }; 0081 0082 /// Retrieve the absolute momentum. 0083 struct P { 0084 /// @brief Extract absolute momentum magnitude 0085 /// @param particle The particle to extract from 0086 /// @return Total momentum magnitude |p| of the particle 0087 double operator()(const Particle& particle) const { 0088 return particle.absoluteMomentum(); 0089 } 0090 }; 0091 0092 /// Retrieve the total energy. 0093 struct E { 0094 /// @brief Extract total energy 0095 /// @param particle The particle to extract from 0096 /// @return Total energy E = sqrt(p²c² + m²c⁴) of the particle 0097 double operator()(const Particle& particle) const { 0098 return particle.energy(); 0099 } 0100 }; 0101 0102 } // namespace ActsFatras::Casts
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |