25 std::unique_ptr<Trk::TrackParameters>
34 p[0],
p[1],
p[2],
p[3],
p[4], std::move(
e))
47 if (!T->hasSurface()) {
51 m_surface.reset(T->associatedSurface().isFree() ? T->associatedSurface().clone() : &T->associatedSurface());
53 m_parameters = T->parameters();
58 if (m_covariance == std::nullopt) {
59 m_covariance.emplace();
62 for (std::size_t
i = 0;
i < 5;
i++) {
63 for (std::size_t j = 0; j <=
i; j++) {
64 m_covariance->fillSymmetric(
i, j, (*C)(
i, j));
81 return calculatePosition();
88 std::ostream& Trk::operator <<
94 MsgStream& Trk::operator <<
106 std::stringstream
ss;
109 const std::string
name{
s?
s->name():
""};
110 const std::string
N(
"\n");
111 ss <<
"Track parameters for " <<
name <<
" surface " <<
N;
112 ss.unsetf(std::ios::fixed);
113 ss.setf (std::ios::showpos);
114 ss.setf (std::ios::scientific);
115 if (m_covariance != std::nullopt) {
117 ss << std::setprecision(4) <<
118 P[ 0]<<
" |"<<V(0, 0) <<
N;
119 ss << std::setprecision(4) <<
120 P[ 1]<<
" |"<<V(0, 1)<<
" "<<V(1, 1) <<
N;
121 ss << std::setprecision(4) <<
122 P[ 2]<<
" |"<<V(0, 2)<<
" "<<V(1, 2)<<
" "<<V(2, 2) <<
N;
123 ss << std::setprecision(4) <<
124 P[ 3]<<
" |"<<V(0, 3)<<
" "<<V(1, 3)<<
" "<<V(2, 3)<<
" "<<V(3, 3) <<
N;
125 ss << std::setprecision(4) <<
126 P[ 4]<<
" |"<<V(0, 4)<<
" "<<V(1, 4)<<
" "<<V(2, 4)<<
" "<<V(3, 4)<<
" "<<V(4, 4) <<
N;
129 ss << std::setprecision(4) <<
P[ 0] <<
" |" <<
N;
130 ss << std::setprecision(4) <<
P[ 1] <<
" |" <<
N;
131 ss << std::setprecision(4) <<
P[ 2] <<
" |" <<
N;
132 ss << std::setprecision(4) <<
P[ 3] <<
" |" <<
N;
133 ss << std::setprecision(4) <<
P[ 4] <<
" |" <<
N;
171 double Ax[3] = {T(0,0),T(1,0),T(2,0)};
172 double Ay[3] = {T(0,1),T(1,1),T(2,1)};
174 Amg::Vector3D gp (m_parameters[0]*Ax[0]+m_parameters[1]*Ay[0]+T(0,3),
175 m_parameters[0]*Ax[1]+m_parameters[1]*Ay[1]+T(1,3),
176 m_parameters[0]*Ax[2]+m_parameters[1]*Ay[2]+T(2,3));
188 double A[3] = {T(0,2),T(1,2),T(2,2)};
191 double Cf; sincos(m_parameters[2],&Sf,&Cf);
193 double Ce; sincos(m_parameters[3],&Se,&Ce);
198 double Bx =
A[1]*P5-
A[2]*P4;
199 double By =
A[2]*P3-
A[0]*P5;
200 double Bz =
A[0]*P4-
A[1]*P3;
201 double Bn = 1./std::sqrt(Bx*Bx+By*By+Bz*Bz); Bx*=Bn; By*=Bn; Bz*=Bn;
204 (m_parameters[1]*
A[0]+Bx*m_parameters[0]+T(0,3),
205 m_parameters[1]*
A[1]+By*m_parameters[0]+T(1,3),
206 m_parameters[1]*
A[2]+Bz*m_parameters[0]+T(2,3));
218 double Ax[3] = {T(0,0),T(1,0),T(2,0)};
219 double Ay[3] = {T(0,1),T(1,1),T(2,1)};
222 double Cf; sincos(m_parameters[1],&Sf,&Cf);
224 double d0 = Cf*Ax[0]+Sf*Ay[0];
225 double d1 = Cf*Ax[1]+Sf*Ay[1];
226 double d2 = Cf*Ax[2]+Sf*Ay[2];
229 (m_parameters[0]*
d0+T(0,3),
230 m_parameters[0]*
d1+T(1,3),
231 m_parameters[0]*
d2+T(2,3));
243 double Ax[3] = {T(0,0),T(1,0),T(2,0)};
244 double Ay[3] = {T(0,1),T(1,1),T(2,1)};
245 double Az[3] = {T(0,2),T(1,2),T(2,2)};
248 double fr = m_parameters[0]/R;
251 double Cf; sincos(
fr,&Sf,&Cf);
254 (R*(Cf*Ax[0]+Sf*Ay[0])+m_parameters[1]*Az[0]+T(0,3),
255 R*(Cf*Ax[1]+Sf*Ay[1])+m_parameters[1]*Az[1]+T(1,3),
256 R*(Cf*Ax[2]+Sf*Ay[2])+m_parameters[1]*Az[2]+T(2,3));
268 double A[3] = {T(0,2),T(1,2),T(2,2)};
271 double Cf; sincos(m_parameters[2],&Sf,&Cf);
273 double Ce; sincos(m_parameters[3],&Se,&Ce);
278 double Bx =
A[1]*P5-
A[2]*P4;
279 double By =
A[2]*P3-
A[0]*P5;
280 double Bz =
A[0]*P4-
A[1]*P3;
281 double Bn = 1./std::sqrt(Bx*Bx+By*By+Bz*Bz); Bx*=Bn; By*=Bn; Bz*=Bn;
284 (m_parameters[1]*
A[0]+Bx*m_parameters[0]+T(0,3),
285 m_parameters[1]*
A[1]+By*m_parameters[0]+T(1,3),
286 m_parameters[1]*
A[2]+Bz*m_parameters[0]+T(2,3));
298 double Ax[3] = {T(0,0),T(1,0),T(2,0)};
299 double Ay[3] = {T(0,1),T(1,1),T(2,1)};
300 double Az[3] = {T(0,2),T(1,2),T(2,2)};
304 double Cf; sincos((m_parameters[0]/
r),&Sf,&Cf);
310 (Ax[0]*xl+Ay[0]*yl+Az[0]*m_parameters[1]+T(0,3),
311 Ax[1]*xl+Ay[1]*yl+Az[1]*m_parameters[1]+T(1,3),
312 Ax[2]*xl+Ay[2]*yl+Az[2]*m_parameters[1]+T(2,3));
324 int n =
E.rows();
if(n<=0 || n>2) {
return false;
328 if (m_covariance == std::nullopt) {
334 if (m_covariance == std::nullopt) {
335 m_covariance.emplace();
339 m_parameters[0] =
P (0);
341 m_covariance->fillSymmetric(0, 0,
E(0,0));
344 m_parameters[ 1] =
P(1);
345 m_covariance->fillSymmetric(0, 1,
E(1,0));
346 m_covariance->fillSymmetric(1, 1,
E(1,1));
349 m_parameters[ 1] = Tp.m_parameters[ 1];
351 m_parameters[ 2] = Tp.m_parameters[ 2];
352 m_parameters[ 3] = Tp.m_parameters[ 3];
353 m_parameters[ 4] = Tp.m_parameters[ 4];
358 m_surface.reset(
nullptr);
370 constexpr
double pi =
M_PI;
371 constexpr
double pi2 = 2.*
M_PI;
373 m_parameters[ 2] = m_parameters[2]-
pi;
374 m_parameters[ 3] =
pi-m_parameters[3];
375 m_parameters[ 4] = -m_parameters[4] ;
377 if (m_parameters[2] < -
pi) {
378 m_parameters[2] +=
pi2;
384 if (m_covariance == std::nullopt) {
388 m_covariance->fillSymmetric(0, 3, -(*m_covariance)(0, 3));
389 m_covariance->fillSymmetric(1, 3, -(*m_covariance)(1, 3));
390 m_covariance->fillSymmetric(2, 3, -(*m_covariance)(2, 3));
391 m_covariance->fillSymmetric(0, 4, -(*m_covariance)(0, 4));
392 m_covariance->fillSymmetric(1, 4, -(*m_covariance)(1, 4));
393 m_covariance->fillSymmetric(2, 4, -(*m_covariance)(2, 4));
398 m_parameters[ 0] = -m_parameters[ 0];
401 if(m_covariance == std::nullopt) {
405 m_covariance->fillSymmetric(0, 1, -(*m_covariance)(0, 1));
406 m_covariance->fillSymmetric(0, 2, -(*m_covariance)(0, 2));
407 m_covariance->fillSymmetric(1, 3, -(*m_covariance)(1, 3));
408 m_covariance->fillSymmetric(2, 3, -(*m_covariance)(2, 3));
409 m_covariance->fillSymmetric(1, 4, -(*m_covariance)(1, 4));
410 m_covariance->fillSymmetric(2, 4, -(*m_covariance)(2, 4));
417 switch ( m_surface->type()){
425 return localToGlobal(
static_cast<const Trk::DiscSurface*
>(m_surface.get()));
434 return localToGlobal(
static_cast<const Trk::ConeSurface*
>(m_surface.get()));
442 double p = absoluteMomentum();
445 return {
p * Se * Cf,
p * Se * Sf,
p * Ce};