```// @(#)root/mathcore:\$Id: Boost.h 22516 2008-03-07 15:14:26Z moneta \$
// Authors: W. Brown, M. Fischler, L. Moneta    2005

/**********************************************************************
*                                                                    *
* Copyright (c) 2005 ROOT FNAL MathLib Team                          *
*                                                                    *
*                                                                    *
**********************************************************************/

//
// Created by: Mark Fischler  Mon Nov 1  2005
//
// Last update: \$Id: Boost.h 22516 2008-03-07 15:14:26Z moneta \$
//
#ifndef ROOT_Math_GenVector_Boost
#define ROOT_Math_GenVector_Boost 1

#include "Math/GenVector/LorentzVector.h"
#include "Math/GenVector/PxPyPzE4D.h"
#include "Math/GenVector/DisplacementVector3D.h"
#include "Math/GenVector/Cartesian3D.h"

#include "Math/GenVector/BoostX.h"
#include "Math/GenVector/BoostY.h"
#include "Math/GenVector/BoostZ.h"

namespace ROOT {

namespace Math {

//__________________________________________________________________________________________
/**
Lorentz boost class with the (4D) transformation represented internally
by a 4x4 orthosymplectic matrix.
specialized Lorentz boosts.
Also, the 3-D rotation classes can be considered to be special Lorentz
transformations which do not mix space and time components.

@ingroup GenVector

*/

class Boost {

public:

typedef double Scalar;

enum ELorentzRotationMatrixIndex {
kLXX =  0, kLXY =  1, kLXZ =  2, kLXT =  3
, kLYX =  4, kLYY =  5, kLYZ =  6, kLYT =  7
, kLZX =  8, kLZY =  9, kLZZ = 10, kLZT = 11
, kLTX = 12, kLTY = 13, kLTZ = 14, kLTT = 15
};

enum EBoostMatrixIndex {
kXX =  0, kXY =  1, kXZ =  2, kXT =  3
, kYY =  4, kYZ =  5, kYT =  6
, kZZ =  7, kZT =  8
, kTT =  9
};

// ========== Constructors and Assignment =====================

/**
Default constructor (identity transformation)
*/
Boost() { SetIdentity(); }

/**
Construct given a three Scalars beta_x, beta_y, and beta_z
*/
Boost(Scalar beta_x, Scalar beta_y, Scalar beta_z)
{ SetComponents(beta_x, beta_y, beta_z); }

/**
Construct given a beta vector (which must have methods x(), y(), z())
*/
template <class Avector>
explicit
Boost(const Avector & beta) { SetComponents(beta); }

/**
Construct given a pair of pointers or iterators defining the
beginning and end of an array of three Scalars to use as beta_x, _y, and _z
*/
template<class IT>
Boost(IT begin, IT end) { SetComponents(begin,end); }

/**
Construct from an axial boost
*/

explicit Boost( BoostX const & bx ) {SetComponents(bx.BetaVector());}
explicit Boost( BoostY const & by ) {SetComponents(by.BetaVector());}
explicit Boost( BoostZ const & bz ) {SetComponents(bz.BetaVector());}

// The compiler-generated copy ctor, copy assignment, and dtor are OK.

/**
Assign from an axial pure boost
*/
Boost &
operator=( BoostX const & bx ) { return operator=(Boost(bx)); }
Boost &
operator=( BoostY const & by ) { return operator=(Boost(by)); }
Boost &
operator=( BoostZ const & bz ) { return operator=(Boost(bz)); }

/**
Re-adjust components to eliminate small deviations from a perfect
orthosyplectic matrix.
*/
void Rectify();

// ======== Components ==============

/**
Set components from beta_x, beta_y, and beta_z
*/
void
SetComponents (Scalar beta_x, Scalar beta_y, Scalar beta_z);

/**
Get components into beta_x, beta_y, and beta_z
*/
void
GetComponents (Scalar& beta_x, Scalar& beta_y, Scalar& beta_z) const;

/**
Set components from a beta vector
*/
template <class Avector>
void
SetComponents (const Avector & beta)
{ SetComponents(beta.x(), beta.y(), beta.z()); }

/**
Set given a pair of pointers or iterators defining the beginning and end of
an array of three Scalars to use as beta_x,beta _y, and beta_z
*/
template<class IT>
void SetComponents(IT begin, IT end) {
IT a = begin; IT b = ++begin; IT c = ++begin;
assert (++begin==end);
SetComponents (*a, *b, *c);
}

/**
Get given a pair of pointers or iterators defining the beginning and end of
an array of three Scalars into which to place beta_x, beta_y, and beta_z
*/
template<class IT>
void GetComponents(IT begin, IT end) const {
IT a = begin; IT b = ++begin; IT c = ++begin;
assert (++begin==end);
GetComponents (*a, *b, *c);
}

/**
Get given a pointer or an iterator defining the beginning of
an array into which to place beta_x, beta_y, and beta_z
*/
template<class IT>
void GetComponents(IT begin ) const {
double bx,by,bz = 0;
GetComponents (bx,by,bz);
*begin++ = bx;
*begin++ = by;
*begin = bz;
}

/**
The beta vector for this boost
*/
typedef  DisplacementVector3D<Cartesian3D<double>, DefaultCoordinateSystemTag > XYZVector;
XYZVector BetaVector() const;

/**
Get elements of internal 4x4 symmetric representation, into a data
array suitable for direct use as the components of a LorentzRotation
Note -- 16 Scalars will be written into the array; if the array is not
that large, then this will lead to undefined behavior.
*/
void
GetLorentzRotation (Scalar r[]) const;

// =========== operations ==============

/**
Lorentz transformation operation on a Minkowski ('Cartesian')
LorentzVector
*/
LorentzVector< ROOT::Math::PxPyPzE4D<double> >
operator() (const LorentzVector< ROOT::Math::PxPyPzE4D<double> > & v) const;

/**
Lorentz transformation operation on a LorentzVector in any
coordinate system
*/
template <class CoordSystem>
LorentzVector<CoordSystem>
operator() (const LorentzVector<CoordSystem> & v) const {
LorentzVector< PxPyPzE4D<double> > xyzt(v);
LorentzVector< PxPyPzE4D<double> > r_xyzt = operator()(xyzt);
return LorentzVector<CoordSystem> ( r_xyzt );
}

/**
Lorentz transformation operation on an arbitrary 4-vector v.
Preconditions:  v must implement methods x(), y(), z(), and t()
and the arbitrary vector type must have a constructor taking (x,y,z,t)
*/
template <class Foreign4Vector>
Foreign4Vector
operator() (const Foreign4Vector & v) const {
LorentzVector< PxPyPzE4D<double> > xyzt(v);
LorentzVector< PxPyPzE4D<double> > r_xyzt = operator()(xyzt);
return Foreign4Vector ( r_xyzt.X(), r_xyzt.Y(), r_xyzt.Z(), r_xyzt.T() );
}

/**
Overload operator * for boost on a vector
*/
template <class A4Vector>
inline
A4Vector operator* (const A4Vector & v) const
{
return operator()(v);
}

/**
Invert a Boost in place
*/
void Invert();

/**
Return inverse of  a boost
*/
Boost Inverse() const;

/**
Equality/inequality operators
*/
bool operator == (const Boost & rhs) const {
for (unsigned int i=0; i < 10; ++i) {
if( fM[i] != rhs.fM[i] )  return false;
}
return true;
}
bool operator != (const Boost & rhs) const {
return ! operator==(rhs);
}

protected:

void SetIdentity();

private:

Scalar fM[10];

};  // Boost

// ============ Class Boost ends here ============

/**
Stream Output and Input
*/
// TODO - I/O should be put in the manipulator form

std::ostream & operator<< (std::ostream & os, const Boost & b);

} //namespace Math
} //namespace ROOT

#endif /* ROOT_Math_GenVector_Boost  */
```
Boost.h:1
Boost.h:2
Boost.h:3
Boost.h:4
Boost.h:5
Boost.h:6
Boost.h:7
Boost.h:8
Boost.h:9
Boost.h:10
Boost.h:11
Boost.h:12
Boost.h:13
Boost.h:14
Boost.h:15
Boost.h:16
Boost.h:17
Boost.h:18
Boost.h:19
Boost.h:20
Boost.h:21
Boost.h:22
Boost.h:23
Boost.h:24
Boost.h:25
Boost.h:26
Boost.h:27
Boost.h:28
Boost.h:29
Boost.h:30
Boost.h:31
Boost.h:32
Boost.h:33
Boost.h:34
Boost.h:35
Boost.h:36
Boost.h:37
Boost.h:38
Boost.h:39
Boost.h:40
Boost.h:41
Boost.h:42
Boost.h:43
Boost.h:44
Boost.h:45
Boost.h:46
Boost.h:47
Boost.h:48
Boost.h:49
Boost.h:50
Boost.h:51
Boost.h:52
Boost.h:53
Boost.h:54
Boost.h:55
Boost.h:56
Boost.h:57
Boost.h:58
Boost.h:59
Boost.h:60
Boost.h:61
Boost.h:62
Boost.h:63
Boost.h:64
Boost.h:65
Boost.h:66
Boost.h:67
Boost.h:68
Boost.h:69
Boost.h:70
Boost.h:71
Boost.h:72
Boost.h:73
Boost.h:74
Boost.h:75
Boost.h:76
Boost.h:77
Boost.h:78
Boost.h:79
Boost.h:80
Boost.h:81
Boost.h:82
Boost.h:83
Boost.h:84
Boost.h:85
Boost.h:86
Boost.h:87
Boost.h:88
Boost.h:89
Boost.h:90
Boost.h:91
Boost.h:92
Boost.h:93
Boost.h:94
Boost.h:95
Boost.h:96
Boost.h:97
Boost.h:98
Boost.h:99
Boost.h:100
Boost.h:101
Boost.h:102
Boost.h:103
Boost.h:104
Boost.h:105
Boost.h:106
Boost.h:107
Boost.h:108
Boost.h:109
Boost.h:110
Boost.h:111
Boost.h:112
Boost.h:113
Boost.h:114
Boost.h:115
Boost.h:116
Boost.h:117
Boost.h:118
Boost.h:119
Boost.h:120
Boost.h:121
Boost.h:122
Boost.h:123
Boost.h:124
Boost.h:125
Boost.h:126
Boost.h:127
Boost.h:128
Boost.h:129
Boost.h:130
Boost.h:131
Boost.h:132
Boost.h:133
Boost.h:134
Boost.h:135
Boost.h:136
Boost.h:137
Boost.h:138
Boost.h:139
Boost.h:140
Boost.h:141
Boost.h:142
Boost.h:143
Boost.h:144
Boost.h:145
Boost.h:146
Boost.h:147
Boost.h:148
Boost.h:149
Boost.h:150
Boost.h:151
Boost.h:152
Boost.h:153
Boost.h:154
Boost.h:155
Boost.h:156
Boost.h:157
Boost.h:158
Boost.h:159
Boost.h:160
Boost.h:161
Boost.h:162
Boost.h:163
Boost.h:164
Boost.h:165
Boost.h:166
Boost.h:167
Boost.h:168
Boost.h:169
Boost.h:170
Boost.h:171
Boost.h:172
Boost.h:173
Boost.h:174
Boost.h:175
Boost.h:176
Boost.h:177
Boost.h:178
Boost.h:179
Boost.h:180
Boost.h:181
Boost.h:182
Boost.h:183
Boost.h:184
Boost.h:185
Boost.h:186
Boost.h:187
Boost.h:188
Boost.h:189
Boost.h:190
Boost.h:191
Boost.h:192
Boost.h:193
Boost.h:194
Boost.h:195
Boost.h:196
Boost.h:197
Boost.h:198
Boost.h:199
Boost.h:200
Boost.h:201
Boost.h:202
Boost.h:203
Boost.h:204
Boost.h:205
Boost.h:206
Boost.h:207
Boost.h:208
Boost.h:209
Boost.h:210
Boost.h:211
Boost.h:212
Boost.h:213
Boost.h:214
Boost.h:215
Boost.h:216
Boost.h:217
Boost.h:218
Boost.h:219
Boost.h:220
Boost.h:221
Boost.h:222
Boost.h:223
Boost.h:224
Boost.h:225
Boost.h:226
Boost.h:227
Boost.h:228
Boost.h:229
Boost.h:230
Boost.h:231
Boost.h:232
Boost.h:233
Boost.h:234
Boost.h:235
Boost.h:236
Boost.h:237
Boost.h:238
Boost.h:239
Boost.h:240
Boost.h:241
Boost.h:242
Boost.h:243
Boost.h:244
Boost.h:245
Boost.h:246
Boost.h:247
Boost.h:248
Boost.h:249
Boost.h:250
Boost.h:251
Boost.h:252
Boost.h:253
Boost.h:254
Boost.h:255
Boost.h:256
Boost.h:257
Boost.h:258
Boost.h:259
Boost.h:260
Boost.h:261
Boost.h:262
Boost.h:263
Boost.h:264
Boost.h:265
Boost.h:266
Boost.h:267
Boost.h:268
Boost.h:269
Boost.h:270
Boost.h:271
Boost.h:272
Boost.h:273
Boost.h:274
Boost.h:275
Boost.h:276
Boost.h:277
Boost.h:278
Boost.h:279
Boost.h:280
Boost.h:281
Boost.h:282
Boost.h:283
Boost.h:284
Boost.h:285
Boost.h:286
Boost.h:287