00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 namespace CLHEP {
00012
00013
00014
00015 inline double HepRotation::xx() const { return rxx; }
00016 inline double HepRotation::xy() const { return rxy; }
00017 inline double HepRotation::xz() const { return rxz; }
00018 inline double HepRotation::yx() const { return ryx; }
00019 inline double HepRotation::yy() const { return ryy; }
00020 inline double HepRotation::yz() const { return ryz; }
00021 inline double HepRotation::zx() const { return rzx; }
00022 inline double HepRotation::zy() const { return rzy; }
00023 inline double HepRotation::zz() const { return rzz; }
00024
00025 inline HepRep3x3 HepRotation::rep3x3() const {
00026 return HepRep3x3 ( rxx, rxy, rxz,
00027 ryx, ryy, ryz,
00028 rzx, rzy, rzz );
00029 }
00030
00031 inline double HepRotation::xt() const { return 0.0; }
00032 inline double HepRotation::yt() const { return 0.0; }
00033 inline double HepRotation::zt() const { return 0.0; }
00034 inline double HepRotation::tx() const { return 0.0; }
00035 inline double HepRotation::ty() const { return 0.0; }
00036 inline double HepRotation::tz() const { return 0.0; }
00037 inline double HepRotation::tt() const { return 1.0; }
00038
00039 inline HepRep4x4 HepRotation::rep4x4() const {
00040 return HepRep4x4 ( rxx, rxy, rxz, 0.0,
00041 ryx, ryy, ryz, 0.0,
00042 rzx, rzy, rzz, 0.0,
00043 0.0, 0.0, 0.0, 1.0 );
00044 }
00045
00046
00047
00048 inline HepRotation::HepRotation() : rxx(1.0), rxy(0.0), rxz(0.0),
00049 ryx(0.0), ryy(1.0), ryz(0.0),
00050 rzx(0.0), rzy(0.0), rzz(1.0) {}
00051
00052 inline HepRotation::HepRotation(const HepRotation & m1) :
00053 rxx(m1.rxx), rxy(m1.rxy), rxz(m1.rxz),
00054 ryx(m1.ryx), ryy(m1.ryy), ryz(m1.ryz),
00055 rzx(m1.rzx), rzy(m1.rzy), rzz(m1.rzz) {}
00056
00057 inline HepRotation::HepRotation
00058 (double mxx, double mxy, double mxz,
00059 double myx, double myy, double myz,
00060 double mzx, double mzy, double mzz) :
00061 rxx(mxx), rxy(mxy), rxz(mxz),
00062 ryx(myx), ryy(myy), ryz(myz),
00063 rzx(mzx), rzy(mzy), rzz(mzz) {}
00064
00065 inline HepRotation::HepRotation ( const HepRep3x3 & m1 ) :
00066 rxx(m1.xx_), rxy(m1.xy_), rxz(m1.xz_),
00067 ryx(m1.yx_), ryy(m1.yy_), ryz(m1.yz_),
00068 rzx(m1.zx_), rzy(m1.zy_), rzz(m1.zz_) {}
00069
00070 inline HepRotation::HepRotation(const HepRotationX & rx) :
00071 rxx(1.0), rxy(0.0), rxz(0.0),
00072 ryx(0.0), ryy(rx.yy()), ryz(rx.yz()),
00073 rzx(0.0), rzy(rx.zy()), rzz(rx.zz()) {}
00074
00075 inline HepRotation::HepRotation(const HepRotationY & ry) :
00076 rxx(ry.xx()), rxy(0.0), rxz(ry.xz()),
00077 ryx(0.0), ryy(1.0), ryz(0.0),
00078 rzx(ry.zx()), rzy(0.0), rzz(ry.zz()) {}
00079
00080 inline HepRotation::HepRotation(const HepRotationZ & rz) :
00081 rxx(rz.xx()), rxy(rz.xy()), rxz(0.0),
00082 ryx(rz.yx()), ryy(rz.yy()), ryz(0.0),
00083 rzx(0.0), rzy(0.0), rzz(1.0) {}
00084
00085 inline HepRotation::~HepRotation() {}
00086
00087
00088
00089 inline HepRotation::HepRotation_row::HepRotation_row
00090 (const HepRotation & r, int i) : rr(r), ii(i) {}
00091
00092 inline double HepRotation::HepRotation_row::operator [] (int jj) const {
00093 return rr(ii,jj);
00094 }
00095
00096 inline
00097 const HepRotation::HepRotation_row HepRotation::operator [] (int i) const {
00098 return HepRotation_row(*this, i);
00099 }
00100
00101 inline Hep3Vector HepRotation::colX() const
00102 { return Hep3Vector ( rxx, ryx, rzx ); }
00103 inline Hep3Vector HepRotation::colY() const
00104 { return Hep3Vector ( rxy, ryy, rzy ); }
00105 inline Hep3Vector HepRotation::colZ() const
00106 { return Hep3Vector ( rxz, ryz, rzz ); }
00107
00108 inline Hep3Vector HepRotation::rowX() const
00109 { return Hep3Vector ( rxx, rxy, rxz ); }
00110 inline Hep3Vector HepRotation::rowY() const
00111 { return Hep3Vector ( ryx, ryy, ryz ); }
00112 inline Hep3Vector HepRotation::rowZ() const
00113 { return Hep3Vector ( rzx, rzy, rzz ); }
00114
00115 inline HepLorentzVector HepRotation::col1() const
00116 { return HepLorentzVector (colX(), 0); }
00117 inline HepLorentzVector HepRotation::col2() const
00118 { return HepLorentzVector (colY(), 0); }
00119 inline HepLorentzVector HepRotation::col3() const
00120 { return HepLorentzVector (colZ(), 0); }
00121 inline HepLorentzVector HepRotation::col4() const
00122 { return HepLorentzVector (0,0,0,1); }
00123 inline HepLorentzVector HepRotation::row1() const
00124 { return HepLorentzVector (rowX(), 0); }
00125 inline HepLorentzVector HepRotation::row2() const
00126 { return HepLorentzVector (rowY(), 0); }
00127 inline HepLorentzVector HepRotation::row3() const
00128 { return HepLorentzVector (rowZ(), 0); }
00129 inline HepLorentzVector HepRotation::row4() const
00130 { return HepLorentzVector (0,0,0,1); }
00131
00132 inline double HepRotation::getPhi () const { return phi(); }
00133 inline double HepRotation::getTheta() const { return theta(); }
00134 inline double HepRotation::getPsi () const { return psi(); }
00135 inline double HepRotation::getDelta() const { return delta(); }
00136 inline Hep3Vector HepRotation::getAxis () const { return axis(); }
00137
00138 inline HepRotation & HepRotation::operator = (const HepRotation & m1) {
00139 rxx = m1.rxx;
00140 rxy = m1.rxy;
00141 rxz = m1.rxz;
00142 ryx = m1.ryx;
00143 ryy = m1.ryy;
00144 ryz = m1.ryz;
00145 rzx = m1.rzx;
00146 rzy = m1.rzy;
00147 rzz = m1.rzz;
00148 return *this;
00149 }
00150
00151 inline HepRotation & HepRotation::set(const HepRep3x3 & m1) {
00152 rxx = m1.xx_;
00153 rxy = m1.xy_;
00154 rxz = m1.xz_;
00155 ryx = m1.yx_;
00156 ryy = m1.yy_;
00157 ryz = m1.yz_;
00158 rzx = m1.zx_;
00159 rzy = m1.zy_;
00160 rzz = m1.zz_;
00161 return *this;
00162 }
00163
00164 inline HepRotation & HepRotation::set(const HepRotationX & r) {
00165 return (set (r.rep3x3()));
00166 }
00167 inline HepRotation & HepRotation::set(const HepRotationY & r) {
00168 return (set (r.rep3x3()));
00169 }
00170 inline HepRotation & HepRotation::set(const HepRotationZ & r) {
00171 return (set (r.rep3x3()));
00172 }
00173
00174 inline HepRotation & HepRotation::operator= (const HepRotationX & r) {
00175 return (set (r.rep3x3()));
00176 }
00177 inline HepRotation & HepRotation::operator= (const HepRotationY & r) {
00178 return (set (r.rep3x3()));
00179 }
00180 inline HepRotation & HepRotation::operator= (const HepRotationZ & r) {
00181 return (set (r.rep3x3()));
00182 }
00183
00184 inline Hep3Vector HepRotation::operator * (const Hep3Vector & p) const {
00185 return Hep3Vector(rxx*p.x() + rxy*p.y() + rxz*p.z(),
00186 ryx*p.x() + ryy*p.y() + ryz*p.z(),
00187 rzx*p.x() + rzy*p.y() + rzz*p.z());
00188
00189 }
00190
00191 inline Hep3Vector HepRotation::operator () (const Hep3Vector & p) const {
00192 register double x = p.x();
00193 register double y = p.y();
00194 register double z = p.z();
00195 return Hep3Vector(rxx*x + rxy*y + rxz*z,
00196 ryx*x + ryy*y + ryz*z,
00197 rzx*x + rzy*y + rzz*z);
00198 }
00199
00200 inline HepLorentzVector
00201 HepRotation::operator () (const HepLorentzVector & w) const {
00202 return HepLorentzVector( operator() (w.vect()), w.t() );
00203 }
00204
00205 inline HepLorentzVector HepRotation::operator *
00206 (const HepLorentzVector & p) const {
00207 return operator()(p);
00208 }
00209
00210 inline HepRotation HepRotation::operator* (const HepRotation & r) const {
00211 return HepRotation(rxx*r.rxx + rxy*r.ryx + rxz*r.rzx,
00212 rxx*r.rxy + rxy*r.ryy + rxz*r.rzy,
00213 rxx*r.rxz + rxy*r.ryz + rxz*r.rzz,
00214 ryx*r.rxx + ryy*r.ryx + ryz*r.rzx,
00215 ryx*r.rxy + ryy*r.ryy + ryz*r.rzy,
00216 ryx*r.rxz + ryy*r.ryz + ryz*r.rzz,
00217 rzx*r.rxx + rzy*r.ryx + rzz*r.rzx,
00218 rzx*r.rxy + rzy*r.ryy + rzz*r.rzy,
00219 rzx*r.rxz + rzy*r.ryz + rzz*r.rzz );
00220 }
00221
00222 inline HepRotation HepRotation::operator * (const HepRotationX & rx) const {
00223 double yy1 = rx.yy();
00224 double yz1 = rx.yz();
00225 double zy1 = -yz1;
00226 double zz1 = yy1;
00227 return HepRotation(
00228 rxx, rxy*yy1 + rxz*zy1, rxy*yz1 + rxz*zz1,
00229 ryx, ryy*yy1 + ryz*zy1, ryy*yz1 + ryz*zz1,
00230 rzx, rzy*yy1 + rzz*zy1, rzy*yz1 + rzz*zz1 );
00231 }
00232
00233 inline HepRotation HepRotation::operator * (const HepRotationY & ry) const {
00234 double xx1 = ry.xx();
00235 double xz1 = ry.xz();
00236 double zx1 = -xz1;
00237 double zz1 = xx1;
00238 return HepRotation(
00239 rxx*xx1 + rxz*zx1, rxy, rxx*xz1 + rxz*zz1,
00240 ryx*xx1 + ryz*zx1, ryy, ryx*xz1 + ryz*zz1,
00241 rzx*xx1 + rzz*zx1, rzy, rzx*xz1 + rzz*zz1 );
00242 }
00243
00244 inline HepRotation HepRotation::operator * (const HepRotationZ & rz) const {
00245 double xx1 = rz.xx();
00246 double xy1 = rz.xy();
00247 double yx1 = -xy1;
00248 double yy1 = xx1;
00249 return HepRotation(
00250 rxx*xx1 + rxy*yx1, rxx*xy1 + rxy*yy1, rxz,
00251 ryx*xx1 + ryy*yx1, ryx*xy1 + ryy*yy1, ryz,
00252 rzx*xx1 + rzy*yx1, rzx*xy1 + rzy*yy1, rzz );
00253 }
00254
00255
00256 inline HepRotation & HepRotation::operator *= (const HepRotation & r) {
00257 return *this = (*this) * (r);
00258 }
00259
00260 inline HepRotation & HepRotation::operator *= (const HepRotationX & r) {
00261 return *this = (*this) * (r); }
00262 inline HepRotation & HepRotation::operator *= (const HepRotationY & r) {
00263 return *this = (*this) * (r); }
00264 inline HepRotation & HepRotation::operator *= (const HepRotationZ & r) {
00265 return *this = (*this) * (r); }
00266
00267 inline HepRotation & HepRotation::transform(const HepRotation & r) {
00268 return *this = r * (*this);
00269 }
00270
00271 inline HepRotation & HepRotation::transform(const HepRotationX & r) {
00272 return *this = r * (*this); }
00273 inline HepRotation & HepRotation::transform(const HepRotationY & r) {
00274 return *this = r * (*this); }
00275 inline HepRotation & HepRotation::transform(const HepRotationZ & r) {
00276 return *this = r * (*this); }
00277
00278 inline HepRotation HepRotation::inverse() const {
00279 return HepRotation( rxx, ryx, rzx,
00280 rxy, ryy, rzy,
00281 rxz, ryz, rzz );
00282 }
00283
00284 inline HepRotation inverseOf (const HepRotation & r) {
00285 return r.inverse();
00286 }
00287
00288 inline HepRotation & HepRotation::invert() {
00289 return *this=inverse();
00290 }
00291
00292 inline HepRotation & HepRotation::rotate
00293 (double ddelta, const Hep3Vector * p) {
00294 return rotate(ddelta, *p);
00295 }
00296
00297 inline bool HepRotation::operator== ( const HepRotation & r ) const {
00298 return ( rxx==r.rxx && rxy==r.rxy && rxz==r.rxz &&
00299 ryx==r.ryx && ryy==r.ryy && ryz==r.ryz &&
00300 rzx==r.rzx && rzy==r.rzy && rzz==r.rzz );
00301 }
00302 inline bool HepRotation::operator!= ( const HepRotation & r ) const {
00303 return ! operator==(r);
00304 }
00305 inline bool HepRotation::operator< ( const HepRotation & r ) const
00306 { return compare(r)< 0; }
00307 inline bool HepRotation::operator<=( const HepRotation & r ) const
00308 { return compare(r)<=0; }
00309 inline bool HepRotation::operator>=( const HepRotation & r ) const
00310 { return compare(r)>=0; }
00311 inline bool HepRotation::operator> ( const HepRotation & r ) const
00312 { return compare(r)> 0; }
00313
00314 inline double HepRotation::getTolerance() {
00315 return Hep4RotationInterface::tolerance;
00316 }
00317 inline double HepRotation::setTolerance(double tol) {
00318 return Hep4RotationInterface::setTolerance(tol);
00319 }
00320
00321 inline HepRotation operator * (const HepRotationX & rx, const HepRotation & r){
00322 HepRep3x3 mmm = r.rep3x3();
00323 double c = rx.yy();
00324 double ss = rx.zy();
00325 return HepRotation ( mmm.xx_, mmm.xy_, mmm.xz_,
00326 c*mmm.yx_-ss*mmm.zx_, c*mmm.yy_-ss*mmm.zy_, c*mmm.yz_-ss*mmm.zz_,
00327 ss*mmm.yx_+c*mmm.zx_, ss*mmm.yy_+c*mmm.zy_, ss*mmm.yz_+c*mmm.zz_ );
00328 }
00329
00330 inline HepRotation operator * (const HepRotationY & ry, const HepRotation & r){
00331 HepRep3x3 mmm = r.rep3x3();
00332 double c = ry.xx();
00333 double ss = ry.xz();
00334 return HepRotation ( c*mmm.xx_+ss*mmm.zx_, c*mmm.xy_+ss*mmm.zy_, c*mmm.xz_+ss*mmm.zz_,
00335 mmm.yx_, mmm.yy_, mmm.yz_,
00336 -ss*mmm.xx_+c*mmm.zx_,-ss*mmm.xy_+c*mmm.zy_,-ss*mmm.xz_+c*mmm.zz_ );
00337 }
00338
00339 inline HepRotation operator * (const HepRotationZ & rz, const HepRotation & r){
00340 HepRep3x3 mmm = r.rep3x3();
00341 double c = rz.xx();
00342 double ss = rz.yx();
00343 return HepRotation ( c*mmm.xx_-ss*mmm.yx_, c*mmm.xy_-ss*mmm.yy_, c*mmm.xz_-ss*mmm.yz_,
00344 ss*mmm.xx_+c*mmm.yx_, ss*mmm.xy_+c*mmm.yy_, ss*mmm.xz_+c*mmm.yz_,
00345 mmm.zx_, mmm.zy_, mmm.zz_ );
00346 }
00347
00348 }