ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
make_projection_matrix.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file make_projection_matrix.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2016-2018 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
9 #pragma once
10 // Acts include(s)
12 
13 namespace Acts {
15 namespace detail {
29 template <unsigned int columns, unsigned int... rows>
30 struct make_projection_matrix;
31 
33 // build projection matrix by iteratively stacking row vectors
34 template <unsigned int columns, unsigned int i, unsigned int... N>
35 struct make_projection_matrix<columns, i, N...> {
36  static ActsMatrixD<sizeof...(N) + 1, columns> init() {
37  ActsRowVectorD<columns> v;
38  v.setZero();
39  v(i) = 1;
40 
41  ActsMatrixD<sizeof...(N) + 1, columns> m;
42  m.row(0) << v;
43  m.block(1, 0, sizeof...(N), columns)
45 
46  return m;
47  }
48 };
49 
50 // projection matrix for a single local parameter is a simple row vector
51 template <unsigned int columns, unsigned int i>
52 struct make_projection_matrix<columns, i> {
53  static ActsRowVectorD<columns> init() {
54  ActsRowVectorD<columns> v;
55  v.setZero();
56  v(i) = 1;
57  return v;
58  }
59 };
61 } // namespace detail
63 } // namespace Acts