Belle II Software  release-05-02-19
TMatrixConversion.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2017 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Oliver Frost *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 #pragma once
11 
12 #include <tracking/trackFindingCDC/numerics/CovarianceMatrix.h>
13 
14 #include <TMatrixDSymfwd.h>
15 
18 namespace Belle2 {
23  namespace TrackFindingCDC {
24 
26  struct TMatrixConversion {
27 
29  template <int N>
30  static CovarianceMatrix<N> fromTMatrix(const TMatrixDSym& tCov);
31 
33  template <int N>
34  static TMatrixDSym toTMatrix(const CovarianceMatrix<N>& cov);
35  };
36  }
38 }
39 
42 #include <TMatrixDSym.h>
43 
44 namespace Belle2 {
49  namespace TrackFindingCDC {
50 
51  template <int N>
53  {
54  assert(tCov.GetNrows() == N);
55  assert(tCov.GetNcols() == N);
56  assert(tCov.GetRowLwb() == 0);
57  assert(tCov.GetColLwb() == 0);
58 
59  CovarianceMatrix<N> result;
60  for (int i = 0; i < N; ++i) {
61  for (int j = 0; j < N; ++j) {
62  result(i, j) = tCov(i, j);
63  }
64  }
65  return result;
66  }
67 
68  template <int N>
70  {
71  TMatrixDSym result(N);
72  for (int i = 0; i < N; ++i) {
73  for (int j = 0; j < N; ++j) {
74  result(i, j) = cov(i, j);
75  }
76  }
77  return result;
78  }
79  }
81 }
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TrackFindingCDC::TMatrixConversion::toTMatrix
static TMatrixDSym toTMatrix(const CovarianceMatrix< N > &cov)
Translate the covariance matrix to the TMatrix representation.
Definition: TMatrixConversion.h:69
Belle2::TrackFindingCDC::PlainMatrix
A matrix implementation to be used as an interface typ through out the track finder.
Definition: PlainMatrix.h:50
Belle2::TrackFindingCDC::TMatrixConversion::fromTMatrix
static CovarianceMatrix< N > fromTMatrix(const TMatrixDSym &tCov)
Create a covariance matrix from a TMatrix representation.
Definition: TMatrixConversion.h:52