Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:12:13

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   double operator()(const Particle& particle) const {
0021     return std::hypot(particle.position().x(), particle.position().y());
0022   }
0023 };
0024 
0025 /// Retrieve the longitudinal distance of the position to the origin.
0026 struct Vz {
0027   double operator()(const Particle& particle) const {
0028     return particle.position().z();
0029   }
0030 };
0031 
0032 /// Retrieve the longitudinal absolute distance of the position to the origin.
0033 struct AbsVz {
0034   double operator()(const Particle& particle) const {
0035     return std::abs(particle.position().z());
0036   }
0037 };
0038 
0039 /// Retrieve the direction pseudo-rapidity.
0040 struct Eta {
0041   double operator()(const Particle& particle) const {
0042     // particle direction is always normalized, i.e. dz = pz / p
0043     return std::atanh(particle.direction().z());
0044   }
0045 };
0046 
0047 /// Retrieve the direction absolute pseudo-rapidity.
0048 struct AbsEta {
0049   double operator()(const Particle& particle) const {
0050     // particle direction is always normalized, i.e. dz = pz / p
0051     return std::atanh(std::abs(particle.direction().z()));
0052   }
0053 };
0054 
0055 /// Retrieve the transverse momentum.
0056 struct Pt {
0057   double operator()(const Particle& particle) const {
0058     // particle direction is always normalized, i.e. dt²+dz²=1 w/ dt²=dx²+dy²
0059     return particle.absoluteMomentum() *
0060            Acts::VectorHelpers::perp(particle.direction());
0061   }
0062 };
0063 
0064 /// Retrieve the absolute momentum.
0065 struct P {
0066   double operator()(const Particle& particle) const {
0067     return particle.absoluteMomentum();
0068   }
0069 };
0070 
0071 /// Retrieve the total energy.
0072 struct E {
0073   double operator()(const Particle& particle) const {
0074     return particle.energy();
0075   }
0076 };
0077 
0078 }  // namespace ActsFatras::Casts