Page MenuHomeHEPForge

No OneTemporary

diff --git a/Vectors/SpinOneLorentzRotation.cc b/Vectors/SpinOneLorentzRotation.cc
--- a/Vectors/SpinOneLorentzRotation.cc
+++ b/Vectors/SpinOneLorentzRotation.cc
@@ -1,188 +1,188 @@
// -*- C++ -*-
//
// SpinOneLorentzRotation.cc is a part of ThePEG - Toolkit for HEP Event Generation
// Copyright (C) 1999-2017 Leif Lonnblad
//
// ThePEG is licenced under version 3 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
//
// This is the implementation of the non-inlined, non-templated member
// functions of the LorentzRotation class.
//
#include "SpinOneLorentzRotation.h"
using namespace ThePEG;
SpinOneLorentzRotation::
SpinOneLorentzRotation(double xx, double xy, double xz, double xt,
double yx, double yy, double yz, double yt,
double zx, double zy, double zz, double zt,
double tx, double ty, double tz, double tt)
- : matrix_(16) {
+{
xx_() = xx; xy_() = xy; xz_() = xz; xt_() = xt;
yx_() = yx; yy_() = yy; yz_() = yz; yt_() = yt;
zx_() = zx; zy_() = zy; zz_() = zz; zt_() = zt;
tx_() = tx; ty_() = ty; tz_() = tz; tt_() = tt;
}
bool SpinOneLorentzRotation::isIdentity() const {
return
1.0 == xx() && 0.0 == xy() && 0.0 == xz() && 0.0 == xt()
&& 0.0 == yx() && 1.0 == yy() && 0.0 == yz() && 0.0 == yt()
&& 0.0 == zx() && 0.0 == zy() && 1.0 == zz() && 0.0 == zt()
&& 0.0 == tx() && 0.0 == ty() && 0.0 == tz() && 1.0 == tt();
}
SpinOneLorentzRotation SpinOneLorentzRotation::inverse() const {
return SpinOneLorentzRotation( xx(), yx(), zx(),-tx(),
xy(), yy(), zy(),-ty(),
xz(), yz(), zz(),-tz(),
-xt(),-yt(),-zt(), tt());
}
// output operator
std::ostream & SpinOneLorentzRotation::print( std::ostream & os) const {
os << "\n [ ( " <<
std::setw(14) << std::setprecision(6) << xx() << " " <<
std::setw(14) << std::setprecision(6) << xy() << " " <<
std::setw(14) << std::setprecision(6) << xz() << " " <<
std::setw(14) << std::setprecision(6) << xt() << ")\n"
<< " ( " <<
std::setw(14) << std::setprecision(6) << yx() << " " <<
std::setw(14) << std::setprecision(6) << yy() << " " <<
std::setw(14) << std::setprecision(6) << yz() << " " <<
std::setw(14) << std::setprecision(6) << yt() << ")\n"
<< " ( " <<
std::setw(14) << std::setprecision(6) << zx() << " " <<
std::setw(14) << std::setprecision(6) << zy() << " " <<
std::setw(14) << std::setprecision(6) << zz() << " " <<
std::setw(14) << std::setprecision(6) << zt() << ")\n"
<< " ( " <<
std::setw(14) << std::setprecision(6) << tx() << " " <<
std::setw(14) << std::setprecision(6) << ty() << " " <<
std::setw(14) << std::setprecision(6) << tz() << " " <<
std::setw(14) << std::setprecision(6) << tt() << ") ]\n";
return os;
}
SpinOneLorentzRotation & SpinOneLorentzRotation::
setBoost (double bx, double by, double bz, double gamma) {
double beta2 = sqr(bx) + sqr(by) + sqr(bz);
if (beta2 >= 1.0) {
throw Exception() << "Invalid boost (" << bx << ',' << by << ',' << bz
<< ") in SpinOneLorentzRotatio::setBoost" << Exception::eventerror;
}
if(gamma<0.) gamma = 1.0 / sqrt((1.-bz)*(1.+bz)-sqr(bx)-sqr(by));
double bgamma = sqr(gamma) / (1.0 + gamma);
xx_() = 1.0 + bgamma * bx * bx;
yy_() = 1.0 + bgamma * by * by;
zz_() = 1.0 + bgamma * bz * bz;
xy_() = yx_() = bgamma * bx * by;
xz_() = zx_() = bgamma * bx * bz;
yz_() = zy_() = bgamma * by * bz;
xt_() = tx_() = gamma * bx;
yt_() = ty_() = gamma * by;
zt_() = tz_() = gamma * bz;
tt_() = gamma;
return *this;
}
SpinOneLorentzRotation &
SpinOneLorentzRotation::setRotate(double delta, const Axis & axis) {
double sinDelta = sin(delta), cosDelta = cos(delta);
double oneMinusCosDelta = 1.0 - cosDelta;
Axis u = unitVector(axis);
double uX = u.x();
double uY = u.y();
double uZ = u.z();
double rxx = oneMinusCosDelta * uX * uX + cosDelta;
double rxy = oneMinusCosDelta * uX * uY - sinDelta * uZ;
double rxz = oneMinusCosDelta * uX * uZ + sinDelta * uY;
double ryx = oneMinusCosDelta * uY * uX + sinDelta * uZ;
double ryy = oneMinusCosDelta * uY * uY + cosDelta;
double ryz = oneMinusCosDelta * uY * uZ - sinDelta * uX;
double rzx = oneMinusCosDelta * uZ * uX - sinDelta * uY;
double rzy = oneMinusCosDelta * uZ * uY + sinDelta * uX;
double rzz = oneMinusCosDelta * uZ * uZ + cosDelta;
xx_() = rxx; xy_() = rxy; xz_() = rxz; xt_() = 0.0;
yx_() = ryx; yy_() = ryy; yz_() = ryz; yt_() = 0.0;
zx_() = rzx; zy_() = rzy; zz_() = rzz; zt_() = 0.0;
tx_() = 0.0; ty_() = 0.0; tz_() = 0.0; tt_() = 1.0;
return *this;
}
SpinOneLorentzRotation &
SpinOneLorentzRotation::setRotateX(double delta) {
double sinDelta = sin(delta), cosDelta = cos(delta);
double ryy = cosDelta, ryz = -sinDelta;
double rzy = sinDelta, rzz = cosDelta;
xx_() = 1.0; xy_() = 0.0; xz_() = 0.0; xt_() = 0.0;
yx_() = 0.0; yy_() = ryy; yz_() = ryz; yt_() = 0.0;
zx_() = 0.0; zy_() = rzy; zz_() = rzz; zt_() = 0.0;
tx_() = 0.0; ty_() = 0.0; tz_() = 0.0; tt_() = 1.0;
return *this;
}
SpinOneLorentzRotation &
SpinOneLorentzRotation::setRotateY(double delta) {
double sinDelta = sin(delta), cosDelta = cos(delta);
double rxx = cosDelta, rxz = sinDelta;
double rzx = -sinDelta, rzz = cosDelta;
xx_() = rxx; xy_() = 0.0; xz_() = rxz; xt_() = 0.0;
yx_() = 0.0; yy_() = 1.0; yz_() = 0.0; yt_() = 0.0;
zx_() = rzx; zy_() = 0.0; zz_() = rzz; zt_() = 0.0;
tx_() = 0.0; ty_() = 0.0; tz_() = 0.0; tt_() = 1.0;
return *this;
}
SpinOneLorentzRotation &
SpinOneLorentzRotation::setRotateZ(double delta) {
double sinDelta = sin(delta), cosDelta = cos(delta);
double rxx = cosDelta, rxy = -sinDelta;
double ryx = sinDelta, ryy = cosDelta;
xx_() = rxx; xy_() = rxy; xz_() = 0.0; xt_() = 0.0;
yx_() = ryx; yy_() = ryy; yz_() = 0.0; yt_() = 0.0;
zx_() = 0.0; zy_() = 0.0; zz_() = 1.0; zt_() = 0.0;
tx_() = 0.0; ty_() = 0.0; tz_() = 0.0; tt_() = 1.0;
return *this;
}
SpinOneLorentzRotation
SpinOneLorentzRotation::operator*(const SpinOneLorentzRotation & b) const {
return SpinOneLorentzRotation
(xx()*b.xx() + xy()*b.yx() + xz()*b.zx() + xt()*b.tx(),
xx()*b.xy() + xy()*b.yy() + xz()*b.zy() + xt()*b.ty(),
xx()*b.xz() + xy()*b.yz() + xz()*b.zz() + xt()*b.tz(),
xx()*b.xt() + xy()*b.yt() + xz()*b.zt() + xt()*b.tt(),
yx()*b.xx() + yy()*b.yx() + yz()*b.zx() + yt()*b.tx(),
yx()*b.xy() + yy()*b.yy() + yz()*b.zy() + yt()*b.ty(),
yx()*b.xz() + yy()*b.yz() + yz()*b.zz() + yt()*b.tz(),
yx()*b.xt() + yy()*b.yt() + yz()*b.zt() + yt()*b.tt(),
zx()*b.xx() + zy()*b.yx() + zz()*b.zx() + zt()*b.tx(),
zx()*b.xy() + zy()*b.yy() + zz()*b.zy() + zt()*b.ty(),
zx()*b.xz() + zy()*b.yz() + zz()*b.zz() + zt()*b.tz(),
zx()*b.xt() + zy()*b.yt() + zz()*b.zt() + zt()*b.tt(),
tx()*b.xx() + ty()*b.yx() + tz()*b.zx() + tt()*b.tx(),
tx()*b.xy() + ty()*b.yy() + tz()*b.zy() + tt()*b.ty(),
tx()*b.xz() + ty()*b.yz() + tz()*b.zz() + tt()*b.tz(),
tx()*b.xt() + ty()*b.yt() + tz()*b.zt() + tt()*b.tt());
}
diff --git a/Vectors/SpinOneLorentzRotation.h b/Vectors/SpinOneLorentzRotation.h
--- a/Vectors/SpinOneLorentzRotation.h
+++ b/Vectors/SpinOneLorentzRotation.h
@@ -1,394 +1,394 @@
// -*- C++ -*-
//
// SpinOneLorentzRotation.h is a part of ThePEG - Toolkit for HEP Event Generation
// Copyright (C) 1999-2017 Leif Lonnblad
//
// ThePEG is licenced under version 3 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
#ifndef ThePEG_SpinOneLorentzRotation_H
#define ThePEG_SpinOneLorentzRotation_H
#include "ThePEG/Helicity/HelicityDefinitions.h"
#include "ThePEG/Helicity/LorentzTensor.fh"
#include "ThePEG/Helicity/LorentzRSSpinor.fh"
#include "ThePEG/Helicity/LorentzRSSpinorBar.fh"
#include "ThreeVector.h"
#include <vector>
namespace ThePEG {
/**
* The SpinOneLorentzRotation class is ... */
class SpinOneLorentzRotation {
public:
/** @name Constructors and destructor. */
//@{
/**
* Default constructor. Gives a unit matrix.
*/
- SpinOneLorentzRotation() : matrix_(16) {
+ SpinOneLorentzRotation() {
xx_() = yy_() = zz_() = tt_() = 1.0;
}
/**
* Constructor giving the components of a Lorentz boost.
* @param bx The x-component of the boost
* @param by The y-component of the boost
* @param bz The z-component of the boost
* @param gamma The \f$\gamma\f$ factor (optional)
*/
SpinOneLorentzRotation (double bx, double by, double bz, double gamma=-1.)
- : matrix_(16) {
+ {
setBoost(bx,by,bz,gamma);
}
/**
* Constructor giving the vector for a Lorentz boost.
* @param b The boost vector
* @param gamma The \f$\gamma\f$ factor (optional)
*/
explicit SpinOneLorentzRotation (const Boost & b, double gamma=-1.)
- : matrix_(16) {
+ {
setBoost(b.x(), b.y(), b.z(),gamma);
}
//@}
/**
* Returns true if the Identity matrix.
*/
bool isIdentity() const;
/**
* Return the inverse.
*/
SpinOneLorentzRotation inverse() const;
/**
* Inverts the SpinOneLorentzRotation matrix.
*/
SpinOneLorentzRotation & invert() { return *this = inverse(); }
/**
* output operator
*/
std::ostream & print( std::ostream & os ) const;
/** @name Set methods for speical cases of simple rotations and boosts */
//@{
/**
* Specify the components of a Lorentz Boost
* @param bx The x-component of the boost
* @param by The y-component of the boost
* @param bz The z-component of the boost
* @param gamma The \f$\gamma\f$ factor (optional)
*/
SpinOneLorentzRotation & setBoost (double bx, double by, double bz, double gamma=-1.);
/**
* Specify a Lorentz Boost as a vector
* @param b The boost vector
* @param gamma The \f$\gamma\f$ factor (optional)
*/
SpinOneLorentzRotation & setBoost (const Boost & b, double gamma=-1.) {
return setBoost(b.x(), b.y(), b.z(),gamma);
}
/**
* Specify a rotation about a general axis by the angle given.
* @param delta The angle
* @param axis The axis
*/
SpinOneLorentzRotation & setRotate(double delta, const Axis & axis);
/**
* Specify a rotation by the given angle about the x-axis
* @param angle The rotation angle
*/
SpinOneLorentzRotation & setRotateX (double angle);
/**
* Specify a rotation by the given angle about the y-axis
* @param angle The rotation angle
*/
SpinOneLorentzRotation & setRotateY (double angle);
/**
* Specify a rotation by the given angle about the z-axis
* @param angle The rotation angle
*/
SpinOneLorentzRotation & setRotateZ (double angle);
//@}
/** @name Access methods for the components of the spin-1 rotation */
//@{
/**
* The xx component
*/
double xx() const { return matrix_[ 0]; }
/**
* The xy component
*/
double xy() const { return matrix_[ 1]; }
/**
* The xz component
*/
double xz() const { return matrix_[ 2]; }
/**
* The xt component
*/
double xt() const { return matrix_[ 3]; }
/**
* The yx component
*/
double yx() const { return matrix_[ 4]; }
/**
* The yy component
*/
double yy() const { return matrix_[ 5]; }
/**
* The yz component
*/
double yz() const { return matrix_[ 6]; }
/**
* The yt component
*/
double yt() const { return matrix_[ 7]; }
/**
* The zx component
*/
double zx() const { return matrix_[ 8]; }
/**
* The zy component
*/
double zy() const { return matrix_[ 9]; }
/**
* The zz component
*/
double zz() const { return matrix_[10]; }
/**
* The zt component
*/
double zt() const { return matrix_[11]; }
/**
* The tx component
*/
double tx() const { return matrix_[12]; }
/**
* The ty component
*/
double ty() const { return matrix_[13]; }
/**
* The tz component
*/
double tz() const { return matrix_[14]; }
/**
* The tt component
*/
double tt() const { return matrix_[15]; }
//@}
/** @name Transformation and product members */
//@{
/**
* Product with a LorentzVector simply returns the rotated vector.
*/
template <typename Value>
LorentzVector<Value>
operator*(const LorentzVector<Value> & v) const {
return LorentzVector<Value>
(xx()*v.x() + xy()*v.y() + xz()*v.z() + xt()*v.t(),
yx()*v.x() + yy()*v.y() + yz()*v.z() + yt()*v.t(),
zx()*v.x() + zy()*v.y() + zz()*v.z() + zt()*v.t(),
tx()*v.x() + ty()*v.y() + tz()*v.z() + tt()*v.t());
}
/**
* Product with a Lorentz5Vector simply returns the rotated vector.
*/
template <typename Value>
Lorentz5Vector<Value>
operator*(const Lorentz5Vector<Value> & v) const {
return Lorentz5Vector<Value>
(xx()*v.x() + xy()*v.y() + xz()*v.z() + xt()*v.t(),
yx()*v.x() + yy()*v.y() + yz()*v.z() + yt()*v.t(),
zx()*v.x() + zy()*v.y() + zz()*v.z() + zt()*v.t(),
tx()*v.x() + ty()*v.y() + tz()*v.z() + tt()*v.t());
}
/**
* Product of two LorentzRotations (this) * lt - matrix multiplication
* @param lt The LorentzRotation we are multiplying
*/
SpinOneLorentzRotation operator * (const SpinOneLorentzRotation & lt) const;
/**
* Multiply by and assign a*=b becomes a= a*b
*/
SpinOneLorentzRotation & operator *= (const SpinOneLorentzRotation & lt) {
return *this = *this * lt;
}
/**
* Transform (similar to *= but a.transform(b) becomes a = b*a
*/
SpinOneLorentzRotation & transform (const SpinOneLorentzRotation & lt) {
return *this = lt * *this;
}
/**
* Rotation around the x-axis; equivalent to LT = RotationX(delta) * LT
*/
SpinOneLorentzRotation & rotateX(double delta) {
SpinOneLorentzRotation tmp;
tmp.setRotateX(delta);
return *this = tmp * *this;
}
/**
* Rotation around the y-axis; equivalent to LT = RotationY(delta) * LT
*/
SpinOneLorentzRotation & rotateY(double delta) {
SpinOneLorentzRotation tmp;
tmp.setRotateY(delta);
return *this = tmp * *this;
}
/**
* Rotation around the z-axis; equivalent to LT = RotationZ(delta) * LT
*/
SpinOneLorentzRotation & rotateZ(double delta) {
SpinOneLorentzRotation tmp;
tmp.setRotateZ(delta);
return *this = tmp * *this;
}
/**
* Rotation around specified vector - LT = Rotation(delta,axis)*LT
*/
SpinOneLorentzRotation & rotate(double delta, const Axis & axis) {
SpinOneLorentzRotation tmp;
tmp.setRotate(delta, axis);
return *this = tmp * *this;
}
/**
* Pure boost along the x-axis; equivalent to LT = BoostX(beta) * LT
*/
SpinOneLorentzRotation & boostX(double beta) {
return *this = SpinOneLorentzRotation(beta,0,0) * *this;
}
/**
* Pure boost along the y-axis; equivalent to LT = BoostX(beta) * LT
*/
SpinOneLorentzRotation & boostY(double beta) {
return *this = SpinOneLorentzRotation(0,beta,0) * *this;
}
/**
* Pure boost along the z-axis; equivalent to LT = BoostX(beta) * LT
*/
SpinOneLorentzRotation & boostZ(double beta) {
return *this = SpinOneLorentzRotation(0,0,beta) * *this;
}
/**
* boost equivalent to LT = Boost(bx,by,bz) * LT
* @param bx The x-component of the boost
* @param by The y-component of the boost
* @param bz The z-component of the boost
* @param gamma The \f$\gamma\f$ factor (optional)
*/
SpinOneLorentzRotation & boost(double bx, double by, double bz,
double gamma=-1.) {
return *this = SpinOneLorentzRotation(bx,by,bz,gamma) * *this;
}
/**
* boost equivalent to LT = Boost(bv) * LT
* @param b The boost vector
* @param gamma The \f$\gamma\f$ factor (optional)
*/
SpinOneLorentzRotation & boost(const Boost & b, double gamma=-1.) {
return *this = SpinOneLorentzRotation(b.x(),b.y(),b.z(),gamma) * *this;
}
//@}
private:
template<typename Value> friend class Helicity::LorentzTensor;
template<typename Value> friend class Helicity::LorentzRSSpinor;
template<typename Value> friend class Helicity::LorentzRSSpinorBar;
/// Matrix components, order: \f$(xx, xy, \ldots, tz, tt)\f$.
- vector<double> matrix_;
+ array<double,16> matrix_;
/// Constructor from doubles.
SpinOneLorentzRotation (double xx, double xy, double xz, double xt,
double yx, double yy, double yz, double yt,
double zx, double zy, double zz, double zt,
double tx, double ty, double tz, double tt);
/// Component access by index: x=0, t=3.
double operator()(unsigned int i, unsigned int j) const {
return matrix_[4*i + j];
}
/// @name Component access.
//@{
double & xx_() { return matrix_[ 0]; }
double & xy_() { return matrix_[ 1]; }
double & xz_() { return matrix_[ 2]; }
double & xt_() { return matrix_[ 3]; }
double & yx_() { return matrix_[ 4]; }
double & yy_() { return matrix_[ 5]; }
double & yz_() { return matrix_[ 6]; }
double & yt_() { return matrix_[ 7]; }
double & zx_() { return matrix_[ 8]; }
double & zy_() { return matrix_[ 9]; }
double & zz_() { return matrix_[10]; }
double & zt_() { return matrix_[11]; }
double & tx_() { return matrix_[12]; }
double & ty_() { return matrix_[13]; }
double & tz_() { return matrix_[14]; }
double & tt_() { return matrix_[15]; }
//@}
};
/**
* output operator
*/
inline std::ostream & operator<< ( std::ostream & os,
const SpinOneLorentzRotation& lt ) {
return lt.print(os);
}
}
#endif /* ThePEG_SpinOneLorentzRotation_H */

File Metadata

Mime Type
text/x-diff
Expires
Sat, May 3, 6:48 AM (1 d, 8 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4982262
Default Alt Text
(17 KB)

Event Timeline