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());
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)
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;
72 os <<
" - global coordinates" << std::endl;
74 os <<
" - local coordinates" << std::endl;
76 os <<
" adc = " <<
getAdc() << std::endl;
79 os <<
" cm, size z = " <<
getZSize() <<
" cm" << std::endl;
84 os <<
getSize(0, 2) <<
" )" << std::endl;
88 os <<
getSize(1, 2) <<
" )" << std::endl;
92 os <<
getSize(2, 2) <<
" )" << std::endl;
97 os <<
getError(0, 2) <<
" )" << std::endl;
101 os <<
getError(1, 2) <<
" )" << std::endl;
105 os <<
getError(2, 2) <<
" )" << std::endl;
108 os <<
"-----------------------------------------------" << std::endl;
115 if (
m_cluskey == TrkrDefs::CLUSKEYMAX)
return 0;
116 for (
int i = 0; i < 3; ++
i)
120 if (
m_adc == 0xFFFFFFFF)
return 0;
121 for (
int j = 0; j < 3; ++
j)
123 for (
int i = j; i < 3; ++
i)
125 if (std::isnan(
getSize(i, j)))
return 0;
126 if (std::isnan(
getError(i, j)))
return 0;
136 if(
this == &source )
return;
147 for (
int j = 0; j < 3; ++
j)
148 for (
int i = 0; i < 3; ++
i)
158 for (
int j = 0; j < 2; ++
j)
159 for (
int i = 0; i < 2; ++
i)
170 {
return m_size[covarIndex(i, j)]; }
179 {
return m_err[covarIndex(i, j)]; }
182 {
return 2*std::sqrt(rotate<&TrkrClusterv2::getSize>(
this)); }
185 {
return 2.*sqrt(
getSize(2, 2)); }
195 {
return std::sqrt(rotate<&TrkrClusterv2::getError>(
this )); }
198 {
return std::sqrt(
getError(2, 2)); }