1 #ifndef _CLEHP_2_SMATRIX_MIGRATION_H_
2 #define _CLEHP_2_SMATRIX_MIGRATION_H_
6 #include "CLHEP/Matrix/Matrix.h"
7 #include "CLHEP/Matrix/Vector.h"
8 #include "CLHEP/Matrix/SymMatrix.h"
29 template <
unsigned int N1,
unsigned int N2>
30 ROOT::Math::SMatrix<double, N1, N2, typename ROOT::Math::MatRepStd<double, N1, N2> >
asSMatrix(
31 const CLHEP::HepMatrix &
m) {
32 typedef typename ROOT::Math::MatRepStd<double, N1, N2> REP;
35 return ROOT::Math::SMatrix<double, N1, N2, REP>(&
m(1, 1), REP::kSize);
38 template <
unsigned int N1>
39 ROOT::Math::SMatrix<double, N1, N1, typename ROOT::Math::MatRepSym<double, N1> >
asSMatrix(
40 const CLHEP::HepSymMatrix &
m) {
41 typedef typename ROOT::Math::MatRepSym<double, N1> REP;
43 return ROOT::Math::SMatrix<double, N1, N1, REP>(&
m(1, 1), REP::kSize);
46 template <
unsigned int N1>
47 ROOT::Math::SVector<double, N1>
asSVector(
const CLHEP::HepVector &
m) {
48 return ROOT::Math::SVector<double, N1>(&
m[0], N1);
51 template <
unsigned int N>
52 CLHEP::HepVector
asHepVector(
const ROOT::Math::SVector<double, N> &
v) {
53 CLHEP::HepVector hv(
N);
54 memcpy(&hv[0], &
v[0],
N *
sizeof(
double));
58 template <
unsigned int N1,
unsigned int N2>
60 const ROOT::Math::SMatrix<
double, N1, N2,
typename ROOT::Math::MatRepStd<double, N1, N2> > &
rm) {
61 CLHEP::HepMatrix am(N1, N2);
62 memcpy(&am(1, 1),
rm.Array(), N1 * N2 *
sizeof(double));
66 template <
unsigned int N1>
68 const ROOT::Math::SMatrix<
double, N1, N1,
typename ROOT::Math::MatRepSym<double, N1> > &
rm) {
69 CLHEP::HepSymMatrix am(N1);
70 memcpy(&am(1, 1),
rm.Array(), (N1 * (N1 + 1)) / 2 *
sizeof(double));