Analysis Software
Documentation for sPHENIX simulation 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 
13 
14 #include <cmath>
15 
16 namespace ActsFatras {
17 namespace Casts {
18 
20 struct Vrho {
21  double operator()(const Particle& particle) const {
22  return std::hypot(particle.position().x(), particle.position().y());
23  }
24 };
25 
27 struct Vz {
28  double operator()(const Particle& particle) const {
29  return particle.position().z();
30  }
31 };
32 
34 struct AbsVz {
35  double operator()(const Particle& particle) const {
36  return std::abs(particle.position().z());
37  }
38 };
39 
41 struct Eta {
42  double operator()(const Particle& particle) const {
43  // particle direction is always normalized, i.e. dz = pz / p
44  return std::atanh(particle.direction().z());
45  }
46 };
47 
49 struct AbsEta {
50  double operator()(const Particle& particle) const {
51  // particle direction is always normalized, i.e. dz = pz / p
52  return std::atanh(std::abs(particle.direction().z()));
53  }
54 };
55 
57 struct Pt {
58  double operator()(const Particle& particle) const {
59  // particle direction is always normalized, i.e. dt²+dz²=1 w/ dt²=dx²+dy²
60  return particle.absoluteMomentum() *
62  }
63 };
64 
66 struct P {
67  double operator()(const Particle& particle) const {
68  return particle.absoluteMomentum();
69  }
70 };
71 
73 struct E {
74  double operator()(const Particle& particle) const {
75  return particle.energy();
76  }
77 };
78 
79 } // namespace Casts
80 } // namespace ActsFatras