2// ---------------------------------------------------------------------------
4// This file is a part of the CLHEP - a Class Library for High Energy Physics.
6// This is the definitions of the inline member functions of the
12// Put commonly used accessors as early as possible to avoid inlining misses:
14inline double HepRotation::xx() const { return rxx; }
15inline double HepRotation::xy() const { return rxy; }
16inline double HepRotation::xz() const { return rxz; }
17inline double HepRotation::yx() const { return ryx; }
18inline double HepRotation::yy() const { return ryy; }
19inline double HepRotation::yz() const { return ryz; }
20inline double HepRotation::zx() const { return rzx; }
21inline double HepRotation::zy() const { return rzy; }
22inline double HepRotation::zz() const { return rzz; }
24inline HepRep3x3 HepRotation::rep3x3() const {
25 return HepRep3x3 ( rxx, rxy, rxz,
30inline double HepRotation::xt() const { return 0.0; }
31inline double HepRotation::yt() const { return 0.0; }
32inline double HepRotation::zt() const { return 0.0; }
33inline double HepRotation::tx() const { return 0.0; }
34inline double HepRotation::ty() const { return 0.0; }
35inline double HepRotation::tz() const { return 0.0; }
36inline double HepRotation::tt() const { return 1.0; }
38inline HepRep4x4 HepRotation::rep4x4() const {
39 return HepRep4x4 ( rxx, rxy, rxz, 0.0,
47inline HepRotation::HepRotation() : rxx(1.0), rxy(0.0), rxz(0.0),
48 ryx(0.0), ryy(1.0), ryz(0.0),
49 rzx(0.0), rzy(0.0), rzz(1.0) {}
51inline HepRotation::HepRotation(const HepRotation & m1) :
52 rxx(m1.rxx), rxy(m1.rxy), rxz(m1.rxz),
53 ryx(m1.ryx), ryy(m1.ryy), ryz(m1.ryz),
54 rzx(m1.rzx), rzy(m1.rzy), rzz(m1.rzz) {}
56inline HepRotation::HepRotation
57 (double mxx, double mxy, double mxz,
58 double myx, double myy, double myz,
59 double mzx, double mzy, double mzz) :
60 rxx(mxx), rxy(mxy), rxz(mxz),
61 ryx(myx), ryy(myy), ryz(myz),
62 rzx(mzx), rzy(mzy), rzz(mzz) {}
64inline HepRotation::HepRotation ( const HepRep3x3 & m1 ) :
65 rxx(m1.xx_), rxy(m1.xy_), rxz(m1.xz_),
66 ryx(m1.yx_), ryy(m1.yy_), ryz(m1.yz_),
67 rzx(m1.zx_), rzy(m1.zy_), rzz(m1.zz_) {}
69inline HepRotation::HepRotation(const HepRotationX & rx) :
70 rxx(1.0), rxy(0.0), rxz(0.0),
71 ryx(0.0), ryy(rx.yy()), ryz(rx.yz()),
72 rzx(0.0), rzy(rx.zy()), rzz(rx.zz()) {}
74inline HepRotation::HepRotation(const HepRotationY & ry) :
75 rxx(ry.xx()), rxy(0.0), rxz(ry.xz()),
76 ryx(0.0), ryy(1.0), ryz(0.0),
77 rzx(ry.zx()), rzy(0.0), rzz(ry.zz()) {}
79inline HepRotation::HepRotation(const HepRotationZ & rz) :
80 rxx(rz.xx()), rxy(rz.xy()), rxz(0.0),
81 ryx(rz.yx()), ryy(rz.yy()), ryz(0.0),
82 rzx(0.0), rzy(0.0), rzz(1.0) {}
84inline HepRotation::~HepRotation() {}
88inline HepRotation::HepRotation_row::HepRotation_row
89(const HepRotation & r, int i) : rr(r), ii(i) {}
91inline double HepRotation::HepRotation_row::operator [] (int jj) const {
96const HepRotation::HepRotation_row HepRotation::operator [] (int i) const {
97 return HepRotation_row(*this, i);
100inline Hep3Vector HepRotation::colX() const
101 { return Hep3Vector ( rxx, ryx, rzx ); }
102inline Hep3Vector HepRotation::colY() const
103 { return Hep3Vector ( rxy, ryy, rzy ); }
104inline Hep3Vector HepRotation::colZ() const
105 { return Hep3Vector ( rxz, ryz, rzz ); }
107inline Hep3Vector HepRotation::rowX() const
108 { return Hep3Vector ( rxx, rxy, rxz ); }
109inline Hep3Vector HepRotation::rowY() const
110 { return Hep3Vector ( ryx, ryy, ryz ); }
111inline Hep3Vector HepRotation::rowZ() const
112 { return Hep3Vector ( rzx, rzy, rzz ); }
114inline HepLorentzVector HepRotation::col1() const
115 { return HepLorentzVector (colX(), 0); }
116inline HepLorentzVector HepRotation::col2() const
117 { return HepLorentzVector (colY(), 0); }
118inline HepLorentzVector HepRotation::col3() const
119 { return HepLorentzVector (colZ(), 0); }
120inline HepLorentzVector HepRotation::col4() const
121 { return HepLorentzVector (0,0,0,1); }
122inline HepLorentzVector HepRotation::row1() const
123 { return HepLorentzVector (rowX(), 0); }
124inline HepLorentzVector HepRotation::row2() const
125 { return HepLorentzVector (rowY(), 0); }
126inline HepLorentzVector HepRotation::row3() const
127 { return HepLorentzVector (rowZ(), 0); }
128inline HepLorentzVector HepRotation::row4() const
129 { return HepLorentzVector (0,0,0,1); }
131inline double HepRotation::getPhi () const { return phi(); }
132inline double HepRotation::getTheta() const { return theta(); }
133inline double HepRotation::getPsi () const { return psi(); }
134inline double HepRotation::getDelta() const { return delta(); }
135inline Hep3Vector HepRotation::getAxis () const { return axis(); }
137inline HepRotation & HepRotation::operator = (const HepRotation & m1) {
150inline HepRotation & HepRotation::set(const HepRep3x3 & m1) {
163inline HepRotation & HepRotation::set(const HepRotationX & r) {
164 return (set (r.rep3x3()));
166inline HepRotation & HepRotation::set(const HepRotationY & r) {
167 return (set (r.rep3x3()));
169inline HepRotation & HepRotation::set(const HepRotationZ & r) {
170 return (set (r.rep3x3()));
173inline HepRotation & HepRotation::operator= (const HepRotationX & r) {
174 return (set (r.rep3x3()));
176inline HepRotation & HepRotation::operator= (const HepRotationY & r) {
177 return (set (r.rep3x3()));
179inline HepRotation & HepRotation::operator= (const HepRotationZ & r) {
180 return (set (r.rep3x3()));
183inline Hep3Vector HepRotation::operator * (const Hep3Vector & p) const {
184 return Hep3Vector(rxx*p.x() + rxy*p.y() + rxz*p.z(),
185 ryx*p.x() + ryy*p.y() + ryz*p.z(),
186 rzx*p.x() + rzy*p.y() + rzz*p.z());
187// This is identical to the code in the CLHEP 1.6 version
190inline Hep3Vector HepRotation::operator () (const Hep3Vector & p) const {
194 return Hep3Vector(rxx*x + rxy*y + rxz*z,
195 ryx*x + ryy*y + ryz*z,
196 rzx*x + rzy*y + rzz*z);
199inline HepLorentzVector
200HepRotation::operator () (const HepLorentzVector & w) const {
201 return HepLorentzVector( operator() (w.vect()), w.t() );
204inline HepLorentzVector HepRotation::operator *
205 (const HepLorentzVector & p) const {
206 return operator()(p);
209inline HepRotation HepRotation::operator* (const HepRotation & r) const {
210 return HepRotation(rxx*r.rxx + rxy*r.ryx + rxz*r.rzx,
211 rxx*r.rxy + rxy*r.ryy + rxz*r.rzy,
212 rxx*r.rxz + rxy*r.ryz + rxz*r.rzz,
213 ryx*r.rxx + ryy*r.ryx + ryz*r.rzx,
214 ryx*r.rxy + ryy*r.ryy + ryz*r.rzy,
215 ryx*r.rxz + ryy*r.ryz + ryz*r.rzz,
216 rzx*r.rxx + rzy*r.ryx + rzz*r.rzx,
217 rzx*r.rxy + rzy*r.ryy + rzz*r.rzy,
218 rzx*r.rxz + rzy*r.ryz + rzz*r.rzz );
221inline HepRotation HepRotation::operator * (const HepRotationX & rx) const {
222 double yy1 = rx.yy();
223 double yz1 = rx.yz();
227 rxx, rxy*yy1 + rxz*zy1, rxy*yz1 + rxz*zz1,
228 ryx, ryy*yy1 + ryz*zy1, ryy*yz1 + ryz*zz1,
229 rzx, rzy*yy1 + rzz*zy1, rzy*yz1 + rzz*zz1 );
232inline HepRotation HepRotation::operator * (const HepRotationY & ry) const {
233 double xx1 = ry.xx();
234 double xz1 = ry.xz();
238 rxx*xx1 + rxz*zx1, rxy, rxx*xz1 + rxz*zz1,
239 ryx*xx1 + ryz*zx1, ryy, ryx*xz1 + ryz*zz1,
240 rzx*xx1 + rzz*zx1, rzy, rzx*xz1 + rzz*zz1 );
243inline HepRotation HepRotation::operator * (const HepRotationZ & rz) const {
244 double xx1 = rz.xx();
245 double xy1 = rz.xy();
249 rxx*xx1 + rxy*yx1, rxx*xy1 + rxy*yy1, rxz,
250 ryx*xx1 + ryy*yx1, ryx*xy1 + ryy*yy1, ryz,
251 rzx*xx1 + rzy*yx1, rzx*xy1 + rzy*yy1, rzz );
255inline HepRotation & HepRotation::operator *= (const HepRotation & r) {
256 return *this = (*this) * (r);
259inline HepRotation & HepRotation::operator *= (const HepRotationX & r) {
260 return *this = (*this) * (r); }
261inline HepRotation & HepRotation::operator *= (const HepRotationY & r) {
262 return *this = (*this) * (r); }
263inline HepRotation & HepRotation::operator *= (const HepRotationZ & r) {
264 return *this = (*this) * (r); }
266inline HepRotation & HepRotation::transform(const HepRotation & r) {
267 return *this = r * (*this);
270inline HepRotation & HepRotation::transform(const HepRotationX & r) {
271 return *this = r * (*this); }
272inline HepRotation & HepRotation::transform(const HepRotationY & r) {
273 return *this = r * (*this); }
274inline HepRotation & HepRotation::transform(const HepRotationZ & r) {
275 return *this = r * (*this); }
277inline HepRotation HepRotation::inverse() const {
278 return HepRotation( rxx, ryx, rzx,
283inline HepRotation inverseOf (const HepRotation & r) {
287inline HepRotation & HepRotation::invert() {
288 return *this=inverse();
291inline HepRotation & HepRotation::rotate
292 (double ddelta, const Hep3Vector * p) {
293 return rotate(ddelta, *p);
296inline bool HepRotation::operator== ( const HepRotation & r ) const {
297 return ( rxx==r.rxx && rxy==r.rxy && rxz==r.rxz &&
298 ryx==r.ryx && ryy==r.ryy && ryz==r.ryz &&
299 rzx==r.rzx && rzy==r.rzy && rzz==r.rzz );
301inline bool HepRotation::operator!= ( const HepRotation & r ) const {
302 return ! operator==(r);
304inline bool HepRotation::operator< ( const HepRotation & r ) const
305 { return compare(r)< 0; }
306inline bool HepRotation::operator<=( const HepRotation & r ) const
307 { return compare(r)<=0; }
308inline bool HepRotation::operator>=( const HepRotation & r ) const
309 { return compare(r)>=0; }
310inline bool HepRotation::operator> ( const HepRotation & r ) const
311 { return compare(r)> 0; }
313inline double HepRotation::getTolerance() {
314 return Hep4RotationInterface::tolerance;
316inline double HepRotation::setTolerance(double tol) {
317 return Hep4RotationInterface::setTolerance(tol);
320inline HepRotation operator * (const HepRotationX & rx, const HepRotation & r){
321 HepRep3x3 mmm = r.rep3x3();
324 return HepRotation ( mmm.xx_, mmm.xy_, mmm.xz_,
325 c*mmm.yx_-ss*mmm.zx_, c*mmm.yy_-ss*mmm.zy_, c*mmm.yz_-ss*mmm.zz_,
326 ss*mmm.yx_+c*mmm.zx_, ss*mmm.yy_+c*mmm.zy_, ss*mmm.yz_+c*mmm.zz_ );
329inline HepRotation operator * (const HepRotationY & ry, const HepRotation & r){
330 HepRep3x3 mmm = r.rep3x3();
333 return HepRotation ( c*mmm.xx_+ss*mmm.zx_, c*mmm.xy_+ss*mmm.zy_, c*mmm.xz_+ss*mmm.zz_,
334 mmm.yx_, mmm.yy_, mmm.yz_,
335 -ss*mmm.xx_+c*mmm.zx_,-ss*mmm.xy_+c*mmm.zy_,-ss*mmm.xz_+c*mmm.zz_ );
338inline HepRotation operator * (const HepRotationZ & rz, const HepRotation & r){
339 HepRep3x3 mmm = r.rep3x3();
342 return HepRotation ( c*mmm.xx_-ss*mmm.yx_, c*mmm.xy_-ss*mmm.yy_, c*mmm.xz_-ss*mmm.yz_,
343 ss*mmm.xx_+c*mmm.yx_, ss*mmm.xy_+c*mmm.yy_, ss*mmm.xz_+c*mmm.yz_,
344 mmm.zx_, mmm.zy_, mmm.zz_ );