ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Tracking
TrkEvent
TrkEventPrimitives
src
ProjectionMatricesSet.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
6
// ProjectionMatricesSet.cxx, (c) ATLAS Detector software
8
9
#include "
TrkEventPrimitives/ProjectionMatricesSet.h
"
10
#include <cmath>
11
12
Trk::ProjectionMatricesSet::ProjectionMatricesSet
(
int
maxdim) :
13
m_maxdim
(maxdim)
14
{
15
16
// the number of projection matrices is 2**(maxdim),
17
// it is the possible number of binary numbers of with maxdim digits
18
int
numMatrices = int(pow(2,
m_maxdim
));
19
20
for
(
int
imatx=0; imatx<numMatrices; ++imatx){
21
22
std::vector<int> accessorInt(
m_maxdim
);
23
std::vector<bool> parameterTag(
m_maxdim
);
24
unsigned
int
cols = 0;
25
for
(
int
itag = 0, ipos = 1; itag <
m_maxdim
; ++itag, ipos *= 2) {
26
bool
bit = (imatx & ipos);
27
parameterTag[itag] = bit;
28
if
(bit) {
29
++cols;
30
}
31
}
32
33
//By default set zero
34
Amg::MatrixX
reduction;
35
reduction.setZero();
36
Amg::MatrixX
expansion;
37
expansion.setZero();
38
if
(cols){
39
// rows and cols - initialized to zero
40
reduction =
Amg::MatrixX
(
m_maxdim
, cols);
41
reduction.setZero();
42
// go through the rows and fill them
43
int
reduc = 0;
44
for
(
int
irow = 0; irow<
m_maxdim
; irow++)
45
{
46
int
icol = irow - reduc;
47
// avoids couting to col 4 for int(0b01111) = 15 matrix
48
icol = (icol < int(cols)) ? icol : cols-1;
49
reduction(irow,icol) = parameterTag[irow] ? 1. : 0.;
50
if
(!parameterTag[irow])
51
{
52
accessorInt[irow] = -100;
53
++reduc;
54
}
else
{
55
accessorInt[irow] = reduc;
56
}
57
}
58
// the expansion matrix is the transposed reduction matrix
59
expansion =
Amg::MatrixX
(reduction.transpose());
60
}
61
// store them
62
m_reductions
.push_back(std::move(reduction));
63
m_expansions
.push_back(std::move(expansion));
64
m_accessors
.push_back(std::move(accessorInt));
65
}
66
67
}
ProjectionMatricesSet.h
Trk::ProjectionMatricesSet::m_accessors
std::vector< std::vector< int > > m_accessors
Definition
ProjectionMatricesSet.h:48
Trk::ProjectionMatricesSet::m_expansions
std::vector< Amg::MatrixX > m_expansions
Definition
ProjectionMatricesSet.h:46
Trk::ProjectionMatricesSet::m_reductions
std::vector< Amg::MatrixX > m_reductions
Definition
ProjectionMatricesSet.h:47
Trk::ProjectionMatricesSet::ProjectionMatricesSet
ProjectionMatricesSet(int maxdim)
Explicit constructor for 1-dimensional vector.
Definition
ProjectionMatricesSet.cxx:12
Trk::ProjectionMatricesSet::m_maxdim
int m_maxdim
Definition
ProjectionMatricesSet.h:45
Amg::MatrixX
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Definition
EventPrimitives.h:27
Generated on
for ATLAS Offline Software by
1.17.0