Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:55:28

0001 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
0002 
0003 #ifndef EDM4EIC_Cov2f_H
0004 #define EDM4EIC_Cov2f_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 /** @class Cov2f
0015  *  
0016  *  @author: 
0017  */
0018 class Cov2f {
0019 public:
0020   float xx{};
0021   float yy{};
0022   float xy{};
0023 
0024  Cov2f() : xx{0}, yy{0}, xy{0} {}
0025  Cov2f(double vx, double vy, double vxy = 0)
0026  : xx{static_cast<float>(vx)}, yy{static_cast<float>(vy)}, xy{static_cast<float>(vxy)} {}
0027  float operator()(unsigned i, unsigned j) const {
0028  // diagonal
0029  if (i == j) {
0030  return *(&xx + i);
0031  }
0032  // off-diagonal
0033  // we have as options (0, 1), and (1, 0)
0034  // note that, starting from xy, we find the correct element at (i+j+1)/2)
0035  return *(&xy + (i + j + 1) / 2);
0036  }
0037  
0038 
0039 };
0040 
0041 std::ostream& operator<<(std::ostream& o, const edm4eic::Cov2f& value);
0042 
0043 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0044 void to_json(nlohmann::json& j, const Cov2f& value);
0045 #endif
0046 
0047 } // namespace edm4eic
0048 
0049 
0050 #endif