EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HMatrixU.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file HMatrixU.cc
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 
22 #include "IO.h"
23 
24 #include <cassert>
25 #include <alloca.h>
26 
27 
28 namespace genfit {
29 
30 
31 // 0, 0, 0, 1, 0
32 
33 const TMatrixD& HMatrixU::getMatrix() const {
34  static const double HMatrixContent[5] = {0, 0, 0, 1, 0};
35 
36  static const TMatrixD HMatrix(1,5, HMatrixContent);
37 
38  return HMatrix;
39 }
40 
41 
42 TVectorD HMatrixU::Hv(const TVectorD& v) const {
43  assert (v.GetNrows() == 5);
44 
45  double* retValArray =(double *)alloca(sizeof(double) * 1);
46 
47  retValArray[0] = v(3); // u
48 
49  return TVectorD(1, retValArray);
50 }
51 
52 
53 TMatrixD HMatrixU::MHt(const TMatrixDSym& M) const {
54  assert (M.GetNcols() == 5);
55 
56  double* retValArray =(double *)alloca(sizeof(double) * 5);
57  const double* MatArray = M.GetMatrixArray();
58 
59  for (unsigned int i=0; i<5; ++i) {
60  retValArray[i] = MatArray[i*5 + 3];
61  }
62 
63  return TMatrixD(5,1, retValArray);
64 }
65 
66 
67 TMatrixD HMatrixU::MHt(const TMatrixD& M) const {
68  assert (M.GetNcols() == 5);
69 
70  double* retValArray =(double *)alloca(sizeof(double) * M.GetNrows());
71  const double* MatArray = M.GetMatrixArray();
72 
73  for (int i = 0; i < M.GetNrows(); ++i) {
74  retValArray[i] = MatArray[i*5 + 3];
75  }
76 
77  return TMatrixD(M.GetNrows(),1, retValArray);
78 }
79 
80 
81 void HMatrixU::HMHt(TMatrixDSym& M) const {
82  assert (M.GetNrows() == 5);
83 
84  M(0,0) = M(3,3);
85 
86  M.ResizeTo(1,1);
87 }
88 
89 
90 void HMatrixU::Print(const Option_t*) const {
91  printOut << "U" << std::endl;
92 }
93 
94 
95 } /* End of namespace genfit */