Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-07-29 09:05:50

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   constexpr Vector4f(float xx, float yy, float zz, float tt) : x(xx), y(yy), z(zz), t(tt) {}
0028   constexpr Vector4f(const float* v) : x(v[0]), y(v[1]), z(v[2]), t(v[3]) {}
0029   constexpr bool operator==(const Vector4f& v) const { return (x == v.x && y == v.y && z == v.z && t == v.t); }
0030   constexpr bool operator!=(const Vector4f& v) const { return !(*this == v); }
0031   constexpr float operator[](unsigned i) const {
0032     static_assert((offsetof(Vector4f, x) + sizeof(Vector4f::x) == offsetof(Vector4f, y)) &&
0033                       (offsetof(Vector4f, y) + sizeof(Vector4f::y) == offsetof(Vector4f, z)) &&
0034                       (offsetof(Vector4f, z) + sizeof(Vector4f::z) == offsetof(Vector4f, t)),
0035                   "operator[] requires no padding");
0036     return *(&x + i);
0037   }
0038 };
0039 
0040 std::ostream& operator<<(std::ostream& o, const Vector4f& value);
0041 
0042 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0043 void to_json(nlohmann::json& j, const Vector4f& value);
0044 #endif
0045 
0046 namespace v6 {
0047   using Vector4f = edm4hep::Vector4f;
0048 } // namespace v6
0049 
0050 // Definitions for older versions
0051 namespace v5 {
0052 
0053   class Vector4f {
0054   public:
0055     float x{};
0056     float y{};
0057     float z{};
0058     float t{};
0059   };
0060 
0061 } // namespace v5
0062 namespace v4 {
0063 
0064   class Vector4f {
0065   public:
0066     float x{};
0067     float y{};
0068     float z{};
0069     float t{};
0070   };
0071 
0072 } // namespace v4
0073 namespace v3 {
0074 
0075   class Vector4f {
0076   public:
0077     float x{};
0078     float y{};
0079     float z{};
0080     float t{};
0081   };
0082 
0083 } // namespace v3
0084 namespace v2 {
0085 
0086   class Vector4f {
0087   public:
0088     float x{};
0089     float y{};
0090     float z{};
0091     float t{};
0092   };
0093 
0094 } // namespace v2
0095 
0096 } // namespace edm4hep
0097 
0098 #endif