SND@LHC Software
Loading...
Searching...
No Matches
HMatrixU.cc
Go to the documentation of this file.
1/* Copyright 2013, Technische Universitaet Muenchen,
2 Authors: Johannes Rauch
3
4 This file is part of GENFIT.
5
6 GENFIT is free software: you can redistribute it and/or modify
7 it under the terms of the GNU Lesser General Public License as published
8 by the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 GENFIT is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public License
17 along with GENFIT. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#include "HMatrixU.h"
21#include <cassert>
22#include <alloca.h>
23
24
25namespace genfit {
26
27
28// 0, 0, 0, 1, 0
29
30const TMatrixD& HMatrixU::getMatrix() const {
31 static const double HMatrixContent[5] = {0, 0, 0, 1, 0};
32
33 static const TMatrixD HMatrix(1,5, HMatrixContent);
34
35 return HMatrix;
36}
37
38
39TVectorD HMatrixU::Hv(const TVectorD& v) const {
40 assert (v.GetNrows() == 5);
41
42 double* retValArray =(double *)alloca(sizeof(double) * 1);
43
44 retValArray[0] = v(3); // u
45
46 return TVectorD(1, retValArray);
47}
48
49
50TMatrixD HMatrixU::MHt(const TMatrixDSym& M) const {
51 assert (M.GetNcols() == 5);
52
53 double* retValArray =(double *)alloca(sizeof(double) * 5);
54 const double* MatArray = M.GetMatrixArray();
55
56 for (unsigned int i=0; i<5; ++i) {
57 retValArray[i] = MatArray[i*5 + 3];
58 }
59
60 return TMatrixD(5,1, retValArray);
61}
62
63
64TMatrixD HMatrixU::MHt(const TMatrixD& M) const {
65 assert (M.GetNcols() == 5);
66
67 double* retValArray =(double *)alloca(sizeof(double) * M.GetNrows());
68 const double* MatArray = M.GetMatrixArray();
69
70 for (int i = 0; i < M.GetNrows(); ++i) {
71 retValArray[i] = MatArray[i*5 + 3];
72 }
73
74 return TMatrixD(M.GetNrows(),1, retValArray);
75}
76
77
78void HMatrixU::HMHt(TMatrixDSym& M) const {
79 assert (M.GetNrows() == 5);
80
81 M(0,0) = M(3,3);
82
83 M.ResizeTo(1,1);
84}
85
86
87} /* End of namespace genfit */
TVectorD Hv(const TVectorD &v) const
H*v.
Definition HMatrixU.cc:39
TMatrixD MHt(const TMatrixDSym &M) const
M*H^t.
Definition HMatrixU.cc:50
void HMHt(TMatrixDSym &M) const
similarity: H*M*H^t
Definition HMatrixU.cc:78
const TMatrixD & getMatrix() const
Get the actual matrix representation.
Definition HMatrixU.cc:30
Matrix inversion tools.
Definition AbsBField.h:29