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" 30 template <
unsigned int N1,
unsigned int N2>
31 ROOT::Math::SMatrix<double, N1, N2, typename ROOT::Math::MatRepStd<double, N1, N2> >
asSMatrix(
32 const CLHEP::HepMatrix &
m) {
33 typedef typename ROOT::Math::MatRepStd<double, N1, N2> REP;
36 return ROOT::Math::SMatrix<double, N1, N2, REP>(&
m(1, 1), REP::kSize);
39 template <
unsigned int N1>
40 ROOT::Math::SMatrix<double, N1, N1, typename ROOT::Math::MatRepSym<double, N1> >
asSMatrix(
41 const CLHEP::HepSymMatrix &
m) {
42 typedef typename ROOT::Math::MatRepSym<double, N1> REP;
44 return ROOT::Math::SMatrix<double, N1, N1, REP>(&
m(1, 1), REP::kSize);
47 template <
unsigned int N1>
48 ROOT::Math::SVector<double, N1>
asSVector(
const CLHEP::HepVector &
m) {
49 return ROOT::Math::SVector<double, N1>(&
m[0], N1);
52 template <
unsigned int N>
53 CLHEP::HepVector
asHepVector(
const ROOT::Math::SVector<double, N> &
v) {
54 CLHEP::HepVector hv(
N);
55 memcpy(&hv[0], &
v[0],
N *
sizeof(
double));
59 template <
unsigned int N1,
unsigned int N2>
61 const ROOT::Math::SMatrix<
double, N1, N2,
typename ROOT::Math::MatRepStd<double, N1, N2> > &
rm) {
62 CLHEP::HepMatrix am(N1, N2);
63 memcpy(&am(1, 1),
rm.Array(), N1 * N2 *
sizeof(double));
67 template <
unsigned int N1>
69 const ROOT::Math::SMatrix<
double, N1, N1,
typename ROOT::Math::MatRepSym<double, N1> > &
rm) {
70 CLHEP::HepSymMatrix am(N1);
71 memcpy(&am(1, 1),
rm.Array(), (N1 * (N1 + 1)) / 2 *
sizeof(double));
CLHEP::HepMatrix asHepMatrix(const ROOT::Math::SMatrix< double, N1, N2, typename ROOT::Math::MatRepStd< double, N1, N2 > > &rm)
ROOT::Math::SVector< double, N1 > asSVector(const CLHEP::HepVector &m)
ROOT::Math::SMatrix< double, N1, N2, typename ROOT::Math::MatRepStd< double, N1, N2 > > asSMatrix(const CLHEP::HepMatrix &m)
CLHEP::HepVector asHepVector(const ROOT::Math::SVector< double, N > &v)