16 template<
class T>
inline constexpr
T square(
const T&
x ) {
return x*
x; }
19 inline unsigned int covarIndex(
unsigned int i,
unsigned int j)
22 return i + 1 + (j + 1) * (j) / 2 - 1;
26 template<
float (TrkrClusterv1::*accessor)(
unsigned int,
unsigned int) const>
29 const auto phi = -std::atan2(cluster->
getY(), cluster->
getX());
30 const auto cosphi = std::cos(
phi);
31 const auto sinphi = std::sin(
phi);
34 square(sinphi)*(cluster->*accessor)(0,0) +
35 square(cosphi)*(cluster->*accessor)(1,1) +
36 2.*cosphi*sinphi*(cluster->*accessor)(0,1);
42 : m_cluskey(TrkrDefs::CLUSKEYMAX)
46 for (
int i = 0; i < 3; ++
i)
m_pos[i] = NAN;
48 for (
int j = 0; j < 3; ++
j)
50 for (
int i = 0; i < 3; ++
i)
60 os <<
"---TrkrClusterv1--------------------" << std::endl;
66 os <<
" - global coordinates" << std::endl;
68 os <<
" - local coordinates" << std::endl;
70 os <<
" adc = " <<
getAdc() << std::endl;
73 os <<
" cm, size z = " <<
getZSize() <<
" cm" << std::endl;
78 os <<
getSize(0, 2) <<
" )" << std::endl;
82 os <<
getSize(1, 2) <<
" )" << std::endl;
86 os <<
getSize(2, 2) <<
" )" << std::endl;
91 os <<
getError(0, 2) <<
" )" << std::endl;
95 os <<
getError(1, 2) <<
" )" << std::endl;
99 os <<
getError(2, 2) <<
" )" << std::endl;
102 os <<
"-----------------------------------------------" << std::endl;
109 if (
m_cluskey == TrkrDefs::CLUSKEYMAX)
return 0;
110 for (
int i = 0; i < 3; ++
i)
114 if (
m_adc == 0xFFFFFFFF)
return 0;
115 for (
int j = 0; j < 3; ++
j)
117 for (
int i = j; i < 3; ++
i)
119 if (std::isnan(
getSize(i, j)))
return 0;
120 if (std::isnan(
getError(i, j)))
return 0;
130 if(
this == &source )
return;
141 for (
int j = 0; j < 3; ++
j)
142 for (
int i = 0; i < 3; ++
i)
156 {
return m_size[covarIndex(i, j)]; }
165 {
return m_err[covarIndex(i, j)]; }
168 {
return 2*std::sqrt(rotate<&TrkrClusterv1::getSize>(
this)); }
171 {
return 2.*sqrt(
getSize(2, 2)); }
181 {
return std::sqrt(rotate<&TrkrClusterv1::getError>(
this )); }
184 {
return std::sqrt(
getError(2, 2)); }