Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 10:03:34

0001 // -*- C++ -*-
0002 // ---------------------------------------------------------------------------
0003 //
0004 // This file is a part of the CLHEP - a Class Library for High Energy Physics.
0005 // 
0006 // This is the definitions of the inline member functions of the
0007 // HepRotationZ class
0008 //
0009 
0010 #include <cmath>
0011 #include "CLHEP/Units/PhysicalConstants.h"
0012 
0013 namespace CLHEP {
0014 
0015 inline double HepRotationZ::xx() const { return its_c; }
0016 inline double HepRotationZ::xy() const { return -its_s; }
0017 inline double HepRotationZ::yx() const { return its_s; }
0018 inline double HepRotationZ::yy() const { return its_c; }
0019 
0020 inline double HepRotationZ::zz() const { return 1.0; }
0021 inline double HepRotationZ::zy() const { return 0.0; }
0022 inline double HepRotationZ::zx() const { return 0.0; }
0023 inline double HepRotationZ::yz() const { return 0.0; }
0024 inline double HepRotationZ::xz() const { return 0.0; }
0025 
0026 inline HepRep3x3 HepRotationZ::rep3x3() const {
0027   return HepRep3x3 ( its_c,  -its_s,  0.0,
0028                      its_s,   its_c,  0.0,
0029                      0.0,     0.0,    1.0  );
0030 }
0031 
0032 inline HepRotationZ::HepRotationZ() : its_d(0.0), its_s(0.0), its_c(1.0) {}
0033 
0034 inline HepRotationZ::HepRotationZ(const HepRotationZ & orig) : 
0035     its_d(orig.its_d), its_s(orig.its_s), its_c(orig.its_c)
0036 {}
0037 
0038 inline HepRotationZ::HepRotationZ(double dd, double ss, double cc) :
0039     its_d(dd), its_s(ss), its_c(cc)
0040 {}
0041 
0042 inline HepRotationZ & HepRotationZ::operator= (const HepRotationZ & orig) {
0043   its_d = orig.its_d;
0044   its_s = orig.its_s; 
0045   its_c = orig.its_c;
0046   return *this;
0047 }
0048 
0049 inline HepRotationZ::~HepRotationZ() {}
0050 
0051 inline Hep3Vector HepRotationZ::colX() const 
0052                 { return Hep3Vector (  its_c,   its_s,  0.0 ); }
0053 inline Hep3Vector HepRotationZ::colY() const 
0054                 { return Hep3Vector ( -its_s,   its_c,  0.0 ); }
0055 inline Hep3Vector HepRotationZ::colZ() const 
0056                 { return Hep3Vector ( 0.0, 0.0, 1.0 ); }
0057  
0058 inline Hep3Vector HepRotationZ::rowX() const 
0059                 { return Hep3Vector (  its_c,  -its_s,  0.0 ); }
0060 inline Hep3Vector HepRotationZ::rowY() const 
0061                 { return Hep3Vector (  its_s,   its_c,  0.0 ); }
0062 inline Hep3Vector HepRotationZ::rowZ() const 
0063                 { return Hep3Vector ( 0.0, 0.0, 1.0 ); }
0064 
0065 inline double  HepRotationZ::getPhi  () const { return phi();   }
0066 inline double  HepRotationZ::getTheta() const { return theta(); }
0067 inline double  HepRotationZ::getPsi  () const { return psi();   }
0068 inline double  HepRotationZ::getDelta() const { return its_d; }
0069 inline Hep3Vector HepRotationZ::getAxis () const { return axis();  }
0070 
0071 inline double  HepRotationZ::delta() const { return its_d; }
0072 inline Hep3Vector HepRotationZ::axis() const { return Hep3Vector(0,0,1); }
0073 
0074 inline HepAxisAngle HepRotationZ::axisAngle() const {
0075   return HepAxisAngle ( axis(), delta() );
0076 }
0077 
0078 inline void HepRotationZ::getAngleAxis
0079             (double & ddelta, Hep3Vector & aaxis) const {
0080   ddelta = its_d;
0081   aaxis  = getAxis();
0082 }
0083 
0084 inline bool HepRotationZ::isIdentity() const {
0085   return ( its_d==0 );
0086 }
0087 
0088 inline int HepRotationZ::compare ( const HepRotationZ & r  ) const {
0089   if (its_d > r.its_d) return 1; else if (its_d < r.its_d) return -1; else return 0;
0090 }
0091 
0092 inline bool HepRotationZ::operator==(const HepRotationZ & r) const
0093   { return (its_d==r.its_d); }
0094 inline bool HepRotationZ::operator!=(const HepRotationZ & r) const
0095   { return (its_d!=r.its_d); }
0096 inline bool HepRotationZ::operator>=(const HepRotationZ & r) const
0097   { return (its_d>=r.its_d); }
0098 inline bool HepRotationZ::operator<=(const HepRotationZ & r) const
0099   { return (its_d<=r.its_d); }
0100 inline bool HepRotationZ::operator> (const HepRotationZ & r) const
0101   { return (its_d> r.its_d); }
0102 inline bool HepRotationZ::operator< (const HepRotationZ & r) const
0103   { return (its_d< r.its_d); }
0104 
0105 inline void HepRotationZ::rectify() { 
0106   its_d = proper(its_d);  // Just in case!
0107   its_s = std::sin(its_d);
0108   its_c = std::cos(its_d);
0109 } 
0110 
0111 inline Hep3Vector HepRotationZ::operator() (const Hep3Vector & p) const {
0112   double x = p.x();
0113   double y = p.y();
0114   double z = p.z();
0115   return  Hep3Vector(  x * its_c - y * its_s,
0116                        x * its_s + y * its_c,
0117                              z        );
0118 }
0119 
0120 inline Hep3Vector HepRotationZ::operator * (const Hep3Vector & p) const {
0121   return operator()(p);
0122 }
0123 
0124 inline HepLorentzVector HepRotationZ::operator()
0125             ( const HepLorentzVector & w ) const {
0126   return  HepLorentzVector( operator() (w.vect()) , w.t() );
0127 }
0128 
0129 inline HepLorentzVector HepRotationZ::operator * 
0130                                         (const HepLorentzVector & p) const {
0131   return operator()(p);
0132 }
0133 
0134 inline HepRotationZ & HepRotationZ::operator *= (const HepRotationZ & m1) {
0135   return *this = (*this) * (m1);
0136 }
0137 
0138 inline HepRotationZ & HepRotationZ::transform(const HepRotationZ & m1) {
0139   return *this = m1 * (*this);
0140 }
0141 
0142 inline double HepRotationZ::proper( double ddelta ) {
0143   // -PI < d <= PI
0144   if ( std::fabs(ddelta) < CLHEP::pi ) {
0145     return  ddelta;
0146   } else {
0147     double x = ddelta / (CLHEP::twopi);
0148     return  (CLHEP::twopi) * ( x + std::floor(.5-x) );
0149   }
0150 }  // proper()
0151 
0152 inline HepRotationZ HepRotationZ::operator * ( const HepRotationZ & rz ) const {
0153   return HepRotationZ ( HepRotationZ::proper(its_d+rz.its_d),
0154                         its_s*rz.its_c + its_c*rz.its_s,
0155                         its_c*rz.its_c - its_s*rz.its_s );
0156 }
0157 
0158 inline HepRotationZ HepRotationZ::inverse() const {
0159   return HepRotationZ( proper(-its_d), -its_s, its_c ); 
0160 }
0161 
0162 inline HepRotationZ inverseOf(const HepRotationZ & r) {
0163   return r.inverse();
0164 }
0165 
0166 inline HepRotationZ & HepRotationZ::invert() {
0167   return *this=inverse();
0168 }
0169 
0170 inline HepLorentzVector HepRotationZ::col1() const
0171                                 { return HepLorentzVector (colX(), 0); }
0172 inline HepLorentzVector HepRotationZ::col2() const
0173                                 { return HepLorentzVector (colY(), 0); }
0174 inline HepLorentzVector HepRotationZ::col3() const
0175                                 { return HepLorentzVector (colZ(), 0); }
0176 inline HepLorentzVector HepRotationZ::col4() const
0177                                 { return HepLorentzVector (0,0,0,1); }
0178 inline HepLorentzVector HepRotationZ::row1() const
0179                                 { return HepLorentzVector (rowX(), 0); }
0180 inline HepLorentzVector HepRotationZ::row2() const
0181                                 { return HepLorentzVector (rowY(), 0); }
0182 inline HepLorentzVector HepRotationZ::row3() const
0183                                 { return HepLorentzVector (rowZ(), 0); }
0184 inline HepLorentzVector HepRotationZ::row4() const
0185                                 { return HepLorentzVector (0,0,0,1); }
0186 inline double HepRotationZ::xt() const { return 0.0; }
0187 inline double HepRotationZ::yt() const { return 0.0; }
0188 inline double HepRotationZ::zt() const { return 0.0; }
0189 inline double HepRotationZ::tx() const { return 0.0; }
0190 inline double HepRotationZ::ty() const { return 0.0; }
0191 inline double HepRotationZ::tz() const { return 0.0; }
0192 inline double HepRotationZ::tt() const { return 1.0; }
0193 
0194 inline HepRep4x4 HepRotationZ::rep4x4() const {
0195   return HepRep4x4 ( its_c, -its_s,  0.0, 0.0, 
0196                      its_s,  its_c,  0.0, 0.0, 
0197                      0.0,    0.0,    1.0, 0.0,
0198                      0.0,    0.0,    0.0, 1.0 );
0199 }
0200 
0201 inline double HepRotationZ::getTolerance() {
0202   return Hep4RotationInterface::tolerance;
0203 }
0204 inline double HepRotationZ::setTolerance(double tol) {
0205   return Hep4RotationInterface::setTolerance(tol);
0206 }
0207 
0208 }  // namespace CLHEP