CLHEP VERSION Reference Documentation
CLHEP Home Page CLHEP Documentation CLHEP Bug Reports |
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 implementation of methods of the HepRotation class which 00007 // were introduced when ZOOM PhysicsVectors was merged in, which might cause 00008 // pulling in of LorentzTransformation related code units. 00009 // 00010 00011 #ifdef GNUPRAGMA 00012 #pragma implementation 00013 #endif 00014 00015 #include "CLHEP/Vector/defs.h" 00016 #include "CLHEP/Vector/Rotation.h" 00017 #include "CLHEP/Vector/LorentzRotation.h" 00018 00019 #include <cmath> 00020 00021 namespace CLHEP { 00022 00023 // ---------- distance2 and related member functions: 00024 // 00025 // WHy do we have forms for HepLorentzRotation and HepBoost but not for 00026 // HepBoostX, HepBoostY, HepBoostZ? Because the latter can be gotten by 00027 // implicit conversion to HepBoost; but if we just had HepLorentzRotation 00028 // then this would involve double conversion when HepBoostX was used. 00029 00030 double HepRotation::distance2( const HepLorentzRotation & lt ) const { 00031 HepAxisAngle a; 00032 Hep3Vector b; 00033 lt.decompose(b, a); 00034 double bet = b.beta(); 00035 double bet2 = bet*bet; 00036 HepRotation r(a); 00037 return bet2/(1-bet2) + distance2(r); 00038 } 00039 00040 double HepRotation::distance2( const HepBoost & lt ) const { 00041 return distance2( HepLorentzRotation(lt)); 00042 } 00043 00044 double HepRotation::howNear( const HepLorentzRotation & lt ) const { 00045 return std::sqrt( distance2( lt ) ); 00046 } 00047 00048 double HepRotation::howNear( const HepBoost & lt ) const { 00049 return std::sqrt( distance2( lt ) ); 00050 } 00051 00052 bool HepRotation::isNear( const HepLorentzRotation & lt, 00053 double epsilon) const { 00054 return distance2( lt ) <= epsilon*epsilon; 00055 } 00056 00057 bool HepRotation::isNear( const HepBoost & lt, 00058 double epsilon) const { 00059 return distance2( lt ) <= epsilon*epsilon; 00060 } 00061 00062 } // namespace CLHEP 00063