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