Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-11-01 08:38:54

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(
0033  (offsetof(Vector4f,x)+sizeof(Vector4f::x) == offsetof(Vector4f,y)) &&
0034  (offsetof(Vector4f,y)+sizeof(Vector4f::y) == offsetof(Vector4f,z)) &&
0035  (offsetof(Vector4f,z)+sizeof(Vector4f::z) == offsetof(Vector4f,t)),
0036  "operator[] requires no padding");
0037  return *( &x + i ) ; }
0038  
0039 
0040 };
0041 
0042 std::ostream& operator<<(std::ostream& o, const edm4hep::Vector4f& value);
0043 
0044 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0045 void to_json(nlohmann::json& j, const Vector4f& value);
0046 #endif
0047 
0048 } // namespace edm4hep
0049 
0050 
0051 #endif