ROOT   Reference Guide
Loading...
Searching...
No Matches
Boost.h
Go to the documentation of this file.
1// @(#)root/mathcore:$Id$
2// Authors: W. Brown, M. Fischler, L. Moneta 2005
3
4 /**********************************************************************
5 * *
6 * Copyright (c) 2005 ROOT FNAL MathLib Team *
7 * *
8 * *
9 **********************************************************************/
10
11// Header file for Boost
12//
13// Created by: Mark Fischler Mon Nov 1 2005
14//
15// Last update: $Id$
16//
17#ifndef ROOT_Math_GenVector_Boost
18#define ROOT_Math_GenVector_Boost 1
19
24
28
29namespace ROOT {
30
31 namespace Math {
32
33//__________________________________________________________________________________________
34 /**
35 Lorentz boost class with the (4D) transformation represented internally
36 by a 4x4 orthosymplectic matrix.
37 See also BoostX, BoostY and BoostZ for classes representing
38 specialized Lorentz boosts.
39 Also, the 3-D rotation classes can be considered to be special Lorentz
40 transformations which do not mix space and time components.
41
42 @ingroup GenVector
43
44 @sa Overview of the @ref GenVector "physics vector library"
45 */
46
47class Boost {
48
49public:
50
51 typedef double Scalar;
52
54 kLXX = 0, kLXY = 1, kLXZ = 2, kLXT = 3
55 , kLYX = 4, kLYY = 5, kLYZ = 6, kLYT = 7
56 , kLZX = 8, kLZY = 9, kLZZ = 10, kLZT = 11
57 , kLTX = 12, kLTY = 13, kLTZ = 14, kLTT = 15
58 };
59
61 kXX = 0, kXY = 1, kXZ = 2, kXT = 3
62 , kYY = 4, kYZ = 5, kYT = 6
63 , kZZ = 7, kZT = 8
64 , kTT = 9
65 };
66
67 // ========== Constructors and Assignment =====================
68
69 /**
70 Default constructor (identity transformation)
71 */
73
74 /**
75 Construct given a three Scalars beta_x, beta_y, and beta_z
76 */
77 Boost(Scalar beta_x, Scalar beta_y, Scalar beta_z)
78 { SetComponents(beta_x, beta_y, beta_z); }
79
80 /**
81 Construct given a beta vector (which must have methods x(), y(), z())
82 */
83 template <class Avector>
84 explicit
85 Boost(const Avector & beta) { SetComponents(beta); }
86
87 /**
88 Construct given a pair of pointers or iterators defining the
89 beginning and end of an array of three Scalars to use as beta_x, _y, and _z
90 */
91 template<class IT>
92 Boost(IT begin, IT end) { SetComponents(begin,end); }
93
94 /**
95 copy constructor
96 */
97 Boost(Boost const & b) {
98 *this = b;
99 }
100
101 /**
102 Construct from an axial boost
103 */
104
105 explicit Boost( BoostX const & bx ) {SetComponents(bx.BetaVector());}
106 explicit Boost( BoostY const & by ) {SetComponents(by.BetaVector());}
107 explicit Boost( BoostZ const & bz ) {SetComponents(bz.BetaVector());}
108
109 // The compiler-generated copy ctor, copy assignment, and dtor are OK.
110
111 /**
112 Assignment operator
113 */
114 Boost &
115 operator=(Boost const & rhs ) {
116 for (unsigned int i=0; i < 10; ++i) {
117 fM[i] = rhs.fM[i];
118 }
119 return *this;
120 }
121
122 /**
123 Assign from an axial pure boost
124 */
125 Boost &
126 operator=( BoostX const & bx ) { return operator=(Boost(bx)); }
127 Boost &
128 operator=( BoostY const & by ) { return operator=(Boost(by)); }
129 Boost &
130 operator=( BoostZ const & bz ) { return operator=(Boost(bz)); }
131
132 /**
133 Re-adjust components to eliminate small deviations from a perfect
134 orthosyplectic matrix.
135 */
136 void Rectify();
137
138 // ======== Components ==============
139
140 /**
141 Set components from beta_x, beta_y, and beta_z
142 */
143 void
144 SetComponents (Scalar beta_x, Scalar beta_y, Scalar beta_z);
145
146 /**
147 Get components into beta_x, beta_y, and beta_z
148 */
149 void
150 GetComponents (Scalar& beta_x, Scalar& beta_y, Scalar& beta_z) const;
151
152 /**
153 Set components from a beta vector
154 */
155 template <class Avector>
156 void
157 SetComponents (const Avector & beta)
158 { SetComponents(beta.x(), beta.y(), beta.z()); }
159
160 /**
161 Set given a pair of pointers or iterators defining the beginning and end of
162 an array of three Scalars to use as beta_x,beta _y, and beta_z
163 */
164 template<class IT>
165 void SetComponents(IT begin, IT end) {
166 IT a = begin; IT b = ++begin; IT c = ++begin;
167 (void)end;
168 assert (++begin==end);
169 SetComponents (*a, *b, *c);
170 }
171
172 /**
173 Get given a pair of pointers or iterators defining the beginning and end of
174 an array of three Scalars into which to place beta_x, beta_y, and beta_z
175 */
176 template<class IT>
177 void GetComponents(IT begin, IT end) const {
178 IT a = begin; IT b = ++begin; IT c = ++begin;
179 (void)end;
180 assert (++begin==end);
181 GetComponents (*a, *b, *c);
182 }
183
184 /**
185 Get given a pointer or an iterator defining the beginning of
186 an array into which to place beta_x, beta_y, and beta_z
187 */
188 template<class IT>
189 void GetComponents(IT begin ) const {
190 double bx,by,bz = 0;
191 GetComponents (bx,by,bz);
192 *begin++ = bx;
193 *begin++ = by;
194 *begin = bz;
195 }
196
197 /**
198 The beta vector for this boost
199 */
201 XYZVector BetaVector() const;
202
203 /**
204 Get elements of internal 4x4 symmetric representation, into a data
205 array suitable for direct use as the components of a LorentzRotation
206 Note -- 16 Scalars will be written into the array; if the array is not
207 that large, then this will lead to undefined behavior.
208 */
209 void
210 GetLorentzRotation (Scalar r[]) const;
211
212 // =========== operations ==============
213
214 /**
215 Lorentz transformation operation on a Minkowski ('Cartesian')
216 LorentzVector
217 */
220
221 /**
222 Lorentz transformation operation on a LorentzVector in any
223 coordinate system
224 */
225 template <class CoordSystem>
230 return LorentzVector<CoordSystem> ( r_xyzt );
231 }
232
233 /**
234 Lorentz transformation operation on an arbitrary 4-vector v.
235 Preconditions: v must implement methods x(), y(), z(), and t()
236 and the arbitrary vector type must have a constructor taking (x,y,z,t)
237 */
238 template <class Foreign4Vector>
239 Foreign4Vector
240 operator() (const Foreign4Vector & v) const {
243 return Foreign4Vector ( r_xyzt.X(), r_xyzt.Y(), r_xyzt.Z(), r_xyzt.T() );
244 }
245
246 /**
247 Overload operator * for boost on a vector
248 */
249 template <class A4Vector>
250 inline
251 A4Vector operator* (const A4Vector & v) const
252 {
253 return operator()(v);
254 }
255
256 /**
257 Invert a Boost in place
258 */
259 void Invert();
260
261 /**
262 Return inverse of a boost
263 */
264 Boost Inverse() const;
265
266 /**
267 Equality/inequality operators
268 */
269 bool operator == (const Boost & rhs) const {
270 for (unsigned int i=0; i < 10; ++i) {
271 if( fM[i] != rhs.fM[i] ) return false;
272 }
273 return true;
274 }
275 bool operator != (const Boost & rhs) const {
276 return ! operator==(rhs);
277 }
278
279protected:
280
281 void SetIdentity();
282
283private:
284
286
287}; // Boost
288
289// ============ Class Boost ends here ============
290
291/**
292 Stream Output and Input
293 */
294 // TODO - I/O should be put in the manipulator form
295
296std::ostream & operator<< (std::ostream & os, const Boost & b);
297
298
299} //namespace Math
300} //namespace ROOT
301
302
303
304
305
306
307
308#endif /* ROOT_Math_GenVector_Boost */
#define b(i)
Definition RSha256.hxx:100
#define c(i)
Definition RSha256.hxx:101
#define a(i)
Definition RSha256.hxx:99
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Class representing a Lorentz Boost along the X axis, by beta.
Definition BoostX.h:39
XYZVector BetaVector() const
Definition BoostX.cxx:51
Class representing a Lorentz Boost along the Y axis, by beta.
Definition BoostY.h:39
XYZVector BetaVector() const
Definition BoostY.cxx:50
Class representing a Lorentz Boost along the Z axis, by beta.
Definition BoostZ.h:39
XYZVector BetaVector() const
Definition BoostZ.cxx:50
Lorentz boost class with the (4D) transformation represented internally by a 4x4 orthosymplectic matr...
Definition Boost.h:47
void SetComponents(const Avector &beta)
Set components from a beta vector.
Definition Boost.h:157
double Scalar
Definition Boost.h:51
void GetLorentzRotation(Scalar r[]) const
Get elements of internal 4x4 symmetric representation, into a data array suitable for direct use as t...
Definition Boost.cxx:115
DisplacementVector3D< Cartesian3D< double >, DefaultCoordinateSystemTag > XYZVector
The beta vector for this boost.
Definition Boost.h:200
void Invert()
Invert a Boost in place.
Definition Boost.cxx:156
Scalar fM[10]
Definition Boost.h:285
Boost(Scalar beta_x, Scalar beta_y, Scalar beta_z)
Construct given a three Scalars beta_x, beta_y, and beta_z.
Definition Boost.h:77
bool operator!=(const Boost &rhs) const
Definition Boost.h:275
Boost(BoostX const &bx)
Construct from an axial boost.
Definition Boost.h:105
Boost(Boost const &b)
copy constructor
Definition Boost.h:97
void SetComponents(IT begin, IT end)
Set given a pair of pointers or iterators defining the beginning and end of an array of three Scalars...
Definition Boost.h:165
Boost()
Default constructor (identity transformation)
Definition Boost.h:72
A4Vector operator*(const A4Vector &v) const
Overload operator * for boost on a vector.
Definition Boost.h:251
Boost(BoostZ const &bz)
Definition Boost.h:107
Boost & operator=(BoostY const &by)
Definition Boost.h:128
Boost & operator=(BoostZ const &bz)
Definition Boost.h:130
Boost(const Avector &beta)
Construct given a beta vector (which must have methods x(), y(), z())
Definition Boost.h:85
void SetComponents(Scalar beta_x, Scalar beta_y, Scalar beta_z)
Set components from beta_x, beta_y, and beta_z.
Definition Boost.cxx:76
ELorentzRotationMatrixIndex
Definition Boost.h:53
bool operator==(const Boost &rhs) const
Equality/inequality operators.
Definition Boost.h:269
void SetIdentity()
Definition Boost.cxx:67
Boost Inverse() const
Return inverse of a boost.
Definition Boost.cxx:163
LorentzVector< ROOT::Math::PxPyPzE4D< double > > operator()(const LorentzVector< ROOT::Math::PxPyPzE4D< double > > &v) const
Lorentz transformation operation on a Minkowski ('Cartesian') LorentzVector.
Definition Boost.cxx:143
void Rectify()
Re-adjust components to eliminate small deviations from a perfect orthosyplectic matrix.
Definition Boost.cxx:123
Boost & operator=(BoostX const &bx)
Assign from an axial pure boost.
Definition Boost.h:126
void GetComponents(Scalar &beta_x, Scalar &beta_y, Scalar &beta_z) const
Get components into beta_x, beta_y, and beta_z.
Definition Boost.cxx:99
Boost & operator=(Boost const &rhs)
Assignment operator.
Definition Boost.h:115
void GetComponents(IT begin) const
Get given a pointer or an iterator defining the beginning of an array into which to place beta_x,...
Definition Boost.h:189
void GetComponents(IT begin, IT end) const
Get given a pair of pointers or iterators defining the beginning and end of an array of three Scalars...
Definition Boost.h:177
Boost(IT begin, IT end)
Construct given a pair of pointers or iterators defining the beginning and end of an array of three S...
Definition Boost.h:92
XYZVector BetaVector() const
Definition Boost.cxx:108
Boost(BoostY const &by)
Definition Boost.h:106
DefaultCoordinateSystemTag Default tag for identifying any coordinate system.
Class describing a generic displacement vector in 3 dimensions.
Class describing a generic LorentzVector in the 4D space-time, using the specified coordinate system ...
Class describing a 4D cartesian coordinate system (x, y, z, t coordinates) or momentum-energy vectors...
Definition PxPyPzE4D.h:44
double beta(double x, double y)
Calculates the beta function.
Namespace for new Math classes and functions.
Rotation3D::Scalar Scalar
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...