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 (TrkrClusterv2::*accessor)(
unsigned int,
unsigned int) const>
29 const auto phi = -std::atan2(cluster->
getY(), cluster->
getX());
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)
43 , m_subsurfkey(TrkrDefs::SUBSURFKEYMAX)
47 for (
int i = 0; i < 3; ++i)
m_pos[i] = NAN;
49 for (
int j = 0; j < 6; ++j)
54 for (
int i = 0; i < 2; i++)
57 for(
int j = 0; j < 2; j ++)
66 os <<
"---TrkrClusterv2--------------------" << std::endl;
67 os <<
"clusid: " <<
getClusKey() << std::dec << std::endl;
73 os <<
" - global coordinates" << std::endl;
75 os <<
" - local coordinates" << std::endl;
77 os <<
" adc = " <<
getAdc() << std::endl;
80 os <<
" cm, size z = " <<
getZSize() <<
" cm" << std::endl;
85 os <<
getSize(0, 2) <<
" )" << std::endl;
89 os <<
getSize(1, 2) <<
" )" << std::endl;
93 os <<
getSize(2, 2) <<
" )" << std::endl;
98 os <<
getError(0, 2) <<
" )" << std::endl;
102 os <<
getError(1, 2) <<
" )" << std::endl;
106 os <<
getError(2, 2) <<
" )" << std::endl;
109 os <<
"-----------------------------------------------" << std::endl;
116 if (
m_cluskey == TrkrDefs::CLUSKEYMAX)
return 0;
117 for (
int i = 0; i < 3; ++i)
121 if (
m_adc == 0xFFFFFFFF)
return 0;
122 for (
int j = 0; j < 3; ++j)
124 for (
int i = j; i < 3; ++i)
126 if (std::isnan(
getSize(i, j)))
return 0;
127 if (std::isnan(
getError(i, j)))
return 0;
137 if(
this == &source )
return;
149 for (
int j = 0; j < 3; ++j)
150 for (
int i = 0; i < 3; ++i)
160 for (
int j = 0; j < 2; ++j)
161 for (
int i = 0; i < 2; ++i)
172 {
return m_size[covarIndex(i, j)]; }
181 {
return m_err[covarIndex(i, j)]; }
184 {
return 2*std::sqrt(rotate<&TrkrClusterv2::getSize>(
this)); }
187 {
return 2.*sqrt(
getSize(2, 2)); }
197 {
return std::sqrt(rotate<&TrkrClusterv2::getError>(
this )); }
200 {
return std::sqrt(
getError(2, 2)); }