ECCE @ EIC Software
Reference for
ECCE @ EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
LorentzRotation.h
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file LorentzRotation.h
1
// -*- C++ -*-
2
// CLASSDOC OFF
3
// ---------------------------------------------------------------------------
4
// CLASSDOC ON
5
//
6
// This file is a part of the CLHEP - a Class Library for High Energy Physics.
7
//
8
// This is the definition of the HepLorentzRotation class for performing
9
// Lorentz transformations (rotations and boosts) on objects of the
10
// HepLorentzVector class.
11
//
12
// HepLorentzRotation is a concrete implementation of Hep4RotationInterface.
13
//
14
// .SS See Also
15
// RotationInterfaces.h
16
// ThreeVector.h, LorentzVector.h
17
// Rotation.h, Boost.h
18
//
19
// .SS Author
20
// Leif Lonnblad, Mark Fischler
21
22
#ifndef HEP_LORENTZROTATION_H
23
#define HEP_LORENTZROTATION_H
24
25
#ifdef GNUPRAGMA
26
#pragma interface
27
#endif
28
29
#include "
CLHEP/Vector/RotationInterfaces.h
"
30
#include "
CLHEP/Vector/Rotation.h
"
31
#include "
CLHEP/Vector/Boost.h
"
32
#include "
CLHEP/Vector/LorentzVector.h
"
33
34
namespace
CLHEP {
35
36
// Global methods
37
38
inline
HepLorentzRotation
inverseOf
(
const
HepLorentzRotation & lt );
39
HepLorentzRotation
operator *
(
const
HepRotation &
r
,
40
const
HepLorentzRotation & lt);
41
HepLorentzRotation
operator *
(
const
HepRotationX &
r
,
42
const
HepLorentzRotation & lt);
43
HepLorentzRotation
operator *
(
const
HepRotationY &
r
,
44
const
HepLorentzRotation & lt);
45
HepLorentzRotation
operator *
(
const
HepRotationZ &
r
,
46
const
HepLorentzRotation & lt);
47
52
class
HepLorentzRotation
{
53
54
public
:
55
// ---------- Identity HepLorentzRotation:
56
57
DLL_API
static
const
HepLorentzRotation
IDENTITY
;
58
59
// ---------- Constructors and Assignment:
60
61
inline
HepLorentzRotation
();
62
// Default constructor. Gives a unit matrix.
63
64
inline
HepLorentzRotation
(
const
HepLorentzRotation
&
r
);
65
inline
HepLorentzRotation
(
HepLorentzRotation
&&
r
) =
default
;
66
// Copy and move constructors.
67
68
inline
HepLorentzRotation
(
const
HepRotation
&
r
);
69
inline
explicit
HepLorentzRotation
(
const
HepRotationX
&
r
);
70
inline
explicit
HepLorentzRotation
(
const
HepRotationY
&
r
);
71
inline
explicit
HepLorentzRotation
(
const
HepRotationZ
&
r
);
72
inline
HepLorentzRotation
(
const
HepBoost
&
b
);
73
inline
explicit
HepLorentzRotation
(
const
HepBoostX
&
b
);
74
inline
explicit
HepLorentzRotation
(
const
HepBoostY
&
b
);
75
inline
explicit
HepLorentzRotation
(
const
HepBoostZ
&
b
);
76
// Constructors from special cases.
77
78
inline
HepLorentzRotation
&
operator =
(
HepLorentzRotation
&&
m
) =
default
;
79
inline
HepLorentzRotation
&
operator =
(
const
HepLorentzRotation
&
m
);
80
inline
HepLorentzRotation
&
operator =
(
const
HepRotation
&
m
);
81
inline
HepLorentzRotation
&
operator =
(
const
HepBoost
&
m
);
82
// Assignment.
83
84
HepLorentzRotation
&
set
(
double
bx,
double
by,
double
bz);
85
inline
HepLorentzRotation
&
set
(
const
Hep3Vector
&
p
);
86
inline
HepLorentzRotation
&
set
(
const
HepRotation
&
r
);
87
inline
HepLorentzRotation
&
set
(
const
HepRotationX
&
r
);
88
inline
HepLorentzRotation
&
set
(
const
HepRotationY
&
r
);
89
inline
HepLorentzRotation
&
set
(
const
HepRotationZ
&
r
);
90
inline
HepLorentzRotation
&
set
(
const
HepBoost
&
boost
);
91
inline
HepLorentzRotation
&
set
(
const
HepBoostX
&
boost
);
92
inline
HepLorentzRotation
&
set
(
const
HepBoostY
&
boost
);
93
inline
HepLorentzRotation
&
set
(
const
HepBoostZ
&
boost
);
94
inline
HepLorentzRotation
(
double
bx,
double
by,
double
bz);
95
inline
HepLorentzRotation
(
const
Hep3Vector
&
p
);
96
// Other Constructors giving a Lorentz-boost.
97
98
HepLorentzRotation
&
set
(
const
HepBoost
&
B
,
const
HepRotation
&
R
);
99
inline
HepLorentzRotation
(
const
HepBoost
&
B
,
const
HepRotation
&
R
);
100
// supply B and R: T = B R:
101
102
HepLorentzRotation
&
set
(
const
HepRotation
&
R
,
const
HepBoost
&
B
);
103
inline
HepLorentzRotation
(
const
HepRotation
&
R
,
const
HepBoost
&
B
);
104
// supply R and B: T = R B:
105
106
HepLorentzRotation
(
const
HepLorentzVector
&
col1
,
107
const
HepLorentzVector
&
col2
,
108
const
HepLorentzVector
&
col3
,
109
const
HepLorentzVector
&
col4
);
110
// Construct from four *orthosymplectic* LorentzVectors for the columns:
111
// NOTE:
112
// This constructor, and the two set methods below,
113
// will check that the columns (or rows) form an orthosymplectic
114
// matrix, and will adjust values so that this relation is
115
// as exact as possible.
116
// Orthosymplectic means the dot product USING THE METRIC
117
// of two different coumns will be 0, and of a column with
118
// itself will be one.
119
120
HepLorentzRotation
&
set
(
const
HepLorentzVector
&
col1
,
121
const
HepLorentzVector
&
col2
,
122
const
HepLorentzVector
&
col3
,
123
const
HepLorentzVector
&
col4
);
124
// supply four *orthosymplectic* HepLorentzVectors for the columns
125
126
HepLorentzRotation
&
setRows
(
const
HepLorentzVector
&
row1
,
127
const
HepLorentzVector
&
row2
,
128
const
HepLorentzVector
&
row3
,
129
const
HepLorentzVector
&
row4
);
130
// supply four *orthosymplectic* HepLorentzVectors for the columns
131
132
inline
HepLorentzRotation
&
set
(
const
HepRep4x4
& rep );
133
inline
HepLorentzRotation
(
const
HepRep4x4
& rep );
134
// supply a HepRep4x4 structure (16 numbers)
135
// WARNING:
136
// This constructor and set method will assume the
137
// HepRep4x4 supplied is in fact an orthosymplectic matrix.
138
// No checking or correction is done. If you are
139
// not certain the matrix is orthosymplectic, break it
140
// into four HepLorentzVector columns and use the form
141
// HepLorentzRotation (col1, col2, col3, col4)
142
143
// ---------- Accessors:
144
145
inline
double
xx
()
const
;
146
inline
double
xy
()
const
;
147
inline
double
xz
()
const
;
148
inline
double
xt
()
const
;
149
inline
double
yx
()
const
;
150
inline
double
yy
()
const
;
151
inline
double
yz
()
const
;
152
inline
double
yt
()
const
;
153
inline
double
zx
()
const
;
154
inline
double
zy
()
const
;
155
inline
double
zz
()
const
;
156
inline
double
zt
()
const
;
157
inline
double
tx
()
const
;
158
inline
double
ty
()
const
;
159
inline
double
tz
()
const
;
160
inline
double
tt
()
const
;
161
// Elements of the matrix.
162
163
inline
HepLorentzVector
col1
()
const
;
164
inline
HepLorentzVector
col2
()
const
;
165
inline
HepLorentzVector
col3
()
const
;
166
inline
HepLorentzVector
col4
()
const
;
167
// orthosymplectic column vectors
168
169
inline
HepLorentzVector
row1
()
const
;
170
inline
HepLorentzVector
row2
()
const
;
171
inline
HepLorentzVector
row3
()
const
;
172
inline
HepLorentzVector
row4
()
const
;
173
// orthosymplectic row vectors
174
175
inline
HepRep4x4
rep4x4
()
const
;
176
// 4x4 representation:
177
178
// ------------ Subscripting:
179
180
class
HepLorentzRotation_row
{
181
public
:
182
inline
HepLorentzRotation_row
(
const
HepLorentzRotation
&,
int
);
183
inline
double
operator []
(
int
)
const
;
184
private
:
185
const
HepLorentzRotation
&
rr
;
186
int
ii
;
187
};
188
// Helper class for implemention of C-style subscripting r[i][j]
189
190
inline
const
HepLorentzRotation_row
operator []
(
int
)
const
;
191
// Returns object of the helper class for C-style subscripting r[i][j]
192
193
double
operator ()
(
int
,
int
)
const
;
194
// Fortran-style subscripting: returns (i,j) element of the matrix.
195
196
// ---------- Decomposition:
197
198
void
decompose
(
Hep3Vector
&
boost
,
HepAxisAngle
& rotation)
const
;
199
void
decompose
(
HepBoost
&
boost
,
HepRotation
& rotation)
const
;
200
// Find B and R such that L = B*R
201
202
void
decompose
(
HepAxisAngle
& rotation,
Hep3Vector
&
boost
)
const
;
203
void
decompose
(
HepRotation
& rotation,
HepBoost
&
boost
)
const
;
204
// Find R and B such that L = R*B
205
206
// ---------- Comparisons:
207
208
int
compare
(
const
HepLorentzRotation
&
m
)
const
;
209
// Dictionary-order comparison, in order tt,tz,...zt,zz,zy,zx,yt,yz,...,xx
210
// Used in operator<, >, <=, >=
211
212
inline
bool
operator ==
(
const
HepLorentzRotation
&)
const
;
213
inline
bool
operator !=
(
const
HepLorentzRotation
&)
const
;
214
inline
bool
operator <=
(
const
HepLorentzRotation
&)
const
;
215
inline
bool
operator >=
(
const
HepLorentzRotation
&)
const
;
216
inline
bool
operator <
(
const
HepLorentzRotation
&)
const
;
217
inline
bool
operator >
(
const
HepLorentzRotation
&)
const
;
218
219
inline
bool
isIdentity
()
const
;
220
// Returns true if the Identity matrix.
221
222
double
distance2
(
const
HepBoost
&
b
)
const
;
223
double
distance2
(
const
HepRotation
&
r
)
const
;
224
double
distance2
(
const
HepLorentzRotation
& lt )
const
;
225
// Decomposes L = B*R, returns the sum of distance2 for B and R.
226
227
double
howNear
(
const
HepBoost
&
b
)
const
;
228
double
howNear
(
const
HepRotation
&
r
)
const
;
229
double
howNear
(
const
HepLorentzRotation
& lt )
const
;
230
231
bool
isNear
(
const
HepBoost
&
b
,
232
double
epsilon
=
Hep4RotationInterface::tolerance
)
const
;
233
bool
isNear
(
const
HepRotation
&
r
,
234
double
epsilon
=
Hep4RotationInterface::tolerance
)
const
;
235
bool
isNear
(
const
HepLorentzRotation
& lt,
236
double
epsilon
=
Hep4RotationInterface::tolerance
)
const
;
237
238
// ---------- Properties:
239
240
double
norm2
()
const
;
241
// distance2 (IDENTITY), which involves decomposing into B and R and summing
242
// norm2 for the individual B and R parts.
243
244
void
rectify
();
245
// non-const but logically moot correction for accumulated roundoff errors
246
// rectify averages the matrix with the orthotranspose of its actual
247
// inverse (absent accumulated roundoff errors, the orthotranspose IS
248
// the inverse)); this removes to first order those errors.
249
// Then it formally decomposes that, extracts axis and delta for its
250
// Rotation part, forms a LorentzRotation from a true HepRotation
251
// with those values of axis and delta, times the true Boost
252
// with that boost vector.
253
254
// ---------- Application:
255
256
inline
HepLorentzVector
vectorMultiplication
(
const
HepLorentzVector
&)
const
;
257
inline
HepLorentzVector
operator()
(
const
HepLorentzVector
&
w
)
const
;
258
inline
HepLorentzVector
operator*
(
const
HepLorentzVector
&
p
)
const
;
259
// Multiplication with a Lorentz Vector.
260
261
// ---------- Operations in the group of 4-Rotations
262
263
HepLorentzRotation
matrixMultiplication
(
const
HepRep4x4
&
m
)
const
;
264
265
inline
HepLorentzRotation
operator *
(
const
HepBoost
&
b
)
const
;
266
inline
HepLorentzRotation
operator *
(
const
HepRotation
&
r
)
const
;
267
inline
HepLorentzRotation
operator *
(
const
HepLorentzRotation
& lt)
const
;
268
// Product of two Lorentz Rotations (this) * lt - matrix multiplication
269
270
inline
HepLorentzRotation
&
operator *=
(
const
HepBoost
&
b
);
271
inline
HepLorentzRotation
&
operator *=
(
const
HepRotation
&
r
);
272
inline
HepLorentzRotation
&
operator *=
(
const
HepLorentzRotation
& lt);
273
inline
HepLorentzRotation
&
transform
(
const
HepBoost
&
b
);
274
inline
HepLorentzRotation
&
transform
(
const
HepRotation
&
r
);
275
inline
HepLorentzRotation
&
transform
(
const
HepLorentzRotation
& lt);
276
// Matrix multiplication.
277
// Note a *= b; <=> a = a * b; while a.transform(b); <=> a = b * a;
278
279
// Here there is an opportunity for speedup by providing specialized forms
280
// of lt * r and lt * b where r is a RotationX Y or Z or b is a BoostX Y or Z
281
// These are, in fact, provided below for the transform() methods.
282
283
HepLorentzRotation
&
rotateX
(
double
delta
);
284
// Rotation around the x-axis; equivalent to LT = RotationX(delta) * LT
285
286
HepLorentzRotation
&
rotateY
(
double
delta
);
287
// Rotation around the y-axis; equivalent to LT = RotationY(delta) * LT
288
289
HepLorentzRotation
&
rotateZ
(
double
delta
);
290
// Rotation around the z-axis; equivalent to LT = RotationZ(delta) * LT
291
292
inline
HepLorentzRotation
&
rotate
(
double
delta
,
const
Hep3Vector
& axis);
293
inline
HepLorentzRotation
&
rotate
(
double
delta
,
const
Hep3Vector
*axis);
294
// Rotation around specified vector - LT = Rotation(delta,axis)*LT
295
296
HepLorentzRotation
&
boostX
(
double
beta);
297
// Pure boost along the x-axis; equivalent to LT = BoostX(beta) * LT
298
299
HepLorentzRotation
&
boostY
(
double
beta);
300
// Pure boost along the y-axis; equivalent to LT = BoostX(beta) * LT
301
302
HepLorentzRotation
&
boostZ
(
double
beta);
303
// Pure boost along the z-axis; equivalent to LT = BoostX(beta) * LT
304
305
inline
HepLorentzRotation
&
boost
(
double
,
double
,
double
);
306
inline
HepLorentzRotation
&
boost
(
const
Hep3Vector
&);
307
// Lorenz boost.
308
309
inline
HepLorentzRotation
inverse
()
const
;
310
// Return the inverse.
311
312
inline
HepLorentzRotation
&
invert
();
313
// Inverts the LorentzRotation matrix.
314
315
// ---------- I/O:
316
317
std::ostream &
print
( std::ostream & os )
const
;
318
// Aligned six-digit-accurate output of the transformation matrix.
319
320
// ---------- Tolerance
321
322
static
inline
double
getTolerance
();
323
static
inline
double
setTolerance
(
double
tol);
324
325
friend
HepLorentzRotation
inverseOf
(
const
HepLorentzRotation
& lt );
326
327
protected
:
328
329
inline
HepLorentzRotation
330
(
double
mxx
,
double
mxy
,
double
mxz
,
double
mxt
,
331
double
myx
,
double
myy
,
double
myz
,
double
myt
,
332
double
mzx
,
double
mzy
,
double
mzz
,
double
mzt
,
333
double
mtx
,
double
mty
,
double
mtz
,
double
mtt
);
334
// Protected constructor.
335
// DOES NOT CHECK FOR VALIDITY AS A LORENTZ TRANSFORMATION.
336
337
inline
void
setBoost
(
double
,
double
,
double
);
338
// Set elements according to a boost vector.
339
340
double
mxx
,
mxy
,
mxz
,
mxt
,
341
myx
,
myy
,
myz
,
myt
,
342
mzx
,
mzy
,
mzz
,
mzt
,
343
mtx
,
mty
,
mtz
,
mtt
;
344
// The matrix elements.
345
346
};
// HepLorentzRotation
347
348
inline
std::ostream &
operator
<<
349
( std::ostream & os,
const
HepLorentzRotation
& lt )
350
{
return
lt.print(os);}
351
352
inline
bool
operator==
(
const
HepRotation
&
r
,
const
HepLorentzRotation
& lt)
353
{
return
lt==
r
; }
354
inline
bool
operator!=
(
const
HepRotation
&
r
,
const
HepLorentzRotation
& lt)
355
{
return
lt!=
r
; }
356
inline
bool
operator<=
(
const
HepRotation
&
r
,
const
HepLorentzRotation
& lt)
357
{
return
lt<=
r
; }
358
inline
bool
operator>=
(
const
HepRotation
&
r
,
const
HepLorentzRotation
& lt)
359
{
return
lt>=
r
; }
360
inline
bool
operator<
(
const
HepRotation
&
r
,
const
HepLorentzRotation
& lt)
361
{
return
lt<
r
; }
362
inline
bool
operator>
(
const
HepRotation
&
r
,
const
HepLorentzRotation
& lt)
363
{
return
lt>
r
; }
364
365
inline
bool
operator==
(
const
HepBoost
&
b
,
const
HepLorentzRotation
& lt)
366
{
return
lt==
b
; }
367
inline
bool
operator!=
(
const
HepBoost
&
b
,
const
HepLorentzRotation
& lt)
368
{
return
lt!=
b
; }
369
inline
bool
operator<=
(
const
HepBoost
&
b
,
const
HepLorentzRotation
& lt)
370
{
return
lt<=
b
; }
371
inline
bool
operator>=
(
const
HepBoost
&
b
,
const
HepLorentzRotation
& lt)
372
{
return
lt>=
b
; }
373
inline
bool
operator<
(
const
HepBoost
&
b
,
const
HepLorentzRotation
& lt)
374
{
return
lt<
b
; }
375
inline
bool
operator>
(
const
HepBoost
&
b
,
const
HepLorentzRotation
& lt)
376
{
return
lt>
b
; }
377
378
}
// namespace CLHEP
379
380
#include "CLHEP/Vector/LorentzRotation.icc"
381
382
#endif
/* HEP_LORENTZROTATION_H */
383
geant4
tree
geant4-10.6-release
source
externals
clhep
include
CLHEP
Vector
LorentzRotation.h
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:14
using
1.8.2 with
ECCE GitHub integration