Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:09:08

0001 // This file is part of the Acts project.
0002 //
0003 // Copyright (C) 2018 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/Utilities/Helpers.hpp"
0012 #include <cmath>
0013 
0014 namespace Fatras {
0015 
0016 namespace casts {
0017 
0018 /// The Eta cast operator
0019 struct eta {
0020 
0021   template <typename particle_t>
0022   double operator()(const particle_t &particle) const {
0023     return Acts::VectorHelpers::eta(particle.momentum());
0024   }
0025 };
0026 
0027 /// The Eta cast operator
0028 struct absEta {
0029 
0030   template <typename particle_t>
0031   double operator()(const particle_t &particle) const {
0032     return std::abs(Acts::VectorHelpers::eta(particle.momentum()));
0033   }
0034 };
0035 
0036 /// The Pt cast operator
0037 struct pT {
0038   template <typename particle_t>
0039   double operator()(const particle_t &particle) const {
0040     return Acts::VectorHelpers::perp(particle.momentum());
0041   }
0042 };
0043 
0044 /// The P cast operator
0045 struct p {
0046   template <typename particle_t>
0047   double operator()(const particle_t &particle) const {
0048     return particle.momentum().norm();
0049   }
0050 };
0051 
0052 /// The E cast operator
0053 struct E {
0054 
0055   template <typename particle_t>
0056   double operator()(const particle_t &particle) const {
0057     return particle.E();
0058   }
0059 };
0060 
0061 /// The E cast operator
0062 struct vR {
0063 
0064   template <typename particle_t>
0065   double operator()(const particle_t &particle) const {
0066     return Acts::VectorHelpers::perp(particle.position());
0067   }
0068 };
0069 
0070 /// The E cast operator
0071 struct vZ {
0072 
0073   template <typename particle_t>
0074   double operator()(const particle_t &particle) const {
0075     return particle.position().z();
0076   }
0077 };
0078 
0079 /// The E cast operator
0080 struct AbsVz {
0081 
0082   template <typename particle_t>
0083   double operator()(const particle_t &particle) const {
0084     return std::abs(particle.position().z());
0085   }
0086 };
0087 
0088 } // namespace casts
0089 } // namespace Fatras