Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:18:27

0001 /* Copyright 2013, Technische Universitaet Muenchen, Ludwig-Maximilians-Universität München
0002    Authors: Johannes Rauch, Tobias Schlüter
0003 
0004    This file is part of GENFIT.
0005 
0006    GENFIT is free software: you can redistribute it and/or modify
0007    it under the terms of the GNU Lesser General Public License as published
0008    by the Free Software Foundation, either version 3 of the License, or
0009    (at your option) any later version.
0010 
0011    GENFIT is distributed in the hope that it will be useful,
0012    but WITHOUT ANY WARRANTY; without even the implied warranty of
0013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0014    GNU Lesser General Public License for more details.
0015 
0016    You should have received a copy of the GNU Lesser General Public License
0017    along with GENFIT.  If not, see <http://www.gnu.org/licenses/>.
0018 */
0019 
0020 #include "HMatrixV.h"
0021 
0022 #include "IO.h"
0023 
0024 #include <cassert>
0025 #include <alloca.h>
0026 
0027 namespace genfit {
0028 
0029 
0030 // 0, 0, 0, 0, 1
0031 
0032 const TMatrixD& HMatrixV::getMatrix() const {
0033   static const double HMatrixContent[5] = {0, 0, 0, 0, 1};
0034 
0035   static const TMatrixD HMatrix(1,5, HMatrixContent);
0036 
0037   return HMatrix;
0038 }
0039 
0040 
0041 TVectorD HMatrixV::Hv(const TVectorD& v) const {
0042   assert (v.GetNrows() == 5);
0043 
0044   double* retValArray =(double *)alloca(sizeof(double) * 1);
0045 
0046   retValArray[0] = v(4); // v
0047 
0048   return TVectorD(1, retValArray);
0049 }
0050 
0051 
0052 TMatrixD HMatrixV::MHt(const TMatrixDSym& M) const {
0053   assert (M.GetNcols() == 5);
0054 
0055   double* retValArray =(double *)alloca(sizeof(double) * 5);
0056   const double* MatArray = M.GetMatrixArray();
0057 
0058   for (unsigned int i=0; i<5; ++i) {
0059     retValArray[i] = MatArray[i*5 + 4];
0060   }
0061 
0062   return TMatrixD(5,1, retValArray);
0063 }
0064 
0065 
0066 TMatrixD HMatrixV::MHt(const TMatrixD& M) const {
0067   assert (M.GetNcols() == 5);
0068 
0069   double* retValArray =(double *)alloca(sizeof(double) * M.GetNrows());
0070   const double* MatArray = M.GetMatrixArray();
0071 
0072   for (int i = 0; i < M.GetNrows(); ++i) {
0073     retValArray[i] = MatArray[i*5 + 4];
0074   }
0075 
0076   return TMatrixD(M.GetNrows(),1, retValArray);
0077 }
0078 
0079 
0080 void HMatrixV::HMHt(TMatrixDSym& M) const {
0081   assert (M.GetNrows() == 5);
0082 
0083   M(0,0) = M(4,4);
0084 
0085   M.ResizeTo(1,1);
0086 }
0087 
0088 
0089 void HMatrixV::Print(const Option_t*) const {
0090   printOut << "V" << std::endl;
0091 }
0092 
0093 } /* End of namespace genfit */