Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 /* Copyright 2008-2009, Technische Universitaet Muenchen,
0002    Authors: Christian Hoeppner & Sebastian Neubert & 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 /** @addtogroup RKTrackRep
0021  * @{
0022  */
0023 
0024 #ifndef genfit_RKTools_h
0025 #define genfit_RKTools_h
0026 
0027 #include <stddef.h>
0028 #include <algorithm>
0029 #include <initializer_list>
0030 
0031 namespace genfit {
0032 
0033 template <size_t nRows, size_t nCols>
0034 struct RKMatrix {
0035   double vals[nRows * nCols];
0036 
0037   RKMatrix() = default;
0038   RKMatrix(const RKMatrix&) = default;
0039   RKMatrix(std::initializer_list<double> initList) {
0040     std::copy(initList.begin(), initList.end(), vals);
0041   };
0042 
0043   double& operator()(size_t iRow, size_t iCol) {
0044     return vals[nCols*iRow + iCol];
0045   }
0046   double& operator[](size_t n) {
0047     return vals[n];
0048   }
0049   const double& operator[](size_t n) const {
0050     return vals[n];
0051   }
0052 
0053   double* begin() { return vals; }
0054   double* end() { return vals + nRows * nCols; }
0055   const double* begin() const { return vals; }
0056   const double* end() const { return vals + nRows * nCols; }
0057 
0058   RKMatrix<nRows, nCols>& operator=(const RKMatrix<nRows, nCols>& o) {
0059     std::copy(o.begin(), o.end(), this->begin());
0060     return *this;
0061   }
0062 
0063   void print();
0064 };
0065 
0066 typedef RKMatrix<1, 3> M1x3;
0067 typedef RKMatrix<1, 4> M1x4;
0068 typedef RKMatrix<1, 7> M1x7;
0069 typedef RKMatrix<5, 5> M5x5;
0070 typedef RKMatrix<6, 6> M6x6;
0071 typedef RKMatrix<7, 7> M7x7;
0072 typedef RKMatrix<6, 5> M6x5;
0073 typedef RKMatrix<7, 5> M7x5;
0074 typedef RKMatrix<5, 6> M5x6;
0075 typedef RKMatrix<5, 7> M5x7;
0076 
0077 /**
0078  * @brief Array matrix multiplications used in RKTrackRep
0079  */
0080 namespace RKTools {
0081 
0082   void J_pMTxcov5xJ_pM(const M5x7& J_pM, const M5x5& cov5, M7x7& out7);
0083   void J_pMTxcov5xJ_pM(const M5x6& J_pM, const M5x5& cov5, M6x6& out6);
0084 
0085   void J_MpTxcov7xJ_Mp(const M7x5& J_Mp, const M7x7& cov7, M5x5& out5);
0086   void J_MpTxcov6xJ_Mp(const M6x5& J_Mp, const M6x6& cov6, M5x5& out5);
0087 
0088   void J_pMTTxJ_MMTTxJ_MpTT(const M7x5& J_pMT, const M7x7& J_MMT, const M5x7& J_MpT, M5x5& J_pp);
0089 
0090   void Np_N_NpT(const M7x7& Np, M7x7& N);
0091 
0092   void printDim(const double* mat, unsigned int dimX, unsigned int dimY);
0093 
0094 }
0095 
0096 template<size_t nRows, size_t nCols>
0097 inline void
0098 RKMatrix<nRows, nCols>::print() {
0099   RKTools::printDim(this->vals, nRows, nCols);
0100 }
0101 
0102 } /* End of namespace genfit */
0103 /** @} */
0104 
0105 #endif // genfit_RKTools_h
0106