00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #include <cmath>
00011
00012 namespace CLHEP {
00013
00014
00015
00016 inline HepBoostX::HepBoostX() : beta_(0.0), gamma_(1.0) {}
00017
00018 inline HepBoostX::HepBoostX(const HepBoostX & b) :
00019 beta_ (b.beta_),
00020 gamma_(b.gamma_) {}
00021
00022 inline HepBoostX & HepBoostX::operator = (const HepBoostX & b) {
00023 beta_ = b.beta_;
00024 gamma_ = b.gamma_;
00025 return *this;
00026 }
00027
00028 inline HepBoostX::HepBoostX(double bbeta) { set(bbeta); }
00029
00030
00031 inline HepBoostX::HepBoostX( double bbeta, double ggamma ) :
00032 beta_(bbeta), gamma_(ggamma) {}
00033
00034
00035
00036 inline double HepBoostX::beta() const {
00037 return beta_;
00038 }
00039
00040 inline double HepBoostX::gamma() const {
00041 return gamma_;
00042 }
00043
00044 inline Hep3Vector HepBoostX::boostVector() const {
00045 return Hep3Vector( beta_, 0, 0 );
00046 }
00047
00048 inline Hep3Vector HepBoostX::getDirection() const {
00049 return Hep3Vector(1.0, 0.0, 0.0);
00050 }
00051
00052 inline double HepBoostX::xx() const { return gamma();}
00053 inline double HepBoostX::xy() const { return 0.0;}
00054 inline double HepBoostX::xz() const { return 0.0;}
00055 inline double HepBoostX::xt() const { return beta()*gamma();}
00056 inline double HepBoostX::yx() const { return 0.0;}
00057 inline double HepBoostX::yy() const { return 1.0;}
00058 inline double HepBoostX::yz() const { return 0.0;}
00059 inline double HepBoostX::yt() const { return 0.0;}
00060 inline double HepBoostX::zx() const { return 0.0;}
00061 inline double HepBoostX::zy() const { return 0.0;}
00062 inline double HepBoostX::zz() const { return 1.0;}
00063 inline double HepBoostX::zt() const { return 0.0;}
00064 inline double HepBoostX::tx() const { return beta()*gamma();}
00065 inline double HepBoostX::ty() const { return 0.0;}
00066 inline double HepBoostX::tz() const { return 0.0;}
00067 inline double HepBoostX::tt() const { return gamma();}
00068
00069 inline HepLorentzVector HepBoostX::col1() const {
00070 return HepLorentzVector ( gamma(), 0, 0, beta()*gamma() );
00071 }
00072 inline HepLorentzVector HepBoostX::col2() const {
00073 return HepLorentzVector ( 0, 1, 0, 0 );
00074 }
00075 inline HepLorentzVector HepBoostX::col3() const {
00076 return HepLorentzVector ( 0, 0, 1, 0 );
00077 }
00078 inline HepLorentzVector HepBoostX::col4() const {
00079 return HepLorentzVector ( beta()*gamma(), 0, 0, gamma() );
00080 }
00081
00082 inline HepLorentzVector HepBoostX::row1() const {
00083 return HepLorentzVector ( col1() );
00084 }
00085 inline HepLorentzVector HepBoostX::row2() const {
00086 return HepLorentzVector ( col2() );
00087 }
00088 inline HepLorentzVector HepBoostX::row3() const {
00089 return HepLorentzVector ( col3() );
00090 }
00091 inline HepLorentzVector HepBoostX::row4() const {
00092 return HepLorentzVector ( col4() );
00093 }
00094
00095
00096
00097 inline int HepBoostX::compare( const HepBoostX & b ) const {
00098 if (beta() < b.beta()) {
00099 return -1;
00100 } else if (beta() > b.beta()) {
00101 return 1;
00102 } else {
00103 return 0;
00104 }
00105 }
00106
00107 inline bool HepBoostX::operator == ( const HepBoostX & b ) const {
00108 return beta_ == b.beta_;
00109 }
00110 inline bool HepBoostX::operator != ( const HepBoostX & b ) const {
00111 return beta_ != b.beta_;
00112 }
00113 inline bool HepBoostX::operator <= ( const HepBoostX & b ) const {
00114 return beta_ <= b.beta_;
00115 }
00116 inline bool HepBoostX::operator >= ( const HepBoostX & b ) const {
00117 return beta_ >= b.beta_;
00118 }
00119 inline bool HepBoostX::operator < ( const HepBoostX & b ) const {
00120 return beta_ < b.beta_;
00121 }
00122 inline bool HepBoostX::operator > ( const HepBoostX & b ) const {
00123 return beta_ > b.beta_;
00124 }
00125
00126 inline bool HepBoostX::isIdentity() const {
00127 return ( beta() == 0 );
00128 }
00129
00130 inline double HepBoostX::distance2( const HepBoostX & b ) const {
00131 double d = beta()*gamma() - b.beta()*b.gamma();
00132 return d*d;
00133 }
00134
00135 inline double HepBoostX::howNear(const HepBoostX & b) const {
00136 return std::sqrt(distance2(b)); }
00137 inline double HepBoostX::howNear(const HepBoost & b) const {
00138 return std::sqrt(distance2(b)); }
00139 inline double HepBoostX::howNear(const HepRotation & r) const {
00140 return std::sqrt(distance2(r)); }
00141 inline double HepBoostX::howNear(const HepLorentzRotation & lt) const {
00142 return std::sqrt(distance2(lt)); }
00143
00144 inline bool HepBoostX::isNear(const HepBoostX & b,
00145 double epsilon) const {
00146 return (distance2(b) <= epsilon*epsilon);
00147 }
00148 inline bool HepBoostX::isNear(const HepBoost & b,
00149 double epsilon) const {
00150 return (distance2(b) <= epsilon*epsilon);
00151 }
00152
00153
00154
00155 inline double HepBoostX::norm2() const {
00156 register double bg = beta_*gamma_;
00157 return bg*bg;
00158 }
00159
00160
00161
00162 inline HepLorentzVector
00163 HepBoostX::operator * (const HepLorentzVector & p) const {
00164 double bg = beta_*gamma_;
00165 return HepLorentzVector(gamma_*p.x() + bg*p.t(),
00166 p.y(),
00167 p.z(),
00168 gamma_*p.t() + bg*p.x());
00169 }
00170
00171 inline HepLorentzVector
00172 HepBoostX::operator() (const HepLorentzVector & w) const {
00173 return operator*(w);
00174 }
00175
00176
00177
00178 inline HepBoostX HepBoostX::inverse() const {
00179 return HepBoostX( -beta(), gamma() );
00180 }
00181
00182 inline HepBoostX inverseOf ( const HepBoostX & b ) {
00183 return HepBoostX( -b.beta(), b.gamma());
00184 }
00185
00186 inline HepBoostX & HepBoostX::invert() {
00187 beta_ = -beta_;
00188 return *this;
00189 }
00190
00191
00192
00193 inline double HepBoostX::getTolerance() {
00194 return Hep4RotationInterface::tolerance;
00195 }
00196 inline double HepBoostX::setTolerance(double tol) {
00197 return Hep4RotationInterface::setTolerance(tol);
00198 }
00199
00200 }