File indexing completed on 2025-01-18 09:55:40
0001
0002
0003 #ifndef EDM4HEP_Vector3d_H
0004 #define EDM4HEP_Vector3d_H
0005
0006 #include <ostream>
0007
0008 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0009 #include "nlohmann/json_fwd.hpp"
0010 #endif
0011
0012 namespace edm4hep {
0013
0014
0015
0016
0017
0018 class Vector3d {
0019 public:
0020 double x{};
0021 double y{};
0022 double z{};
0023
0024 constexpr Vector3d() : x(0), y(0), z(0) {
0025 }
0026 constexpr Vector3d(double xx, double yy, double zz) : x(xx), y(yy), z(zz) {
0027 }
0028 constexpr Vector3d(const double* v) : x(v[0]), y(v[1]), z(v[2]) {
0029 }
0030 constexpr Vector3d(const float* v) : x(v[0]), y(v[1]), z(v[2]) {
0031 }
0032 constexpr bool operator==(const Vector3d& v) const {
0033 return (x == v.x && y == v.y && z == v.z);
0034 }
0035 constexpr double operator[](unsigned i) const {
0036 return *(&x + i);
0037 }
0038 };
0039
0040 std::ostream& operator<<(std::ostream& o, const edm4hep::Vector3d& value);
0041
0042 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0043 void to_json(nlohmann::json& j, const Vector3d& value);
0044 #endif
0045
0046 }
0047
0048 #endif