42 declareInterface<IUpdator>(
this );
53 ATH_MSG_WARNING(
"Wrong-sized initial covariance given, so set to default: ");
58 ATH_MSG_DEBUG(
"Fast computation will be used for track state cov matrices (Fruehwirth-1987 eq. 8a)." );
60 ATH_MSG_DEBUG(
"Track state cov matrix will be calculated according to Gelb-1975 p305." );
66 return StatusCode::SUCCESS;
72 return StatusCode::SUCCESS;
79 if (
msgLvl(MSG::VERBOSE))
logStart(
"addToState(TP,LPOS,ERR)",inputTrkPar);
81 const int updatingSign = 1;
84 if (!
getStartCov(covTrk,inputTrkPar,updatingSign))
return nullptr;
87 int nLocCoord = measLocCov.cols();
91 measLocPos[0],1,measLocCov,
92 updatingSign,fitQoS,
false);
93 }
if (nLocCoord == 2) {
98 updatingSign,fitQoS,
false);
100 ATH_MSG_WARNING(
" number (" << nLocCoord <<
") of local coordinates must be 1 or 2, can not update!" );
109 if (
msgLvl(MSG::VERBOSE))
logStart(
"addToState(TP,LPAR,ERR)",trkPar);
119 const int updatingSign = 1;
120 if (
msgLvl(MSG::VERBOSE))
logStart(
"addToState(TP,LPOS,ERR,FQ)",inputTP);
122 ATH_MSG_WARNING(
"expect nil FitQuality pointer, refuse operation to avoid mem leak!");
127 if (!
getStartCov(covTrk,inputTP,updatingSign))
return nullptr;
129 int nLocCoord = measLocCov.cols();
130 if (nLocCoord == 1) {
133 measLocPos[0],1,measLocCov,
134 updatingSign,fitQoS,
true);
135 }
if (nLocCoord == 2) {
140 updatingSign,fitQoS,
true);
142 ATH_MSG_WARNING(
" number (" << nLocCoord <<
") of local coordinates must be 1 or 2, can not update!" );
153 if (
msgLvl(MSG::VERBOSE))
logStart(
"addToState(TP,LPAR,ERR,FQ)",trkPar);
156 <<
" avoid mem leak!" );
167 if (
msgLvl(MSG::VERBOSE))
logStart(
"removeFromState(TP,LPOS,ERR)",inputTP);
169 const int updatingSign = -1;
171 if (!
getStartCov(covTrk,inputTP,updatingSign))
return nullptr;
173 int nLocCoord = measLocCov.cols();
174 if (nLocCoord == 1) {
177 measLocPos[0],1,measLocCov,
178 updatingSign,fitQoS,
false);
179 }
if (nLocCoord == 2) {
184 updatingSign,fitQoS,
false);
187 <<
"must be 1 or 2, can not un-update!" );
196 if (
msgLvl(MSG::DEBUG))
logStart(
"removeFromState(TP,LPAR,ERR)",trkPar);
206 const int updatingSign = -1;
207 if (
msgLvl(MSG::VERBOSE))
logStart(
"removeFromState(TP,LPOS,ERR,FQ)",inputTP);
209 msg(MSG::WARNING) <<
"expect nil FitQuality pointer, refuse operation to"
210 <<
" avoid mem leak!" <<
endmsg;
215 if (!
getStartCov(covTrk,inputTP,updatingSign))
return nullptr;
217 int nLocCoord = measLocCov.cols();
218 if (nLocCoord == 1) {
221 measLocPos[0],1,measLocCov,
222 updatingSign,fitQoS,
true);
223 }
if (nLocCoord == 2) {
228 updatingSign,fitQoS,
true);
231 <<
" must be 1 or 2, can not un-update!" );
242 if (
msgLvl(MSG::VERBOSE))
logStart(
"removeFromState(TP,LPAR,ERR,FQ)",trkPar);
244 ATH_MSG_WARNING(
"expect nil FitQuality pointer, refuse operation to avoid mem leak!" );
259 if (!covOne && ! covTwo) {
260 ATH_MSG_WARNING(
"both parameters have no errors, invalid use of Updator::combineStates()" );
266 return std::unique_ptr<Trk::TrackParameters>(
two.clone());
270 return std::unique_ptr<Trk::TrackParameters>(
one.clone());
278 for (
int i=0; i<5; ++i)
279 for (
int j=0; j<=i; ++j) {
280 covOneSM(j,i) = (*covOne)(j,i);
299 if (!covOne && ! covTwo) {
300 ATH_MSG_WARNING(
"both parameters have no errors, invalid use of Updator::combineStates()" );
305 ATH_MSG_WARNING(
"expect nil FitQuality pointer, refuse operation to avoid mem leak!");
312 return std::unique_ptr<Trk::TrackParameters>(
two.clone());
316 return std::unique_ptr<Trk::TrackParameters>(
one.clone());
321 for (
int i=0; i<5; ++i)
322 for (
int j=0; j<=i; ++j) {
323 covOneSM(j,i) = (*covOne)(j,i);
338 ATH_MSG_DEBUG(
"--> entered KalmanUpdatorSMatrix::fullStateFitQuality(TP,LPOS,ERR)" );
340 if (!trkPar.covariance()) {
345 int nLocCoord = covRio.cols();
346 if (nLocCoord == 1) {
348 (*trkPar.covariance()),
351 }
if (nLocCoord == 2) {
353 SmeasCov(0,0) = covRio(0,0);
354 SmeasCov(1,0) = covRio(0,1);
355 SmeasCov(1,1) = covRio(1,1);
357 (*trkPar.covariance()),
372 ATH_MSG_VERBOSE(
"--> entered KalmanUpdatorSMatrix::fullStateFitQuality(TP,LPAR,ERR)" );
375 if (!trkPar.covariance()) {
382 ROOT::Math::SVector<int,5> intAccessor;
383 for (
int i=0,k=0; i<5; ++i) {
if (parRio.
parameterKey() & (1<<i)) intAccessor(k++)=i; }
384 if (nLocCoord == 1) {
386 (*trkPar.covariance()),
389 }
if (nLocCoord == 2) {
391 for (
int i=0, irow=0; i<5; ++i) {
393 SmeasCov(0,irow) = covRio(0,irow);
394 SmeasCov(1,irow) = covRio(1,irow);
399 (*trkPar.covariance()),
403 }
if (nLocCoord == 5) {
405 (*trkPar.covariance()),
417 if (parRio.
parameterKey()==31)
r = (parRio - trkPar.parameters());
418 else r = (parRio -
H*trkPar.parameters());
430 ATH_MSG_VERBOSE(
"--> entered KalmanUpdatorSMatrix::predictedStateFitQuality(TP,LPOS,ERR)" );
432 if (!predPar.covariance()) {
433 ATH_MSG_WARNING(
"input state has no error matrix in predictedStateFitQuality()" );
437 int nLocCoord = covRio.cols();
438 if (nLocCoord == 1) {
440 (*predPar.covariance()),
443 }
if (nLocCoord == 2) {
445 SmeasCov(0,0) = covRio(0,0);
446 SmeasCov(1,0) = covRio(1,0);
447 SmeasCov(1,1) = covRio(1,1);
449 (*predPar.covariance()),
463 ATH_MSG_VERBOSE(
"--> entered KalmanUpdatorSMatrix::predictedStateFitQuality(TP,LPAR,ERR)" );
466 if (!predPar.covariance()) {
467 ATH_MSG_WARNING(
"input state has no error matrix in predictedStateFitQuality()" );
473 ROOT::Math::SVector<int,5> intAccessor;
474 for (
int i=0,k=0; i<5; ++i) {
if (parRio.
parameterKey() & (1<<i)) intAccessor(k++)=i; }
475 if (nLocCoord == 1) {
477 (*predPar.covariance()),
480 }
if (nLocCoord == 2) {
482 for (
int i=0, irow=0; i<5; ++i) {
484 SmeasCov(0,irow) = covRio(0,irow);
485 SmeasCov(1,irow) = covRio(1,irow);
490 (*predPar.covariance()),
494 }
if (nLocCoord == 5 ) {
496 (*predPar.covariance()),
508 if (parRio.
parameterKey()==31)
r = parRio - predPar.parameters();
509 else r = parRio -
H * predPar.parameters();
521 ATH_MSG_VERBOSE(
"--> entered KalmanUpdatorSMatrix::predictedStateFitQuality(TP,TP)");
526 if (!covOne && ! covTwo) {
527 ATH_MSG_WARNING(
"both parameters have no errors, invalid use of Updator::fitQuality()" );
531 if (!covOne || ! covTwo) {
532 ATH_MSG_DEBUG(
"One parameter does not have uncertainties, assume initial state and return chi2=0.0");
542 std::vector<double> E(5);
543 for (
int i=0; i<5; ++i) E[i] = std::sqrt(
m_cov0(i));
553 bool createFQoS )
const {
559 int nLocCoord = covRio.cols();
564 ROOT::Math::SVector<int,5> intAccessor;
565 for (
int i=0,k=0; i<5; ++i) {
if (parRio.
parameterKey() & (1<<i)) intAccessor(k++)=i; }
570 sign,fitQoS,createFQoS);
574 sign,fitQoS,createFQoS);
578 sign,fitQoS,createFQoS);
581 sign,fitQoS,createFQoS);
584 sign,fitQoS,createFQoS);
589std::unique_ptr<Trk::TrackParameters>
598 bool createFQoS )
const {
601 if (paramKey!=1)
for (
int i=0; i<5; ++i)
if (paramKey & (1<<i)) mk=i;
603 double r = measPar - trkPar(mk);
604 double R = (
sign * measCov(0,0)) + trkCov(mk,mk);
606 ATH_MSG_DEBUG(
"inversion of the error-on-the-residual failed.");
611 ROOT::Math::SMatrix<double,5,1,ROOT::Math::MatRepStd<double, 5, 1> >
612 K = trkCov.Sub<ROOT::Math::SMatrix<double,5,1,ROOT::Math::MatRepStd<double, 5, 1> > >(0,mk)*R;
613 if (
msgLvl(MSG::VERBOSE)) {
617 <<std::setiosflags(std::ios::fixed | std::ios::showpoint | std::ios::right)
618 << std::setw(7) << std::setprecision(4) << K(0,0)<<
", "
619 << std::setw(7) << std::setprecision(4) << K(1,0)<<
", "
620 << std::setw(7) << std::setprecision(4) << K(2,0)<<
", "
621 << std::setw(7) << std::setprecision(4) << K(3,0)<<
", "
622 << std::setw(7) << std::setprecision(4) << K(4,0)<<
")"
623 << std::resetiosflags(std::ios::fixed));
632 ATH_MSG_DEBUG(
"calculateFS_1D(): decided to damp update of theta and re-calculate." );
635 newPar = trkPar + dampedCov * R *
r;
638 <<std::setiosflags(std::ios::fixed | std::ios::showpoint | std::ios::right)
639 << std::setw(7) << std::setprecision(4) << K(0,0)<<
", "
640 << std::setw(7) << std::setprecision(4) << K(1,0)<<
", "
641 << std::setw(7) << std::setprecision(4) << K(2,0)<<
", "
642 << std::setw(7) << std::setprecision(4) << K(3,0)<<
", "
643 << std::setw(7) << std::setprecision(4) << K(4,0)<<
")"
644 << std::resetiosflags(std::ios::fixed) );
646 ATH_MSG_DEBUG(
"-U- theta out of range but can not damp this update.");
654 << M(0,0)<<
"," << M(1,1)<<
","
655 << M(2,2)<<
"," << M(3,3)<<
","
661 newCov = ROOT::Math::Similarity(M,trkCov)
662 +
sign*(ROOT::Math::Similarity(K,measuredSMatrix1D));
670 ROOT::Math::AssignSym::Evaluate(newCov, M * trkCov);
680 double predictedResidual = (
sign<0) ?
r:measPar - newPar(mk);
686 double chiSquared = measCov(0,0) - updatedCov(mk,mk);
687 if (chiSquared == 0.0)
688 ATH_MSG_DEBUG(
"division by zero in 1D chi2, set chi2 to 0.0 instead" );
691 chiSquared = predictedResidual*predictedResidual/chiSquared;
693 <<
" state, chi2 :" << chiSquared <<
" / ndof= 1" );
701std::unique_ptr<Trk::TrackParameters>
710 bool createFQoS )
const {
712 ROOT::Math::SMatrix<double,2,5,ROOT::Math::MatRepStd<double, 2, 5> >
H;
715 for (
int i=0, irow=0; i<5; ++i) {
716 if (paramKey & (1<<i)) {
718 H.Place_in_row(
v, irow, 0);
719 SmeasCov(0,irow) = measCov(0,irow);
720 SmeasCov(1,irow) = measCov(1,irow);
728 ATH_MSG_DEBUG(
"inversion of residual error matrix (2D) failed.");
733 ROOT::Math::SMatrix<double,5,2,ROOT::Math::MatRepStd<double, 5, 2> >
734 K = trkCov * ROOT::Math::Transpose(
H) * R;
735 if (
msgLvl(MSG::VERBOSE)) {
738 trans_R.Place_at(R,0,0),
739 trans_K.Place_at(K,0,0));
746 ( std::abs(R(0,0)*
r(0))>1.0 || std::abs(R(1,1)*
r(1))>1.0 ||
748 ATH_MSG_DEBUG(
"calculateFS_2D(): decided to damp update of theta and re-calculate.");
751 newPar = trkPar + K *
r;
753 msg(MSG::DEBUG) <<
"-U- damped gain K0=("
754 <<std::setiosflags(std::ios::fixed | std::ios::showpoint | std::ios::right)
755 << std::setw(7) << std::setprecision(4) << K(0,0)<<
", "
756 << std::setw(7) << std::setprecision(4) << K(1,0)<<
", "
757 << std::setw(7) << std::setprecision(4) << K(2,0)<<
", "
758 << std::setw(7) << std::setprecision(4) << K(3,0)<<
", "
759 << std::setw(7) << std::setprecision(4) << K(4,0)<<
")"
760 << std::resetiosflags(std::ios::fixed) <<
endmsg;
761 msg(MSG::DEBUG) <<
"-U- K1=("
762 <<std::setiosflags(std::ios::fixed | std::ios::showpoint | std::ios::right)
763 << std::setw(7) << std::setprecision(4) << K(0,1)<<
", "
764 << std::setw(7) << std::setprecision(4) << K(1,1)<<
", "
765 << std::setw(7) << std::setprecision(4) << K(2,1)<<
", "
766 << std::setw(7) << std::setprecision(4) << K(3,1)<<
", "
767 << std::setw(7) << std::setprecision(4) << K(4,1)<<
")"
768 << std::resetiosflags(std::ios::fixed) <<
endmsg;
771 ATH_MSG_DEBUG(
"-U- theta out of range but can not damp this update.");
781 newCov = ROOT::Math::Similarity(M,trkCov)
782 +
sign*(ROOT::Math::Similarity(K,SmeasCov));
789 ROOT::Math::AssignSym::Evaluate(newCov, M * trkCov);
798 double chiSquared = (
sign>0) ?
800 ROOT::Math::Similarity(
r,R) :
802 ROOT::Math::Similarity(
r,-R);
804 <<
" state, chi2 :" << chiSquared <<
" / ndof= 2" );
811std::unique_ptr<Trk::TrackParameters>
819 bool createFQoS )
const {
824 ROOT::Math::SMatrix<double,3,5,ROOT::Math::MatRepStd<double, 3, 5> >
H;
825 for (
int i=0, irow=0; i<5; ++i) {
828 H.Place_in_row(
v, irow, 0);
829 SmeasCov(0,irow) = measCov(0,irow);
830 SmeasCov(1,irow) = measCov(1,irow);
831 SmeasCov(2,irow) = measCov(2,irow);
839 ATH_MSG_DEBUG(
"inversion of residual error matrix (3D) failed.");
844 ROOT::Math::SMatrix<double,5,3,ROOT::Math::MatRepStd<double, 5, 3> >
845 K = trkCov * ROOT::Math::Transpose(
H) * R;
847 if (
msgLvl(MSG::VERBOSE)) {
850 trans_R.Place_at(R,0,0), trans_K.Place_at(K,0,0));
860 newCov = ROOT::Math::Similarity(M,trkCov)
861 +
sign*(ROOT::Math::Similarity(K,SmeasCov));
868 ROOT::Math::AssignSym::Evaluate(newCov, M * trkCov);
880 SmeasPar -
H * newPar ;
888 if ( !R2.Invert() ) {
889 ATH_MSG_DEBUG(
"matrix (3D) inversion not possible, set chi2 to zero");
893 chiSquared = ROOT::Math::Similarity(predictedResidual,R2);
895 <<
" state, chi2 :" << chiSquared <<
" / ndof= 3" );
903std::unique_ptr<Trk::TrackParameters>
911 bool createFQoS )
const {
918 ROOT::Math::SMatrix<double,4,5,ROOT::Math::MatRepStd<double, 4, 5> >
H;
919 for (
int i=0, irow=0; i<5; ++i) {
922 H.Place_in_row(
v, irow, 0);
923 SmeasCov(0,irow) = measCov(0,irow);
924 SmeasCov(1,irow) = measCov(1,irow);
925 SmeasCov(2,irow) = measCov(2,irow);
926 SmeasCov(3,irow) = measCov(3,irow);
934 ATH_MSG_DEBUG(
"inversion of residual error matrix (4D) failed." );
939 ROOT::Math::SMatrix<double,5,4,ROOT::Math::MatRepStd<double, 5, 4> >
940 K = trkCov * ROOT::Math::Transpose(
H) * R;
942 if (
msgLvl(MSG::VERBOSE)) {
945 trans_R.Place_at(R,0,0), trans_K.Place_at(K,0,0));
955 newCov = ROOT::Math::Similarity(M,trkCov)
956 +
sign*(ROOT::Math::Similarity(K,SmeasCov));
963 ROOT::Math::AssignSym::Evaluate(newCov, M * trkCov);
981 if ( !R2.Invert() ) {
982 ATH_MSG_DEBUG(
"matrix (4D) inversion not possible, set chi2 to zero");
986 chiSquared = ROOT::Math::Similarity(predictedResidual,R2);
988 <<
" state, chi2 :" << chiSquared <<
" / ndof= 4" );
996std::unique_ptr<Trk::TrackParameters>
1004 bool createFQoS )
const {
1006 for (
int i=0; i<5; ++i)
1007 for (
int j=0; j<=i; ++j) {
1008 trkCovTwo(j,i) = measCov(j,i);
1014 ATH_MSG_DEBUG(
"inversion of residual error matrix (5D) failed." );
1021 ATH_MSG_WARNING(
"calculateFS_5D(): bad angles in intermediate residual!" );
1038 ROOT::Math::AssignSym::Evaluate(newCov, K * trkCovTwo);
1047 bool goodMatrix(
true);
1048 for (
int i=0; i<5; ++i) {
1049 if (newCov(i,i) < 0.0 && goodMatrix ) goodMatrix=
false;
1055 newCov = ROOT::Math::Similarity(M,trkCovOne)
1056 +
sign*(ROOT::Math::Similarity(K,trkCovTwo));
1058 for (
int i=0; i<5; ++i) {
1059 if (newCov(i,i) < 0.0 && goodMatrix ) goodMatrix=
false;
1068 double chiSquared = (
sign>0) ?
1070 ROOT::Math::Similarity(
r,R) :
1072 ROOT::Math::Similarity(
r,-R);
1074 <<
" state, chi2 :" << chiSquared <<
" / ndof= 5" );
1090 if (key!=1)
for (
int i=0; i<5; ++i)
if (key & (1<<i)) mk=i;
1091 double r = valRio - parTrk(mk);
1093 double chiSquared = covRio +
sign * covTrk(mk,mk);
1094 if (chiSquared == 0.0) {
1095 ATH_MSG_DEBUG(
"inversion of the error-on-the-residual failed." );
1098 chiSquared =
r*
r/chiSquared;
1100 return {chiSquared, 1};
1112 ROOT::Math::SVector<int,2>
index(0,1);
1114 for (
int i=0, irow=0; i<5; ++i)
1115 if (key & (1<<i))
index(irow++) = i;
1119 double chiSquared = 0.0;
1121 ATH_MSG_DEBUG(
"matrix inversion not possible, set chi2 to zero" );
1123 chiSquared = ROOT::Math::Similarity(
r,R);
1125 <<
" state, chi2 :" << chiSquared <<
" / ndof= 2" );
1127 return {chiSquared, 2};
1140 for (
int i=0; i<5; ++i)
1141 for (
int j=0; j<=i; ++j) {
1142 ScovOne(i,j) = covOne(i,j);
1143 ScovTwo(i,j) = covTwo(i,j);
1147 double chiSquared = 0.0;
1149 ATH_MSG_DEBUG(
"matrix inversion not possible, set chi2 to zero" );
1151 chiSquared = ROOT::Math::Similarity(
r,R);
1153 <<
" state, chi2 :" << chiSquared <<
" / ndof= 2" );
1155 return {chiSquared, 5};
1158std::unique_ptr<Trk::TrackParameters>
1164 std::string_view ndtext)
const {
1167 for (
int i=0; i<5; ++i) {
1168 for (
int j=0; j<=i; ++j) {
1169 C.fillSymmetric(i,j, covpar(i,j));
1173 std::unique_ptr<Trk::TrackParameters> resultPar =
1176 if (
msgLvl(MSG::VERBOSE) && resultPar) {
1177 char reportCalledInterface[80];
1179 memset(ndtext2,
'\0', 5 ); ndtext.copy(ndtext2,2);
1181 sprintf(reportCalledInterface,
"%s-%s,%s)",
1182 (ndtext==
"5D"?
"combineStates(TP,TP":
"addToState(TP,Meas"),
1183 ndtext2,(createFQoS?
"Err,FQ":
"Err"));
1185 sprintf(reportCalledInterface,
"%s,Meas-%s,%s)",
"removeFromState(TP,",
1186 ndtext2,(createFQoS?
"Err,FQ":
"Err"));
1187 logResult((std::string)reportCalledInterface, resultPar->parameters(),
C);
1199 ROOT::Math::SVector<int,2> iv;
1200 for (
int i=0,k=0; i<5; ++i) {
if (key & (1<<i)) iv(k++)=i; }
1202 for (
int i=0; i<2; ++i) {
1203 for (
int j=0; j<2; ++j) {
1204 covSubMatrix(i,j) = M(iv(i),iv(j));
1207 return covSubMatrix;
1214 ROOT::Math::SVector<int,2> iv;
1215 for (
int i=0,k=0; i<5; ++i) {
if (key & (1<<i)) iv(k++)=i; }
1217 for (
int i=0; i<2; ++i) {
1218 for (
int j=0; j<2; ++j) {
1219 covSubMatrix(i,j) = M(iv(i),iv(j));
1222 return covSubMatrix;
1230 ROOT::Math::SVector<int,3> iv;
1231 for (
int i=0,k=0; i<5; ++i) {
if (key & (1<<i)) iv(k++)=i; }
1233 for (
int i=0; i<3; ++i) {
1234 for (
int j=0; j<3; ++j) {
1235 covSubMatrix(i,j) = M(iv(i),iv(j));
1238 return covSubMatrix;
1247 ROOT::Math::SVector<int,4> iv;
1248 for (
int i=0,k=0; i<5; ++i) {
if (key & (1<<i)) iv(k++)=i; }
1250 for (
int i=0; i<4; ++i) {
1251 for (
int j=0; j<4; ++j) {
1252 covSubMatrix(i,j) = M(iv(i),iv(j));
1255 return covSubMatrix;
1261 const int isign)
const
1264 const AmgSymMatrix(5)* covariance = inputParameters.covariance();
1267 ATH_MSG_WARNING (
"MeasuredTrackParameters == Null, can not calculate updated parameter state.");
1271 ATH_MSG_VERBOSE (
"-U- no covTrk at input - assign large error matrix for the time being.");
1276 for (
int i=0; i<5; ++i) {
1277 for (
int j=0; j<=i; ++j) {
1278 M(i,j) = (*covariance)(i,j);
1293 double chiSquared = 0.;
1295 ATH_MSG_DEBUG(
"matrix inversion not possible, set chi2 to zero" );
1299 chiSquared =
Amg::chi2(R.inverse(), residual);
1301 <<
" state, chi2 :" << chiSquared <<
" / ndof= " << covRio.cols() );
1305 int numberDoF = covRio.cols();
1307 return {chiSquared, numberDoF};
1312 if (
P.dimension() != dimCov ) {
1313 ATH_MSG_WARNING (
"Inconsistency in dimension of local coord - problem with LocalParameters object?");
1314 ATH_MSG_WARNING (
"dim of local parameters: "<<
P.dimension()<<
" vs. dim of error matrix: "<<dimCov);
1368 ATH_MSG_DEBUG(
"--> entered KalmanUpdatorSMatrix::" << IDstring );
1369 ATH_MSG_VERBOSE(
"-U- TrkPar:" << std::setiosflags(std::ios::right)<<std::setprecision(4)
1370 << std::setw( 9)<<tp.parameters()[0]<< std::setw(10)<<tp.parameters()[1]<<std::setprecision(5)
1371 << std::setw(10)<<tp.parameters()[2]<< std::setw(10)<<tp.parameters()[3]<<std::setprecision(4)
1372 << std::setw(10)<<tp.parameters()[4]);
1378 ATH_MSG_VERBOSE(
"-U- cov "<<std::setiosflags(std::ios::right)<<std::setprecision(3)
1379 << std::setw(9)<<covTrk(0,0)<<
" "<< std::setw(9)<<covTrk(0,1)<<
" "
1380 << std::setw(9)<<covTrk(0,2)<<
" "<< std::setw(9)<<covTrk(0,3)<<
" "
1381 << std::setw(9)<<covTrk(0,4));
1383 << std::setw(9)<<covTrk(1,1)<<
" "<< std::setw(9)<<covTrk(1,2)<<
" "
1384 << std::setw(9)<<covTrk(1,3)<<
" "<< std::setw(9)<<covTrk(1,4));
1386 << std::setw(9)<<covTrk(2,2)<<
" "<< std::setw(9)<<covTrk(2,3)<<
" "
1387 << std::setw(9)<<covTrk(2,4));
1389 << std::setw(9)<<covTrk(3,3)<<
" "<< std::setw(9)<<covTrk(3,4));
1391 << std::setw(9)<<covTrk(4,4)<<std::setprecision(6));
1393 int nLocCoord = covRio.cols();
1396 msg(MSG::VERBOSE) <<
"-U- measurement (err)^2: " <<std::setprecision(4)<<covRio(0,0);
1397 for (
int i=1; i<nLocCoord; i++)
msg(MSG::VERBOSE) <<
", "<<covRio(i,i);
1398 msg(MSG::VERBOSE) << std::setprecision(6)<<
"\n";
1406 msg(MSG::VERBOSE) <<
"-U- residual: r=("<<
r(0);
1407 for (
int i=1; i<nc; i++)
msg(MSG::VERBOSE) <<
","<<
r(i);
1408 msg(MSG::VERBOSE) <<
")\n";
1409 msg(MSG::VERBOSE) <<
"-U- inv. sigmaR=("<< R(0,0);
1410 for (
int i=1; i<nc; i++)
msg(MSG::VERBOSE) <<
"," << R(i,i);
1411 msg(MSG::VERBOSE) <<
")\n";
1412 for (
int i=0; i<nc; i++)
1414 << ( i==0 ?
"-U- gain mtx K=(" :
" (" )
1415 << std::setiosflags(std::ios::fixed | std::ios::showpoint | std::ios::right )
1416 << std::setw(7) << std::setprecision(4) << K(0,i)<<
", "
1417 << std::setw(7) << std::setprecision(4) << K(1,i)<<
", "
1418 << std::setw(7) << std::setprecision(4) << K(2,i)<<
", "
1419 << std::setw(7) << std::setprecision(4) << K(3,i)<<
", "
1420 << std::setw(7) << std::setprecision(4) << K(4,i)<<
")"
1421 << std::resetiosflags(std::ios::fixed) <<
"\n";
1429 msg(MSG::VERBOSE) <<
"-U- ==> result for KalmanUpdatorSMatrix::"<<methodName<<
endmsg;
1430 msg(MSG::VERBOSE) <<
"-U- new par"<<std::setiosflags(std::ios::right)<<std::setprecision(4)
1431 << std::setw( 9)<<par[0]<< std::setw(10)<<par[1]<<std::setprecision(5)
1432 << std::setw(10)<<par[2]<< std::setw(10)<<par[3]<<std::setprecision(4)
1433 << std::setw(10)<<par[4] <<
"\n";
1434 msg(MSG::VERBOSE) <<
"-U- new cov" <<std::setiosflags(std::ios::right)<<std::setprecision(3)
1435 << std::setw(9)<<(covPar)(0,0)<<
" "<< std::setw(9)<<(covPar)(0,1)<<
" "
1436 << std::setw(9)<<(covPar)(0,2)<<
" "<< std::setw(9)<<(covPar)(0,3)
1437 <<
" " << std::setw(9)<<(covPar)(0,4)<<
"\n";
1438 msg(MSG::VERBOSE) <<
" " <<
" " <<
" "
1439 << std::setw(9)<<(covPar)(1,1)<<
" "<< std::setw(9)<<(covPar)(1,2)<<
" "
1440 << std::setw(9)<<(covPar)(1,3)<<
" "<< std::setw(9)<<(covPar)(1,4)<<
"\n";
1441 msg(MSG::VERBOSE) <<
" covariance matrix " <<
" " <<
" "
1442 << std::setw(9)<<(covPar)(2,2) <<
" "<< std::setw(9)<<(covPar)(2,3) <<
" "
1443 << std::setw(9)<<(covPar)(2,4) <<
"\n";
1444 msg(MSG::VERBOSE) <<
" of the UPDATED track pars " <<
" "
1445 <<
" " <<std::setw(9)<<(covPar)(3,3) <<
" "
1446 << std::setw(9)<<(covPar)(3,4) <<
"\n";
1447 msg(MSG::VERBOSE) <<
" " <<
" "
1449 << std::setw(9)<<(covPar)(4,4) <<std::setprecision(6)<<
"\n";
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
#define AmgSymMatrix(dim)
ROOT::Math::SVector< double, 3 > SParVector3
ROOT::Math::SMatrix< double, 2, 2, ROOT::Math::MatRepSym< double, 2 > > SCovMatrix2
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > SCovMatrix5
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepStd< double, 5, 5 > > SGenMatrix5
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepSym< double, 3 > > SCovMatrix3
ROOT::Math::SMatrix< double, 1, 1, ROOT::Math::MatRepSym< double, 1 > > SCovMatrix1
ROOT::Math::SVector< double, 2 > SParVector2
ROOT::Math::SMatrix< double, 4, 4, ROOT::Math::MatRepSym< double, 4 > > SCovMatrix4
ROOT::Math::SVector< double, 5 > SParVector5
ROOT::Math::SVector< double, 4 > SParVector4
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
bool msgLvl(const MSG::Level lvl) const
std::unique_ptr< TrackParameters > calculateFilterStep_4D(const TrackParameters &, const SParVector5 &, const SCovMatrix5 &, const LocalParameters &, const Amg::MatrixX &, const int, FitQualityOnSurface *&, bool) const
common maths calculation code for all addToState and removeFromState versions which happen to be call...
virtual FitQualityOnSurface fullStateFitQuality(const TrackParameters &, const Amg::Vector2D &, const Amg::MatrixX &) const override final
estimator for FitQuality on Surface from a full track state, that is a state which contains the curre...
bool thetaPhiWithinRange_5D(const SParVector5 &V, const RangeCheckDef rcd) const
Test if angles are inside boundaries.
virtual ~KalmanUpdatorSMatrix()
std::unique_ptr< TrackParameters > calculateFilterStep_1D(const TrackParameters &, const SParVector5 &, const SCovMatrix5 &, double, int, const Amg::MatrixX &, const int, FitQualityOnSurface *&, bool) const
common maths calculation code for all addToState and removeFromState versions which happen to be call...
static const ParamDefsAccessor s_enumAccessor
std::unique_ptr< TrackParameters > calculateFilterStep_5D(const TrackParameters &, const SParVector5 &, const SCovMatrix5 &, const SParVector5 &, const Amg::MatrixX &, const int, FitQualityOnSurface *&, bool) const
common maths calculation code for all addToState and removeFromState versions which happen to be call...
void logGainForm(int, const SParVector5 &, const SCovMatrix5 &, const SGenMatrix5 &) const
internal structuring: common logfile output during calculation
virtual FitQualityOnSurface predictedStateFitQuality(const TrackParameters &, const Amg::Vector2D &, const Amg::MatrixX &) const override final
estimator for FitQuality on Surface from a predicted track state, that is a state which contains the ...
SCovMatrix5 m_unitMatrix
avoid mem allocation at every call
bool getStartCov(SCovMatrix5 &, const TrackParameters &, const int) const
Helper method to transform Eigen cov matrix to SMatrix.
FitQualityOnSurface makeChi2_2D(const SParVector5 &, const AmgSymMatrix(5)&, const SParVector2 &, const SCovMatrix2 &, int, int) const
virtual StatusCode initialize() override
AlgTool initialisation.
FitQualityOnSurface makeChi2Object(const Amg::VectorX &, const AmgSymMatrix(5)&, const Amg::MatrixX &, const Amg::MatrixX &, int) const
std::unique_ptr< TrackParameters > convertToClonedTrackPars(const TrackParameters &, const SParVector5 &, const SCovMatrix5 &, int, bool, std::string_view) const
Helper method to convert internal results from SMatrix to Eigen. */.
virtual std::vector< double > initialErrors() const override final
give back how updator is configured for inital covariances
std::unique_ptr< TrackParameters > calculateFilterStep_2D(const TrackParameters &, const SParVector5 &, const SCovMatrix5 &, const SParVector2 &, int, const Amg::MatrixX &, const int, FitQualityOnSurface *&, bool) const
common maths calculation code for all addToState and removeFromState versions which happen to be call...
virtual std::unique_ptr< TrackParameters > addToState(const TrackParameters &, const Amg::Vector2D &, const Amg::MatrixX &) const override final
measurement updator for the KalmanFitter getting the meas't coord' from Amg::Vector2D (use eg with PR...
float m_thetaGainDampingValue
static SCovMatrix3 projection_3D(const SCovMatrix5 &, int)
Avoid multiplications with sparse H matrices by cutting 3D rows&columns out of the full cov matrix.
virtual StatusCode finalize() override
AlgTool termination.
bool thetaWithinRange_5D(const SParVector5 &V) const
Test if theta angle is inside boundaries. No differential-check option.
virtual std::unique_ptr< TrackParameters > removeFromState(const TrackParameters &, const Amg::Vector2D &, const Amg::MatrixX &) const override final
reverse update eg for track property analysis (unbiased residuals) getting the measurement coordinate...
bool correctThetaPhiRange_5D(SParVector5 &, SCovMatrix5 &, const RangeCheckDef) const
method correcting the calculated angles back to their defined ranges phi (-pi, pi) and theta (0,...
virtual std::unique_ptr< TrackParameters > combineStates(const TrackParameters &, const TrackParameters &) const override final
trajectory state updator which combines two parts of a trajectory on a common surface.
std::unique_ptr< TrackParameters > prepareFilterStep(const TrackParameters &, const LocalParameters &, const Amg::MatrixX &, const int, FitQualityOnSurface *&, bool) const
common code analysing the measurement's rank and calling the appropriate implementation for this rank...
KalmanUpdatorSMatrix(const std::string &, const std::string &, const IInterface *)
AlgTool standard constuctor.
SParVector5 m_cov0
initial cov values in SMatrix object
void logResult(const std::string &, const AmgVector(5) &, const AmgSymMatrix(5) &) const
internal structuring: common logfile output after calculation
static SCovMatrix2 projection_2D(const SCovMatrix5 &, int)
Avoid multiplications with sparse H matrices by cutting 2D rows&columns out of the full cov matrix.
bool m_useFruehwirth8a
job options controlling update formula for covariance matrix
void logInputCov(const SCovMatrix5 &, const Amg::VectorX &, const Amg::MatrixX &) const
internal structuring: common logfile output of the inputs
std::unique_ptr< TrackParameters > calculateFilterStep_3D(const TrackParameters &, const SParVector5 &, const SCovMatrix5 &, const LocalParameters &, const Amg::MatrixX &, const int, FitQualityOnSurface *&, bool) const
common maths calculation code for all addToState and removeFromState versions which happen to be call...
std::vector< double > m_cov_stdvec
job options for initial cov values
static SCovMatrix4 projection_4D(const SCovMatrix5 &, int)
Avoid multiplications with sparse H matrices by cutting 4D rows&columns out of the full cov matrix.
FitQualityOnSurface makeChi2_5D(const SParVector5 &, const AmgSymMatrix(5)&, const SParVector5 &, const AmgSymMatrix(5)&, int) const
FitQualityOnSurface makeChi2_1D(const SParVector5 &, const AmgSymMatrix(5)&, double, double, int, int) const
also the chi2 calculation and FitQuality object creation is combined in an extra method.
bool consistentParamDimensions(const LocalParameters &, int) const
method testing correct use of LocalParameters
void logStart(const std::string &, const TrackParameters &) const
internal structuring: debugging output for start of method.
int parameterKey() const
Identifier key for matrix expansion/reduction.
const Amg::MatrixX & expansionMatrix() const
Expansion matrix from 5x5 to the [dimension()]x[dimension()].
int dimension() const
Dimension of this localParameters() vector.
virtual const Surface & associatedSurface() const override=0
Access to the Surface associated to the Parameters.
virtual ChargedTrackParametersUniquePtr createUniqueTrackParameters(double l1, double l2, double phi, double theat, double qop, std::optional< AmgSymMatrix(5)> cov=std::nullopt) const =0
Use the Surface as a ParametersBase constructor, from local parameters - charged.
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
double chi2(const T &precision, const U &residual, const int sign=1)
Eigen::Matrix< double, 2, 1 > Vector2D
Eigen::Matrix< double, Eigen::Dynamic, 1 > VectorX
Dynamic Vector - dynamic allocation.
ParametersBase< TrackParametersDim, Charged > TrackParameters
Simple struct to access the ParamDefs enum with ints.
static constexpr std::array< ParamDefs, 6 > pardef
Constructor.