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(
const CLHEP::HepMatrix &
m) {
31 typedef typename ROOT::Math::MatRepStd<double,N1,N2> REP;
32 assert(m.num_row() == N1); assert(m.num_col() == N2);
33 return ROOT::Math::SMatrix<double,N1,N2,REP> (&
m(1,1), REP::kSize);
36 template<
unsigned int N1>
37 ROOT::Math::SMatrix<double,N1,N1, typename ROOT::Math::MatRepSym<double,N1> >
asSMatrix(
const CLHEP::HepSymMatrix &
m) {
38 typedef typename ROOT::Math::MatRepSym<double,N1> REP;
39 assert(m.num_row() == N1);
40 return ROOT::Math::SMatrix<double,N1,N1,REP> (&
m(1,1), REP::kSize);
43 template<
unsigned int N1>
44 ROOT::Math::SVector<double,N1>
asSVector(
const CLHEP::HepVector &
m) {
45 return ROOT::Math::SVector<double,N1> (&m[0], N1);
48 template<
unsigned int N> CLHEP::HepVector
asHepVector(
const ROOT::Math::SVector<double,N> &
v) {
49 CLHEP::HepVector
hv(
N);
50 memcpy(&hv[0], &v[0],
N*
sizeof(
double));
54 template<
unsigned int N1,
unsigned int N2> CLHEP::HepMatrix
asHepMatrix (
55 const ROOT::Math::SMatrix<
double,N1,N2,
typename ROOT::Math::MatRepStd<double,N1,N2> > &
rm) {
56 CLHEP::HepMatrix am(N1,N2);
57 memcpy(&am(1,1),
rm.Array(), N1*N2*
sizeof(double));
62 const ROOT::Math::SMatrix<
double,N1,N1,
typename ROOT::Math::MatRepSym<double,N1> > &
rm) {
63 CLHEP::HepSymMatrix am(N1);
64 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)