EICd
EIC data model
Cov2f.h
Go to the documentation of this file.
1// AUTOMATICALLY GENERATED FILE - DO NOT EDIT
2
3#ifndef EICD_Cov2f_H
4#define EICD_Cov2f_H
5
6#include <ostream>
7
8#ifdef PODIO_JSON_OUTPUT
9#include "nlohmann/json.hpp"
10#endif
11
12namespace eicd {
13
14
15class Cov2f {
16public:
17 float xx{};
18 float yy{};
19 float xy{};
20
21 Cov2f() : xx{0}, yy{0}, xy{0} {}
22 Cov2f(double vx, double vy, double vxy = 0)
23 : xx{static_cast<float>(vx)}, yy{static_cast<float>(vy)}, xy{static_cast<float>(vxy)} {}
24 float operator()(unsigned i, unsigned j) const {
25 // diagonal
26 if (i == j) {
27 return *(&xx + i);
28 }
29 // off-diagonal
30 // we have as options (0, 1), and (1, 0)
31 // note that, starting from xy, we find the correct element at (i+j+1)/2)
32 return *(&xy + (i + j + 1) / 2);
33 }
34
35
36};
37
38inline std::ostream& operator<<(std::ostream& o, const eicd::Cov2f& value) {
39 o << value.xx << " ";
40 o << value.yy << " ";
41 o << value.xy << " ";
42
43 return o;
44}
45
46#ifdef PODIO_JSON_OUTPUT
47inline void to_json(nlohmann::json& j, const Cov2f& value) {
48 j = nlohmann::json{
49 {"xx", value.xx}
50 ,{"yy", value.yy}
51 ,{"xy", value.xy}
52 };
53}
54#endif
55
56} // namespace eicd
57
58
59#endif
Definition: Cov2f.h:15
float operator()(unsigned i, unsigned j) const
Definition: Cov2f.h:24
Cov2f(double vx, double vy, double vxy=0)
Definition: Cov2f.h:22
float xy
Definition: Cov2f.h:19
Cov2f()
Definition: Cov2f.h:21
float xx
Definition: Cov2f.h:17
float yy
Definition: Cov2f.h:18
Definition: CalorimeterHit.cc:13
std::ostream & operator<<(std::ostream &o, const CalorimeterHit &value)
Definition: CalorimeterHit.cc:93