Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Lennart Huth
Corryvreckan
Commits
f9070406
Commit
f9070406
authored
Jan 24, 2022
by
Lennart Huth
Browse files
updates
parents
d61dee40
aeabbca5
Pipeline
#3481046
failed with stages
in 36 minutes and 53 seconds
Changes
125
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
View file @
f9070406
...
...
@@ -24,6 +24,7 @@ stages:
script
:
-
mkdir build
-
cd build
-
export CCACHE_DIR=`pwd`/ccache
-
cmake -GNinja -DCMAKE_CXX_FLAGS="-Werror" -DCMAKE_BUILD_TYPE=RELEASE -DROOT_DIR=$ROOTSYS -DEigen3_DIR=$Eigen3_DIR ..
-
ninja -k0
-
ninja install
...
...
@@ -58,17 +59,14 @@ cmp:lxplus-gcc:
-
export COMPILER_TYPE="gcc"
-
source etc/setup_lxplus.sh
cmp:
cc7-
docker:
cmp:docker:
extends
:
.compile
image
:
name
:
gitlab-registry.cern.ch/corryvreckan/corryvreckan/corryvreckan-deps
entrypoint
:
[
"
"
]
before_script
:
-
source scl_source enable devtoolset-8 || echo " "
script
:
-
mkdir build
-
cd build
-
cmake
3
-DCMAKE_CXX_FLAGS="-Werror" -DBUILD_EventLoaderEUDAQ2=ON -DBUILD_EventDefinitionM26=ON -DCMAKE_BUILD_TYPE=RELEASE -DROOT_DIR=$ROOTSYS -DEigen3_DIR=$Eigen3_DIR -Deudaq_DIR=/opt/eudaq2/cmake ..
-
cmake -DCMAKE_CXX_FLAGS="-Werror" -DBUILD_EventLoaderEUDAQ2=ON -DBUILD_EventDefinitionM26=ON -DCMAKE_BUILD_TYPE=RELEASE -DROOT_DIR=$ROOTSYS -DEigen3_DIR=$Eigen3_DIR -Deudaq_DIR=/opt/eudaq2/cmake ..
-
make
-
make install
...
...
@@ -103,13 +101,10 @@ cmp:mac1015-clang:
tags
:
-
docker
needs
:
-
job
:
cmp:
cc7-
docker
-
job
:
cmp:docker
artifacts
:
true
image
:
name
:
gitlab-registry.cern.ch/corryvreckan/corryvreckan/corryvreckan-deps
entrypoint
:
[
"
"
]
before_script
:
-
source scl_source enable devtoolset-8 || echo " "
after_script
:
-
./.gitlab/ci/transform_ctest_junit.py build/Testing/`head -n 1 build/Testing/TAG`/Test.xml .gitlab/ci/ctest-to-junit.xsl corry-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}.xml
artifacts
:
...
...
@@ -254,6 +249,7 @@ cmp:usermanual:
-
schedules@corryvreckan/corryvreckan
before_script
:
-
export COMPILER_TYPE="gcc"
-
export CCACHE_DIR=`pwd`/ccache
-
source .gitlab/ci/init_x86_64.sh
-
source .gitlab/ci/load_deps.sh
script
:
...
...
.gitlab/ci/init_x86_64.sh
View file @
f9070406
...
...
@@ -5,7 +5,7 @@ if [ "$(uname)" = "Linux" ]; then
if
[
"
$(
cat
/etc/
*
-release
|
grep
"CentOS Linux 7"
)
"
]
;
then
echo
"Detected CentOS Linux 7"
OS
=
centos7
elif
[
"
$(
cat
/etc/
*
-release
|
grep
"CentOS Linux 8"
)
"
]
;
then
elif
[
"
$(
cat
/etc/
*
-release
|
grep
"CentOS Linux 8"
)
"
]
||
[
"
$(
cat
/etc/
*
-release
|
grep
"CentOS Stream release 8"
)
"
]
;
then
echo
"Detected CentOS Linux 8"
OS
=
centos8
else
...
...
@@ -15,7 +15,9 @@ if [ "$(uname)" = "Linux" ]; then
elif
[
"
$(
uname
)
"
=
"Darwin"
]
;
then
MACOS_MAJOR
=
$(
sw_vers
-productVersion
|
awk
-F
'.'
'{print $1}'
)
MACOS_MINOR
=
$(
sw_vers
-productVersion
|
awk
-F
'.'
'{print $2}'
)
if
[
$MACOS_MAJOR
=
"11"
]
||
[
"
${
MACOS_MAJOR
}
.
${
MACOS_MINOR
}
"
=
"10.15"
]
;
then
if
[
$MACOS_MAJOR
=
"11"
]
;
then
OS
=
mac11
elif
[
"
${
MACOS_MAJOR
}
.
${
MACOS_MINOR
}
"
=
"10.15"
]
;
then
OS
=
mac1015
else
echo
"Unsupported version of macOS
${
MACOS_MAJOR
}
.
${
MACOS_MINOR
}
"
...
...
@@ -28,7 +30,7 @@ fi
# Determine is you have CVMFS installed
CVMFS_MOUNT
=
""
if
[
"
$OS
"
=
mac1015
]
;
then
if
[
"
$OS
"
=
mac1015
]
||
[
"
$OS
"
=
mac11
]
;
then
CVMFS_MOUNT
=
"/Users/Shared"
fi
...
...
@@ -48,7 +50,7 @@ fi
# Determine which LCG version to use
DEFAULT_LCG
=
"LCG_
99
"
DEFAULT_LCG
=
"LCG_
101
"
if
[
-z
${
ALLPIX_LCG_VERSION
}
]
;
then
echo
"No explicit LCG version set, using
${
DEFAULT_LCG
}
."
...
...
@@ -66,14 +68,14 @@ if [ -z ${COMPILER_TYPE} ]; then
fi
fi
if
[
${
COMPILER_TYPE
}
=
"gcc"
]
;
then
COMPILER_VERSION
=
"gcc1
0
"
COMPILER_VERSION
=
"gcc1
1
"
echo
"Compiler type set to GCC, version
${
COMPILER_VERSION
}
."
fi
if
[
${
COMPILER_TYPE
}
=
"llvm"
]
;
then
if
[
"
$(
uname
)
"
=
"Darwin"
]
;
then
COMPILER_VERSION
=
"clang120"
else
COMPILER_VERSION
=
"clang1
0
"
COMPILER_VERSION
=
"clang1
2
"
fi
echo
"Compiler type set to LLVM, version
${
COMPILER_VERSION
}
."
fi
...
...
3rdparty/GeneralBrokenLines/CMakeLists.txt
View file @
f9070406
...
...
@@ -2,7 +2,7 @@
CMAKE_MINIMUM_REQUIRED
(
VERSION 3.1
)
# declare the project name
PROJECT
(
GBL VERSION
"2.
2
.0"
)
PROJECT
(
GBL VERSION
"2.
4
.0"
)
# project version
# SET( ${PROJECT_NAME}_VERSION_MAJOR 2 )
...
...
3rdparty/GeneralBrokenLines/include/BorderedBandMatrix.h
View file @
f9070406
...
...
@@ -78,6 +78,7 @@ namespace gbl {
BorderedBandMatrix
();
virtual
~
BorderedBandMatrix
();
void
resize
(
unsigned
int
nSize
,
unsigned
int
nBorder
=
1
,
unsigned
int
nBand
=
5
);
void
setZero
();
void
solveAndInvertBorderedBand
(
const
VVector
&
aRightHandSide
,
VVector
&
aSolution
);
void
addBlockMatrix
(
double
aWeight
,
const
std
::
vector
<
unsigned
int
>*
anIndex
,
const
std
::
vector
<
double
>*
aVector
);
void
addBlockMatrix
(
double
aWeight
,
unsigned
int
nSimple
,
unsigned
int
*
anIndex
,
double
*
aVector
);
...
...
@@ -100,5 +101,5 @@ namespace gbl {
VMatrix
invertBand
();
VMatrix
bandOfAVAT
(
const
VMatrix
&
anArray
,
const
VSymMatrix
&
aSymArray
)
const
;
};
}
}
// namespace gbl
#endif
/* BORDEREDBANDMATRIX_H_ */
3rdparty/GeneralBrokenLines/include/GblData.h
View file @
f9070406
...
...
@@ -13,7 +13,7 @@
*
*
* \copyright
* Copyright (c) 2011 - 201
6
Deutsches Elektronen-Synchroton,
* Copyright (c) 2011 - 20
2
1 Deutsches Elektronen-Synchroton,
* Member of the Helmholtz Association, (DESY), HAMBURG, GERMANY \n\n
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
...
...
@@ -57,10 +57,11 @@ namespace gbl {
public:
GblData
(
unsigned
int
aLabel
,
dataBlockType
aType
,
double
a
Meas
,
double
a
Value
,
double
aPrec
,
unsigned
int
aTraj
=
0
,
unsigned
int
aPoint
=
0
);
unsigned
int
aPoint
=
0
,
unsigned
int
aMeas
=
0
);
GblData
(
const
GblData
&
)
=
default
;
GblData
&
operator
=
(
const
GblData
&
)
=
default
;
GblData
(
GblData
&&
)
=
default
;
...
...
@@ -114,7 +115,6 @@ namespace gbl {
void
printData
()
const
;
unsigned
int
getLabel
()
const
;
dataBlockType
getType
()
const
;
unsigned
int
getNumSimple
()
const
;
void
getLocalData
(
double
&
aValue
,
double
&
aWeight
,
unsigned
int
&
numLocal
,
unsigned
int
*&
indLocal
,
double
*&
derLocal
);
void
getAllData
(
double
&
aValue
,
...
...
@@ -124,6 +124,7 @@ namespace gbl {
double
*&
derLocal
,
unsigned
int
&
aTraj
,
unsigned
int
&
aPoint
,
unsigned
int
&
aMeas
,
unsigned
int
&
aRow
);
void
getResidual
(
double
&
aResidual
,
double
&
aVariance
,
...
...
@@ -131,6 +132,7 @@ namespace gbl {
unsigned
int
&
numLocal
,
unsigned
int
*&
indLocal
,
double
*&
derLocal
);
void
getResidual
(
double
&
aResidual
,
double
&
aVariance
);
private:
unsigned
int
theLabel
;
///< Label (of corresponding point)
...
...
@@ -140,6 +142,7 @@ namespace gbl {
double
thePrecision
;
///< Precision (1/sigma**2)
unsigned
int
theTrajectory
;
///< Trajectory number
unsigned
int
thePoint
;
///< Point number (on trajectory)
unsigned
int
theMeas
;
///< Measurement number (at point)
unsigned
int
theDWMethod
;
///< Down-weighting method (0: None, 1: Tukey, 2: Huber, 3: Cauchy)
double
theDownWeight
;
///< Down-weighting factor (0-1)
double
thePrediction
;
///< Prediction from fit
...
...
@@ -262,6 +265,7 @@ namespace gbl {
}
}
}
}
}
// namespace gbl
#endif
/* GBLDATA_H_ */
3rdparty/GeneralBrokenLines/include/GblMeasurement.h
0 → 100644
View file @
f9070406
/*
* GblMeasurement.h
*
* Created on: 31 Mar 2021
* Author: kleinwrt
*/
/** \file
* GblMeasurement (with optional derivatives) definition.
*
* \author Claus Kleinwort, DESY, 2021 (Claus.Kleinwort@desy.de)
*
*
* \copyright
* Copyright (c) 2021 Deutsches Elektronen-Synchroton,
* Member of the Helmholtz Association, (DESY), HAMBURG, GERMANY \n\n
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version. \n\n
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details. \n\n
* You should have received a copy of the GNU Library General Public
* License along with this program (see the file COPYING.LIB for more
* details); if not, write to the Free Software Foundation, Inc.,
* 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef GBLMEASUREMENT_H_
#define GBLMEASUREMENT_H_
#include <array>
#include <iostream>
#include <math.h>
#include <vector>
#include "VMatrix.h"
#ifdef GBL_EIGEN_SUPPORT_ROOT
#include "TMatrixD.h"
#include "TMatrixDSym.h"
#include "TMatrixDSymEigen.h"
#include "TVectorD.h"
#endif
#include "Eigen/Dense"
namespace
gbl
{
typedef
Eigen
::
Matrix
<
double
,
5
,
1
>
Vector5d
;
typedef
Eigen
::
Matrix
<
double
,
2
,
3
>
Matrix23d
;
typedef
Eigen
::
Matrix
<
double
,
2
,
5
>
Matrix25d
;
typedef
Eigen
::
Matrix
<
double
,
2
,
7
>
Matrix27d
;
typedef
Eigen
::
Matrix
<
double
,
3
,
2
>
Matrix32d
;
typedef
Eigen
::
Matrix
<
double
,
5
,
5
>
Matrix5d
;
/// Measurement at point.
/**
* User supplied measurement at point on (initial) trajectory.
*
* Must have measurement (1D - 5D). May have:
*
* -# Additional local parameters (with derivatives). Fitted together with track parameters.
* -# Additional global parameters (with labels and derivatives). Not fitted, only passed
* on to (binary) file for fitting with Millepede-II.
*/
class
GblMeasurement
{
public:
GblMeasurement
(
const
Eigen
::
MatrixXd
&
aProjection
,
const
Eigen
::
VectorXd
&
aResiduals
,
const
Eigen
::
MatrixXd
&
aPrecision
,
double
minPrecision
=
0.
);
GblMeasurement
(
const
Eigen
::
VectorXd
&
aResiduals
,
const
Eigen
::
MatrixXd
&
aPrecision
,
double
minPrecision
=
0.
);
GblMeasurement
(
const
GblMeasurement
&
)
=
default
;
GblMeasurement
&
operator
=
(
const
GblMeasurement
&
)
=
default
;
GblMeasurement
(
GblMeasurement
&&
)
=
default
;
GblMeasurement
&
operator
=
(
GblMeasurement
&&
)
=
default
;
virtual
~
GblMeasurement
();
#ifdef GBL_EIGEN_SUPPORT_ROOT
// input via ROOT
GblMeasurement
(
const
TMatrixD
&
aProjection
,
const
TVectorD
&
aResiduals
,
const
TVectorD
&
aPrecision
,
double
minPrecision
=
0.
);
GblMeasurement
(
const
TMatrixD
&
aProjection
,
const
TVectorD
&
aResiduals
,
const
TMatrixDSym
&
aPrecision
,
double
minPrecision
=
0.
);
GblMeasurement
(
const
TVectorD
&
aResiduals
,
const
TVectorD
&
aPrecision
,
double
minPrecision
=
0.
);
GblMeasurement
(
const
TVectorD
&
aResiduals
,
const
TMatrixDSym
&
aPrecision
,
double
minPrecision
=
0.
);
void
addLocals
(
const
TMatrixD
&
aDerivatives
);
void
addGlobals
(
const
std
::
vector
<
int
>&
aLabels
,
const
TMatrixD
&
aDerivatives
);
#endif
// input via Eigen
void
addLocals
(
const
Eigen
::
MatrixXd
&
aDerivatives
);
void
addGlobals
(
const
std
::
vector
<
int
>&
aLabels
,
const
Eigen
::
MatrixXd
&
aDerivatives
);
void
setEnabled
(
bool
flag
);
bool
isEnabled
()
const
;
unsigned
int
getMeasDim
()
const
;
double
getMeasPrecMin
()
const
;
void
getMeasurement
(
Matrix5d
&
aProjection
,
Vector5d
&
aResiduals
,
Vector5d
&
aPrecision
)
const
;
void
getMeasTransformation
(
Eigen
::
MatrixXd
&
aTransformation
)
const
;
unsigned
int
getNumLocals
()
const
;
const
Eigen
::
MatrixXd
&
getLocalDerivatives
()
const
;
unsigned
int
getNumGlobals
()
const
;
void
printMeasurement
(
unsigned
int
level
=
0
)
const
;
void
getGlobalLabels
(
std
::
vector
<
int
>&
aLabels
)
const
;
void
getGlobalDerivatives
(
Eigen
::
MatrixXd
&
aDerivatives
)
const
;
void
getGlobalLabelsAndDerivatives
(
unsigned
int
aRow
,
std
::
vector
<
int
>&
aLabels
,
std
::
vector
<
double
>&
aDerivatives
)
const
;
private:
bool
enabled
;
///< Enabled flag (to be used)
unsigned
int
measDim
;
///< Dimension of measurement (1-5), 0 indicates absence of measurement
double
measPrecMin
;
///< Minimal measurement precision (for usage)
Matrix5d
measProjection
;
///< Projection from measurement to local system
Vector5d
measResiduals
;
///< Measurement residuals
Vector5d
measPrecision
;
///< Measurement precision (diagonal of inverse covariance matrix)
bool
transFlag
;
///< Transformation exists?
Eigen
::
Matrix
<
double
,
Eigen
::
Dynamic
,
Eigen
::
Dynamic
,
Eigen
::
ColMajor
/* default */
,
5
,
5
>
measTransformation
;
///< Transformation of diagonalization (of meas. precision matrix)
Eigen
::
MatrixXd
localDerivatives
;
///< Derivatives of measurement vs additional local (fit) parameters
std
::
vector
<
int
>
globalLabels
;
///< Labels of global (MP-II) derivatives
Eigen
::
MatrixXd
globalDerivatives
;
///< Derivatives of measurement vs additional global (MP-II) parameters
};
}
// namespace gbl
#endif
/* GBLMEASUREMENT_H_ */
3rdparty/GeneralBrokenLines/include/GblPoint.h
View file @
f9070406
...
...
@@ -13,7 +13,7 @@
*
*
* \copyright
* Copyright (c) 2011 - 201
7
Deutsches Elektronen-Synchroton,
* Copyright (c) 2011 - 20
2
1 Deutsches Elektronen-Synchroton,
* Member of the Helmholtz Association, (DESY), HAMBURG, GERMANY \n\n
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
...
...
@@ -32,16 +32,12 @@
#ifndef GBLPOINT_H_
#define GBLPOINT_H_
#include "GblMeasurement.h"
#include <iostream>
#include <math.h>
#include <stdexcept>
#include <vector>
#ifdef GBL_EIGEN_SUPPORT_ROOT
#include "TMatrixD.h"
#include "TMatrixDSym.h"
#include "TMatrixDSymEigen.h"
#include "TVectorD.h"
#endif
#include "Eigen/Dense"
...
...
@@ -60,15 +56,12 @@ namespace gbl {
*
* Must have jacobian for propagation from previous point. May have:
*
* -# Measurement (1D - 5D)
* -# Measurement
(s)
(1D - 5D)
* -# Scatterer (thin, 2D kinks)
* -# Additional local parameters (with derivatives). Fitted together with track parameters.
* -# Additional global parameters (with labels and derivatives). Not fitted, only passed
* on to (binary) file for fitting with Millepede-II.
*/
class
GblPoint
{
public:
GblPoint
(
const
Matrix5d
&
aJacobian
);
GblPoint
(
const
Matrix5d
&
aJacobian
,
unsigned
int
numMeasReserve
=
0
);
GblPoint
(
const
GblPoint
&
)
=
default
;
GblPoint
&
operator
=
(
const
GblPoint
&
)
=
default
;
GblPoint
(
GblPoint
&&
)
=
default
;
...
...
@@ -103,9 +96,7 @@ namespace gbl {
* \tparam Residuals Residuals vector
* \tparam Precision Precision matrix or vector (with diagonal)
* \param [in] aProjection Projection from local to measurement system (derivative of measurement vs local
* parameters)
* \param [in] aResiduals Measurement residuals
* \param [in] aPrecision Measurement precision (matrix)
* parameters) \param [in] aResiduals Measurement residuals \param [in] aPrecision Measurement precision (matrix)
* \param [in] minPrecision Minimal precision to accept measurement
*/
template
<
typename
Projection
,
...
...
@@ -125,10 +116,8 @@ namespace gbl {
* \tparam Residuals Residuals vector
* \tparam Precision Precision matrix or vector (with diagonal)
* \param [in] aProjection Projection from local to measurement system (derivative of measurement vs local
* parameters)
* \param [in] aResiduals Measurement residuals
* \param [in] aPrecision Measurement precision (vector with diagonal)
* \param [in] minPrecision Minimal precision to accept measurement
* parameters) \param [in] aResiduals Measurement residuals \param [in] aPrecision Measurement precision (vector with
* diagonal) \param [in] minPrecision Minimal precision to accept measurement
*/
template
<
typename
Projection
,
typename
Residuals
,
...
...
@@ -232,25 +221,21 @@ namespace gbl {
*/
void
addGlobals
(
const
std
::
vector
<
int
>&
aLabels
,
const
Eigen
::
MatrixBase
<
Derivative
>&
aDerivatives
);
//
unsigned
int
hasMeasurement
()
const
;
double
getMeasPrecMin
()
const
;
void
getMeasurement
(
Matrix5d
&
aProjection
,
Vector5d
&
aResiduals
,
Vector5d
&
aPrecision
)
const
;
void
getMeasTransformation
(
Eigen
::
MatrixXd
&
aTransformation
)
const
;
unsigned
int
numMeasurements
()
const
;
bool
hasScatterer
()
const
;
void
getScatterer
(
Eigen
::
Matrix2d
&
aTransformation
,
Eigen
::
Vector2d
&
aResiduals
,
Eigen
::
Vector2d
&
aPrecision
)
const
;
void
getScatTransformation
(
Eigen
::
Matrix2d
&
aTransformation
)
const
;
unsigned
int
getNumLocals
()
const
;
const
Eigen
::
MatrixXd
&
getLocalDerivatives
()
const
;
unsigned
int
getNumGlobals
()
const
;
void
getGlobalLabels
(
std
::
vector
<
int
>&
aLabels
)
const
;
void
getGlobalDerivatives
(
Eigen
::
MatrixXd
&
aDerivatives
)
const
;
void
getGlobalLabelsAndDerivatives
(
unsigned
int
aRow
,
std
::
vector
<
int
>&
aLabels
,
std
::
vector
<
double
>&
aDerivatives
)
const
;
unsigned
int
getLabel
()
const
;
int
getOffset
()
const
;
const
Matrix5d
&
getP2pJacobian
()
const
;
void
getDerivatives
(
int
aDirection
,
Eigen
::
Matrix2d
&
matW
,
Eigen
::
Matrix2d
&
matWJ
,
Eigen
::
Vector2d
&
vecWd
)
const
;
void
printPoint
(
unsigned
int
level
=
0
)
const
;
std
::
vector
<
GblMeasurement
>::
iterator
getMeasBegin
();
std
::
vector
<
GblMeasurement
>::
iterator
getMeasEnd
();
void
getGlobalLabelsAndDerivatives
(
unsigned
int
aMeas
,
unsigned
int
aRow
,
std
::
vector
<
int
>&
aLabels
,
std
::
vector
<
double
>&
aDerivatives
)
const
;
private:
friend
class
GblTrajectory
;
// to have the following setters private
...
...
@@ -259,27 +244,16 @@ namespace gbl {
void
addPrevJacobian
(
const
Matrix5d
&
aJac
);
void
addNextJacobian
(
const
Matrix5d
&
aJac
);
unsigned
int
theLabel
;
///< Label identifying point
int
theOffset
;
///< Offset number at point if not negative (else interpolation needed)
Matrix5d
p2pJacobian
;
///< Point-to-point jacobian from previous point
Matrix5d
prevJacobian
;
///< Jacobian to previous scatterer (or first measurement)
Matrix5d
nextJacobian
;
///< Jacobian to next scatterer (or last measurement)
unsigned
int
measDim
;
///< Dimension of measurement (1-5), 0 indicates absence of measurement
double
measPrecMin
;
///< Minimal measurement precision (for usage)
Matrix5d
measProjection
;
///< Projection from measurement to local system
Vector5d
measResiduals
;
///< Measurement residuals
Vector5d
measPrecision
;
///< Measurement precision (diagonal of inverse covariance matrix)
bool
transFlag
;
///< Transformation exists?
Eigen
::
Matrix
<
double
,
Eigen
::
Dynamic
,
Eigen
::
Dynamic
,
Eigen
::
ColMajor
/* default */
,
5
,
5
>
measTransformation
;
///< Transformation of diagonalization (of meas. precision matrix)
bool
scatFlag
;
///< Scatterer present?
Eigen
::
Matrix2d
scatTransformation
;
///< Transformation of diagonalization (of scat. precision matrix)
Eigen
::
Vector2d
scatResiduals
;
///< Scattering residuals (initial kinks if iterating)
Eigen
::
Vector2d
scatPrecision
;
///< Scattering precision (diagonal of inverse covariance matrix)
Eigen
::
MatrixXd
localDerivatives
;
///< Derivatives of measurement vs additional local (fit) parameters
std
::
vector
<
int
>
globalLabels
;
///< Labels of global (MP-II) derivatives
Eigen
::
MatrixXd
globalDerivatives
;
///< Derivatives of measurement vs additional global (MP-II) parameters
unsigned
int
theLabel
;
///< Label identifying point
int
theOffset
;
///< Offset number at point if not negative (else interpolation needed)
Matrix5d
p2pJacobian
;
///< Point-to-point jacobian from previous point
Matrix5d
prevJacobian
;
///< Jacobian to previous scatterer (or first measurement)
Matrix5d
nextJacobian
;
///< Jacobian to next scatterer (or last measurement)
bool
scatFlag
;
///< Scatterer present?
Eigen
::
Matrix2d
scatTransformation
;
///< Transformation of diagonalization (of scat. precision matrix)
Eigen
::
Vector2d
scatResiduals
;
///< Scattering residuals (initial kinks if iterating)
Eigen
::
Vector2d
scatPrecision
;
///< Scattering precision (diagonal of inverse covariance matrix)
std
::
vector
<
GblMeasurement
>
theMeasurements
;
///< List of measurements at point
};
template
<
typename
Projection
,
...
...
@@ -303,15 +277,7 @@ namespace gbl {
"addMeasurement: rows(Precision) and cols(Precision) must be equal"
);
static_assert
(
static_cast
<
int
>
(
Projection
::
RowsAtCompileTime
)
==
static_cast
<
int
>
(
Projection
::
ColsAtCompileTime
),
"addMeasurement: rows(Projection) and cols(Projection) must be equal"
);
measDim
=
aResiduals
.
rows
();
measPrecMin
=
minPrecision
;
// arbitrary precision matrix
Eigen
::
SelfAdjointEigenSolver
<
typename
Precision
::
PlainObject
>
measEigen
{
aPrecision
};
measTransformation
=
measEigen
.
eigenvectors
().
transpose
();
transFlag
=
true
;
measResiduals
.
tail
(
measDim
)
=
measTransformation
*
aResiduals
;
measPrecision
.
tail
(
measDim
)
=
measEigen
.
eigenvalues
();
measProjection
.
bottomRightCorner
(
measDim
,
measDim
)
=
measTransformation
*
aProjection
;
theMeasurements
.
emplace_back
(
aProjection
,
aResiduals
,
aPrecision
,
minPrecision
);
}
template
<
typename
Projection
,
...
...
@@ -333,12 +299,8 @@ namespace gbl {
"addMeasurement: rows(Residuals) and rows(Projection) must be equal"
);
static_assert
(
static_cast
<
int
>
(
Projection
::
RowsAtCompileTime
)
==
static_cast
<
int
>
(
Projection
::
ColsAtCompileTime
),
"addMeasurement: rows(Projection) and cols(Projection) must be equal"
);
measDim
=
aResiduals
.
rows
();
measPrecMin
=
minPrecision
;
// diagonal precision matrix
measResiduals
.
tail
(
measDim
)
=
aResiduals
;
measPrecision
.
tail
(
measDim
)
=
aPrecision
;
measProjection
.
bottomRightCorner
(
measDim
,
measDim
)
=
aProjection
;
// theMeasurements.push_back(GblMeasurement(aProjection, aResiduals, aPrecision, minPrecision));
theMeasurements
.
emplace_back
(
aProjection
,
aResiduals
,
aPrecision
,
minPrecision
);
}
template
<
typename
Residuals
,
typename
Precision
,
typename
std
::
enable_if
<
(
Precision
::
ColsAtCompileTime
!=
1
)>
::
type
*>
...
...
@@ -352,15 +314,7 @@ namespace gbl {
"addMeasurement: rows(Residuals) must be 1-5 or dynamic"
);
static_assert
(
static_cast
<
int
>
(
Residuals
::
RowsAtCompileTime
)
==
static_cast
<
int
>
(
Precision
::
RowsAtCompileTime
),
"addMeasurement: rows(Residuals) and rows(Precision) must be equal"
);
measDim
=
aResiduals
.
rows
();
measPrecMin
=
minPrecision
;
// arbitrary precision matrix
Eigen
::
SelfAdjointEigenSolver
<
typename
Precision
::
PlainObject
>
measEigen
{
aPrecision
};
measTransformation
=
measEigen
.
eigenvectors
().
transpose
();
transFlag
=
true
;
measResiduals
.
tail
(
measDim
)
=
measTransformation
*
aResiduals
;
measPrecision
.
tail
(
measDim
)
=
measEigen
.
eigenvalues
();
measProjection
.
bottomRightCorner
(
measDim
,
measDim
)
=
measTransformation
;
theMeasurements
.
emplace_back
(
aResiduals
,
aPrecision
,
minPrecision
);
}
template
<
typename
Residuals
,
typename
Precision
,
typename
std
::
enable_if
<
(
Precision
::
ColsAtCompileTime
==
1
)>
::
type
*>
...
...
@@ -374,12 +328,7 @@ namespace gbl {
"addMeasurement: rows(Residuals) must be 1-5 or dynamic"
);
static_assert
(
static_cast
<
int
>
(
Residuals
::
RowsAtCompileTime
)
==
static_cast
<
int
>
(
Precision
::
RowsAtCompileTime
),
"addMeasurement: rows(Residuals) and rows(Precision) must be equal"
);
measDim
=
aResiduals
.
rows
();
measPrecMin
=
minPrecision
;
// diagonal precision matrix
measResiduals
.
tail
(
measDim
)
=
aResiduals
;
measPrecision
.
tail
(
measDim
)
=
aPrecision
;
measProjection
.
setIdentity
();
theMeasurements
.
emplace_back
(
aResiduals
,
aPrecision
,
minPrecision
);
}
template
<
typename
Precision
,
typename
std
::
enable_if
<
(
Precision
::
ColsAtCompileTime
==
2
)>
::
type
*>
...
...
@@ -408,27 +357,15 @@ namespace gbl {
}
template
<
typename
Derivative
>
void
GblPoint
::
addLocals
(
const
Eigen
::
MatrixBase
<
Derivative
>&
aDerivatives
)
{
if
(
measDim
)
{
localDerivatives
.
resize
(
aDerivatives
.
rows
(),
aDerivatives
.
cols
());
if
(
transFlag
)
{
localDerivatives
=
measTransformation
*
aDerivatives
;
}
else
{
localDerivatives
=
aDerivatives
;
}
}
if
(
theMeasurements
.
size
())
theMeasurements
.
back
().
addLocals
(
aDerivatives
);
}
template
<
typename
Derivative
>
void
GblPoint
::
addGlobals
(
const
std
::
vector
<
int
>&
aLabels
,
const
Eigen
::
MatrixBase
<
Derivative
>&
aDerivatives
)
{
if
(
measDim
)
{
globalLabels
=
aLabels
;
globalDerivatives
.
resize
(
aDerivatives
.
rows
(),
aDerivatives
.
cols
());
if
(
transFlag
)
{
globalDerivatives
=
measTransformation
*
aDerivatives
;
}
else
{
globalDerivatives
=
aDerivatives
;
}
}
if
(
theMeasurements
.
size
())
theMeasurements
.
back
().
addGlobals
(
aLabels
,
aDerivatives
);
}
}
}
// namespace gbl
#endif
/* GBLPOINT_H_ */
3rdparty/GeneralBrokenLines/include/GblTrajectory.h
View file @
f9070406
...
...
@@ -13,7 +13,7 @@
*
*
* \copyright
* Copyright (c) 2011 - 201
8
Deutsches Elektronen-Synchroton,
* Copyright (c) 2011 - 20
2
1 Deutsches Elektronen-Synchroton,
* Member of the Helmholtz Association, (DESY), HAMBURG, GERMANY \n\n
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
...
...
@@ -84,10 +84,9 @@ namespace gbl {
* \tparam Measurements Residuals vector
* \tparam Precision Precision matrix or vector (with diagonal)
* \param [in] aPointsAndTransList List containing pairs with list of points and transformation (at inner (first)
* point)
* \param [in] extDerivatives Derivatives of external measurements vs external parameters
* \param [in] extMeasurements External measurements (residuals)
* \param [in] extPrecisions Precision of external measurements (matrix)
* point) \param [in] extDerivatives Derivatives of external measurements vs external parameters \param [in]
* extMeasurements External measurements (residuals) \param [in] extPrecisions Precision of external measurements
* (matrix)
*/
template
<
typename
Derivatives
,
typename
Measurements
,
...
...
@@ -101,17 +100,15 @@ namespace gbl {
/// Create new composed trajectory from list of points and transformations with independent external measurements.
/**
* Composed of curved trajectories in space. The (diagonal) precision matrix for the external measurements is
* specified as vector
* (containing the diagonal).
* specified as vector (containing the diagonal).
*
* \tparam Derivatives External derivatives
* \tparam Measurements Residuals vector
* \tparam Precision Precision matrix or vector (with diagonal)
* \param [in] aPointsAndTransList List containing pairs with list of points and transformation (at inner (first)
* point)
* \param [in] extDerivatives Derivatives of external measurements vs external parameters
* \param [in] extMeasurements External measurements (residuals)
* \param [in] extPrecisions Precision of external measurements (vector with diagonal)
* point) \param [in] extDerivatives Derivatives of external measurements vs external parameters \param [in]