Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-06 08:34:48

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef EDM4HEP_Vector4f_H
0004 #define EDM4HEP_Vector4f_H
0005 
0006 #include <cstddef>
0007 #include <ostream>
0008 
0009 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0010 #include "nlohmann/json_fwd.hpp"
0011 #endif
0012 
0013 namespace edm4hep {
0014 
0015 /** @class Vector4f
0016  *  Generic vector for storing classical 4D coordinates in memory. Four momentum helper functions are in edm4hep::utils
0017  *  @author:
0018  */
0019 class Vector4f {
0020 public:
0021   float x{};
0022   float y{};
0023   float z{};
0024   float t{};
0025 
0026   constexpr Vector4f() : x(0), y(0), z(0), t(0) {
0027   }
0028   constexpr Vector4f(float xx, float yy, float zz, float tt) : x(xx), y(yy), z(zz), t(tt) {
0029   }
0030   constexpr Vector4f(const float* v) : x(v[0]), y(v[1]), z(v[2]), t(v[3]) {
0031   }
0032   constexpr bool operator==(const Vector4f& v) const {
0033     return (x == v.x && y == v.y && z == v.z && t == v.t);
0034   }
0035   constexpr bool operator!=(const Vector4f& v) const {
0036     return !(*this == v);
0037   }
0038   constexpr float operator[](unsigned i) const {
0039     static_assert((offsetof(Vector4f, x) + sizeof(Vector4f::x) == offsetof(Vector4f, y)) &&
0040                       (offsetof(Vector4f, y) + sizeof(Vector4f::y) == offsetof(Vector4f, z)) &&
0041                       (offsetof(Vector4f, z) + sizeof(Vector4f::z) == offsetof(Vector4f, t)),
0042                   "operator[] requires no padding");
0043     return *(&x + i);
0044   }
0045 };
0046 
0047 std::ostream& operator<<(std::ostream& o, const edm4hep::Vector4f& value);
0048 
0049 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0050 void to_json(nlohmann::json& j, const Vector4f& value);
0051 #endif
0052 
0053 } // namespace edm4hep
0054 
0055 #endif