LorentzRotation.icc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 // $Id:$
00003 // ---------------------------------------------------------------------------
00004 //
00005 // This file is a part of the CLHEP - a Class Library for High Energy Physics.
00006 // 
00007 // This is the definitions of the inline member functions of the
00008 // HepLorentzRotation class
00009 //
00010 
00011 namespace CLHEP {
00012 
00013 // ----------  Constructors and Assignment:
00014 
00015 inline HepLorentzRotation::HepLorentzRotation() :
00016     mxx(1.0), mxy(0.0), mxz(0.0), mxt(0.0),
00017     myx(0.0), myy(1.0), myz(0.0), myt(0.0),
00018     mzx(0.0), mzy(0.0), mzz(1.0), mzt(0.0),
00019     mtx(0.0), mty(0.0), mtz(0.0), mtt(1.0) {}
00020 
00021 inline HepLorentzRotation::HepLorentzRotation(const HepLorentzRotation & r) :
00022     mxx(r.mxx), mxy(r.mxy), mxz(r.mxz), mxt(r.mxt),
00023     myx(r.myx), myy(r.myy), myz(r.myz), myt(r.myt),
00024     mzx(r.mzx), mzy(r.mzy), mzz(r.mzz), mzt(r.mzt),
00025     mtx(r.mtx), mty(r.mty), mtz(r.mtz), mtt(r.mtt) {}
00026 
00027 inline HepLorentzRotation::HepLorentzRotation(const HepRotation & r) {
00028     set (r.rep4x4());
00029 }
00030 inline HepLorentzRotation::HepLorentzRotation(const HepRotationX & r) {
00031     set (r.rep4x4());
00032 }
00033 inline HepLorentzRotation::HepLorentzRotation(const HepRotationY & r) {
00034     set (r.rep4x4());
00035 }
00036 inline HepLorentzRotation::HepLorentzRotation(const HepRotationZ & r) {
00037     set (r.rep4x4());
00038 }
00039 
00040 inline HepLorentzRotation::HepLorentzRotation(const HepBoost & b) {
00041     set (b.rep4x4());
00042 }
00043 inline HepLorentzRotation::HepLorentzRotation(const HepBoostX & b) {
00044     set (b.rep4x4());
00045 }
00046 inline HepLorentzRotation::HepLorentzRotation(const HepBoostY & b) {
00047     set (b.rep4x4());
00048 }
00049 inline HepLorentzRotation::HepLorentzRotation(const HepBoostZ & b) {
00050     set (b.rep4x4());
00051 }
00052 
00053 inline HepLorentzRotation &
00054 HepLorentzRotation::operator = (const HepLorentzRotation & r) {
00055   mxx = r.mxx; mxy = r.mxy; mxz = r.mxz; mxt = r.mxt;
00056   myx = r.myx; myy = r.myy; myz = r.myz; myt = r.myt;
00057   mzx = r.mzx; mzy = r.mzy; mzz = r.mzz; mzt = r.mzt;
00058   mtx = r.mtx; mty = r.mty; mtz = r.mtz; mtt = r.mtt;
00059   return *this;
00060 }
00061 
00062 inline HepLorentzRotation &
00063 HepLorentzRotation::operator = (const HepRotation & m1) {
00064   return set (m1.rep4x4());
00065 }
00066 
00067 inline HepLorentzRotation &
00068 HepLorentzRotation::operator = (const HepBoost & m1) {
00069   return set (m1.rep4x4());
00070 }
00071 
00072 HepLorentzRotation & HepLorentzRotation::set (const Hep3Vector & p) {
00073   return set (p.x(), p.y(), p.z());
00074 }
00075 
00076 inline HepLorentzRotation & HepLorentzRotation::set (const HepRotation & r) {
00077   return set (r.rep4x4());
00078 }
00079 inline HepLorentzRotation & HepLorentzRotation::set (const HepRotationX & r) {
00080   return set (r.rep4x4());
00081 }
00082 inline HepLorentzRotation & HepLorentzRotation::set (const HepRotationY & r) {
00083   return set (r.rep4x4());
00084 }
00085 inline HepLorentzRotation & HepLorentzRotation::set (const HepRotationZ & r) {
00086   return set (r.rep4x4());
00087 }
00088 
00089 inline HepLorentzRotation & HepLorentzRotation::set (const HepBoost & bboost) {
00090   return set (bboost.rep4x4());
00091 }
00092 inline HepLorentzRotation & HepLorentzRotation::set (const HepBoostX & bboost) {
00093   return set (bboost.rep4x4());
00094 }
00095 inline HepLorentzRotation & HepLorentzRotation::set (const HepBoostY & bboost) {
00096   return set (bboost.rep4x4());
00097 }
00098 inline HepLorentzRotation & HepLorentzRotation::set (const HepBoostZ & bboost) {
00099   return set (bboost.rep4x4());
00100 }
00101 
00102 inline HepLorentzRotation::HepLorentzRotation(double bx,
00103                                               double by,
00104                                               double bz) 
00105 {
00106   set(bx, by, bz);
00107 }
00108 
00109 inline HepLorentzRotation::HepLorentzRotation(const Hep3Vector & p) 
00110 {
00111   set(p.x(), p.y(), p.z());
00112 }
00113 
00114 inline HepLorentzRotation::HepLorentzRotation(
00115                 const HepBoost & B, const HepRotation & R)
00116 {
00117   set(B, R);
00118 }
00119 
00120 inline HepLorentzRotation::HepLorentzRotation( 
00121                 const HepRotation & R, const HepBoost & B) 
00122 {
00123   set(R, B);
00124 }
00125 
00126 inline HepLorentzRotation & HepLorentzRotation::set( const HepRep4x4 & rep ) {
00127   mxx=rep.xx_;  mxy=rep.xy_;  mxz=rep.xz_;  mxt=rep.xt_;
00128   myx=rep.yx_;  myy=rep.yy_;  myz=rep.yz_;  myt=rep.yt_;
00129   mzx=rep.zx_;  mzy=rep.zy_;  mzz=rep.zz_;  mzt=rep.zt_;
00130   mtx=rep.tx_;  mty=rep.ty_;  mtz=rep.tz_;  mtt=rep.tt_;
00131   return *this;
00132 }
00133 
00134 inline HepLorentzRotation ::HepLorentzRotation ( const HepRep4x4 & rep ) :
00135     mxx(rep.xx_), mxy(rep.xy_), mxz(rep.xz_), mxt(rep.xt_),
00136     myx(rep.yx_), myy(rep.yy_), myz(rep.yz_), myt(rep.yt_),
00137     mzx(rep.zx_), mzy(rep.zy_), mzz(rep.zz_), mzt(rep.zt_),
00138     mtx(rep.tx_), mty(rep.ty_), mtz(rep.tz_), mtt(rep.tt_) {}
00139 
00140 // - Protected methods
00141 
00142 inline HepLorentzRotation::HepLorentzRotation( 
00143   double rxx, double rxy, double rxz, double rxt,
00144   double ryx, double ryy, double ryz, double ryt,
00145   double rzx, double rzy, double rzz, double rzt,
00146   double rtx, double rty, double rtz, double rtt) : 
00147     mxx(rxx), mxy(rxy), mxz(rxz), mxt(rxt),
00148     myx(ryx), myy(ryy), myz(ryz), myt(ryt),
00149     mzx(rzx), mzy(rzy), mzz(rzz), mzt(rzt),
00150     mtx(rtx), mty(rty), mtz(rtz), mtt(rtt) {}
00151 
00152 inline void HepLorentzRotation::setBoost
00153                                 (double bx, double by, double bz) {
00154   set(bx, by, bz);
00155 }
00156 
00157 // ----------  Accessors:
00158 
00159 inline double HepLorentzRotation::xx() const { return mxx; }
00160 inline double HepLorentzRotation::xy() const { return mxy; }
00161 inline double HepLorentzRotation::xz() const { return mxz; }
00162 inline double HepLorentzRotation::xt() const { return mxt; }
00163 inline double HepLorentzRotation::yx() const { return myx; }
00164 inline double HepLorentzRotation::yy() const { return myy; }
00165 inline double HepLorentzRotation::yz() const { return myz; }
00166 inline double HepLorentzRotation::yt() const { return myt; }
00167 inline double HepLorentzRotation::zx() const { return mzx; }
00168 inline double HepLorentzRotation::zy() const { return mzy; }
00169 inline double HepLorentzRotation::zz() const { return mzz; }
00170 inline double HepLorentzRotation::zt() const { return mzt; }
00171 inline double HepLorentzRotation::tx() const { return mtx; }
00172 inline double HepLorentzRotation::ty() const { return mty; }
00173 inline double HepLorentzRotation::tz() const { return mtz; }
00174 inline double HepLorentzRotation::tt() const { return mtt; }
00175 
00176 inline HepLorentzVector HepLorentzRotation::col1() const {
00177   return HepLorentzVector ( mxx, myx, mzx, mtx );
00178 }
00179 inline HepLorentzVector HepLorentzRotation::col2() const {
00180   return HepLorentzVector ( mxy, myy, mzy, mty );
00181 }
00182 inline HepLorentzVector HepLorentzRotation::col3() const {
00183   return HepLorentzVector ( mxz, myz, mzz, mtz );
00184 }
00185 inline HepLorentzVector HepLorentzRotation::col4() const {
00186   return HepLorentzVector ( mxt, myt, mzt, mtt );
00187 }
00188 
00189 inline HepLorentzVector HepLorentzRotation::row1() const {
00190   return HepLorentzVector ( mxx, mxy, mxz, mxt );
00191 }
00192 inline HepLorentzVector HepLorentzRotation::row2() const {
00193   return HepLorentzVector ( myx, myy, myz, myt );
00194 }
00195 inline HepLorentzVector HepLorentzRotation::row3() const {
00196   return HepLorentzVector ( mzx, mzy, mzz, mzt );
00197 }
00198 inline HepLorentzVector HepLorentzRotation::row4() const {
00199   return HepLorentzVector ( mtx, mty, mtz, mtt );
00200 }
00201 
00202 inline HepRep4x4 HepLorentzRotation::rep4x4() const {
00203   return HepRep4x4( mxx, mxy, mxz, mxt, 
00204                     myx, myy, myz, myt,
00205                     mzx, mzy, mzz, mzt,
00206                     mtx, mty, mtz, mtt );
00207 }
00208 
00209 
00210 // ------------  Subscripting:
00211 
00212 inline HepLorentzRotation::HepLorentzRotation_row::HepLorentzRotation_row
00213 (const HepLorentzRotation & r, int i) : rr(r), ii(i) {}
00214 
00215 inline double
00216 HepLorentzRotation::HepLorentzRotation_row::operator [] (int jj) const {
00217   return rr(ii,jj);
00218 }
00219 
00220 inline const HepLorentzRotation::HepLorentzRotation_row
00221 HepLorentzRotation::operator [] (int i) const {
00222   return HepLorentzRotation_row(*this, i);
00223 }
00224 
00225 // ----------  Comparisons:
00226 
00227 inline bool
00228 HepLorentzRotation::operator == (const HepLorentzRotation & r) const {
00229   return (mxx == r.xx() && mxy == r.xy() && mxz == r.xz() && mxt == r.xt() && 
00230           myx == r.yx() && myy == r.yy() && myz == r.yz() && myt == r.yt() && 
00231           mzx == r.zx() && mzy == r.zy() && mzz == r.zz() && mzt == r.zt() && 
00232           mtx == r.tx() && mty == r.ty() && mtz == r.tz() && mtt == r.tt());
00233 }
00234 
00235 inline bool
00236 HepLorentzRotation::operator != (const HepLorentzRotation & r) const {
00237   return ! operator==(r);
00238 }
00239 
00240 inline bool 
00241 HepLorentzRotation::operator < ( const HepLorentzRotation & r ) const
00242         { return compare(r)< 0; }
00243 inline bool 
00244 HepLorentzRotation::operator <= ( const HepLorentzRotation & r ) const
00245         { return compare(r)<=0; }
00246 
00247 inline bool 
00248 HepLorentzRotation::operator >= ( const HepLorentzRotation & r ) const
00249         { return compare(r)>=0; }
00250 inline bool 
00251 HepLorentzRotation::operator > ( const HepLorentzRotation & r ) const
00252         { return compare(r)> 0; }
00253 
00254 inline bool HepLorentzRotation::isIdentity() const {
00255   return (mxx == 1.0 && mxy == 0.0 && mxz == 0.0 && mxt == 0.0 && 
00256           myx == 0.0 && myy == 1.0 && myz == 0.0 && myt == 0.0 && 
00257           mzx == 0.0 && mzy == 0.0 && mzz == 1.0 && mzt == 0.0 && 
00258           mtx == 0.0 && mty == 0.0 && mtz == 0.0 && mtt == 1.0);
00259 }
00260 
00261 // ----------  Properties:
00262                              
00263 // ---------- Application:
00264 
00265 inline HepLorentzVector
00266 HepLorentzRotation::vectorMultiplication(const HepLorentzVector & p) const {
00267   register double x(p.x());
00268   register double y(p.y());
00269   register double z(p.z());
00270   register double t(p.t());
00271   return HepLorentzVector(mxx*x + mxy*y + mxz*z + mxt*t,
00272                           myx*x + myy*y + myz*z + myt*t,
00273                           mzx*x + mzy*y + mzz*z + mzt*t,
00274                           mtx*x + mty*y + mtz*z + mtt*t);
00275 }
00276 
00277 inline HepLorentzVector 
00278 HepLorentzRotation::operator() (const HepLorentzVector & w) const {
00279   return vectorMultiplication(w);
00280 }
00281 
00282 inline HepLorentzVector
00283 HepLorentzRotation::operator * (const HepLorentzVector & p) const {
00284   return vectorMultiplication(p);
00285 }
00286 
00287 // ---------- Operations in the group of 4-Rotations
00288 
00289 inline HepLorentzRotation 
00290 HepLorentzRotation::operator * (const HepBoost & b) const {
00291   return matrixMultiplication(b.rep4x4());
00292 }
00293 inline HepLorentzRotation 
00294 HepLorentzRotation::operator * (const HepRotation & r) const {
00295   return matrixMultiplication(r.rep4x4());
00296 }
00297 inline HepLorentzRotation 
00298 HepLorentzRotation::operator * (const HepLorentzRotation & lt) const {
00299   return matrixMultiplication(lt.rep4x4());
00300 }
00301  
00302 inline HepLorentzRotation &
00303 HepLorentzRotation::operator *= (const HepBoost & b) {
00304   return *this = matrixMultiplication(b.rep4x4());
00305 }
00306 inline HepLorentzRotation &
00307 HepLorentzRotation::operator *= (const HepRotation & r) {
00308   return *this = matrixMultiplication(r.rep4x4());
00309 }
00310 inline HepLorentzRotation &
00311 HepLorentzRotation::operator *= (const HepLorentzRotation & lt) {
00312   return *this = matrixMultiplication(lt.rep4x4());
00313 }
00314 
00315 inline HepLorentzRotation &
00316 HepLorentzRotation::transform   (const HepBoost & b) {
00317   return *this = HepLorentzRotation(b).matrixMultiplication(rep4x4());
00318 }
00319 inline HepLorentzRotation &
00320 HepLorentzRotation::transform   (const HepRotation & r) {
00321   return *this = HepLorentzRotation(r).matrixMultiplication(rep4x4());
00322 }
00323 inline HepLorentzRotation &
00324 HepLorentzRotation::transform   (const HepLorentzRotation & lt) {
00325   return *this = lt.matrixMultiplication(rep4x4());
00326 }
00327 
00328 inline HepLorentzRotation &
00329 HepLorentzRotation::rotate(double angle, const Hep3Vector & axis) {
00330   return transform(HepRotation().rotate(angle, axis));
00331 }
00332 
00333 inline HepLorentzRotation &
00334 HepLorentzRotation::rotate(double angle, const Hep3Vector * axis) {
00335   return transform(HepRotation().rotate(angle, axis));
00336 }
00337 
00338 inline HepLorentzRotation &
00339 HepLorentzRotation::boost(double bx, double by, double bz) {
00340   return transform(HepLorentzRotation(bx, by, bz));
00341 }
00342 
00343 inline HepLorentzRotation &
00344 HepLorentzRotation::boost(const Hep3Vector & b) {
00345   return transform(HepLorentzRotation(b));
00346 }
00347 
00348 inline HepLorentzRotation HepLorentzRotation::inverse() const {
00349   return HepLorentzRotation( mxx,  myx,  mzx, -mtx,
00350                              mxy,  myy,  mzy, -mty,
00351                              mxz,  myz,  mzz, -mtz,
00352                             -mxt, -myt, -mzt,  mtt );
00353 }
00354 
00355 inline HepLorentzRotation & HepLorentzRotation::invert() {
00356   return *this = inverse();
00357 }
00358 
00359 inline HepLorentzRotation inverseOf ( const HepLorentzRotation & lt ) {
00360   return HepLorentzRotation( 
00361          HepRep4x4(
00362                              lt.mxx,  lt.myx,  lt.mzx, -lt.mtx,
00363                              lt.mxy,  lt.myy,  lt.mzy, -lt.mty,
00364                              lt.mxz,  lt.myz,  lt.mzz, -lt.mtz,
00365                             -lt.mxt, -lt.myt, -lt.mzt,  lt.mtt )  );
00366 }
00367 
00368 inline double HepLorentzRotation::getTolerance() { 
00369   return Hep4RotationInterface::tolerance;
00370 }
00371 inline double HepLorentzRotation::setTolerance(double tol) { 
00372   return Hep4RotationInterface::setTolerance(tol);
00373 }
00374 
00375 }  // namespace CLHEP

Generated on Mon May 27 17:50:31 2013 for Geant4 by  doxygen 1.4.7