139 using namespace Eigen;
153 GblTrajectory::GblTrajectory(
const std::vector<GblPoint> &aPointList,
154 bool flagCurv,
bool flagU1dir,
bool flagU2dir) :
155 numAllPoints(aPointList.
size()), numPoints(), numOffsets(0),
156 numInnerTrans(0), numCurvature(flagCurv ? 1 : 0), numParameters(0),
157 numLocals(0), numMeasurements(0), externalPoint(0), skippedMeasLabel(0),
158 maxNumGlobals(0), theDimension(0), thePoints(), theData(), measDataIndex(),
159 scatDataIndex(), externalSeed(), innerTransformations(),
160 externalDerivatives(), externalMeasurements(), externalPrecisions()
187 for (
unsigned int iTraj = 0; iTraj < aPointsAndTransList.size(); ++iTraj) {
199 #ifdef GBL_EIGEN_SUPPORT_ROOT 213 unsigned int aLabel,
const TMatrixDSym &aSeed,
214 bool flagCurv,
bool flagU1dir,
bool flagU2dir) :
229 unsigned int nParSeed = aSeed.GetNrows();
231 for (
unsigned int i = 0;
i < nParSeed; ++
i) {
232 for (
unsigned int j = 0; j < nParSeed; ++j) {
256 for (
unsigned int iTraj = 0; iTraj < aPointsAndTransList.size(); ++iTraj) {
261 unsigned int nRowTrans = aPointsAndTransList[iTraj].second.GetNrows();
262 unsigned int nColTrans = aPointsAndTransList[iTraj].second.GetNcols();
263 MatrixXd aTrans(nRowTrans, nColTrans);
264 for (
unsigned int i = 0;
i < nRowTrans; ++
i) {
265 for (
unsigned int j = 0; j < nColTrans; ++j) {
266 aTrans(
i, j) = aPointsAndTransList[iTraj].second(
i, j);
286 const TMatrixD &extDerivatives,
287 const TVectorD &extMeasurements,
288 const TVectorD &extPrecisions) :
298 unsigned int nExtMeas = extDerivatives.GetNrows();
299 unsigned int nExtPar = extDerivatives.GetNcols();
303 for (
unsigned int i = 0;
i < nExtMeas; ++
i) {
306 for (
unsigned int j = 0; j < nExtPar; ++j) {
310 for (
unsigned int iTraj = 0; iTraj < aPointsAndTransList.size(); ++iTraj) {
315 unsigned int nRowTrans = aPointsAndTransList[iTraj].second.GetNrows();
316 unsigned int nColTrans = aPointsAndTransList[iTraj].second.GetNcols();
317 MatrixXd aTrans(nRowTrans, nColTrans);
318 for (
unsigned int i = 0;
i < nRowTrans; ++
i) {
319 for (
unsigned int j = 0; j < nColTrans; ++j) {
320 aTrans(
i, j) = aPointsAndTransList[iTraj].second(
i, j);
340 const TMatrixD &extDerivatives,
341 const TVectorD &extMeasurements,
342 const TMatrixDSym &extPrecisions) :
351 TMatrixDSymEigen extEigen(extPrecisions);
352 TMatrixD extTransformation = extEigen.GetEigenVectors();
353 extTransformation.T();
354 TMatrixD aDerivatives = extTransformation * extDerivatives;
355 TVectorD aMeasurements = extTransformation * extMeasurements;
356 TVectorD aPrecisions = extEigen.GetEigenValues();
358 unsigned int nExtMeas = aDerivatives.GetNrows();
359 unsigned int nExtPar = aDerivatives.GetNcols();
363 for (
unsigned int i = 0;
i < nExtMeas; ++
i) {
366 for (
unsigned int j = 0; j < nExtPar; ++j) {
370 for (
unsigned int iTraj = 0; iTraj < aPointsAndTransList.size(); ++iTraj) {
375 unsigned int nRowTrans = aPointsAndTransList[iTraj].second.GetNrows();
376 unsigned int nColTrans = aPointsAndTransList[iTraj].second.GetNcols();
377 MatrixXd aTrans(nRowTrans, nColTrans);
378 for (
unsigned int i = 0;
i < nRowTrans; ++
i) {
379 for (
unsigned int j = 0; j < nColTrans; ++j) {
380 aTrans(
i, j) = aPointsAndTransList[iTraj].second(
i, j);
413 unsigned int aLabel = 0;
415 std::cout <<
" GblTrajectory construction failed: too few GblPoints " 423 std::vector<GblPoint>::iterator itPoint;
425 itPoint <
thePoints[iTraj].end(); ++itPoint) {
428 itPoint->setLabel(++aLabel);
435 }
catch (std::overflow_error &
e) {
436 std::cout <<
" GblTrajectory construction failed: " << e.what()
459 std::vector<GblPoint>::iterator itPoint;
461 itPoint <
thePoints[iTraj].end() - 1; ++itPoint) {
462 if (itPoint->hasScatterer()) {
481 unsigned int numStep = 0;
482 std::vector<GblPoint>::iterator itPoint;
484 itPoint <
thePoints[iTraj].end(); ++itPoint) {
486 scatJacobian = itPoint->getP2pJacobian();
488 scatJacobian = itPoint->getP2pJacobian() * scatJacobian;
491 itPoint->addPrevJacobian(scatJacobian);
492 if (itPoint->getOffset() >= 0) {
495 previousPoint = &(*itPoint);
500 itPoint >
thePoints[iTraj].begin(); --itPoint) {
501 if (itPoint->getOffset() >= 0) {
505 itPoint->addNextJacobian(scatJacobian);
506 scatJacobian = scatJacobian * itPoint->getP2pJacobian();
521 int aSignedLabel)
const {
526 unsigned int nBorder = nCurv + nLocals;
527 unsigned int nParBRL = nBorder + 2 * nDim;
528 unsigned int nParLoc = nLocals + 5;
529 std::vector<unsigned int> anIndex;
530 anIndex.reserve(nParBRL);
531 MatrixXd aJacobian(nParLoc, nParBRL);
534 unsigned int aLabel =
abs(aSignedLabel);
535 unsigned int firstLabel = 1;
536 unsigned int lastLabel = 0;
537 unsigned int aTrajectory = 0;
542 if (aLabel <= lastLabel)
544 if (iTraj < numTrajectories - 1)
549 if (aSignedLabel > 0) {
551 if (aLabel >= lastLabel) {
557 if (aLabel <= firstLabel) {
563 std::array<unsigned int, 5> labDer;
568 for (
unsigned int i = 0;
i < nLocals; ++
i) {
569 aJacobian(
i + 5,
i) = 1.0;
570 anIndex.push_back(
i + 1);
573 unsigned int iCol = nLocals;
574 for (
unsigned int i = 0;
i < 5; ++
i) {
576 anIndex.push_back(labDer[
i]);
577 for (
unsigned int j = 0; j < 5; ++j) {
578 aJacobian(j, iCol) = matDer(j, i);
583 return std::make_pair(anIndex, aJacobian);
598 unsigned int nJacobian)
const {
610 Matrix2d prevW, prevWJ, nextW, nextWJ, matN;
611 Vector2d prevWd, nextWd;
614 const Matrix2d sumWJ(prevWJ + nextWJ);
615 matN = sumWJ.inverse();
617 const Matrix2d prevNW(matN * prevW);
618 const Matrix2d nextNW(matN * nextW);
619 const Vector2d prevNd(matN * prevWd);
620 const Vector2d nextNd(matN * nextWd);
622 unsigned int iOff = nDim * (-nOffset - 1) + nLocals + nCurv + 1;
626 aJacobian.block<2, 1>(3, 0) = -prevNd - nextNd;
627 anIndex[0] = nLocals + 1;
629 aJacobian.block<2, 2>(3, 1) = prevNW;
630 aJacobian.block<2, 2>(3, 3) = nextNW;
631 for (
unsigned int i = 0;
i < nDim; ++
i) {
633 anIndex[3 + theDimension[
i]] = iOff + nDim +
i;
639 const Matrix2d prevWPN(nextWJ * prevNW);
640 const Matrix2d nextWPN(prevWJ * nextNW);
641 const Vector2d prevWNd(nextWJ * prevNd);
642 const Vector2d nextWNd(prevWJ * nextNd);
644 aJacobian(0, 0) = 1.0;
645 aJacobian.block<2, 1>(1, 0) = prevWNd - nextWNd;
647 aJacobian.block<2, 2>(1, 1) = -prevWPN;
648 aJacobian.block<2, 2>(1, 3) = nextWPN;
654 unsigned int iOff1 = nDim * nOffset + nCurv + nLocals + 1;
655 unsigned int index1 = 3 - 2 * nJacobian;
656 unsigned int iOff2 = iOff1 + nDim * (nJacobian * 2 - 1);
657 unsigned int index2 = 1 + 2 * nJacobian;
659 aJacobian(3, index1) = 1.0;
660 aJacobian(4, index1 + 1) = 1.0;
661 for (
unsigned int i = 0;
i < nDim; ++
i) {
667 Matrix2d matW, matWJ;
670 double sign = (nJacobian > 0) ? 1. : -1.;
672 aJacobian(0, 0) = 1.0;
673 aJacobian.block<2, 1>(1, 0) = -sign * vecWd;
674 anIndex[0] = nLocals + 1;
676 aJacobian.block<2, 2>(1, index1) = -sign * matWJ;
677 aJacobian.block<2, 2>(1, index2) = sign * matW;
678 for (
unsigned int i = 0;
i < nDim; ++
i) {
704 Matrix2d prevW, prevWJ, nextW, nextWJ;
705 Vector2d prevWd, nextWd;
708 const Matrix2d sumWJ(prevWJ + nextWJ);
709 const Vector2d sumWd(prevWd + nextWd);
711 unsigned int iOff = (nOffset - 1) * nDim + nCurv + nLocals + 1;
715 aJacobian.block<2, 1>(0, 0) = -sumWd;
716 anIndex[0] = nLocals + 1;
718 aJacobian.block<2, 2>(0, 1) = prevW;
719 aJacobian.block<2, 2>(0, 3) = -sumWJ;
720 aJacobian.block<2, 2>(0, 5) = nextW;
721 for (
unsigned int i = 0;
i < nDim; ++
i) {
723 anIndex[3 + theDimension[
i]] = iOff + nDim +
i;
724 anIndex[5 + theDimension[
i]] = iOff + nDim * 2 +
i;
744 MatrixXd &localCov)
const {
747 std::pair<std::vector<unsigned int>, MatrixXd> indexAndJacobian =
749 unsigned int nParBrl = indexAndJacobian.first.size();
750 VectorXd aVec(nParBrl);
751 for (
unsigned int i = 0;
i < nParBrl; ++
i) {
752 aVec[
i] =
theVector(indexAndJacobian.first[
i] - 1);
755 localPar = indexAndJacobian.second * aVec;
756 localCov = indexAndJacobian.second * aMat
757 * indexAndJacobian.second.adjoint();
775 unsigned int &numData, VectorXd &aResiduals, VectorXd &aMeasErrors,
776 VectorXd &aResErrors, VectorXd &aDownWeights) {
783 for (
unsigned int i = 0;
i < numData; ++
i) {
785 aMeasErrors(
i), aResErrors(
i), aDownWeights(
i));
804 unsigned int &numData, VectorXd &aResiduals, VectorXd &aMeasErrors,
805 VectorXd &aResErrors, VectorXd &aDownWeights) {
812 for (
unsigned int i = 0;
i < numData; ++
i) {
814 aResErrors(
i), aDownWeights(
i));
819 #ifdef GBL_EIGEN_SUPPORT_ROOT 836 TMatrixDSym &localCov)
const {
839 std::pair<std::vector<unsigned int>, MatrixXd> indexAndJacobian =
841 unsigned int nParBrl = indexAndJacobian.first.size();
842 VectorXd aVec(nParBrl);
843 for (
unsigned int i = 0;
i < nParBrl; ++
i) {
844 aVec[
i] =
theVector(indexAndJacobian.first[
i] - 1);
847 VectorXd aLocalPar = indexAndJacobian.second * aVec;
848 MatrixXd aLocalCov = indexAndJacobian.second * aMat
849 * indexAndJacobian.second.adjoint();
851 unsigned int nParOut = localPar.GetNrows();
852 for (
unsigned int i = 0;
i < nParOut; ++
i) {
853 localPar[
i] = aLocalPar(
i);
854 for (
unsigned int j = 0; j < nParOut; ++j) {
855 localCov(
i, j) = aLocalCov(
i, j);
875 unsigned int &numData, TVectorD &aResiduals, TVectorD &aMeasErrors,
876 TVectorD &aResErrors, TVectorD &aDownWeights) {
883 for (
unsigned int i = 0;
i < numData; ++
i) {
885 aMeasErrors[i], aResErrors[i], aDownWeights[i]);
904 unsigned int &numData, TVectorD &aResiduals, TVectorD &aMeasErrors,
905 TVectorD &aResErrors, TVectorD &aDownWeights) {
912 for (
unsigned int i = 0;
i < numData; ++
i) {
914 aResErrors[i], aDownWeights[i]);
930 unsigned int aLabel = 0;
931 unsigned int nPoint =
thePoints[0].size();
932 aLabelList.resize(nPoint);
933 for (
unsigned i = 0;
i < nPoint; ++
i) {
934 aLabelList[
i] = ++aLabel;
945 std::vector<std::vector<unsigned int> > &aLabelList) {
949 unsigned int aLabel = 0;
952 unsigned int nPoint =
thePoints[iTraj].size();
953 aLabelList[iTraj].resize(nPoint);
954 for (
unsigned i = 0;
i < nPoint; ++
i) {
955 aLabelList[iTraj][
i] = ++aLabel;
973 double &aResidual,
double &aMeasError,
double &aResError,
974 double &aDownWeight) {
977 unsigned int numLocal;
978 unsigned int* indLocal;
980 theData[aData].getResidual(aResidual, aMeasVar, aDownWeight, numLocal,
982 VectorXd aVec(numLocal);
983 for (
unsigned int j = 0; j < numLocal; ++j) {
984 aVec[j] = derLocal[j];
987 double aFitVar = aVec.transpose() * aMat * aVec;
988 aMeasError =
sqrt(aMeasVar);
990 aResError = (aFitVar < aMeasVar ?
sqrt(aMeasVar - aFitVar) : 0.);
992 aResError =
sqrt(aMeasVar + aFitVar);
1000 double aValue, aWeight;
1001 unsigned int* indLocal;
1003 unsigned int numLocal;
1005 std::vector<GblData>::iterator itData;
1006 for (itData =
theData.begin(); itData <
theData.end(); ++itData) {
1011 itData->getLocalData(aValue, aWeight, numLocal, indLocal, derLocal);
1012 for (
unsigned int j = 0; j < numLocal; ++j) {
1013 theVector(indLocal[j] - 1) += derLocal[j] * aWeight * aValue;
1031 unsigned int nData = 0;
1032 std::vector<MatrixXd> innerTransDer;
1033 std::vector<std::array<unsigned int, 5> > innerTransLab;
1041 std::array<unsigned int, 5> firstLabels;
1042 Matrix5d matFitToLocal, matLocalToFit;
1045 matLocalToFit = matFitToLocal.inverse();
1048 innerTransLab.push_back(firstLabels);
1052 std::vector<GblPoint>::iterator itPoint;
1057 Eigen::ColMajor , 5, 5> proDer;
1061 itPoint <
thePoints[iTraj].end(); ++itPoint) {
1063 unsigned int nLabel = itPoint->getLabel();
1064 unsigned int measDim = itPoint->hasMeasurement();
1066 const MatrixXd localDer = itPoint->getLocalDerivatives();
1068 itPoint->getNumGlobals());
1070 itPoint->getMeasurement(matP, aMeas, aPrec);
1071 double minPrecision = itPoint->getMeasPrecMin();
1072 unsigned int iOff = 5 - measDim;
1073 std::array<unsigned int, 5> labDer;
1075 unsigned int nJacobian =
1076 (itPoint <
thePoints[iTraj].end() - 1) ? 1 : 0;
1080 matPDer = matP * matDer;
1083 matPDer.block<2, 5>(3, 0) = matP.block<2, 2>(3, 3)
1084 * matDer.block<2, 5>(3, 0);
1089 proDer.resize(measDim, Eigen::NoChange);
1092 unsigned int ifirst = 0;
1093 unsigned int ilabel = 0;
1094 while (ilabel < 5) {
1095 if (labDer[ilabel] > 0) {
1096 while (innerTransLab[iTraj][ifirst]
1097 != labDer[ilabel] and ifirst < 5) {
1101 labDer[ilabel] -= 2 * nDim * (iTraj + 1);
1105 for (
unsigned int k = iOff;
k < 5; ++
k) {
1106 proDer(
k - iOff, ifirst) = matPDer(
k,
1114 transDer = proDer * innerTransDer[iTraj];
1116 for (
unsigned int i = iOff;
i < 5; ++
i) {
1117 if (aPrec(
i) > minPrecision) {
1139 Eigen::ColMajor , 5, 5> proDer;
1145 itPoint <
thePoints[iTraj].end() - 1; ++itPoint) {
1146 Vector2d aMeas, aPrec;
1147 unsigned int nLabel = itPoint->getLabel();
1148 if (itPoint->hasScatterer()) {
1149 itPoint->getScatterer(matT, aMeas, aPrec);
1151 std::array<unsigned int, 7> labDer;
1154 matTDer = matT * matDer;
1157 proDer.resize(nDim, Eigen::NoChange);
1160 unsigned int ifirst = 0;
1161 unsigned int ilabel = 0;
1162 while (ilabel < 7) {
1163 if (labDer[ilabel] > 0) {
1164 while (innerTransLab[iTraj][ifirst]
1165 != labDer[ilabel] and ifirst < 5) {
1169 labDer[ilabel] -= 2 * nDim * (iTraj + 1);
1173 for (
unsigned int k = 0;
k < nDim; ++
k) {
1174 proDer(
k, ifirst) = matTDer(
k, ilabel);
1181 transDer = proDer * innerTransDer[iTraj];
1183 for (
unsigned int i = 0;
i < nDim; ++
i) {
1185 if (aPrec(iDim) > 0.) {
1204 std::pair<std::vector<unsigned int>, MatrixXd> indexAndJacobian =
1206 std::vector<unsigned int> externalSeedIndex = indexAndJacobian.first;
1207 std::vector<double> externalSeedDerivatives(externalSeedIndex.size());
1208 SelfAdjointEigenSolver<MatrixXd> externalSeedEigen(
externalSeed);
1209 VectorXd valEigen = externalSeedEigen.eigenvalues();
1210 MatrixXd vecEigen = externalSeedEigen.eigenvectors();
1211 vecEigen = vecEigen.transpose() * indexAndJacobian.second;
1213 if (valEigen(
i) > 0.) {
1215 externalSeedDerivatives[j] = vecEigen(
i, j);
1219 externalSeedDerivatives);
1231 for (
unsigned int iExt = 0; iExt < nExt; ++iExt) {
1232 for (
unsigned int iCol = 0; iCol <
numCurvature; ++iCol) {
1233 index[iCol] = iCol + 1;
1248 std::vector<GblData>::iterator itData;
1249 for (itData =
theData.begin(); itData <
theData.end(); ++itData) {
1260 std::vector<GblData>::iterator itData;
1261 for (itData =
theData.begin(); itData <
theData.end(); ++itData) {
1262 aLoss += (1. - itData->setDownWeighting(aMethod));
1281 const std::string& optionList,
unsigned int aLabel) {
1282 const double normChi2[4] = { 1.0, 0.8737, 0.9326, 0.8228 };
1291 unsigned int aMethod = 0;
1296 unsigned int ierr = 0;
1302 for (
unsigned int i = 0;
i < optionList.size(); ++
i)
1304 size_t aPosition = methodList.find(optionList[
i]);
1305 if (aPosition != std::string::npos) {
1306 aMethod = aPosition / 2 + 1;
1315 for (
unsigned int i = 0;
i <
theData.size(); ++
i) {
1323 Chi2 /= normChi2[aMethod];
1327 std::cout <<
" GblTrajectory::fit exception " << e << std::endl;
1338 unsigned int aPoint;
1340 unsigned int numLocal;
1341 unsigned int* labLocal;
1343 std::vector<int> labGlobal;
1344 std::vector<double> derGlobal;
1352 std::vector<GblData>::iterator itData;
1353 for (itData =
theData.begin(); itData !=
theData.end(); ++itData) {
1354 itData->getAllData(aValue, aErr, numLocal, labLocal, derLocal, aTraj,
1357 thePoints[aTraj][aPoint].getGlobalLabelsAndDerivatives(aRow,
1358 labGlobal, derGlobal);
1360 labGlobal.resize(0);
1361 aMille.
addData(aValue, aErr, numLocal, labLocal, derLocal, labGlobal,
1374 <<
" subtrajectories" << std::endl;
1376 std::cout <<
"Simple GblTrajectory" << std::endl;
1379 std::cout <<
" 2D-trajectory" << std::endl;
1389 std::cout <<
" Number of ext. measurements : " 1397 std::cout <<
" Constructed OK " << std::endl;
1400 std::cout <<
" Fitted OK " << std::endl;
1403 IOFormat CleanFmt(4, 0,
", ",
"\n",
"[",
"]");
1405 std::cout <<
" Inner transformations" << std::endl;
1412 std::cout <<
" External measurements" << std::endl;
1413 std::cout <<
" Measurements:" << std::endl;
1415 std::cout <<
" Precisions:" << std::endl;
1417 std::cout <<
" Derivatives:" << std::endl;
1421 std::cout <<
" External seed:" << std::endl;
1425 std::cout <<
" Fit results" << std::endl;
1426 std::cout <<
" Parameters:" << std::endl;
1428 std::cout <<
" Covariance matrix (bordered band part):" 1442 std::vector<GblPoint>::iterator itPoint;
1444 itPoint <
thePoints[iTraj].end(); ++itPoint) {
1445 itPoint->printPoint(level);
1452 std::cout <<
"GblData blocks " << std::endl;
1453 std::vector<GblData>::iterator itData;
1454 for (itData =
theData.begin(); itData <
theData.end(); ++itData) {
1455 itData->printData();
void printMatrix() const
Print bordered band matrix.
std::vector< unsigned int > scatDataIndex
mapping points to data blocks from scatterers
void addBlockMatrix(double aWeight, const std::vector< unsigned int > *anIndex, const std::vector< double > *aVector)
Add symmetric block matrix.
void construct()
Construct trajectory from list of points.
void addNextJacobian(const Matrix5d &aJac)
Define jacobian to next scatterer (by GBLTrajectory constructor)
Data (block) for independent scalar measurement.
void buildLinearEquationSystem()
Build linear equation system from data (blocks).
void printTrajectory(unsigned int level=0)
Print GblTrajectory.
unsigned int numParameters
Number of fit parameters.
void writeRecord()
Write record to file.
bool constructOK
Trajectory has been successfully constructed (ready for fit/output)
std::vector< unsigned int > measDataIndex
mapping points to data blocks from measurements
Eigen::MatrixXd getBlockMatrix(const std::vector< unsigned int > anIndex) const
Retrieve symmetric block matrix.
bool fitOK
Trajectory has been successfully fitted (results are valid)
std::vector< unsigned int > theDimension
List of active dimensions (0=u1, 1=u2) in fit.
void addDerivatives(unsigned int iRow, const std::array< unsigned int, 5 > &labDer, const Matrix5d &matDer, unsigned int iOff, const Eigen::MatrixBase< LocalDerivative > &derLocal, unsigned int nLocal, const Eigen::MatrixBase< TrafoDerivative > &derTrans)
Add derivatives from measurement.
unsigned int getLabels(std::vector< unsigned int > &aLabelList)
Get (list of) labels of points on (simple) valid trajectory.
void print() const
Print vector.
void predict()
Calculate predictions for all points.
int getOffset() const
Retrieve offset for point.
unsigned int numOffsets
Number of (points with) offsets on trajectory.
Eigen::VectorXd externalMeasurements
bool isValid() const
Retrieve validity of trajectory.
unsigned int getResults(int aSignedLabel, Eigen::VectorXd &localPar, Eigen::MatrixXd &localCov) const
Get fit results at point.
U second(std::pair< T, U > const &p)
unsigned int fit(double &Chi2, int &Ndf, double &lostWeight, const std::string &optionList="", unsigned int aLabel=0)
Perform fit of (valid) trajectory.
unsigned int externalPoint
Label of external point (or 0)
unsigned int numInnerTrans
Number of inner transformations to external parameters.
void calcJacobians()
Calculate Jacobians to previous/next scatterer from point to point ones.
unsigned int numMeasurements
Total number of measurements.
void getFitToKinkJacobian(std::array< unsigned int, 7 > &anIndex, Matrix27d &aJacobian, const GblPoint &aPoint) const
Get jacobian for transformation from (trajectory) fit to kink parameters at point.
void resize(const unsigned int nRows)
Resize vector.
Eigen::MatrixXd externalSeed
Precision (inverse covariance matrix) of external seed.
void defineOffsets()
Define offsets from list of points.
void addData(double aMeas, double aErr, unsigned int numLocal, unsigned int *indLocal, double *derLocal, const std::vector< int > &labGlobal, const std::vector< double > &derGlobal)
Add data block to (end of) record.
void prepare()
Prepare fit for simple or composed trajectory.
unsigned int getScatResults(unsigned int aLabel, unsigned int &numRes, Eigen::VectorXd &aResiduals, Eigen::VectorXd &aMeasErrors, Eigen::VectorXd &aResErrors, Eigen::VectorXd &aDownWeights)
Get (kink) residuals from fit at point for scatterer.
Abs< T >::type abs(const T &t)
void printData()
Print GblData blocks for trajectory.
Namespace for the general broken lines package.
double downWeight(unsigned int aMethod)
Down-weight all points.
std::vector< unsigned int > numPoints
Number of points on (sub)trajectory.
std::pair< std::vector< unsigned int >, Eigen::MatrixXd > getJacobian(int aSignedLabel) const
Get jacobian for transformation from fit to track parameters at point.
void getFitToLocalJacobian(std::array< unsigned int, 5 > &anIndex, Matrix5d &aJacobian, const GblPoint &aPoint, unsigned int measDim, unsigned int nJacobian=1) const
Get (part of) jacobian for transformation from (trajectory) fit to track parameters at point...
void milleOut(MilleBinary &aMille)
Write valid trajectory to Millepede-II binary file.
std::vector< GblData > theData
List of data blocks.
Eigen::Matrix< double, 5, 1 > Vector5d
Eigen::Matrix< double, 2, 7 > Matrix27d
unsigned int maxNumGlobals
Max. number of global labels/derivatives per point.
void resize(unsigned int nSize, unsigned int nBorder=1, unsigned int nBand=5)
Resize bordered band matrix.
std::vector< Eigen::MatrixXd > innerTransformations
Transformations at innermost points of.
Eigen::MatrixXd externalDerivatives
void getDerivatives(int aDirection, Eigen::Matrix2d &matW, Eigen::Matrix2d &matWJ, Eigen::Vector2d &vecWd) const
Retrieve derivatives of local track model.
std::vector< std::vector< GblPoint > > thePoints
(list of) List of points on trajectory
BorderedBandMatrix theMatrix
(Bordered band) matrix of linear equation system
VVector theVector
Vector of linear equation system.
unsigned int numTrajectories
Number of trajectories (in composed trajectory)
unsigned int getMeasResults(unsigned int aLabel, unsigned int &numRes, Eigen::VectorXd &aResiduals, Eigen::VectorXd &aMeasErrors, Eigen::VectorXd &aResErrors, Eigen::VectorXd &aDownWeights)
Get residuals from fit at point for measurement.
GblTrajectory(const std::vector< GblPoint > &aPointList, bool flagCurv=true, bool flagU1dir=true, bool flagU2dir=true)
Create new (simple) trajectory from list of points.
unsigned int numLocals
Total number of (additional) local parameters.
Millepede-II (binary) record.
unsigned int getNumPoints() const
Retrieve number of point from trajectory.
unsigned int numAllPoints
Number of all points on trajectory.
void getResAndErr(unsigned int aData, bool used, double &aResidual, double &aMeadsError, double &aResError, double &aDownWeight)
Get residual and errors from data block.
void printPoints(unsigned int level=0)
Print GblPoints on trajectory.
void solveAndInvertBorderedBand(const VVector &aRightHandSide, VVector &aSolution)
Solve linear equation system, partially calculate inverse.
unsigned int numCurvature
Number of curvature parameters (0 or 1) or external parameters.
unsigned int skippedMeasLabel
Label of point with measurements skipped in fit (for unbiased residuals) (or 0)
const Matrix5d & getP2pJacobian() const
Retrieve point-to-(previous)point jacobian.
Eigen::VectorXd externalPrecisions
Eigen::Matrix< double, 5, 5 > Matrix5d