/usr/include/root/Math/GenVector/Boost.h is in libroot-math-genvector-dev 5.34.30-0ubuntu8.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 | // @(#)root/mathcore:$Id$
// Authors: W. Brown, M. Fischler, L. Moneta 2005
/**********************************************************************
* *
* Copyright (c) 2005 ROOT FNAL MathLib Team *
* *
* *
**********************************************************************/
// Header file for Boost
//
// Created by: Mark Fischler Mon Nov 1 2005
//
// Last update: $Id$
//
#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.
See also BoostX, BoostY and BoostZ for classes representing
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); }
/**
copy constructor
*/
Boost(Boost const & b) {
*this = b;
}
/**
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.
/**
Assignment operator
*/
Boost &
operator=(Boost const & rhs ) {
for (unsigned int i=0; i < 10; ++i) {
fM[i] = rhs.fM[i];
}
return *this;
}
/**
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) {
(void)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 {
(void)end;
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 */
|