File indexing completed on 2025-01-18 09:54:40
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 namespace CLHEP {
0012
0013
0014
0015 inline HepLorentzRotation::HepLorentzRotation() :
0016 mxx(1.0), mxy(0.0), mxz(0.0), mxt(0.0),
0017 myx(0.0), myy(1.0), myz(0.0), myt(0.0),
0018 mzx(0.0), mzy(0.0), mzz(1.0), mzt(0.0),
0019 mtx(0.0), mty(0.0), mtz(0.0), mtt(1.0) {}
0020
0021 inline HepLorentzRotation::HepLorentzRotation(const HepLorentzRotation & r) :
0022 mxx(r.mxx), mxy(r.mxy), mxz(r.mxz), mxt(r.mxt),
0023 myx(r.myx), myy(r.myy), myz(r.myz), myt(r.myt),
0024 mzx(r.mzx), mzy(r.mzy), mzz(r.mzz), mzt(r.mzt),
0025 mtx(r.mtx), mty(r.mty), mtz(r.mtz), mtt(r.mtt) {}
0026
0027 inline HepLorentzRotation::HepLorentzRotation(const HepRotation & r) {
0028 set (r.rep4x4());
0029 }
0030 inline HepLorentzRotation::HepLorentzRotation(const HepRotationX & r) {
0031 set (r.rep4x4());
0032 }
0033 inline HepLorentzRotation::HepLorentzRotation(const HepRotationY & r) {
0034 set (r.rep4x4());
0035 }
0036 inline HepLorentzRotation::HepLorentzRotation(const HepRotationZ & r) {
0037 set (r.rep4x4());
0038 }
0039
0040 inline HepLorentzRotation::HepLorentzRotation(const HepBoost & b) {
0041 set (b.rep4x4());
0042 }
0043 inline HepLorentzRotation::HepLorentzRotation(const HepBoostX & b) {
0044 set (b.rep4x4());
0045 }
0046 inline HepLorentzRotation::HepLorentzRotation(const HepBoostY & b) {
0047 set (b.rep4x4());
0048 }
0049 inline HepLorentzRotation::HepLorentzRotation(const HepBoostZ & b) {
0050 set (b.rep4x4());
0051 }
0052
0053 inline HepLorentzRotation &
0054 HepLorentzRotation::operator = (const HepLorentzRotation & r) {
0055 mxx = r.mxx; mxy = r.mxy; mxz = r.mxz; mxt = r.mxt;
0056 myx = r.myx; myy = r.myy; myz = r.myz; myt = r.myt;
0057 mzx = r.mzx; mzy = r.mzy; mzz = r.mzz; mzt = r.mzt;
0058 mtx = r.mtx; mty = r.mty; mtz = r.mtz; mtt = r.mtt;
0059 return *this;
0060 }
0061
0062 inline HepLorentzRotation &
0063 HepLorentzRotation::operator = (const HepRotation & m1) {
0064 return set (m1.rep4x4());
0065 }
0066
0067 inline HepLorentzRotation &
0068 HepLorentzRotation::operator = (const HepBoost & m1) {
0069 return set (m1.rep4x4());
0070 }
0071
0072 HepLorentzRotation & HepLorentzRotation::set (const Hep3Vector & p) {
0073 return set (p.x(), p.y(), p.z());
0074 }
0075
0076 inline HepLorentzRotation & HepLorentzRotation::set (const HepRotation & r) {
0077 return set (r.rep4x4());
0078 }
0079 inline HepLorentzRotation & HepLorentzRotation::set (const HepRotationX & r) {
0080 return set (r.rep4x4());
0081 }
0082 inline HepLorentzRotation & HepLorentzRotation::set (const HepRotationY & r) {
0083 return set (r.rep4x4());
0084 }
0085 inline HepLorentzRotation & HepLorentzRotation::set (const HepRotationZ & r) {
0086 return set (r.rep4x4());
0087 }
0088
0089 inline HepLorentzRotation & HepLorentzRotation::set (const HepBoost & bboost) {
0090 return set (bboost.rep4x4());
0091 }
0092 inline HepLorentzRotation & HepLorentzRotation::set (const HepBoostX & bboost) {
0093 return set (bboost.rep4x4());
0094 }
0095 inline HepLorentzRotation & HepLorentzRotation::set (const HepBoostY & bboost) {
0096 return set (bboost.rep4x4());
0097 }
0098 inline HepLorentzRotation & HepLorentzRotation::set (const HepBoostZ & bboost) {
0099 return set (bboost.rep4x4());
0100 }
0101
0102 inline HepLorentzRotation::HepLorentzRotation(double bx,
0103 double by,
0104 double bz)
0105 {
0106 set(bx, by, bz);
0107 }
0108
0109 inline HepLorentzRotation::HepLorentzRotation(const Hep3Vector & p)
0110 {
0111 set(p.x(), p.y(), p.z());
0112 }
0113
0114 inline HepLorentzRotation::HepLorentzRotation(
0115 const HepBoost & B, const HepRotation & R)
0116 {
0117 set(B, R);
0118 }
0119
0120 inline HepLorentzRotation::HepLorentzRotation(
0121 const HepRotation & R, const HepBoost & B)
0122 {
0123 set(R, B);
0124 }
0125
0126 inline HepLorentzRotation & HepLorentzRotation::set( const HepRep4x4 & rep ) {
0127 mxx=rep.xx_; mxy=rep.xy_; mxz=rep.xz_; mxt=rep.xt_;
0128 myx=rep.yx_; myy=rep.yy_; myz=rep.yz_; myt=rep.yt_;
0129 mzx=rep.zx_; mzy=rep.zy_; mzz=rep.zz_; mzt=rep.zt_;
0130 mtx=rep.tx_; mty=rep.ty_; mtz=rep.tz_; mtt=rep.tt_;
0131 return *this;
0132 }
0133
0134 inline HepLorentzRotation ::HepLorentzRotation ( const HepRep4x4 & rep ) :
0135 mxx(rep.xx_), mxy(rep.xy_), mxz(rep.xz_), mxt(rep.xt_),
0136 myx(rep.yx_), myy(rep.yy_), myz(rep.yz_), myt(rep.yt_),
0137 mzx(rep.zx_), mzy(rep.zy_), mzz(rep.zz_), mzt(rep.zt_),
0138 mtx(rep.tx_), mty(rep.ty_), mtz(rep.tz_), mtt(rep.tt_) {}
0139
0140
0141
0142 inline HepLorentzRotation::HepLorentzRotation(
0143 double rxx, double rxy, double rxz, double rxt,
0144 double ryx, double ryy, double ryz, double ryt,
0145 double rzx, double rzy, double rzz, double rzt,
0146 double rtx, double rty, double rtz, double rtt) :
0147 mxx(rxx), mxy(rxy), mxz(rxz), mxt(rxt),
0148 myx(ryx), myy(ryy), myz(ryz), myt(ryt),
0149 mzx(rzx), mzy(rzy), mzz(rzz), mzt(rzt),
0150 mtx(rtx), mty(rty), mtz(rtz), mtt(rtt) {}
0151
0152 inline void HepLorentzRotation::setBoost
0153 (double bx, double by, double bz) {
0154 set(bx, by, bz);
0155 }
0156
0157
0158
0159 inline double HepLorentzRotation::xx() const { return mxx; }
0160 inline double HepLorentzRotation::xy() const { return mxy; }
0161 inline double HepLorentzRotation::xz() const { return mxz; }
0162 inline double HepLorentzRotation::xt() const { return mxt; }
0163 inline double HepLorentzRotation::yx() const { return myx; }
0164 inline double HepLorentzRotation::yy() const { return myy; }
0165 inline double HepLorentzRotation::yz() const { return myz; }
0166 inline double HepLorentzRotation::yt() const { return myt; }
0167 inline double HepLorentzRotation::zx() const { return mzx; }
0168 inline double HepLorentzRotation::zy() const { return mzy; }
0169 inline double HepLorentzRotation::zz() const { return mzz; }
0170 inline double HepLorentzRotation::zt() const { return mzt; }
0171 inline double HepLorentzRotation::tx() const { return mtx; }
0172 inline double HepLorentzRotation::ty() const { return mty; }
0173 inline double HepLorentzRotation::tz() const { return mtz; }
0174 inline double HepLorentzRotation::tt() const { return mtt; }
0175
0176 inline HepLorentzVector HepLorentzRotation::col1() const {
0177 return HepLorentzVector ( mxx, myx, mzx, mtx );
0178 }
0179 inline HepLorentzVector HepLorentzRotation::col2() const {
0180 return HepLorentzVector ( mxy, myy, mzy, mty );
0181 }
0182 inline HepLorentzVector HepLorentzRotation::col3() const {
0183 return HepLorentzVector ( mxz, myz, mzz, mtz );
0184 }
0185 inline HepLorentzVector HepLorentzRotation::col4() const {
0186 return HepLorentzVector ( mxt, myt, mzt, mtt );
0187 }
0188
0189 inline HepLorentzVector HepLorentzRotation::row1() const {
0190 return HepLorentzVector ( mxx, mxy, mxz, mxt );
0191 }
0192 inline HepLorentzVector HepLorentzRotation::row2() const {
0193 return HepLorentzVector ( myx, myy, myz, myt );
0194 }
0195 inline HepLorentzVector HepLorentzRotation::row3() const {
0196 return HepLorentzVector ( mzx, mzy, mzz, mzt );
0197 }
0198 inline HepLorentzVector HepLorentzRotation::row4() const {
0199 return HepLorentzVector ( mtx, mty, mtz, mtt );
0200 }
0201
0202 inline HepRep4x4 HepLorentzRotation::rep4x4() const {
0203 return HepRep4x4( mxx, mxy, mxz, mxt,
0204 myx, myy, myz, myt,
0205 mzx, mzy, mzz, mzt,
0206 mtx, mty, mtz, mtt );
0207 }
0208
0209
0210
0211
0212 inline HepLorentzRotation::HepLorentzRotation_row::HepLorentzRotation_row
0213 (const HepLorentzRotation & r, int i) : rr(r), ii(i) {}
0214
0215 inline double
0216 HepLorentzRotation::HepLorentzRotation_row::operator [] (int jj) const {
0217 return rr(ii,jj);
0218 }
0219
0220 inline const HepLorentzRotation::HepLorentzRotation_row
0221 HepLorentzRotation::operator [] (int i) const {
0222 return HepLorentzRotation_row(*this, i);
0223 }
0224
0225
0226
0227 inline bool
0228 HepLorentzRotation::operator == (const HepLorentzRotation & r) const {
0229 return (mxx == r.xx() && mxy == r.xy() && mxz == r.xz() && mxt == r.xt() &&
0230 myx == r.yx() && myy == r.yy() && myz == r.yz() && myt == r.yt() &&
0231 mzx == r.zx() && mzy == r.zy() && mzz == r.zz() && mzt == r.zt() &&
0232 mtx == r.tx() && mty == r.ty() && mtz == r.tz() && mtt == r.tt());
0233 }
0234
0235 inline bool
0236 HepLorentzRotation::operator != (const HepLorentzRotation & r) const {
0237 return ! operator==(r);
0238 }
0239
0240 inline bool
0241 HepLorentzRotation::operator < ( const HepLorentzRotation & r ) const
0242 { return compare(r)< 0; }
0243 inline bool
0244 HepLorentzRotation::operator <= ( const HepLorentzRotation & r ) const
0245 { return compare(r)<=0; }
0246
0247 inline bool
0248 HepLorentzRotation::operator >= ( const HepLorentzRotation & r ) const
0249 { return compare(r)>=0; }
0250 inline bool
0251 HepLorentzRotation::operator > ( const HepLorentzRotation & r ) const
0252 { return compare(r)> 0; }
0253
0254 inline bool HepLorentzRotation::isIdentity() const {
0255 return (mxx == 1.0 && mxy == 0.0 && mxz == 0.0 && mxt == 0.0 &&
0256 myx == 0.0 && myy == 1.0 && myz == 0.0 && myt == 0.0 &&
0257 mzx == 0.0 && mzy == 0.0 && mzz == 1.0 && mzt == 0.0 &&
0258 mtx == 0.0 && mty == 0.0 && mtz == 0.0 && mtt == 1.0);
0259 }
0260
0261
0262
0263
0264
0265 inline HepLorentzVector
0266 HepLorentzRotation::vectorMultiplication(const HepLorentzVector & p) const {
0267 double x(p.x());
0268 double y(p.y());
0269 double z(p.z());
0270 double t(p.t());
0271 return HepLorentzVector(mxx*x + mxy*y + mxz*z + mxt*t,
0272 myx*x + myy*y + myz*z + myt*t,
0273 mzx*x + mzy*y + mzz*z + mzt*t,
0274 mtx*x + mty*y + mtz*z + mtt*t);
0275 }
0276
0277 inline HepLorentzVector
0278 HepLorentzRotation::operator() (const HepLorentzVector & w) const {
0279 return vectorMultiplication(w);
0280 }
0281
0282 inline HepLorentzVector
0283 HepLorentzRotation::operator * (const HepLorentzVector & p) const {
0284 return vectorMultiplication(p);
0285 }
0286
0287
0288
0289 inline HepLorentzRotation
0290 HepLorentzRotation::operator * (const HepBoost & b) const {
0291 return matrixMultiplication(b.rep4x4());
0292 }
0293 inline HepLorentzRotation
0294 HepLorentzRotation::operator * (const HepRotation & r) const {
0295 return matrixMultiplication(r.rep4x4());
0296 }
0297 inline HepLorentzRotation
0298 HepLorentzRotation::operator * (const HepLorentzRotation & lt) const {
0299 return matrixMultiplication(lt.rep4x4());
0300 }
0301
0302 inline HepLorentzRotation &
0303 HepLorentzRotation::operator *= (const HepBoost & b) {
0304 return *this = matrixMultiplication(b.rep4x4());
0305 }
0306 inline HepLorentzRotation &
0307 HepLorentzRotation::operator *= (const HepRotation & r) {
0308 return *this = matrixMultiplication(r.rep4x4());
0309 }
0310 inline HepLorentzRotation &
0311 HepLorentzRotation::operator *= (const HepLorentzRotation & lt) {
0312 return *this = matrixMultiplication(lt.rep4x4());
0313 }
0314
0315 inline HepLorentzRotation &
0316 HepLorentzRotation::transform (const HepBoost & b) {
0317 return *this = HepLorentzRotation(b).matrixMultiplication(rep4x4());
0318 }
0319 inline HepLorentzRotation &
0320 HepLorentzRotation::transform (const HepRotation & r) {
0321 return *this = HepLorentzRotation(r).matrixMultiplication(rep4x4());
0322 }
0323 inline HepLorentzRotation &
0324 HepLorentzRotation::transform (const HepLorentzRotation & lt) {
0325 return *this = lt.matrixMultiplication(rep4x4());
0326 }
0327
0328
0329
0330
0331
0332
0333 inline HepLorentzRotation &
0334 HepLorentzRotation::rotate(double angle, const Hep3Vector & axis) {
0335 return transform(HepRotation().rotate(angle, axis));
0336 }
0337
0338 inline HepLorentzRotation &
0339 HepLorentzRotation::rotate(double angle, const Hep3Vector * axis) {
0340 return transform(HepRotation().rotate(angle, axis));
0341 }
0342
0343 inline HepLorentzRotation &
0344 HepLorentzRotation::boost(double bx, double by, double bz) {
0345 return transform(HepLorentzRotation(bx, by, bz));
0346 }
0347
0348 inline HepLorentzRotation &
0349 HepLorentzRotation::boost(const Hep3Vector & b) {
0350 return transform(HepLorentzRotation(b));
0351 }
0352
0353 inline HepLorentzRotation HepLorentzRotation::inverse() const {
0354 return HepLorentzRotation( mxx, myx, mzx, -mtx,
0355 mxy, myy, mzy, -mty,
0356 mxz, myz, mzz, -mtz,
0357 -mxt, -myt, -mzt, mtt );
0358 }
0359
0360 inline HepLorentzRotation & HepLorentzRotation::invert() {
0361 return *this = inverse();
0362 }
0363
0364 inline HepLorentzRotation inverseOf ( const HepLorentzRotation & lt ) {
0365 return HepLorentzRotation(
0366 HepRep4x4(
0367 lt.mxx, lt.myx, lt.mzx, -lt.mtx,
0368 lt.mxy, lt.myy, lt.mzy, -lt.mty,
0369 lt.mxz, lt.myz, lt.mzz, -lt.mtz,
0370 -lt.mxt, -lt.myt, -lt.mzt, lt.mtt ) );
0371 }
0372
0373 inline double HepLorentzRotation::getTolerance() {
0374 return Hep4RotationInterface::tolerance;
0375 }
0376 inline double HepLorentzRotation::setTolerance(double tol) {
0377 return Hep4RotationInterface::setTolerance(tol);
0378 }
0379
0380 }