3 // ---------------------------------------------------------------------------
 
    5 // This file is a part of the CLHEP - a Class Library for High Energy Physics.
 
    7 // This is the definitions of the inline member functions of the
 
    8 // HepLorentzRotation class
 
   13 // ----------  Constructors and Assignment:
 
   15 inline HepLorentzRotation::HepLorentzRotation() :
 
   16     mxx(1.0), mxy(0.0), mxz(0.0), mxt(0.0),
 
   17     myx(0.0), myy(1.0), myz(0.0), myt(0.0),
 
   18     mzx(0.0), mzy(0.0), mzz(1.0), mzt(0.0),
 
   19     mtx(0.0), mty(0.0), mtz(0.0), mtt(1.0) {}
 
   21 inline HepLorentzRotation::HepLorentzRotation(const HepLorentzRotation & r) :
 
   22     mxx(r.mxx), mxy(r.mxy), mxz(r.mxz), mxt(r.mxt),
 
   23     myx(r.myx), myy(r.myy), myz(r.myz), myt(r.myt),
 
   24     mzx(r.mzx), mzy(r.mzy), mzz(r.mzz), mzt(r.mzt),
 
   25     mtx(r.mtx), mty(r.mty), mtz(r.mtz), mtt(r.mtt) {}
 
   27 inline HepLorentzRotation::HepLorentzRotation(const HepRotation & r) {
 
   30 inline HepLorentzRotation::HepLorentzRotation(const HepRotationX & r) {
 
   33 inline HepLorentzRotation::HepLorentzRotation(const HepRotationY & r) {
 
   36 inline HepLorentzRotation::HepLorentzRotation(const HepRotationZ & r) {
 
   40 inline HepLorentzRotation::HepLorentzRotation(const HepBoost & b) {
 
   43 inline HepLorentzRotation::HepLorentzRotation(const HepBoostX & b) {
 
   46 inline HepLorentzRotation::HepLorentzRotation(const HepBoostY & b) {
 
   49 inline HepLorentzRotation::HepLorentzRotation(const HepBoostZ & b) {
 
   53 inline HepLorentzRotation &
 
   54 HepLorentzRotation::operator = (const HepLorentzRotation & r) {
 
   55   mxx = r.mxx; mxy = r.mxy; mxz = r.mxz; mxt = r.mxt;
 
   56   myx = r.myx; myy = r.myy; myz = r.myz; myt = r.myt;
 
   57   mzx = r.mzx; mzy = r.mzy; mzz = r.mzz; mzt = r.mzt;
 
   58   mtx = r.mtx; mty = r.mty; mtz = r.mtz; mtt = r.mtt;
 
   62 inline HepLorentzRotation &
 
   63 HepLorentzRotation::operator = (const HepRotation & m1) {
 
   64   return set (m1.rep4x4());
 
   67 inline HepLorentzRotation &
 
   68 HepLorentzRotation::operator = (const HepBoost & m1) {
 
   69   return set (m1.rep4x4());
 
   72 HepLorentzRotation & HepLorentzRotation::set (const Hep3Vector & p) {
 
   73   return set (p.x(), p.y(), p.z());
 
   76 inline HepLorentzRotation & HepLorentzRotation::set (const HepRotation & r) {
 
   77   return set (r.rep4x4());
 
   79 inline HepLorentzRotation & HepLorentzRotation::set (const HepRotationX & r) {
 
   80   return set (r.rep4x4());
 
   82 inline HepLorentzRotation & HepLorentzRotation::set (const HepRotationY & r) {
 
   83   return set (r.rep4x4());
 
   85 inline HepLorentzRotation & HepLorentzRotation::set (const HepRotationZ & r) {
 
   86   return set (r.rep4x4());
 
   89 inline HepLorentzRotation & HepLorentzRotation::set (const HepBoost & bboost) {
 
   90   return set (bboost.rep4x4());
 
   92 inline HepLorentzRotation & HepLorentzRotation::set (const HepBoostX & bboost) {
 
   93   return set (bboost.rep4x4());
 
   95 inline HepLorentzRotation & HepLorentzRotation::set (const HepBoostY & bboost) {
 
   96   return set (bboost.rep4x4());
 
   98 inline HepLorentzRotation & HepLorentzRotation::set (const HepBoostZ & bboost) {
 
   99   return set (bboost.rep4x4());
 
  102 inline HepLorentzRotation::HepLorentzRotation(double bx,
 
  109 inline HepLorentzRotation::HepLorentzRotation(const Hep3Vector & p) 
 
  111   set(p.x(), p.y(), p.z());
 
  114 inline HepLorentzRotation::HepLorentzRotation(
 
  115            const HepBoost & B, const HepRotation & R)
 
  120 inline HepLorentzRotation::HepLorentzRotation( 
 
  121            const HepRotation & R, const HepBoost & B) 
 
  126 inline HepLorentzRotation & HepLorentzRotation::set( const HepRep4x4 & rep ) {
 
  127   mxx=rep.xx_;  mxy=rep.xy_;  mxz=rep.xz_;  mxt=rep.xt_;
 
  128   myx=rep.yx_;  myy=rep.yy_;  myz=rep.yz_;  myt=rep.yt_;
 
  129   mzx=rep.zx_;  mzy=rep.zy_;  mzz=rep.zz_;  mzt=rep.zt_;
 
  130   mtx=rep.tx_;  mty=rep.ty_;  mtz=rep.tz_;  mtt=rep.tt_;
 
  134 inline HepLorentzRotation ::HepLorentzRotation ( const HepRep4x4 & rep ) :
 
  135     mxx(rep.xx_), mxy(rep.xy_), mxz(rep.xz_), mxt(rep.xt_),
 
  136     myx(rep.yx_), myy(rep.yy_), myz(rep.yz_), myt(rep.yt_),
 
  137     mzx(rep.zx_), mzy(rep.zy_), mzz(rep.zz_), mzt(rep.zt_),
 
  138     mtx(rep.tx_), mty(rep.ty_), mtz(rep.tz_), mtt(rep.tt_) {}
 
  140 // - Protected methods
 
  142 inline HepLorentzRotation::HepLorentzRotation( 
 
  143   double rxx, double rxy, double rxz, double rxt,
 
  144   double ryx, double ryy, double ryz, double ryt,
 
  145   double rzx, double rzy, double rzz, double rzt,
 
  146   double rtx, double rty, double rtz, double rtt) : 
 
  147     mxx(rxx), mxy(rxy), mxz(rxz), mxt(rxt),
 
  148     myx(ryx), myy(ryy), myz(ryz), myt(ryt),
 
  149     mzx(rzx), mzy(rzy), mzz(rzz), mzt(rzt),
 
  150     mtx(rtx), mty(rty), mtz(rtz), mtt(rtt) {}
 
  152 inline void HepLorentzRotation::setBoost
 
  153                            (double bx, double by, double bz) {
 
  157 // ----------  Accessors:
 
  159 inline double HepLorentzRotation::xx() const { return mxx; }
 
  160 inline double HepLorentzRotation::xy() const { return mxy; }
 
  161 inline double HepLorentzRotation::xz() const { return mxz; }
 
  162 inline double HepLorentzRotation::xt() const { return mxt; }
 
  163 inline double HepLorentzRotation::yx() const { return myx; }
 
  164 inline double HepLorentzRotation::yy() const { return myy; }
 
  165 inline double HepLorentzRotation::yz() const { return myz; }
 
  166 inline double HepLorentzRotation::yt() const { return myt; }
 
  167 inline double HepLorentzRotation::zx() const { return mzx; }
 
  168 inline double HepLorentzRotation::zy() const { return mzy; }
 
  169 inline double HepLorentzRotation::zz() const { return mzz; }
 
  170 inline double HepLorentzRotation::zt() const { return mzt; }
 
  171 inline double HepLorentzRotation::tx() const { return mtx; }
 
  172 inline double HepLorentzRotation::ty() const { return mty; }
 
  173 inline double HepLorentzRotation::tz() const { return mtz; }
 
  174 inline double HepLorentzRotation::tt() const { return mtt; }
 
  176 inline HepLorentzVector HepLorentzRotation::col1() const {
 
  177   return HepLorentzVector ( mxx, myx, mzx, mtx );
 
  179 inline HepLorentzVector HepLorentzRotation::col2() const {
 
  180   return HepLorentzVector ( mxy, myy, mzy, mty );
 
  182 inline HepLorentzVector HepLorentzRotation::col3() const {
 
  183   return HepLorentzVector ( mxz, myz, mzz, mtz );
 
  185 inline HepLorentzVector HepLorentzRotation::col4() const {
 
  186   return HepLorentzVector ( mxt, myt, mzt, mtt );
 
  189 inline HepLorentzVector HepLorentzRotation::row1() const {
 
  190   return HepLorentzVector ( mxx, mxy, mxz, mxt );
 
  192 inline HepLorentzVector HepLorentzRotation::row2() const {
 
  193   return HepLorentzVector ( myx, myy, myz, myt );
 
  195 inline HepLorentzVector HepLorentzRotation::row3() const {
 
  196   return HepLorentzVector ( mzx, mzy, mzz, mzt );
 
  198 inline HepLorentzVector HepLorentzRotation::row4() const {
 
  199   return HepLorentzVector ( mtx, mty, mtz, mtt );
 
  202 inline HepRep4x4 HepLorentzRotation::rep4x4() const {
 
  203   return HepRep4x4( mxx, mxy, mxz, mxt, 
 
  206                     mtx, mty, mtz, mtt );
 
  210 // ------------  Subscripting:
 
  212 inline HepLorentzRotation::HepLorentzRotation_row::HepLorentzRotation_row
 
  213 (const HepLorentzRotation & r, int i) : rr(r), ii(i) {}
 
  216 HepLorentzRotation::HepLorentzRotation_row::operator [] (int jj) const {
 
  220 inline const HepLorentzRotation::HepLorentzRotation_row
 
  221 HepLorentzRotation::operator [] (int i) const {
 
  222   return HepLorentzRotation_row(*this, i);
 
  225 // ----------  Comparisons:
 
  228 HepLorentzRotation::operator == (const HepLorentzRotation & r) const {
 
  229   return (mxx == r.xx() && mxy == r.xy() && mxz == r.xz() && mxt == r.xt() && 
 
  230           myx == r.yx() && myy == r.yy() && myz == r.yz() && myt == r.yt() && 
 
  231           mzx == r.zx() && mzy == r.zy() && mzz == r.zz() && mzt == r.zt() && 
 
  232           mtx == r.tx() && mty == r.ty() && mtz == r.tz() && mtt == r.tt());
 
  236 HepLorentzRotation::operator != (const HepLorentzRotation & r) const {
 
  237   return ! operator==(r);
 
  241 HepLorentzRotation::operator < ( const HepLorentzRotation & r ) const
 
  242         { return compare(r)< 0; }
 
  244 HepLorentzRotation::operator <= ( const HepLorentzRotation & r ) const
 
  245         { return compare(r)<=0; }
 
  248 HepLorentzRotation::operator >= ( const HepLorentzRotation & r ) const
 
  249         { return compare(r)>=0; }
 
  251 HepLorentzRotation::operator > ( const HepLorentzRotation & r ) const
 
  252         { return compare(r)> 0; }
 
  254 inline bool HepLorentzRotation::isIdentity() const {
 
  255   return (mxx == 1.0 && mxy == 0.0 && mxz == 0.0 && mxt == 0.0 && 
 
  256           myx == 0.0 && myy == 1.0 && myz == 0.0 && myt == 0.0 && 
 
  257           mzx == 0.0 && mzy == 0.0 && mzz == 1.0 && mzt == 0.0 && 
 
  258           mtx == 0.0 && mty == 0.0 && mtz == 0.0 && mtt == 1.0);
 
  261 // ----------  Properties:
 
  263 // ---------- Application:
 
  265 inline HepLorentzVector
 
  266 HepLorentzRotation::vectorMultiplication(const HepLorentzVector & p) const {
 
  271   return HepLorentzVector(mxx*x + mxy*y + mxz*z + mxt*t,
 
  272                      myx*x + myy*y + myz*z + myt*t,
 
  273                      mzx*x + mzy*y + mzz*z + mzt*t,
 
  274                      mtx*x + mty*y + mtz*z + mtt*t);
 
  277 inline HepLorentzVector 
 
  278 HepLorentzRotation::operator() (const HepLorentzVector & w) const {
 
  279   return vectorMultiplication(w);
 
  282 inline HepLorentzVector
 
  283 HepLorentzRotation::operator * (const HepLorentzVector & p) const {
 
  284   return vectorMultiplication(p);
 
  287 // ---------- Operations in the group of 4-Rotations
 
  289 inline HepLorentzRotation 
 
  290 HepLorentzRotation::operator * (const HepBoost & b) const {
 
  291   return matrixMultiplication(b.rep4x4());
 
  293 inline HepLorentzRotation 
 
  294 HepLorentzRotation::operator * (const HepRotation & r) const {
 
  295   return matrixMultiplication(r.rep4x4());
 
  297 inline HepLorentzRotation 
 
  298 HepLorentzRotation::operator * (const HepLorentzRotation & lt) const {
 
  299   return matrixMultiplication(lt.rep4x4());
 
  302 inline HepLorentzRotation &
 
  303 HepLorentzRotation::operator *= (const HepBoost & b) {
 
  304   return *this = matrixMultiplication(b.rep4x4());
 
  306 inline HepLorentzRotation &
 
  307 HepLorentzRotation::operator *= (const HepRotation & r) {
 
  308   return *this = matrixMultiplication(r.rep4x4());
 
  310 inline HepLorentzRotation &
 
  311 HepLorentzRotation::operator *= (const HepLorentzRotation & lt) {
 
  312   return *this = matrixMultiplication(lt.rep4x4());
 
  315 inline HepLorentzRotation &
 
  316 HepLorentzRotation::transform   (const HepBoost & b) {
 
  317   return *this = HepLorentzRotation(b).matrixMultiplication(rep4x4());
 
  319 inline HepLorentzRotation &
 
  320 HepLorentzRotation::transform   (const HepRotation & r) {
 
  321   return *this = HepLorentzRotation(r).matrixMultiplication(rep4x4());
 
  323 inline HepLorentzRotation &
 
  324 HepLorentzRotation::transform   (const HepLorentzRotation & lt) {
 
  325   return *this = lt.matrixMultiplication(rep4x4());
 
  328 inline HepLorentzRotation &
 
  329 HepLorentzRotation::rotate(double angle, const Hep3Vector & axis) {
 
  330   return transform(HepRotation().rotate(angle, axis));
 
  333 inline HepLorentzRotation &
 
  334 HepLorentzRotation::rotate(double angle, const Hep3Vector * axis) {
 
  335   return transform(HepRotation().rotate(angle, axis));
 
  338 inline HepLorentzRotation &
 
  339 HepLorentzRotation::boost(double bx, double by, double bz) {
 
  340   return transform(HepLorentzRotation(bx, by, bz));
 
  343 inline HepLorentzRotation &
 
  344 HepLorentzRotation::boost(const Hep3Vector & b) {
 
  345   return transform(HepLorentzRotation(b));
 
  348 inline HepLorentzRotation HepLorentzRotation::inverse() const {
 
  349   return HepLorentzRotation( mxx,  myx,  mzx, -mtx,
 
  352                             -mxt, -myt, -mzt,  mtt );
 
  355 inline HepLorentzRotation & HepLorentzRotation::invert() {
 
  356   return *this = inverse();
 
  359 inline HepLorentzRotation inverseOf ( const HepLorentzRotation & lt ) {
 
  360   return HepLorentzRotation( 
 
  362                         lt.mxx,  lt.myx,  lt.mzx, -lt.mtx,
 
  363                              lt.mxy,  lt.myy,  lt.mzy, -lt.mty,
 
  364                              lt.mxz,  lt.myz,  lt.mzz, -lt.mtz,
 
  365                             -lt.mxt, -lt.myt, -lt.mzt,  lt.mtt )  );
 
  368 inline double HepLorentzRotation::getTolerance() { 
 
  369   return Hep4RotationInterface::tolerance;
 
  371 inline double HepLorentzRotation::setTolerance(double tol) { 
 
  372   return Hep4RotationInterface::setTolerance(tol);