11 #pragma implementation
14 #include "CLHEP/Vector/RotationY.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 HepRotationY::HepRotationY(
double ddelta) :
32 its_d(proper(ddelta)), its_s(
std::sin(ddelta)), its_c(
std::cos(ddelta))
35 HepRotationY & HepRotationY::set (
double ddelta ) {
36 its_d = proper(ddelta);
37 its_s = std::sin(its_d);
38 its_c = std::cos(its_d);
42 double HepRotationY::phi()
const {
45 }
else if ( (its_d < 0) || (its_d ==
CLHEP::pi) ) {
52 double HepRotationY::theta()
const {
53 return std::fabs( its_d );
56 double HepRotationY::psi()
const {
59 }
else if ( (its_d < 0) || (its_d ==
CLHEP::pi) ) {
66 HepEulerAngles HepRotationY::eulerAngles()
const {
67 return HepEulerAngles( phi(), theta(), psi() );
78 double HepRotationY::phiX()
const {
79 return (yx() == 0.0 && xx() == 0.0) ? 0.0 : std::atan2(yx(),xx());
83 double HepRotationY::phiY()
const {
84 return (yy() == 0.0 && xy() == 0.0) ? 0.0 : std::atan2(yy(),xy());
88 double HepRotationY::phiZ()
const {
89 return (yz() == 0.0 && xz() == 0.0) ? 0.0 : std::atan2(yz(),xz());
93 double HepRotationY::thetaX()
const {
97 double HepRotationY::thetaY()
const {
102 double HepRotationY::thetaZ()
const {
107 void HepRotationY::setDelta (
double ddelta ) {
111 void HepRotationY::decompose
112 (HepAxisAngle & rotation, Hep3Vector & boost)
const {
114 rotation = axisAngle();
117 void HepRotationY::decompose
118 (Hep3Vector & boost, HepAxisAngle & rotation)
const {
120 rotation = axisAngle();
123 void HepRotationY::decompose
124 (HepRotation & rotation, HepBoost & boost)
const {
126 rotation = HepRotation(*
this);
129 void HepRotationY::decompose
130 (HepBoost & boost, HepRotation & rotation)
const {
132 rotation = HepRotation(*
this);
135 double HepRotationY::distance2(
const HepRotationY & r )
const {
136 double answer = 2.0 * ( 1.0 - ( its_s * r.its_s + its_c * r.its_c ) ) ;
137 return (answer >= 0) ? answer : 0;
140 double HepRotationY::distance2(
const HepRotation & r )
const {
141 double sum = xx() * r.xx() + xz() * r.xz()
143 + zx() * r.zx() + zz() * r.zz();
144 double answer = 3.0 - sum;
145 return (answer >= 0 ) ? answer : 0;
148 double HepRotationY::distance2(
const HepLorentzRotation & lt )
const {
152 double bet = b.beta();
153 double bet2 = bet*bet;
155 return bet2/(1-bet2) + distance2(r);
158 double HepRotationY::distance2(
const HepBoost & lt )
const {
159 return distance2( HepLorentzRotation(lt));
162 double HepRotationY::howNear(
const HepRotationY & r )
const {
163 return std::sqrt(distance2(r));
165 double HepRotationY::howNear(
const HepRotation & r )
const {
166 return std::sqrt(distance2(r));
168 double HepRotationY::howNear(
const HepBoost & lt )
const {
169 return std::sqrt(distance2(lt));
171 double HepRotationY::howNear(
const HepLorentzRotation & lt )
const {
172 return std::sqrt(distance2(lt));
174 bool HepRotationY::isNear(
const HepRotationY & r,
double epsilon)
const{
175 return (distance2(r) <= epsilon*epsilon);
177 bool HepRotationY::isNear(
const HepRotation & r,
double epsilon)
const {
178 return (distance2(r) <= epsilon*epsilon);
180 bool HepRotationY::isNear(
const HepBoost & lt,
double epsilon)
const {
181 return (distance2(lt) <= epsilon*epsilon);
183 bool HepRotationY::isNear(
const HepLorentzRotation & lt,
184 double epsilon)
const {
185 return (distance2(lt) <= epsilon*epsilon);
188 double HepRotationY::norm2()
const {
189 return 2.0 - 2.0 * its_c;
193 os <<
"\nRotation about Y (" << its_d <<
194 ") [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
static constexpr double halfpi
double epsilon(double density, double temperature)