ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
KinematicCasts.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file KinematicCasts.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2018-2020 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 http://mozilla.org/MPL/2.0/.
8 
9 #pragma once
10 
11 #include <cmath>
12 
14 
15 namespace ActsFatras {
16 namespace Casts {
17 
19 struct Vrho {
20  double operator()(const Particle& particle) const {
21  return std::hypot(particle.position().x(), particle.position().y());
22  }
23 };
24 
26 struct Vz {
27  double operator()(const Particle& particle) const {
28  return particle.position().z();
29  }
30 };
31 
33 struct AbsVz {
34  double operator()(const Particle& particle) const {
35  return std::abs(particle.position().z());
36  }
37 };
38 
40 struct Eta {
41  double operator()(const Particle& particle) const {
42  // particle direction is always normalized, i.e. dz = pz / p
43  return std::atanh(particle.unitDirection().z());
44  }
45 };
46 
48 struct AbsEta {
49  double operator()(const Particle& particle) const {
50  // particle direction is always normalized, i.e. dz = pz / p
51  return std::atanh(std::abs(particle.unitDirection().z()));
52  }
53 };
54 
56 struct Pt {
57  double operator()(const Particle& particle) const {
58  // particle direction is always normalized, i.e. dt²+dz²=1 w/ dt²=dx²+dy²
59  return particle.absMomentum() * std::hypot(particle.unitDirection().x(),
60  particle.unitDirection().y());
61  }
62 };
63 
65 struct P {
66  double operator()(const Particle& particle) const {
67  return particle.absMomentum();
68  }
69 };
70 
72 struct E {
73  double operator()(const Particle& particle) const {
74  return particle.energy();
75  }
76 };
77 
78 } // namespace Casts
79 } // namespace ActsFatras