![]() |
|
|||
File indexing completed on 2025-06-03 08:33:23
0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT 0002 0003 #ifndef EDM4HEP_CovMatrix6f_H 0004 #define EDM4HEP_CovMatrix6f_H 0005 0006 #include <array> 0007 #include <edm4hep/utils/cov_matrix_utils.h> 0008 #include <ostream> 0009 0010 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__) 0011 #include "nlohmann/json_fwd.hpp" 0012 #endif 0013 0014 namespace edm4hep { 0015 0016 /** @class CovMatrix6f 0017 * A generic 6 dimensional covariance matrix with values stored in lower triangular form 0018 * @author: 0019 */ 0020 class CovMatrix6f { 0021 public: 0022 std::array<float, 21> values{}; ///< the covariance matrix values 0023 0024 constexpr CovMatrix6f() = default; 0025 template <typename... Vs> 0026 constexpr CovMatrix6f(Vs... v) : values{static_cast<float>(v)...} { 0027 static_assert(sizeof...(v) == 21, "CovMatrix6f requires 21 values"); 0028 } 0029 constexpr CovMatrix6f(const std::array<float, 21>& v) : values(v) { 0030 } 0031 constexpr CovMatrix6f& operator=(std::array<float, 21>& v) { 0032 values = v; 0033 return *this; 0034 } 0035 bool operator==(const CovMatrix6f& v) const { 0036 return v.values == values; 0037 } 0038 bool operator!=(const CovMatrix6f& v) const { 0039 return v.values != values; 0040 } 0041 0042 // This file is meant to be included via the ExtraCode declarationFile directive 0043 // for the CovMatrixNx components. They live in this file because they 0044 // can be written very generically and reduce the clutter and code repetition in 0045 // the edm4hep.yaml file 0046 // 0047 // NOTE: All of these functions are intended to be member functions, and the 0048 // only member of a CovMatrixNx component is an appropriately sized std::array 0049 // named values. 0050 // 0051 // NOTE: It is also assumed that the edm4hep/utils/cov_matrix_utils.h header is 0052 // included via the corresponding ExtraCode: include directive 0053 0054 /// Get the i-th element of the underlying storage 0055 /// 0056 /// \note The values are stored in a flat array assuming a lower 0057 /// triangular matrix representation 0058 constexpr float operator[](unsigned i) const { 0059 return values[i]; 0060 } 0061 0062 /// Get the i-th element of the underlying storage 0063 /// 0064 /// \note The values are stored in a flat array assuming a lower 0065 /// triangular matrix representation 0066 constexpr float& operator[](unsigned i) { 0067 return values[i]; 0068 } 0069 0070 /// Get the begin iterator to the underlying storage 0071 constexpr auto begin() const { 0072 return values.begin(); 0073 } 0074 0075 /// Get the begin iterator to the underlying storage 0076 constexpr auto begin() { 0077 return values.begin(); 0078 } 0079 0080 /// Get the end iterator to the underlying storage 0081 constexpr auto end() const { 0082 return values.end(); 0083 } 0084 0085 /// Get the end iterator to the underlying storage 0086 constexpr auto end() { 0087 return values.end(); 0088 } 0089 0090 /// Get a pointer to the underlying storage data 0091 auto* data() { 0092 return values.data(); 0093 } 0094 0095 /// Get a pointer to the underlying storage data 0096 const auto* data() const { 0097 return values.data(); 0098 } 0099 0100 /// Get the value of the covariance matrix for the passed dimensions 0101 /// 0102 /// @tparam DimEnum The enum (class) type that describes the dimensions of this 0103 /// covariance matrix. This will be deduced from the passed 0104 /// arguments! 0105 /// 0106 /// @param dimI The first dimension for which the covariance matrix value should 0107 /// be obtained 0108 /// @param dimJ The second dimension for which the covariance matrix value 0109 /// should be obtained 0110 /// 0111 /// @returns The value of the covariance matrix for dimension dimI and dimJ 0112 template <typename DimEnum> 0113 constexpr float getValue(DimEnum dimI, DimEnum dimJ) const { 0114 return edm4hep::utils::get_cov_value(values, dimI, dimJ); 0115 } 0116 0117 /// Set the value of the covariance matrix for the passed dimensions 0118 /// 0119 /// @tparam DimEnum The enum (class) type that describes the dimensions of this 0120 /// covariance matrix. This will be deduced from the passed 0121 /// arguments! 0122 /// 0123 /// @param value The value to be set 0124 /// @param dimI The first dimension for which the covariance matrix value 0125 /// should be obtained 0126 /// @param dimJ The second dimension for which the covariance matrix value 0127 /// should be obtained 0128 template <typename DimEnum> 0129 constexpr void setValue(float value, DimEnum dimI, DimEnum dimJ) { 0130 utils::set_cov_value(value, values, dimI, dimJ); 0131 } 0132 }; 0133 0134 std::ostream& operator<<(std::ostream& o, const edm4hep::CovMatrix6f& value); 0135 0136 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__) 0137 void to_json(nlohmann::json& j, const CovMatrix6f& value); 0138 #endif 0139 0140 } // namespace edm4hep 0141 0142 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |