Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
RotationL.cc
Go to the documentation of this file.
1// -*- C++ -*-
2// ---------------------------------------------------------------------------
3//
4// This file is a part of the CLHEP - a Class Library for High Energy Physics.
5//
6// This is the implementation of methods of the HepRotation class which
7// were introduced when ZOOM PhysicsVectors was merged in, which might cause
8// pulling in of LorentzTransformation related code units.
9//
10
11#ifdef GNUPRAGMA
12#pragma implementation
13#endif
14
17
18#include <cmath>
19
20namespace CLHEP {
21
22// ---------- distance2 and related member functions:
23//
24// WHy do we have forms for HepLorentzRotation and HepBoost but not for
25// HepBoostX, HepBoostY, HepBoostZ? Because the latter can be gotten by
26// implicit conversion to HepBoost; but if we just had HepLorentzRotation
27// then this would involve double conversion when HepBoostX was used.
28
29double HepRotation::distance2( const HepLorentzRotation & lt ) const {
30 HepAxisAngle a;
31 Hep3Vector b;
32 lt.decompose(b, a);
33 double bet = b.beta();
34 double bet2 = bet*bet;
35 HepRotation r(a);
36 return bet2/(1-bet2) + distance2(r);
37}
38
39double HepRotation::distance2( const HepBoost & lt ) const {
40 return distance2( HepLorentzRotation(lt));
41}
42
43double HepRotation::howNear( const HepLorentzRotation & lt ) const {
44 return std::sqrt( distance2( lt ) );
45}
46
47double HepRotation::howNear( const HepBoost & lt ) const {
48 return std::sqrt( distance2( lt ) );
49}
50
52 double epsilon) const {
53 return distance2( lt ) <= epsilon*epsilon;
54}
55
57 double epsilon) const {
58 return distance2( lt ) <= epsilon*epsilon;
59}
60
61} // namespace CLHEP
62
double beta() const
Definition: SpaceVectorP.cc:30
void decompose(Hep3Vector &boost, HepAxisAngle &rotation) const
double distance2(const HepRotation &r) const
Definition: RotationP.cc:33
bool isNear(const HepRotation &r, double epsilon=Hep4RotationInterface::tolerance) const
Definition: RotationP.cc:45
double howNear(const HepRotation &r) const
Definition: RotationP.cc:41
Definition: DoubConv.h:17