ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SimpleHit3D.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file SimpleHit3D.cpp
1 #include "SimpleHit3D.h"
2 
3 #include <iostream>
4 #include <utility>
5 
6 using namespace std;
7 
8 
10  : _cluskey(0)
11  , _id(0)
12  , _layer(-1)
13  , _x(0.0)
14  , _y(0.0)
15  , _z(0.0)
16  , _err()
17  , _size()
18 {
19  for (int j = 0; j < 3; ++j) {
20  for (int i = j; i < 3; ++i) {
21  set_error(i,j,0.0);
22  set_size(i,j,0.0);
23  }
24  }
25 }
26 
27 void SimpleHit3D::print(std::ostream& out) const {
28  //TrkrDefs::cluskey cluskey = get_cluskey();
29  out << "SimpleHit3D: "
30  << "id: " << get_id()
31  << " cluskey: " << _cluskey << " "
32  << " layer: " << get_layer() << " "
33  << "(x,y,z) = (" << get_x() << "," << get_y() << "," << get_z() << ") "
34  << endl;
35 
36  out << " ( ";
37  out << get_error(0,0) << " , ";
38  out << get_error(0,1) << " , ";
39  out << get_error(0,2) << " )" << endl;
40  out << "err = ( ";
41  out << get_error(1,0) << " , ";
42  out << get_error(1,1) << " , ";
43  out << get_error(1,2) << " )" << endl;
44  out << " ( ";
45  out << get_error(2,0) << " , ";
46  out << get_error(2,1) << " , ";
47  out << get_error(2,2) << " )" << endl;
48 
49  out << " ( ";
50  out << get_size(0,0) << " , ";
51  out << get_size(0,1) << " , ";
52  out << get_size(0,2) << " )" << endl;
53  out << "size = ( ";
54  out << get_size(1,0) << " , ";
55  out << get_size(1,1) << " , ";
56  out << get_size(1,2) << " )" << endl;
57  out << " ( ";
58  out << get_size(2,0) << " , ";
59  out << get_size(2,1) << " , ";
60  out << get_size(2,2) << " )" << endl;
61 
62  return;
63 }
64 
65 void SimpleHit3D::set_error(unsigned int i, unsigned int j, float value) {
66  _err[covar_index(i,j)] = value;
67  return;
68 }
69 
70 float SimpleHit3D::get_error(unsigned int i, unsigned int j) const {
71  return _err[covar_index(i,j)];
72 }
73 
74 void SimpleHit3D::set_size(unsigned int i, unsigned int j, float value) {
75  _size[covar_index(i,j)] = value;
76  return;
77 }
78 
79 float SimpleHit3D::get_size(unsigned int i, unsigned int j) const {
80  return _size[covar_index(i,j)];
81 }
82 
83 unsigned int SimpleHit3D::covar_index(unsigned int i, unsigned int j) const {
84  if (i>j) std::swap(i,j);
85  return i+1+(j+1)*(j)/2-1;
86 }