11 #pragma implementation
14 #include "CLHEP/Vector/RotationX.h"
15 #include "CLHEP/Vector/AxisAngle.h"
16 #include "CLHEP/Vector/EulerAngles.h"
17 #include "CLHEP/Vector/LorentzRotation.h"
18 #include "CLHEP/Units/PhysicalConstants.h"
27 if (std::abs(x) <= 1.0)
return std::acos(x);
31 HepRotationX::HepRotationX(
double ddelta) :
32 its_d(proper(ddelta)), its_s(
std::sin(ddelta)), its_c(
std::cos(ddelta))
35 HepRotationX & HepRotationX::set (
double ddelta ) {
36 its_d = proper(ddelta);
37 its_s = std::sin(its_d);
38 its_c = std::cos(its_d);
42 double HepRotationX::phi()
const {
43 if ( (its_d > 0) && (its_d <
CLHEP::pi) ) {
50 double HepRotationX::theta()
const {
51 return std::fabs( its_d );
54 double HepRotationX::psi()
const {
55 if ( (its_d > 0) && (its_d <
CLHEP::pi) ) {
62 HepEulerAngles HepRotationX::eulerAngles()
const {
63 return HepEulerAngles( phi(), theta(), psi() );
74 double HepRotationX::phiX()
const {
75 return (yx() == 0.0 && xx() == 0.0) ? 0.0 : std::atan2(yx(),xx());
79 double HepRotationX::phiY()
const {
80 return (yy() == 0.0 && xy() == 0.0) ? 0.0 : std::atan2(yy(),xy());
84 double HepRotationX::phiZ()
const {
85 return (yz() == 0.0 && xz() == 0.0) ? 0.0 : std::atan2(yz(),xz());
89 double HepRotationX::thetaX()
const {
94 double HepRotationX::thetaY()
const {
98 double HepRotationX::thetaZ()
const {
103 void HepRotationX::setDelta (
double ddelta ) {
107 void HepRotationX::decompose
108 (HepAxisAngle & rotation, Hep3Vector & boost)
const {
110 rotation = axisAngle();
113 void HepRotationX::decompose
114 (Hep3Vector & boost, HepAxisAngle & rotation)
const {
116 rotation = axisAngle();
119 void HepRotationX::decompose
120 (HepRotation & rotation, HepBoost & boost)
const {
122 rotation = HepRotation(*
this);
125 void HepRotationX::decompose
126 (HepBoost & boost, HepRotation & rotation)
const {
128 rotation = HepRotation(*
this);
131 double HepRotationX::distance2(
const HepRotationX & r )
const {
132 double answer = 2.0 * ( 1.0 - ( its_s * r.its_s + its_c * r.its_c ) ) ;
133 return (answer >= 0) ? answer : 0;
136 double HepRotationX::distance2(
const HepRotation & r )
const {
137 double sum = r.xx() +
138 yy() * r.yy() + yz() * r.yz()
139 + zy() * r.zy() + zz() * r.zz();
140 double answer = 3.0 - sum;
141 return (answer >= 0 ) ? answer : 0;
144 double HepRotationX::distance2(
const HepLorentzRotation & lt )
const {
148 double bet = b.beta();
149 double bet2 = bet*bet;
151 return bet2/(1-bet2) + distance2(r);
154 double HepRotationX::distance2(
const HepBoost & lt )
const {
155 return distance2( HepLorentzRotation(lt));
158 double HepRotationX::howNear(
const HepRotationX & r )
const {
159 return std::sqrt(distance2(r));
161 double HepRotationX::howNear(
const HepRotation & r )
const {
162 return std::sqrt(distance2(r));
164 double HepRotationX::howNear(
const HepBoost & b )
const {
165 return std::sqrt(distance2(b));
167 double HepRotationX::howNear(
const HepLorentzRotation & lt )
const {
168 return std::sqrt(distance2(lt));
170 bool HepRotationX::isNear(
const HepRotationX & r,
double epsilon)
const{
171 return (distance2(r) <= epsilon*epsilon);
173 bool HepRotationX::isNear(
const HepRotation & r,
double epsilon)
const{
174 return (distance2(r) <= epsilon*epsilon);
176 bool HepRotationX::isNear(
const HepBoost & lt,
double epsilon)
const {
177 return (distance2(lt) <= epsilon*epsilon);
180 bool HepRotationX::isNear(
const HepLorentzRotation & lt,
181 double epsilon )
const {
182 return (distance2(lt) <= epsilon*epsilon);
185 double HepRotationX::norm2()
const {
186 return 2.0 - 2.0 * its_c;
190 os <<
"\nRotation about X (" << its_d <<
191 ") [cos d = " << its_c <<
" sin d = " << its_s <<
"]\n";
std::vector< ExP01TrackerHit * > a
void print(G4double elem)
static double safe_acos(double x)
static constexpr double pi
double epsilon(double density, double temperature)