[4] | 1 | // -*- C++ -*-
|
---|
| 2 | // ---------------------------------------------------------------------------
|
---|
| 3 | //
|
---|
| 4 | // This file is a part of the CLHEP - a Class Library for High Energy Physics.
|
---|
| 5 | //
|
---|
| 6 | // This is the definitions of the inline member functions of the
|
---|
| 7 | // HepRotationY class
|
---|
| 8 | //
|
---|
| 9 |
|
---|
| 10 | #include <cmath>
|
---|
| 11 | #include "CLHEP/Units/PhysicalConstants.h"
|
---|
| 12 |
|
---|
| 13 | namespace CLHEP {
|
---|
| 14 |
|
---|
| 15 | inline double HepRotationY::xx() const { return c; }
|
---|
| 16 | inline double HepRotationY::xz() const { return s; }
|
---|
| 17 | inline double HepRotationY::zx() const { return -s; }
|
---|
| 18 | inline double HepRotationY::zz() const { return c; }
|
---|
| 19 |
|
---|
| 20 | inline double HepRotationY::yy() const { return 1.0; }
|
---|
| 21 | inline double HepRotationY::yx() const { return 0.0; }
|
---|
| 22 | inline double HepRotationY::yz() const { return 0.0; }
|
---|
| 23 | inline double HepRotationY::xy() const { return 0.0; }
|
---|
| 24 | inline double HepRotationY::zy() const { return 0.0; }
|
---|
| 25 |
|
---|
| 26 | inline HepRep3x3 HepRotationY::rep3x3() const {
|
---|
| 27 | return HepRep3x3 ( c , 0.0, s,
|
---|
| 28 | 0.0, 1.0, 0.0,
|
---|
| 29 | -s , 0.0, c );
|
---|
| 30 | }
|
---|
| 31 |
|
---|
| 32 | inline HepRotationY::HepRotationY() : d(0.0), s(0.0), c(1.0) {}
|
---|
| 33 |
|
---|
| 34 | inline HepRotationY::HepRotationY(const HepRotationY & orig) :
|
---|
| 35 | d(orig.d), s(orig.s), c(orig.c)
|
---|
| 36 | {}
|
---|
| 37 |
|
---|
| 38 | inline HepRotationY::HepRotationY(double dd, double ss, double cc) :
|
---|
| 39 | d(dd), s(ss), c(cc)
|
---|
| 40 | {}
|
---|
| 41 |
|
---|
| 42 | inline HepRotationY & HepRotationY::operator= (const HepRotationY & orig) {
|
---|
| 43 | d = orig.d;
|
---|
| 44 | s = orig.s;
|
---|
| 45 | c = orig.c;
|
---|
| 46 | return *this;
|
---|
| 47 | }
|
---|
| 48 |
|
---|
| 49 | inline HepRotationY::~HepRotationY() {}
|
---|
| 50 |
|
---|
| 51 | inline Hep3Vector HepRotationY::colX() const
|
---|
| 52 | { return Hep3Vector ( c, 0.0, -s ); }
|
---|
| 53 | inline Hep3Vector HepRotationY::colY() const
|
---|
| 54 | { return Hep3Vector ( 0.0, 1.0, 0.0 ); }
|
---|
| 55 | inline Hep3Vector HepRotationY::colZ() const
|
---|
| 56 | { return Hep3Vector ( s, 0.0, c ); }
|
---|
| 57 |
|
---|
| 58 | inline Hep3Vector HepRotationY::rowX() const
|
---|
| 59 | { return Hep3Vector ( c, 0.0, s ); }
|
---|
| 60 | inline Hep3Vector HepRotationY::rowY() const
|
---|
| 61 | { return Hep3Vector ( 0.0, 1.0, 0.0 ); }
|
---|
| 62 | inline Hep3Vector HepRotationY::rowZ() const
|
---|
| 63 | { return Hep3Vector ( -s, 0.0, c ); }
|
---|
| 64 |
|
---|
| 65 | inline double HepRotationY::getPhi () const { return phi(); }
|
---|
| 66 | inline double HepRotationY::getTheta() const { return theta(); }
|
---|
| 67 | inline double HepRotationY::getPsi () const { return psi(); }
|
---|
| 68 | inline double HepRotationY::getDelta() const { return d; }
|
---|
| 69 | inline Hep3Vector HepRotationY::getAxis () const { return axis(); }
|
---|
| 70 |
|
---|
| 71 | inline double HepRotationY::delta() const { return d; }
|
---|
| 72 | inline Hep3Vector HepRotationY::axis() const { return Hep3Vector(0,1,0); }
|
---|
| 73 |
|
---|
| 74 | inline HepAxisAngle HepRotationY::axisAngle() const {
|
---|
| 75 | return HepAxisAngle ( axis(), delta() );
|
---|
| 76 | }
|
---|
| 77 |
|
---|
| 78 | inline void HepRotationY::getAngleAxis
|
---|
| 79 | (double & delta, Hep3Vector & axis) const {
|
---|
| 80 | delta = d;
|
---|
| 81 | axis = getAxis();
|
---|
| 82 | }
|
---|
| 83 |
|
---|
| 84 | inline bool HepRotationY::isIdentity() const {
|
---|
| 85 | return ( d==0 );
|
---|
| 86 | }
|
---|
| 87 |
|
---|
| 88 | inline int HepRotationY::compare ( const HepRotationY & r ) const {
|
---|
| 89 | if (d > r.d) return 1; else if (d < r.d) return -1; else return 0;
|
---|
| 90 | }
|
---|
| 91 |
|
---|
| 92 |
|
---|
| 93 | inline bool HepRotationY::operator==(const HepRotationY & r) const
|
---|
| 94 | { return (d==r.d); }
|
---|
| 95 | inline bool HepRotationY::operator!=(const HepRotationY & r) const
|
---|
| 96 | { return (d!=r.d); }
|
---|
| 97 | inline bool HepRotationY::operator>=(const HepRotationY & r) const
|
---|
| 98 | { return (d>=r.d); }
|
---|
| 99 | inline bool HepRotationY::operator<=(const HepRotationY & r) const
|
---|
| 100 | { return (d<=r.d); }
|
---|
| 101 | inline bool HepRotationY::operator> (const HepRotationY & r) const
|
---|
| 102 | { return (d> r.d); }
|
---|
| 103 | inline bool HepRotationY::operator< (const HepRotationY & r) const
|
---|
| 104 | { return (d< r.d); }
|
---|
| 105 |
|
---|
| 106 | inline void HepRotationY::rectify() {
|
---|
| 107 | d = proper(d); // Just in case!
|
---|
| 108 | s = std::sin(d);
|
---|
| 109 | c = std::cos(d);
|
---|
| 110 | }
|
---|
| 111 |
|
---|
| 112 | inline Hep3Vector HepRotationY::operator() (const Hep3Vector & p) const {
|
---|
| 113 | double x = p.x();
|
---|
| 114 | double y = p.y();
|
---|
| 115 | double z = p.z();
|
---|
| 116 | return Hep3Vector( x * c + z * s,
|
---|
| 117 | y,
|
---|
| 118 | z * c - x * s );
|
---|
| 119 | }
|
---|
| 120 |
|
---|
| 121 | inline Hep3Vector HepRotationY::operator * (const Hep3Vector & p) const {
|
---|
| 122 | return operator()(p);
|
---|
| 123 | }
|
---|
| 124 |
|
---|
| 125 | inline HepLorentzVector HepRotationY::operator()
|
---|
| 126 | ( const HepLorentzVector & w ) const {
|
---|
| 127 | return HepLorentzVector( operator() (w.vect()) , w.t() );
|
---|
| 128 | }
|
---|
| 129 |
|
---|
| 130 | inline HepLorentzVector HepRotationY::operator *
|
---|
| 131 | (const HepLorentzVector & p) const {
|
---|
| 132 | return operator()(p);
|
---|
| 133 | }
|
---|
| 134 |
|
---|
| 135 | inline HepRotationY & HepRotationY::operator *= (const HepRotationY & m) {
|
---|
| 136 | return *this = (*this) * (m);
|
---|
| 137 | }
|
---|
| 138 |
|
---|
| 139 | inline HepRotationY & HepRotationY::transform(const HepRotationY & m) {
|
---|
| 140 | return *this = m * (*this);
|
---|
| 141 | }
|
---|
| 142 |
|
---|
| 143 | inline double HepRotationY::proper( double delta ) {
|
---|
| 144 | // -PI < d <= PI
|
---|
| 145 | if ( std::fabs(delta) < CLHEP::pi ) {
|
---|
| 146 | return delta;
|
---|
| 147 | } else {
|
---|
| 148 | register double x = delta / (CLHEP::twopi);
|
---|
| 149 | return (CLHEP::twopi) * ( x + std::floor(.5-x) );
|
---|
| 150 | }
|
---|
| 151 | } // proper()
|
---|
| 152 |
|
---|
| 153 | inline HepRotationY HepRotationY::operator * ( const HepRotationY & ry ) const {
|
---|
| 154 | return HepRotationY ( HepRotationY::proper(d+ry.d),
|
---|
| 155 | s*ry.c + c*ry.s,
|
---|
| 156 | c*ry.c - s*ry.s );
|
---|
| 157 | }
|
---|
| 158 |
|
---|
| 159 | inline HepRotationY HepRotationY::inverse() const {
|
---|
| 160 | return HepRotationY( proper(-d), -s, c );
|
---|
| 161 | }
|
---|
| 162 |
|
---|
| 163 | inline HepRotationY inverseOf(const HepRotationY & r) {
|
---|
| 164 | return r.inverse();
|
---|
| 165 | }
|
---|
| 166 |
|
---|
| 167 | inline HepRotationY & HepRotationY::invert() {
|
---|
| 168 | return *this=inverse();
|
---|
| 169 | }
|
---|
| 170 |
|
---|
| 171 | inline HepLorentzVector HepRotationY::col1() const
|
---|
| 172 | { return HepLorentzVector (colX(), 0); }
|
---|
| 173 | inline HepLorentzVector HepRotationY::col2() const
|
---|
| 174 | { return HepLorentzVector (colY(), 0); }
|
---|
| 175 | inline HepLorentzVector HepRotationY::col3() const
|
---|
| 176 | { return HepLorentzVector (colZ(), 0); }
|
---|
| 177 | inline HepLorentzVector HepRotationY::col4() const
|
---|
| 178 | { return HepLorentzVector (0,0,0,1); }
|
---|
| 179 | inline HepLorentzVector HepRotationY::row1() const
|
---|
| 180 | { return HepLorentzVector (rowX(), 0); }
|
---|
| 181 | inline HepLorentzVector HepRotationY::row2() const
|
---|
| 182 | { return HepLorentzVector (rowY(), 0); }
|
---|
| 183 | inline HepLorentzVector HepRotationY::row3() const
|
---|
| 184 | { return HepLorentzVector (rowZ(), 0); }
|
---|
| 185 | inline HepLorentzVector HepRotationY::row4() const
|
---|
| 186 | { return HepLorentzVector (0,0,0,1); }
|
---|
| 187 | inline double HepRotationY::xt() const { return 0.0; }
|
---|
| 188 | inline double HepRotationY::yt() const { return 0.0; }
|
---|
| 189 | inline double HepRotationY::zt() const { return 0.0; }
|
---|
| 190 | inline double HepRotationY::tx() const { return 0.0; }
|
---|
| 191 | inline double HepRotationY::ty() const { return 0.0; }
|
---|
| 192 | inline double HepRotationY::tz() const { return 0.0; }
|
---|
| 193 | inline double HepRotationY::tt() const { return 1.0; }
|
---|
| 194 |
|
---|
| 195 | inline HepRep4x4 HepRotationY::rep4x4() const {
|
---|
| 196 | return HepRep4x4 ( c , 0.0, s, 0.0,
|
---|
| 197 | 0.0, 1.0, 0.0, 0.0,
|
---|
| 198 | -s , 0.0, c, 0.0,
|
---|
| 199 | 0.0, 0.0, 0.0, 1.0 );
|
---|
| 200 | }
|
---|
| 201 |
|
---|
| 202 | inline double HepRotationY::getTolerance() {
|
---|
| 203 | return Hep4RotationInterface::tolerance;
|
---|
| 204 | }
|
---|
| 205 | inline double HepRotationY::setTolerance(double tol) {
|
---|
| 206 | return Hep4RotationInterface::setTolerance(tol);
|
---|
| 207 | }
|
---|
| 208 |
|
---|
| 209 | } // namespace CLHEP
|
---|