File indexing completed on 2025-01-30 10:03:32
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #include <cmath>
0011
0012 namespace CLHEP {
0013
0014
0015
0016 inline HepBoostX::HepBoostX() : beta_(0.0), gamma_(1.0) {}
0017
0018 inline HepBoostX::HepBoostX(const HepBoostX & b) :
0019 beta_ (b.beta_),
0020 gamma_(b.gamma_) {}
0021
0022 inline HepBoostX & HepBoostX::operator = (const HepBoostX & b) {
0023 beta_ = b.beta_;
0024 gamma_ = b.gamma_;
0025 return *this;
0026 }
0027
0028 inline HepBoostX::HepBoostX(double bbeta) { set(bbeta); }
0029
0030
0031 inline HepBoostX::HepBoostX( double bbeta, double ggamma ) :
0032 beta_(bbeta), gamma_(ggamma) {}
0033
0034
0035
0036 inline double HepBoostX::beta() const {
0037 return beta_;
0038 }
0039
0040 inline double HepBoostX::gamma() const {
0041 return gamma_;
0042 }
0043
0044 inline Hep3Vector HepBoostX::boostVector() const {
0045 return Hep3Vector( beta_, 0, 0 );
0046 }
0047
0048 inline Hep3Vector HepBoostX::getDirection() const {
0049 return Hep3Vector(1.0, 0.0, 0.0);
0050 }
0051
0052 inline double HepBoostX::xx() const { return gamma();}
0053 inline double HepBoostX::xy() const { return 0.0;}
0054 inline double HepBoostX::xz() const { return 0.0;}
0055 inline double HepBoostX::xt() const { return beta()*gamma();}
0056 inline double HepBoostX::yx() const { return 0.0;}
0057 inline double HepBoostX::yy() const { return 1.0;}
0058 inline double HepBoostX::yz() const { return 0.0;}
0059 inline double HepBoostX::yt() const { return 0.0;}
0060 inline double HepBoostX::zx() const { return 0.0;}
0061 inline double HepBoostX::zy() const { return 0.0;}
0062 inline double HepBoostX::zz() const { return 1.0;}
0063 inline double HepBoostX::zt() const { return 0.0;}
0064 inline double HepBoostX::tx() const { return beta()*gamma();}
0065 inline double HepBoostX::ty() const { return 0.0;}
0066 inline double HepBoostX::tz() const { return 0.0;}
0067 inline double HepBoostX::tt() const { return gamma();}
0068
0069 inline HepLorentzVector HepBoostX::col1() const {
0070 return HepLorentzVector ( gamma(), 0, 0, beta()*gamma() );
0071 }
0072 inline HepLorentzVector HepBoostX::col2() const {
0073 return HepLorentzVector ( 0, 1, 0, 0 );
0074 }
0075 inline HepLorentzVector HepBoostX::col3() const {
0076 return HepLorentzVector ( 0, 0, 1, 0 );
0077 }
0078 inline HepLorentzVector HepBoostX::col4() const {
0079 return HepLorentzVector ( beta()*gamma(), 0, 0, gamma() );
0080 }
0081
0082 inline HepLorentzVector HepBoostX::row1() const {
0083 return HepLorentzVector ( col1() );
0084 }
0085 inline HepLorentzVector HepBoostX::row2() const {
0086 return HepLorentzVector ( col2() );
0087 }
0088 inline HepLorentzVector HepBoostX::row3() const {
0089 return HepLorentzVector ( col3() );
0090 }
0091 inline HepLorentzVector HepBoostX::row4() const {
0092 return HepLorentzVector ( col4() );
0093 }
0094
0095
0096
0097 inline int HepBoostX::compare( const HepBoostX & b ) const {
0098 if (beta() < b.beta()) {
0099 return -1;
0100 } else if (beta() > b.beta()) {
0101 return 1;
0102 } else {
0103 return 0;
0104 }
0105 }
0106
0107 inline bool HepBoostX::operator == ( const HepBoostX & b ) const {
0108 return beta_ == b.beta_;
0109 }
0110 inline bool HepBoostX::operator != ( const HepBoostX & b ) const {
0111 return beta_ != b.beta_;
0112 }
0113 inline bool HepBoostX::operator <= ( const HepBoostX & b ) const {
0114 return beta_ <= b.beta_;
0115 }
0116 inline bool HepBoostX::operator >= ( const HepBoostX & b ) const {
0117 return beta_ >= b.beta_;
0118 }
0119 inline bool HepBoostX::operator < ( const HepBoostX & b ) const {
0120 return beta_ < b.beta_;
0121 }
0122 inline bool HepBoostX::operator > ( const HepBoostX & b ) const {
0123 return beta_ > b.beta_;
0124 }
0125
0126 inline bool HepBoostX::isIdentity() const {
0127 return ( beta() == 0 );
0128 }
0129
0130 inline double HepBoostX::distance2( const HepBoostX & b ) const {
0131 double d = beta()*gamma() - b.beta()*b.gamma();
0132 return d*d;
0133 }
0134
0135 inline double HepBoostX::howNear(const HepBoostX & b) const {
0136 return std::sqrt(distance2(b)); }
0137 inline double HepBoostX::howNear(const HepBoost & b) const {
0138 return std::sqrt(distance2(b)); }
0139 inline double HepBoostX::howNear(const HepRotation & r) const {
0140 return std::sqrt(distance2(r)); }
0141 inline double HepBoostX::howNear(const HepLorentzRotation & lt) const {
0142 return std::sqrt(distance2(lt)); }
0143
0144 inline bool HepBoostX::isNear(const HepBoostX & b,
0145 double epsilon) const {
0146 return (distance2(b) <= epsilon*epsilon);
0147 }
0148 inline bool HepBoostX::isNear(const HepBoost & b,
0149 double epsilon) const {
0150 return (distance2(b) <= epsilon*epsilon);
0151 }
0152
0153
0154
0155 inline double HepBoostX::norm2() const {
0156 double bg = beta_*gamma_;
0157 return bg*bg;
0158 }
0159
0160
0161
0162 inline HepLorentzVector
0163 HepBoostX::operator * (const HepLorentzVector & p) const {
0164 double bg = beta_*gamma_;
0165 return HepLorentzVector(gamma_*p.x() + bg*p.t(),
0166 p.y(),
0167 p.z(),
0168 gamma_*p.t() + bg*p.x());
0169 }
0170
0171 inline HepLorentzVector
0172 HepBoostX::operator() (const HepLorentzVector & w) const {
0173 return operator*(w);
0174 }
0175
0176
0177
0178 inline HepBoostX HepBoostX::inverse() const {
0179 return HepBoostX( -beta(), gamma() );
0180 }
0181
0182 inline HepBoostX inverseOf ( const HepBoostX & b ) {
0183 return HepBoostX( -b.beta(), b.gamma());
0184 }
0185
0186 inline HepBoostX & HepBoostX::invert() {
0187 beta_ = -beta_;
0188 return *this;
0189 }
0190
0191
0192
0193 inline double HepBoostX::getTolerance() {
0194 return Hep4RotationInterface::tolerance;
0195 }
0196 inline double HepBoostX::setTolerance(double tol) {
0197 return Hep4RotationInterface::setTolerance(tol);
0198 }
0199
0200 }