Belle II Software development
JacobianMatrixUtil.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8#pragma once
9
10#include <tracking/trackFindingCDC/numerics/JacobianMatrix.h>
11#include <tracking/trackFindingCDC/numerics/ParameterVector.h>
12
13#include <tracking/trackFindingCDC/geometry/Vector2D.h>
14
15#include <tracking/trackFindingCDC/numerics/EigenView.h>
16
17#include <Eigen/Core>
18
19namespace Belle2 {
24 namespace TrackFindingCDC {
25
28
30 template <unsigned int M, unsigned int N = M>
32 {
34 }
35
37 template <int M, int N = M>
39 {
41 }
42
44 template <int N>
45 static JacobianMatrix<N, N> passiveRotation(int i, int j, double phi)
46 {
47 return passiveRotation<N>(i, j, Vector2D::Phi(phi));
48 }
49
51 template <int N>
52 static JacobianMatrix<N, N> passiveRotation(int i, int j, const Vector2D& phiVec)
53 {
54 assert(i < N);
55 assert(j < N);
56 JacobianMatrix<N, N> result = identity<N>();
57 result(i, i) = phiVec.x();
58 result(i, j) = phiVec.y();
59 result(j, i) = -phiVec.y();
60 result(j, j) = phiVec.x();
61 return result;
62 }
63
65 template <int N>
67 {
68 JacobianMatrix<N> result = zero<N>();
69 mapToEigen(result).diagonal() = mapToEigen(scales);
70 return result;
71 }
72
75 template <int M1, int N1, int M2, int N2>
76 static JacobianMatrix < M1 + M2, N1 + N2 > stackBlocks(const JacobianMatrix<M1, N1>& block1,
77 const JacobianMatrix<M2, N2>& block2)
78 {
79 JacobianMatrix < M1 + M2, N1 + N2 > result;
80 mapToEigen(result) << mapToEigen(block1), Eigen::Matrix<double, M1, N2>::Zero(),
81 Eigen::Matrix<double, M2, N1>::Zero(), mapToEigen(block2);
82 return result;
83 }
84 };
85
86 }
88}
A matrix implementation to be used as an interface typ through out the track finder.
Definition: PlainMatrix.h:40
static PlainMatrix< T, M, N > Identity()
Construct an identity matrix.
Definition: PlainMatrix.h:74
static PlainMatrix< T, M, N > Zero()
Construct a matrix initialized with zeros.
Definition: PlainMatrix.h:67
A two dimensional vector which is equipped with functions for correct handeling of orientation relat...
Definition: Vector2D.h:32
double x() const
Getter for the x coordinate.
Definition: Vector2D.h:595
double y() const
Getter for the y coordinate.
Definition: Vector2D.h:605
static Vector2D Phi(const double phi)
Constucts a unit vector with azimuth angle equal to phi.
Definition: Vector2D.h:62
Abstract base class for different kinds of events.
Collection of functions related to jacobian matrices.
static JacobianMatrix< M1+M2, N1+N2 > stackBlocks(const JacobianMatrix< M1, N1 > &block1, const JacobianMatrix< M2, N2 > &block2)
Combines two jacobian matrices by putting them in two blocks diagonal to each other in a larger matri...
static JacobianMatrix< N, N > passiveRotation(int i, int j, const Vector2D &phiVec)
Construct a passive rotation matrix around coordinates i and j.
static JacobianMatrix< N, N > passiveRotation(int i, int j, double phi)
Construct a passive rotation matrix around coordinates i and j.
static JacobianMatrix< M, N > zero()
Construct a zero matrix.
static JacobianMatrix< N > scale(const ParameterVector< N > &scales)
Calculates the jacobian matrix for a scaling in each parameter.
static JacobianMatrix< M, N > identity()
Construct a unit matrix.