Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:54:39

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