TrackingTools
GsfTools
interface
GsfMatrixTools.h
Go to the documentation of this file.
1
#ifndef GsfMatrixTools_h_
2
#define GsfMatrixTools_h_
3
4
#define SMATRIX_USE_CONSTEXPR
5
6
#include "Math/SVector.h"
7
#include "Math/SMatrix.h"
8
9
namespace
GsfMatrixTools
{
10
11
// template <unsigned int N>
12
// double similarity (ROOT::Math::SMatrix<double, N, N, ROOT::Math::MatRepSym<double, N> >,
13
// ROOT::Math::SVector<double, N> vector) {
14
// return vector*matrix*vector;
15
// }
16
17
template
<
typename
T,
unsigned
int
N>
18
T
trace
(ROOT::Math::SMatrix<T, N, N>
const
&
matrix
) {
19
T
result
= 0;
20
for
(
unsigned
int
i
= 0;
i
<
N
; ++
i
)
21
result
+=
matrix
(
i
,
i
);
22
return
result
;
23
}
24
25
/* compute the trace of a product of two sym matrices
26
* a(i,j)*b(j,i) = a(i,j)*b(i,j) sum over i and j
27
*/
28
template
<
typename
T,
unsigned
int
N>
29
T
trace
(ROOT::Math::SMatrix<
T
,
N
,
N
, ROOT::Math::MatRepSym<T, N> >
const
&
a
,
30
ROOT::Math::SMatrix<
T
,
N
,
N
, ROOT::Math::MatRepSym<T, N> >
const
&
b
) {
31
auto
i1
=
a
.begin();
32
auto
e1
=
a
.end();
33
auto
i2
=
b
.begin();
34
35
T
res
= 0;
36
// sum of the lower triangle;
37
for
(;
i1
!=
e1
;
i1
++,
i2
++)
38
res
+= (*
i1
) * (*i2);
39
res
*=
T
(2.);
40
// remove the duplicated diagonal...
41
for
(
unsigned
int
i
= 0;
i
<
N
; ++
i
)
42
res
-=
a
(
i
,
i
) *
b
(
i
,
i
);
43
return
res
;
44
}
45
46
}
// namespace GsfMatrixTools
47
#endif
makeMuonMisalignmentScenario.matrix
list matrix
Definition:
makeMuonMisalignmentScenario.py:141
mps_fire.i
i
Definition:
mps_fire.py:428
mps_fire.result
result
Definition:
mps_fire.py:311
testProducerWithPsetDescEmpty_cfi.i2
i2
Definition:
testProducerWithPsetDescEmpty_cfi.py:46
GsfMatrixTools::trace
T trace(ROOT::Math::SMatrix< T, N, N > const &matrix)
Definition:
GsfMatrixTools.h:18
res
Definition:
Electron.h:6
N
#define N
Definition:
blowfish.cc:9
b
double b
Definition:
hdecay.h:118
StorageManager_cfg.e1
e1
Definition:
StorageManager_cfg.py:16
testProducerWithPsetDescEmpty_cfi.i1
i1
Definition:
testProducerWithPsetDescEmpty_cfi.py:45
a
double a
Definition:
hdecay.h:119
GsfMatrixTools
Definition:
GsfMatrixTools.h:9
T
long double T
Definition:
Basic3DVectorLD.h:48
Generated for CMSSW Reference Manual by
1.8.14