Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-15 10:12:13

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   constexpr CovMatrix6f& operator=(const std::array<float, 21>& v) {
0031     values = v;
0032     return *this;
0033   }
0034   bool operator==(const CovMatrix6f& v) const { return v.values == values; }
0035   bool operator!=(const CovMatrix6f& v) const { return v.values != values; }
0036 
0037   // This file is meant to be included via the ExtraCode declarationFile directive
0038   // for the CovMatrixNx components. They live in this file because they
0039   // can be written very generically and reduce the clutter and code repetition in
0040   // the edm4hep.yaml file
0041   //
0042   // NOTE: All of these functions are intended to be member functions, and the
0043   // only member of a CovMatrixNx component is an appropriately sized std::array
0044   // named values.
0045   //
0046   // NOTE: It is also assumed that the edm4hep/utils/cov_matrix_utils.h header is
0047   // included via the corresponding ExtraCode: include directive
0048 
0049   /// Get the i-th element of the underlying storage
0050   ///
0051   /// \note The values are stored in a flat array assuming a lower
0052   /// triangular matrix representation
0053   constexpr float operator[](unsigned i) const { return values[i]; }
0054 
0055   /// Get the i-th element of the underlying storage
0056   ///
0057   /// \note The values are stored in a flat array assuming a lower
0058   /// triangular matrix representation
0059   constexpr float& operator[](unsigned i) { return values[i]; }
0060 
0061   /// Get the begin iterator to the underlying storage
0062   constexpr auto begin() const { return values.begin(); }
0063 
0064   /// Get the begin iterator to the underlying storage
0065   constexpr auto begin() { return values.begin(); }
0066 
0067   /// Get the end iterator to the underlying storage
0068   constexpr auto end() const { return values.end(); }
0069 
0070   /// Get the end iterator to the underlying storage
0071   constexpr auto end() { return values.end(); }
0072 
0073   /// Get a pointer to the underlying storage data
0074   auto* data() { return values.data(); }
0075 
0076   /// Get a pointer to the underlying storage data
0077   const auto* data() const { return values.data(); }
0078 
0079   /// Get the value of the covariance matrix for the passed dimensions
0080   ///
0081   /// @tparam DimEnum The enum (class) type that describes the dimensions of this
0082   ///                 covariance matrix. This will be deduced from the passed
0083   ///                 arguments!
0084   ///
0085   /// @param dimI The first dimension for which the covariance matrix value should
0086   ///             be obtained
0087   /// @param dimJ The second dimension for which the covariance matrix value
0088   ///             should be obtained
0089   ///
0090   /// @returns The value of the covariance matrix for dimension dimI and dimJ
0091   template <typename DimEnum>
0092   constexpr float getValue(DimEnum dimI, DimEnum dimJ) const {
0093     return edm4hep::utils::get_cov_value(values, dimI, dimJ);
0094   }
0095 
0096   /// Set the value of the covariance matrix for the passed dimensions
0097   ///
0098   /// @tparam DimEnum The enum (class) type that describes the dimensions of this
0099   ///                 covariance matrix. This will be deduced from the passed
0100   ///                 arguments!
0101   ///
0102   /// @param value The value to be set
0103   /// @param dimI  The first dimension for which the covariance matrix value
0104   ///              should be obtained
0105   /// @param dimJ  The second dimension for which the covariance matrix value
0106   ///              should be obtained
0107   template <typename DimEnum>
0108   constexpr void setValue(float value, DimEnum dimI, DimEnum dimJ) {
0109     utils::set_cov_value(value, values, dimI, dimJ);
0110   }
0111 };
0112 
0113 std::ostream& operator<<(std::ostream& o, const CovMatrix6f& value);
0114 
0115 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0116 void to_json(nlohmann::json& j, const CovMatrix6f& value);
0117 #endif
0118 
0119 namespace v5 {
0120   using CovMatrix6f = edm4hep::CovMatrix6f;
0121 } // namespace v5
0122 
0123 } // namespace edm4hep
0124 
0125 #endif