[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 | // HepBoostY class
|
---|
| 8 | //
|
---|
| 9 |
|
---|
| 10 | #include <cmath>
|
---|
| 11 |
|
---|
| 12 | namespace CLHEP {
|
---|
| 13 |
|
---|
| 14 | // ---------- Constructors and Assignment:
|
---|
| 15 |
|
---|
| 16 | inline HepBoostY::HepBoostY() : beta_(0.0), gamma_(1.0) {}
|
---|
| 17 |
|
---|
| 18 | inline HepBoostY::HepBoostY(const HepBoostY & b) :
|
---|
| 19 | beta_ (b.beta_),
|
---|
| 20 | gamma_(b.gamma_) {}
|
---|
| 21 |
|
---|
| 22 | inline HepBoostY & HepBoostY::operator = (const HepBoostY & b) {
|
---|
| 23 | beta_ = b.beta_;
|
---|
| 24 | gamma_ = b.gamma_;
|
---|
| 25 | return *this;
|
---|
| 26 | }
|
---|
| 27 |
|
---|
| 28 | inline HepBoostY::HepBoostY(double beta) { set(beta); }
|
---|
| 29 |
|
---|
| 30 | // - Protected method:
|
---|
| 31 | inline HepBoostY::HepBoostY( double beta, double gamma ) :
|
---|
| 32 | beta_(beta), gamma_(gamma) {}
|
---|
| 33 |
|
---|
| 34 | // ---------- Accessors:
|
---|
| 35 |
|
---|
| 36 | inline double HepBoostY::beta() const {
|
---|
| 37 | return beta_;
|
---|
| 38 | }
|
---|
| 39 |
|
---|
| 40 | inline double HepBoostY::gamma() const {
|
---|
| 41 | return gamma_;
|
---|
| 42 | }
|
---|
| 43 |
|
---|
| 44 | inline Hep3Vector HepBoostY::boostVector() const {
|
---|
| 45 | return Hep3Vector( 0, beta_, 0 );
|
---|
| 46 | }
|
---|
| 47 |
|
---|
| 48 | inline Hep3Vector HepBoostY::getDirection() const {
|
---|
| 49 | return Hep3Vector( 0.0, 1.0, 0.0 );
|
---|
| 50 | }
|
---|
| 51 |
|
---|
| 52 | inline double HepBoostY::xx() const { return 1.0;}
|
---|
| 53 | inline double HepBoostY::xy() const { return 0.0;}
|
---|
| 54 | inline double HepBoostY::xz() const { return 0.0;}
|
---|
| 55 | inline double HepBoostY::xt() const { return 0.0;}
|
---|
| 56 | inline double HepBoostY::yx() const { return 0.0;}
|
---|
| 57 | inline double HepBoostY::yy() const { return gamma();}
|
---|
| 58 | inline double HepBoostY::yz() const { return 0.0;}
|
---|
| 59 | inline double HepBoostY::yt() const { return beta()*gamma();}
|
---|
| 60 | inline double HepBoostY::zx() const { return 0.0;}
|
---|
| 61 | inline double HepBoostY::zy() const { return 0.0;}
|
---|
| 62 | inline double HepBoostY::zz() const { return 1.0;}
|
---|
| 63 | inline double HepBoostY::zt() const { return 0.0;}
|
---|
| 64 | inline double HepBoostY::tx() const { return 0.0;}
|
---|
| 65 | inline double HepBoostY::ty() const { return beta()*gamma();}
|
---|
| 66 | inline double HepBoostY::tz() const { return 0.0;}
|
---|
| 67 | inline double HepBoostY::tt() const { return gamma();}
|
---|
| 68 |
|
---|
| 69 | inline HepLorentzVector HepBoostY::col1() const {
|
---|
| 70 | return HepLorentzVector ( 1, 0, 0, 0 );
|
---|
| 71 | }
|
---|
| 72 | inline HepLorentzVector HepBoostY::col2() const {
|
---|
| 73 | return HepLorentzVector ( 0, gamma(), 0, beta()*gamma() );
|
---|
| 74 | }
|
---|
| 75 | inline HepLorentzVector HepBoostY::col3() const {
|
---|
| 76 | return HepLorentzVector ( 0, 0, 1, 0 );
|
---|
| 77 | }
|
---|
| 78 | inline HepLorentzVector HepBoostY::col4() const {
|
---|
| 79 | return HepLorentzVector ( 0, beta()*gamma(), 0, gamma() );
|
---|
| 80 | }
|
---|
| 81 |
|
---|
| 82 | inline HepLorentzVector HepBoostY::row1() const {
|
---|
| 83 | return HepLorentzVector ( col1() );
|
---|
| 84 | }
|
---|
| 85 | inline HepLorentzVector HepBoostY::row2() const {
|
---|
| 86 | return HepLorentzVector ( col2() );
|
---|
| 87 | }
|
---|
| 88 | inline HepLorentzVector HepBoostY::row3() const {
|
---|
| 89 | return HepLorentzVector ( col3() );
|
---|
| 90 | }
|
---|
| 91 | inline HepLorentzVector HepBoostY::row4() const {
|
---|
| 92 | return HepLorentzVector ( col4() );
|
---|
| 93 | }
|
---|
| 94 |
|
---|
| 95 | // ---------- Comparisons:
|
---|
| 96 |
|
---|
| 97 | inline int HepBoostY::compare( const HepBoostY & b ) const {
|
---|
| 98 | if (beta() < b.beta()) {
|
---|
| 99 | return -1;
|
---|
| 100 | } else if (beta() > b.beta()) {
|
---|
| 101 | return 1;
|
---|
| 102 | } else {
|
---|
| 103 | return 0;
|
---|
| 104 | }
|
---|
| 105 | }
|
---|
| 106 |
|
---|
| 107 | inline bool HepBoostY::operator == ( const HepBoostY & b ) const {
|
---|
| 108 | return beta_ == b.beta_;
|
---|
| 109 | }
|
---|
| 110 | inline bool HepBoostY::operator != ( const HepBoostY & b ) const {
|
---|
| 111 | return beta_ != b.beta_;
|
---|
| 112 | }
|
---|
| 113 | inline bool HepBoostY::operator <= ( const HepBoostY & b ) const {
|
---|
| 114 | return beta_ <= b.beta_;
|
---|
| 115 | }
|
---|
| 116 | inline bool HepBoostY::operator >= ( const HepBoostY & b ) const {
|
---|
| 117 | return beta_ >= b.beta_;
|
---|
| 118 | }
|
---|
| 119 | inline bool HepBoostY::operator < ( const HepBoostY & b ) const {
|
---|
| 120 | return beta_ < b.beta_;
|
---|
| 121 | }
|
---|
| 122 | inline bool HepBoostY::operator > ( const HepBoostY & b ) const {
|
---|
| 123 | return beta_ > b.beta_;
|
---|
| 124 | }
|
---|
| 125 |
|
---|
| 126 |
|
---|
| 127 | inline bool HepBoostY::isIdentity() const {
|
---|
| 128 | return ( beta() == 0 );
|
---|
| 129 | }
|
---|
| 130 |
|
---|
| 131 | inline double HepBoostY::distance2( const HepBoostY & b ) const {
|
---|
| 132 | double d = beta()*gamma() - b.beta()*b.gamma();
|
---|
| 133 | return d*d;
|
---|
| 134 | }
|
---|
| 135 |
|
---|
| 136 | inline double HepBoostY::howNear(const HepBoostY & b) const {
|
---|
| 137 | return std::sqrt(distance2(b)); }
|
---|
| 138 | inline double HepBoostY::howNear(const HepBoost & b) const {
|
---|
| 139 | return std::sqrt(distance2(b)); }
|
---|
| 140 | inline double HepBoostY::howNear(const HepRotation & r) const {
|
---|
| 141 | return std::sqrt(distance2(r)); }
|
---|
| 142 | inline double HepBoostY::howNear(const HepLorentzRotation & lt) const {
|
---|
| 143 | return std::sqrt(distance2(lt)); }
|
---|
| 144 |
|
---|
| 145 | inline bool HepBoostY::isNear(const HepBoostY & b,
|
---|
| 146 | double epsilon) const {
|
---|
| 147 | return (distance2(b) <= epsilon*epsilon);
|
---|
| 148 | }
|
---|
| 149 | inline bool HepBoostY::isNear(const HepBoost & b,
|
---|
| 150 | double epsilon) const {
|
---|
| 151 | return (distance2(b) <= epsilon*epsilon);
|
---|
| 152 | }
|
---|
| 153 |
|
---|
| 154 | // ---------- Properties:
|
---|
| 155 |
|
---|
| 156 | double HepBoostY::norm2() const {
|
---|
| 157 | register double bg = beta_*gamma_;
|
---|
| 158 | return bg*bg;
|
---|
| 159 | }
|
---|
| 160 |
|
---|
| 161 | // ---------- Application:
|
---|
| 162 |
|
---|
| 163 | inline HepLorentzVector
|
---|
| 164 | HepBoostY::operator * (const HepLorentzVector & p) const {
|
---|
| 165 | double bg = beta_*gamma_;
|
---|
| 166 | return HepLorentzVector( p.x(),
|
---|
| 167 | gamma_*p.y() + bg*p.t(),
|
---|
| 168 | p.z(),
|
---|
| 169 | gamma_*p.t() + bg*p.y());
|
---|
| 170 | }
|
---|
| 171 |
|
---|
| 172 | HepLorentzVector HepBoostY::operator() (const HepLorentzVector & w) const {
|
---|
| 173 | return operator*(w);
|
---|
| 174 | }
|
---|
| 175 |
|
---|
| 176 | // ---------- Operations in the group of 4-Rotations
|
---|
| 177 |
|
---|
| 178 | inline HepBoostY HepBoostY::inverse() const {
|
---|
| 179 | return HepBoostY( -beta(), gamma() );
|
---|
| 180 | }
|
---|
| 181 |
|
---|
| 182 | inline HepBoostY inverseOf ( const HepBoostY & b ) {
|
---|
| 183 | return HepBoostY( -b.beta(), b.gamma());
|
---|
| 184 | }
|
---|
| 185 |
|
---|
| 186 | inline HepBoostY & HepBoostY::invert() {
|
---|
| 187 | beta_ = -beta_;
|
---|
| 188 | return *this;
|
---|
| 189 | }
|
---|
| 190 |
|
---|
| 191 | // ---------- Tolerance:
|
---|
| 192 |
|
---|
| 193 | inline double HepBoostY::getTolerance() {
|
---|
| 194 | return Hep4RotationInterface::tolerance;
|
---|
| 195 | }
|
---|
| 196 | inline double HepBoostY::setTolerance(double tol) {
|
---|
| 197 | return Hep4RotationInterface::setTolerance(tol);
|
---|
| 198 | }
|
---|
| 199 |
|
---|
| 200 | } // namespace CLHEP
|
---|