File indexing completed on 2025-01-18 09:55:28
0001
0002
0003 #ifndef EDM4EIC_Cov6f_H
0004 #define EDM4EIC_Cov6f_H
0005
0006 #include <array>
0007 #include <ostream>
0008
0009 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0010 #include "nlohmann/json_fwd.hpp"
0011 #endif
0012
0013 namespace edm4eic {
0014
0015
0016
0017
0018
0019 class Cov6f {
0020 public:
0021 std::array<float, 21> covariance{};
0022
0023 Cov6f() : covariance{} {}
0024 Cov6f(std::array<float, 21> vcov) : covariance{vcov}{}
0025 float operator()(unsigned i, unsigned j) const {
0026 if(i > j) {
0027 std::swap(i, j);
0028 }
0029 return covariance[i + 1 + (j + 1) * (j) / 2 - 1];
0030 }
0031 float& operator()(unsigned i, unsigned j) {
0032 if(i > j) {
0033 std::swap(i, j);
0034 }
0035 return covariance[i + 1 + (j + 1) * (j) / 2 - 1];
0036 }
0037
0038
0039 };
0040
0041 std::ostream& operator<<(std::ostream& o, const edm4eic::Cov6f& value);
0042
0043 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0044 void to_json(nlohmann::json& j, const Cov6f& value);
0045 #endif
0046
0047 }
0048
0049
0050 #endif