20 throw new genfit::Exception(
"GblFitterInfo: Representation state is not 5D", __LINE__, __FILE__);
21 TMatrixDSym noise(dim, dim);
33 throw new genfit::Exception(
"GblFitterInfo: Representation state is not 5D", __LINE__, __FILE__);
34 TMatrixDSym noise(dim, dim);
58 TMatrixDSym
zero(repDim);
67 fwdCov_.SetMatrixArray(zero.GetMatrixArray());
68 bwdCov_.SetMatrixArray(zero.GetMatrixArray());
98 double c1 = trackDirection.Dot(measurementPlane->getU());
99 double c2 = trackDirection.Dot(measurementPlane->getV());
101 TMatrixDSym scatCov(2);
102 scatCov(0, 0) = 1. - c2 *
c2;
103 scatCov(1, 1) = 1. - c1 * c1;
104 scatCov(0, 1) = c1 *
c2;
105 scatCov(1, 0) = c1 *
c2;
106 scatCov *= variance * variance / (1. - c1 * c1 - c2 *
c2) / (1. - c1 * c1 - c2 * c2) ;
144 TVectorD aResiduals(measurement.
getState());
145 TMatrixDSym aPrecision(measurement.
getCov().Invert());
147 double res = aResiduals(0);
148 double prec = aPrecision(0, 0);
149 aResiduals.ResizeTo(2);
150 aPrecision.ResizeTo(TMatrixDSym(2));
154 aPrecision(0, 0) = prec;
157 double res = aResiduals(0);
158 double prec = aPrecision(0, 0);
159 aResiduals.ResizeTo(2);
160 aPrecision.ResizeTo(TMatrixDSym(2));
164 aPrecision(1, 1) = prec;
173 std::pair<std::vector<int>, TMatrixD> labelsAndMatrix = globals->
globalDerivatives(&sop);
174 std::vector<int> labels = labelsAndMatrix.first;
175 TMatrixD derivs = labelsAndMatrix.second;
177 if (derivs.GetNcols() > 0 && !labels.empty() && (
unsigned int)derivs.GetNcols() == labels.size()) {
181 if (locals.GetNcols() > 0) {
224 unsigned int imop = 0;
225 double maxWeight = allMeas.at(0)->getWeight();
226 for (
unsigned int i = 0;
i < allMeas.size();
i++)
227 if (allMeas.at(
i)->getWeight() > maxWeight)
232 measCov_.ResizeTo(allMeas.at(imop)->getCov());
233 measCov_ = allMeas.at(imop)->getCov();
234 hMatrix_.ResizeTo(allMeas.at(imop)->getHMatrix()->getMatrix());
235 hMatrix_ = allMeas.at(imop)->getHMatrix()->getMatrix();
237 setPlane(allMeas.at(imop)->getPlane());
239 for (
unsigned int imeas = 0; imeas < allMeas.size(); imeas++)
240 delete allMeas[imeas];
252 unsigned int label = 0;
255 for (
unsigned int ip = 0; ip < trk->
getNumPoints(); ip++) {
266 throw genfit::Exception(
"GblFitterInfo: fitter info did not found itself in track to update", __LINE__, __FILE__);
268 throw genfit::Exception(
"GblFitterInfo: Deduced point label not valid", __LINE__, __FILE__);
272 unsigned int numMRes = 2;
273 TVectorD mResiduals(2), mMeasErrors(2), mResErrors(2), mDownWeights(2);
274 if (0 != traj.
getMeasResults(label, numMRes, mResiduals, mMeasErrors, mResErrors, mDownWeights))
278 unsigned int numKRes = 2;
279 TVectorD kResiduals(2), kMeasErrors(2), kResErrors(2), kDownWeights(2);
280 if (0 != traj.
getScatResults(label, numKRes, kResiduals, kMeasErrors, kResErrors, kDownWeights))
290 TVectorD bwdUpdate(5 + nLocals), fwdUpdate(5 + nLocals);
291 TMatrixDSym bwdCov(5 + nLocals), fwdCov(5 + nLocals);
294 if (0 != traj.
getResults(label, fwdUpdate, fwdCov))
298 if (0 != traj.
getResults(-1 * label, bwdUpdate, bwdCov))
302 TVectorD _bwdUpdate(5 + nLocals), _fwdUpdate(5 + nLocals);
303 TMatrixDSym _bwdCov(5 + nLocals), _fwdCov(5 + nLocals);
304 _bwdUpdate = bwdUpdate;
305 _fwdUpdate = fwdUpdate;
308 bwdUpdate.ResizeTo(5);
309 fwdUpdate.ResizeTo(5);
310 bwdCov.ResizeTo(TMatrixDSym(5));
311 fwdCov.ResizeTo(TMatrixDSym(5));
312 for (
int i = 0;
i < 5;
i++) {
313 bwdUpdate(
i) = _bwdUpdate(
i);
314 fwdUpdate(
i) = _fwdUpdate(
i);
315 for (
int j = 0;
j < 5;
j++) {
316 bwdCov(
i,
j) = _bwdCov(
i,
j);
317 fwdCov(
i,
j) = _fwdCov(
i,
j);
351 if (!prevFitterInfo) {
356 prevFitterInfo =
this;
418 TMatrixDSym localCovariance(2);
419 localCovariance.Zero();
427 localCovariance.ResizeTo(TMatrixDSym(1));
431 localCovariance.ResizeTo(TMatrixDSym(1));
439 if (onlyMeasurementErrors) {
454 TMatrixDSym localCovariance(2);
455 localCovariance.Zero();
467 kinks(0) = -stateDiff(1);
468 kinks(1) = -stateDiff(2);
514 std::cout <<
"=============================================================================================" << std::endl;
515 std::cout <<
" >>> GblFitterInfo " << std::endl;
516 std::cout <<
" ************* " << std::endl;
520 std::cout << std::endl;
522 std::cout <<
"=============================================================================================" << std::endl;
523 std::cout <<
" | PREDICTIONS | REFERENCE | Corrections from last iteration |" << std::endl;
524 std::cout <<
" | (+)prediction | (-)prediction | state | (+)correction | (-) correction |" << std::endl;
525 std::cout <<
"---------------------------------------------------------------------------------------------" << std::endl;
527 for (
int i = 0;
i <5;
i++) {
547 std::cout <<
"=============================================================================================" << std::endl;
550 std::cout <<
" | Meas. residual | measurement - prediction | Down-weight | Fit+meas Err. |" << std::endl;
551 std::cout <<
" | | | | -diagonaliz. |" << std::endl;
552 std::cout <<
"---------------------------------------------------------------------------------------------" << std::endl;
555 if (residual.GetNoElements()<2) {
556 residual.ResizeTo(2);
566 << std::setw(12) << residual(0) <<
" | "
573 << std::setw(12) << residual(1) <<
" | "
578 std::cout <<
"---------------------------------------------------------------------------------------------" << std::endl;
581 std::cout <<
" | Kink residual | Residual of slope difference | Down-weight | Fit Kink Err. |" << std::endl;
582 std::cout <<
" | -diagonalized | - ( (+)pred - (-)pred ) | | -diagonaliz. |" << std::endl;
583 std::cout <<
"---------------------------------------------------------------------------------------------" << std::endl;
585 std::cout <<
" u' | "
587 << std::setw(12) <<
getKinks()(0) <<
" | "
592 std::cout <<
" v' | "
594 << std::setw(12) <<
getKinks()(1) <<
" | "
598 std::cout <<
"=============================================================================================" << std::endl;
601 std::cout <<
"H Matrix: ";
hMatrix_.Print();
603 std::cout <<
"Measurement covariance: ";
measCov_.Print();
605 std::cout <<
"Jacobian: ";
jacobian_.Print();
606 std::cout <<
"Backward covariance: ";
bwdCov_.Print();
607 std::cout <<
"Forward covariance : ";
fwdCov_.Print();
609 std::cout <<
"=============================================================================================" << std::endl;