File indexing completed on 2025-01-18 09:55:28
0001
0002
0003 #ifndef EDM4EIC_Cov4f_H
0004 #define EDM4EIC_Cov4f_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 edm4eic {
0013
0014
0015
0016
0017
0018 class Cov4f {
0019 public:
0020 float xx{};
0021 float yy{};
0022 float zz{};
0023 float tt{};
0024 float xy{};
0025 float xz{};
0026 float xt{};
0027 float yz{};
0028 float yt{};
0029 float zt{};
0030
0031 Cov4f() : xx{0}, yy{0}, zz{0}, tt{0}, xy{0}, xz{0}, xt{0}, yz{0}, yt{0}, zt{0} {}
0032 Cov4f(double vx, double vy, double vz, double vt,
0033 double vxy = 0, double vxz = 0, double vxt = 0,
0034 double vyz = 0, double vyt = 0, double vzt = 0)
0035 : xx{static_cast<float>(vx)}, yy{static_cast<float>(vy)}, zz{static_cast<float>(vz)}, tt{static_cast<float>(vt)},
0036 xy{static_cast<float>(vxy)}, xz{static_cast<float>(vxz)}, xt{static_cast<float>(vxt)},
0037 yz{static_cast<float>(vyz)}, yt{static_cast<float>(vyt)}, zt{static_cast<float>(vzt)} {}
0038 float operator()(unsigned i, unsigned j) const {
0039
0040 if (i == j) {
0041 return *(&xx + i);
0042
0043 } else {
0044 if (i > j) {
0045 std::swap(i,j);
0046 }
0047 if (i == 0) {
0048 return *(&xy + j - 1);
0049 } else if (i == 1) {
0050 return *(&yz + j - 2);
0051 } else {
0052 return zt;
0053 }
0054 }
0055 }
0056
0057
0058 };
0059
0060 std::ostream& operator<<(std::ostream& o, const edm4eic::Cov4f& value);
0061
0062 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0063 void to_json(nlohmann::json& j, const Cov4f& value);
0064 #endif
0065
0066 }
0067
0068
0069 #endif