Warning, file /include/edm4hep/Vector3d.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003 #ifndef EDM4HEP_Vector3d_H
0004 #define EDM4HEP_Vector3d_H
0005
0006 #include <cstddef>
0007 #include <edm4hep/Vector3f.h>
0008 #include <ostream>
0009
0010 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0011 #include "nlohmann/json_fwd.hpp"
0012 #endif
0013
0014 namespace edm4hep {
0015
0016
0017
0018
0019
0020 class Vector3d {
0021 public:
0022 double x{};
0023 double y{};
0024 double z{};
0025
0026 constexpr Vector3d() : x(0), y(0), z(0) {}
0027 constexpr Vector3d(double xx, double yy, double zz) : x(xx), y(yy), z(zz) {}
0028 constexpr Vector3d(const double* v) : x(v[0]), y(v[1]), z(v[2]) {}
0029 constexpr Vector3d(const float* v) : x(v[0]), y(v[1]), z(v[2]) {}
0030 constexpr bool operator==(const Vector3d& v) const { return (x == v.x && y == v.y && z == v.z); }
0031 constexpr bool operator!=(const Vector3d& v) const { return !(*this == v); }
0032 constexpr double operator[](unsigned i) const {
0033 static_assert((offsetof(Vector3d, x) + sizeof(Vector3d::x) == offsetof(Vector3d, y)) &&
0034 (offsetof(Vector3d, y) + sizeof(Vector3d::y) == offsetof(Vector3d, z)),
0035 "operator[] requires no padding");
0036 return *(&x + i);
0037 }
0038 };
0039
0040 std::ostream& operator<<(std::ostream& o, const 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 namespace v5 {
0047 using Vector3d = edm4hep::Vector3d;
0048 }
0049
0050 }
0051
0052 #endif