BoostZ.icc

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

Generated on Mon May 27 17:47:34 2013 for Geant4 by  doxygen 1.4.7