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,
0002    Authors: Johannes Rauch
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 "HMatrixU.h"
0021 
0022 #include "IO.h"
0023 
0024 #include <cassert>
0025 #include <alloca.h>
0026 
0027 
0028 namespace genfit {
0029 
0030 
0031 // 0, 0, 0, 1, 0
0032 
0033 const TMatrixD& HMatrixU::getMatrix() const {
0034   static const double HMatrixContent[5] = {0, 0, 0, 1, 0};
0035 
0036   static const TMatrixD HMatrix(1,5, HMatrixContent);
0037 
0038   return HMatrix;
0039 }
0040 
0041 
0042 TVectorD HMatrixU::Hv(const TVectorD& v) const {
0043   assert (v.GetNrows() == 5);
0044 
0045   double* retValArray =(double *)alloca(sizeof(double) * 1);
0046 
0047   retValArray[0] = v(3); // u
0048 
0049   return TVectorD(1, retValArray);
0050 }
0051 
0052 
0053 TMatrixD HMatrixU::MHt(const TMatrixDSym& M) const {
0054   assert (M.GetNcols() == 5);
0055 
0056   double* retValArray =(double *)alloca(sizeof(double) * 5);
0057   const double* MatArray = M.GetMatrixArray();
0058 
0059   for (unsigned int i=0; i<5; ++i) {
0060     retValArray[i] = MatArray[i*5 + 3];
0061   }
0062 
0063   return TMatrixD(5,1, retValArray);
0064 }
0065 
0066 
0067 TMatrixD HMatrixU::MHt(const TMatrixD& M) const {
0068   assert (M.GetNcols() == 5);
0069 
0070   double* retValArray =(double *)alloca(sizeof(double) * M.GetNrows());
0071   const double* MatArray = M.GetMatrixArray();
0072 
0073   for (int i = 0; i < M.GetNrows(); ++i) {
0074     retValArray[i] = MatArray[i*5 + 3];
0075   }
0076 
0077   return TMatrixD(M.GetNrows(),1, retValArray);
0078 }
0079 
0080 
0081 void HMatrixU::HMHt(TMatrixDSym& M) const {
0082   assert (M.GetNrows() == 5);
0083 
0084   M(0,0) = M(3,3);
0085 
0086   M.ResizeTo(1,1);
0087 }
0088 
0089 
0090 void HMatrixU::Print(const Option_t*) const {
0091   printOut << "U" << std::endl;
0092 }
0093 
0094 
0095 } /* End of namespace genfit */