EICd
EIC data model
VectorPolar.h
Go to the documentation of this file.
1 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
2 
3 #ifndef EICD_VectorPolar_H
4 #define EICD_VectorPolar_H
5 
6 #include <cmath>
7 #include<tuple>
8 #include <ostream>
9 
10 namespace eic {
11 
12 
13 class VectorPolar {
14 public:
15  float r{}; ///< [mm] or [GeV]
16  float theta{}; ///< [rad, 0->pi]
17  float phi{}; ///< [rad, -pi->pi]
18 
19  VectorPolar() : r{0}, theta{0}, phi{0} {}
20  VectorPolar(double rr, double th, double ph) : r{static_cast<float>(rr)}, theta{static_cast<float>(th)}, phi{static_cast<float>(ph)} {}
21  template<class VectorXYZType> VectorPolar(const VectorXYZType& v) : VectorPolar(v.r(), v.theta(), v.phi()) {}
22  float mag() const {return r;}
23  float x() const {return r * cos(phi) * sin(theta);}
24  float y() const {return r * sin(phi) * sin(theta);}
25  float z() const {return r * cos(theta);}
26  float eta() const {return -log(tan(0.5*theta));}
27  operator std::tuple<float, float, float>() {return {r, theta, phi};}
28 
29 
30 };
31 
32 inline std::ostream& operator<<(std::ostream& o, const eic::VectorPolar& value) {
33  o << value.r << " ";
34  o << value.theta << " ";
35  o << value.phi << " ";
36 
37  return o;
38 }
39 
40 } // namespace eic
41 
42 
43 
44 #endif
eic::operator<<
std::ostream & operator<<(std::ostream &o, const ConstBasicParticle &value)
Definition: BasicParticle.cc:102
eic::VectorPolar::phi
float phi
[rad, -pi->pi]
Definition: VectorPolar.h:17
eic::VectorPolar::eta
float eta() const
Definition: VectorPolar.h:26
eic::VectorPolar::y
float y() const
Definition: VectorPolar.h:24
eic::VectorPolar::theta
float theta
[rad, 0->pi]
Definition: VectorPolar.h:16
eic::VectorPolar::VectorPolar
VectorPolar(const VectorXYZType &v)
Definition: VectorPolar.h:21
eic::VectorPolar::VectorPolar
VectorPolar(double rr, double th, double ph)
Definition: VectorPolar.h:20
eic
Definition: BasicParticle.cc:13
eic::VectorPolar::r
float r
[mm] or [GeV]
Definition: VectorPolar.h:15
eic::VectorPolar::z
float z() const
Definition: VectorPolar.h:25
eic::VectorPolar
Definition: VectorPolar.h:13
eic::VectorPolar::x
float x() const
Definition: VectorPolar.h:23
eic::VectorPolar::VectorPolar
VectorPolar()
Definition: VectorPolar.h:19
eic::VectorPolar::mag
float mag() const
Definition: VectorPolar.h:22