1 /***************************************************************************
5 * Author: Brian Lasiuk, Thomas Ullrich, April 1998
6 ***************************************************************************
10 * Remarks: Since not all compilers support member templates
11 * we have to specialize the templated member on these
12 * platforms. If member templates are not supported the
13 * ST_NO_MEMBER_TEMPLATES flag has to be set. tu.
15 ***************************************************************************
18 * Revision 1.1.1.1 2007/03/07 10:14:49 mchojnacki
19 * First version on CVS
21 * Revision 1.15 2005/09/22 20:09:20 fisyak
22 * Make AliFmLorentzVector persistent
24 * Revision 1.14 2005/07/19 22:27:11 perev
27 * Revision 1.13 2005/07/06 18:49:57 fisyak
28 * Replace AliFmHelixD, AliFmLorentzVectorD,AliFmLorentzVectorF,AliFmMatrixD,AliFmMatrixF,AliFmPhysicalHelixD,AliFmThreeVectorD,AliFmThreeVectorF by templated version
30 * Revision 1.12 2005/03/28 06:03:41 perev
33 * Revision 1.11 2004/12/02 20:07:32 fine
34 * define the valid method for both flavor of AliFmThreeVector
36 * Revision 1.10 2003/10/30 20:06:46 perev
37 * Check of quality added
39 * Revision 1.9 2003/09/02 17:59:35 perev
40 * gcc 3.2 updates + WarnOff
42 * Revision 1.8 2002/06/21 17:47:37 genevb
45 * Revision 1.7 2000/01/04 19:56:05 ullrich
46 * Added cpp macro for CINT.
48 * Revision 1.6 1999/12/21 15:14:31 ullrich
49 * Modified to cope with new compiler version on Sun (CC5.0).
51 * Revision 1.5 1999/10/15 15:46:54 ullrich
52 * Changed output format in operator<<
54 * Revision 1.4 1999/06/04 18:00:05 ullrich
55 * Added new constructor which takes C-style array as argument.
56 * New operators operator() and operator[] which can be used
59 * Revision 1.3 1999/02/17 11:42:19 ullrich
60 * Removed specialization for 'long double'.
62 * Revision 1.2 1999/02/14 23:11:48 fisyak
65 * Revision 1.1 1999/01/30 03:59:05 fisyak
66 * Root Version of AliFmarClassLibrary
68 * Revision 1.1 1999/01/23 00:28:04 ullrich
71 **************************************************************************/
72 #ifndef ST_THREE_VECTOR_HH
73 #define ST_THREE_VECTOR_HH
84 #if defined (__SUNPRO_CC) && __SUNPRO_CC < 0x500
87 #ifndef ST_NO_EXCEPTIONS
89 # if !defined(ST_NO_NAMESPACES)
90 using std::out_of_range;
99 class TRootIOCtor;//nic nie rozumiem
103 template<class T> class AliFmThreeVector {
105 AliFmThreeVector(T = 0, T = 0, T = 0);
106 // ROOT_VERSION(5,03,01)
107 #if ROOT_VERSION_CODE >= 328449
108 AliFmThreeVector(TRootIOCtor*) : mX1(0), mX2(0), mX3(0) {}
110 virtual ~AliFmThreeVector();
112 #ifndef ST_NO_MEMBER_TEMPLATES
113 template<class X> AliFmThreeVector(const AliFmThreeVector<X>&);
114 template<class X> AliFmThreeVector(const X*);
115 template<class X> AliFmThreeVector<T>& operator=(const AliFmThreeVector<X>&);
116 // AliFmThreeVector(const AliFmThreeVector<T>&); use default
117 // AliFmThreeVector<T>& operator=(const AliFmThreeVector<T>&); use default
119 AliFmThreeVector(const AliFmThreeVector<float>&);
120 AliFmThreeVector(const AliFmThreeVector<double>&);
122 AliFmThreeVector(const float*);
123 AliFmThreeVector(const double*);
125 AliFmThreeVector<T>& operator=(const AliFmThreeVector<float>&);
126 AliFmThreeVector<T>& operator=(const AliFmThreeVector<double>&);
136 void setMagnitude(T);
149 T pseudoRapidity() const;
150 T operator() (size_t) const;
151 T operator[] (size_t) const;
153 T& operator() (size_t);
154 T& operator[] (size_t);
156 T massHypothesis(T mass) const;
158 AliFmThreeVector<T> unit() const;
159 AliFmThreeVector<T> orthogonal() const;
165 AliFmThreeVector<T> operator- ();
166 AliFmThreeVector<T> operator+ ();
167 AliFmThreeVector<T>& operator*= (double);
168 AliFmThreeVector<T>& operator/= (double);
169 AliFmThreeVector<T> pseudoProduct(double,double,double) const;
171 #ifndef ST_NO_MEMBER_TEMPLATES
172 template<class X> T angle(const AliFmThreeVector<X>&) const;
173 template<class X> AliFmThreeVector<T> cross(const AliFmThreeVector<X>&) const;
174 template<class X> T dot (const AliFmThreeVector<X>&) const;
175 template<class X> AliFmThreeVector<T> pseudoProduct(const AliFmThreeVector<X>&) const;
177 template<class X> bool operator == (const AliFmThreeVector<X>& v) const;
178 template<class X> bool operator != (const AliFmThreeVector<X>& v) const;
180 template<class X> AliFmThreeVector<T>& operator+= (const AliFmThreeVector<X>&);
181 template<class X> AliFmThreeVector<T>& operator-= (const AliFmThreeVector<X>&);
183 T angle(const AliFmThreeVector<float>&) const;
184 AliFmThreeVector<T> cross(const AliFmThreeVector<float>&) const;
185 T dot (const AliFmThreeVector<float>&) const;
186 AliFmThreeVector<T> pseudoProduct(const AliFmThreeVector<float>&) const;
188 T angle(const AliFmThreeVector<double>&) const;
189 T dot (const AliFmThreeVector<double>&) const;
190 AliFmThreeVector<T> cross(const AliFmThreeVector<double>&) const;
191 AliFmThreeVector<T> pseudoProduct(const AliFmThreeVector<double>&) const;
193 bool operator == (const AliFmThreeVector<float>& v) const;
194 bool operator != (const AliFmThreeVector<float>& v) const;
195 AliFmThreeVector<T>& operator+= (const AliFmThreeVector<float>&);
196 AliFmThreeVector<T>& operator-= (const AliFmThreeVector<float>&);
198 bool operator == (const AliFmThreeVector<double>& v) const;
199 bool operator != (const AliFmThreeVector<double>& v) const;
200 AliFmThreeVector<T>& operator+= (const AliFmThreeVector<double>&);
201 AliFmThreeVector<T>& operator-= (const AliFmThreeVector<double>&);
203 int valid(double world = 1.e+5) const;
204 int bad(double world = 1.e+5) const;
208 ClassDef(AliFmThreeVector,3)
209 #endif /* __ROOT__ */
214 // Implementation of member functions
217 inline AliFmThreeVector<T>::AliFmThreeVector(T x, T y, T z)
218 : mX1(x), mX2(y), mX3(z) {/* nop */}
220 inline AliFmThreeVector<T>::~AliFmThreeVector() {/* nop */}
223 inline void AliFmThreeVector<T>::setX(T x) {mX1 = x;}
226 inline void AliFmThreeVector<T>::setY(T y) {mX2 = y;}
229 inline void AliFmThreeVector<T>::setZ(T z) {mX3 = z;}
232 void AliFmThreeVector<T>::setPhi(T angle)
234 double r = magnitude();
237 mX1 = r*sin(th)*cos(angle);
238 mX2 = r*sin(th)*sin(angle);
242 void AliFmThreeVector<T>::setTheta(T angle)
244 double r = magnitude();
247 mX1 = r*sin(angle)*cos(ph);
248 mX2 = r*sin(angle)*sin(ph);
253 void AliFmThreeVector<T>::setMagnitude(T r)
258 mX1 = r*sin(th)*cos(ph);
259 mX2 = r*sin(th)*sin(ph);
264 void AliFmThreeVector<T>::setMag(T mag)
270 inline T AliFmThreeVector<T>::x() const {return mX1;}
273 inline T AliFmThreeVector<T>::y() const {return mX2;}
276 inline T AliFmThreeVector<T>::z() const {return mX3;}
279 inline T AliFmThreeVector<T>::theta() const
281 return acos(cosTheta());
285 inline T AliFmThreeVector<T>::cosTheta() const
287 return mX3/(mag()+1e-20);
291 inline T AliFmThreeVector<T>::phi() const
293 return atan2(mX2,mX1);
297 inline T AliFmThreeVector<T>::pseudoRapidity() const
300 // change code to more optimal:
302 // return 0.5*::log( (m+z())/(m-z()) );
303 double tmp = tan(theta()/2.); if (tmp <=0.) return 1e20;
308 inline AliFmThreeVector<T> AliFmThreeVector<T>::unit() const
310 double tmp = mag(); if (tmp<=0.) tmp = 1e-20;
315 T AliFmThreeVector<T>::massHypothesis(T mass) const
317 return ::sqrt((*this)*(*this) + mass*mass);
321 AliFmThreeVector<T> AliFmThreeVector<T>::orthogonal() const
323 // Direct copy from CLHEP--it is probably better to
324 // use your own dot/cross product code...
325 double x = (mX1 < 0.0) ? -mX1 : mX1;
326 double y = (mX2 < 0.0) ? -mX2 : mX2;
327 double z = (mX3 < 0.0) ? -mX3 : mX3;
330 return x < z ? AliFmThreeVector<T>(0,mX3,-mX2) : AliFmThreeVector<T>(mX2,-mX1,0);
332 return mX2 < mX3 ? AliFmThreeVector<T>(-mX3,0,mX1) : AliFmThreeVector<T>(mX2,-mX1,0);
336 void AliFmThreeVector<T>::rotateX(T angle)
338 // may in the future make use of the AliFmRotation class!
339 double yPrime = cos(angle)*mX2 - sin(angle)*mX3;
340 double zPrime = sin(angle)*mX2 + cos(angle)*mX3;
347 void AliFmThreeVector<T>::rotateY(T angle)
349 // may in the future make use of the AliFmRotation class!
350 double zPrime = cos(angle)*mX3 - sin(angle)*mX1;
351 double xPrime = sin(angle)*mX3 + cos(angle)*mX1;
358 void AliFmThreeVector<T>::rotateZ(T angle)
360 // may in the future make use of the AliFmRotation class!
361 double xPrime = cos(angle)*mX1 - sin(angle)*mX2;
362 double yPrime = sin(angle)*mX1 + cos(angle)*mX2;
369 inline T AliFmThreeVector<T>::perp() const
371 return ::sqrt(mX1*mX1+mX2*mX2);
375 inline T AliFmThreeVector<T>::perp2() const
377 return mX1*mX1+mX2*mX2;
381 inline T AliFmThreeVector<T>::magnitude() const
387 inline T AliFmThreeVector<T>::mag() const
389 return ::sqrt(mX1*mX1+mX2*mX2+mX3*mX3);
393 inline T AliFmThreeVector<T>::mag2() const
395 return mX1*mX1+mX2*mX2+mX3*mX3;
399 inline T AliFmThreeVector<T>::operator() (size_t i) const
401 if (0 <=i && i <= 2) return (&mX1)[i];
402 #ifndef ST_NO_EXCEPTIONS
403 throw out_of_range("AliFmThreeVector<T>::operator(): bad index");
405 cerr << "AliFmThreeVector<T>::operator(): bad index" << endl;
411 inline T& AliFmThreeVector<T>::operator() (size_t i)
413 if (0 <=i && i <= 2) return (&mX1)[i];
414 #ifndef ST_NO_EXCEPTIONS
415 throw out_of_range("AliFmThreeVector<T>::operator(): bad index");
417 cerr << "AliFmThreeVector<T>::operator(): bad index" << endl;
423 inline T AliFmThreeVector<T>::operator[] (size_t i) const
425 if (0 <=i && i <= 2) return (&mX1)[i];
426 #ifndef ST_NO_EXCEPTIONS
427 throw out_of_range("AliFmThreeVector<T>::operator[]: bad index");
429 cerr << "AliFmThreeVector<T>::operator[]: bad index" << endl;
435 inline T &AliFmThreeVector<T>::operator[] (size_t i)
437 if (0 <=i && i <= 2) return (&mX1)[i];
438 #ifndef ST_NO_EXCEPTIONS
439 throw out_of_range("AliFmThreeVector<T>::operator[]: bad index");
441 cerr << "AliFmThreeVector<T>::operator[]: bad index" << endl;
447 inline AliFmThreeVector<T>& AliFmThreeVector<T>::operator*= (double c)
449 mX1 *= c; mX2 *= c; mX3 *= c;
454 inline AliFmThreeVector<T>& AliFmThreeVector<T>::operator/= (double c)
456 mX1 /= c; mX2 /= c; mX3 /= c;
461 inline AliFmThreeVector<T>
462 AliFmThreeVector<T>::pseudoProduct(double x,double y,double z) const
464 return AliFmThreeVector<T>(mX1*x,mX2*y,mX3*z);
468 AliFmThreeVector<T> AliFmThreeVector<T>::operator- ()
470 return AliFmThreeVector<T>(-mX1, -mX2, -mX3);
474 AliFmThreeVector<T> AliFmThreeVector<T>::operator+ ()
479 #ifndef ST_NO_MEMBER_TEMPLATES
484 inline AliFmThreeVector<T>::AliFmThreeVector(const AliFmThreeVector<X>& v)
485 : mX1(v.x()), mX2(v.y()), mX3(v.z()) {/* nop */}
489 inline AliFmThreeVector<T>::AliFmThreeVector(const X *a)
498 inline AliFmThreeVector<T>&
499 AliFmThreeVector<T>::operator=(const AliFmThreeVector<X>& v)
501 mX1 = v.x(); mX2 = v.y(); mX3 = v.z();
507 inline bool AliFmThreeVector<T>::operator== (const AliFmThreeVector<X>& v) const
509 return mX1 == v.x() && mX2 == v.y() && mX3 == v.z();
514 inline bool AliFmThreeVector<T>::operator!= (const AliFmThreeVector<X>& v) const
516 return !(*this == v);
521 inline AliFmThreeVector<T>&
522 AliFmThreeVector<T>::operator+= (const AliFmThreeVector<X>& v)
524 mX1 += v.x(); mX2 += v.y(); mX3 += v.z();
530 inline AliFmThreeVector<T>&
531 AliFmThreeVector<T>::operator-= (const AliFmThreeVector<X>& v)
533 mX1 -= v.x(); mX2 -= v.y(); mX3 -= v.z();
539 inline T AliFmThreeVector<T>::dot(const AliFmThreeVector<X>& v) const
541 return mX1*v.x() + mX2*v.y() + mX3*v.z();
546 inline AliFmThreeVector<T>
547 AliFmThreeVector<T>::cross(const AliFmThreeVector<X>& v) const
549 return AliFmThreeVector<T>(mX2*v.z() - mX3*v.y(),
550 mX3*v.x() - mX1*v.z(),
551 mX1*v.y() - mX2*v.x());
556 inline T AliFmThreeVector<T>::angle(const AliFmThreeVector<X>& vec) const
558 double norm = this->mag2()*vec.mag2();
560 return norm > 0 ? acos(this->dot(vec)/(::sqrt(norm))) : 0;
565 inline AliFmThreeVector<T>
566 AliFmThreeVector<T>::pseudoProduct(const AliFmThreeVector<X>& v) const
568 return this->pseudoProduct(v.x(),v.y(),v.z());
575 inline AliFmThreeVector<T>::AliFmThreeVector(const AliFmThreeVector<float>& v)
576 : mX1(v.x()), mX2(v.y()), mX3(v.z()) {/* nop */}
579 inline AliFmThreeVector<T>::AliFmThreeVector(const AliFmThreeVector<double>& v)
580 : mX1(v.x()), mX2(v.y()), mX3(v.z()) {/* nop */}
583 inline AliFmThreeVector<T>::AliFmThreeVector(const float *a)
591 inline AliFmThreeVector<T>::AliFmThreeVector(const double *a)
599 inline AliFmThreeVector<T>&
600 AliFmThreeVector<T>::operator=(const AliFmThreeVector<float>& v)
602 mX1 = v.x(); mX2 = v.y(); mX3 = v.z();
607 inline AliFmThreeVector<T>&
608 AliFmThreeVector<T>::operator=(const AliFmThreeVector<double>& v)
610 mX1 = v.x(); mX2 = v.y(); mX3 = v.z();
616 AliFmThreeVector<T>::operator== (const AliFmThreeVector<float>& v) const
618 return mX1 == v.x() && mX2 == v.y() && mX3 == v.z();
623 AliFmThreeVector<T>::operator== (const AliFmThreeVector<double>& v) const
625 return mX1 == v.x() && mX2 == v.y() && mX3 == v.z();
630 AliFmThreeVector<T>::operator!= (const AliFmThreeVector<float>& v) const
632 return !(*this == v);
637 AliFmThreeVector<T>::operator!= (const AliFmThreeVector<double>& v) const
639 return !(*this == v);
643 inline AliFmThreeVector<T>&
644 AliFmThreeVector<T>::operator+= (const AliFmThreeVector<float>& v)
646 mX1 += v.x(); mX2 += v.y(); mX3 += v.z();
651 inline AliFmThreeVector<T>&
652 AliFmThreeVector<T>::operator+= (const AliFmThreeVector<double>& v)
654 mX1 += v.x(); mX2 += v.y(); mX3 += v.z();
659 inline AliFmThreeVector<T>&
660 AliFmThreeVector<T>::operator-= (const AliFmThreeVector<float>& v)
662 mX1 -= v.x(); mX2 -= v.y(); mX3 -= v.z();
667 inline AliFmThreeVector<T>&
668 AliFmThreeVector<T>::operator-= (const AliFmThreeVector<double>& v)
670 mX1 -= v.x(); mX2 -= v.y(); mX3 -= v.z();
675 inline T AliFmThreeVector<T>::dot(const AliFmThreeVector<float>& v) const
677 return mX1*v.x() + mX2*v.y() + mX3*v.z();
681 inline T AliFmThreeVector<T>::dot(const AliFmThreeVector<double>& v) const
683 return mX1*v.x() + mX2*v.y() + mX3*v.z();
687 inline AliFmThreeVector<T>
688 AliFmThreeVector<T>::cross(const AliFmThreeVector<float>& v) const
690 return AliFmThreeVector<T>(mX2*v.z() - mX3*v.y(),
691 mX3*v.x() - mX1*v.z(),
692 mX1*v.y() - mX2*v.x());
696 inline AliFmThreeVector<T>
697 AliFmThreeVector<T>::cross(const AliFmThreeVector<double>& v) const
699 return AliFmThreeVector<T>(mX2*v.z() - mX3*v.y(),
700 mX3*v.x() - mX1*v.z(),
701 mX1*v.y() - mX2*v.x());
705 inline T AliFmThreeVector<T>::angle(const AliFmThreeVector<float>& v) const
707 double tmp = mag()*v.mag(); if (tmp <=0) tmp = 1e-20;
708 return acos(this->dot(v)/tmp);
712 inline T AliFmThreeVector<T>::angle(const AliFmThreeVector<double>& v) const
714 double tmp = mag()*v.mag(); if (tmp <=0) tmp = 1e-20;
715 return acos(this->dot(v)/tmp);
719 inline AliFmThreeVector<T>
720 AliFmThreeVector<T>::pseudoProduct(const AliFmThreeVector<float>& v) const
722 return this->pseudoProduct(v.x(),v.y(),v.z());
726 inline AliFmThreeVector<T>
727 AliFmThreeVector<T>::pseudoProduct(const AliFmThreeVector<double>& v) const
729 return this->pseudoProduct(v.x(),v.y(),v.z());
731 #endif // ST_NO_MEMBER_TEMPLATES
734 AliFmThreeVector<T>::valid(double world) const {return !bad(world);}
738 AliFmThreeVector<T>::bad(double world) const
740 for (int i=0;i<3;i++) {
741 if (!finite((&mX1)[i]) ) return 10+i;
742 if ( fabs ((&mX1)[i])>world) return 20+i;
746 #endif /*! __CINT__ */
748 template<> float abs(const AliFmThreeVector<float>& v);
749 template<> double abs(const AliFmThreeVector<double>& v);
750 template<> AliFmThreeVector<double> cross_product(const AliFmThreeVector<double>& v1, const AliFmThreeVector<double>& v2);
751 template<> AliFmThreeVector<float> cross_product(const AliFmThreeVector<float>& v1, const AliFmThreeVector<float>& v2);
752 template<> AliFmThreeVector<double> cross_product(const AliFmThreeVector<float>& v1, const AliFmThreeVector<double>& v2);
753 template<> AliFmThreeVector<double> cross_product(const AliFmThreeVector<double>& v1, const AliFmThreeVector<float>& v2);
754 template<> AliFmThreeVector<double> operator+ (const AliFmThreeVector<double>& v1, const AliFmThreeVector<double>& v2);
755 template<> AliFmThreeVector<float> operator+ (const AliFmThreeVector<float>& v1, const AliFmThreeVector<float>& v2);
756 template<> AliFmThreeVector<double> operator+ (const AliFmThreeVector<double>& v1, const AliFmThreeVector<float>& v2);
757 template<> AliFmThreeVector<double> operator+ (const AliFmThreeVector<float>& v1, const AliFmThreeVector<double>& v2);
758 template<> AliFmThreeVector<double> operator- (const AliFmThreeVector<double>& v1, const AliFmThreeVector<double>& v2);
759 template<> AliFmThreeVector<float> operator- (const AliFmThreeVector<float>& v1, const AliFmThreeVector<float>& v2);
760 template<> AliFmThreeVector<double> operator- (const AliFmThreeVector<double>& v1, const AliFmThreeVector<float>& v2);
761 template<> AliFmThreeVector<double> operator- (const AliFmThreeVector<float>& v1, const AliFmThreeVector<double>& v2);
762 template<> AliFmThreeVector<double> operator* (const AliFmThreeVector<double>& v1, const AliFmThreeVector<double>& v2);
763 template<> AliFmThreeVector<float> operator* (const AliFmThreeVector<float>& v1, const AliFmThreeVector<float>& v2);
764 template<> AliFmThreeVector<double> operator* (const AliFmThreeVector<double>& v1, const AliFmThreeVector<float>& v2);
765 template<> AliFmThreeVector<double> operator* (const AliFmThreeVector<float>& v1, const AliFmThreeVector<double>& v2);
766 template<> AliFmThreeVector<double> operator* (const double v1, const AliFmThreeVector<float>& v2);
767 template<> AliFmThreeVector<double> operator* (const AliFmThreeVector<float>& v1, const double v2);
768 template<> AliFmThreeVector<double> operator* (const double v1, const AliFmThreeVector<double>& v2);
769 template<> AliFmThreeVector<double> operator* (const AliFmThreeVector<double>& v1, const double v2);
770 template<> AliFmThreeVector<double> operator/ (const AliFmThreeVector<double>& v1, const AliFmThreeVector<double>& v2);
771 template<> AliFmThreeVector<float> operator/ (const AliFmThreeVector<float>& v1, const AliFmThreeVector<float>& v2);
772 template<> AliFmThreeVector<double> operator/ (const AliFmThreeVector<double>& v1, const AliFmThreeVector<float>& v2);
773 template<> AliFmThreeVector<double> operator/ (const AliFmThreeVector<float>& v1, const AliFmThreeVector<double>& v2);
774 template<> AliFmThreeVector<double> operator/ (const double v1, const AliFmThreeVector<double>& v2);
775 template<> AliFmThreeVector<float> operator/ (const double v1, const AliFmThreeVector<float>& v2);
776 template<> AliFmThreeVector<double> operator/ (const AliFmThreeVector<double>& v1, const double v2);
777 template<> AliFmThreeVector<double> operator/ (const AliFmThreeVector<float>& v1, const double v2);
778 template<> istream& operator>>(istream& is,const AliFmThreeVector<double>& v);
779 template<> istream& operator>>(istream& is,const AliFmThreeVector<float>& v);
780 template<> ostream& operator<<(ostream& os,const AliFmThreeVector<double>& v);
781 template<> ostream& operator<<(ostream& os,const AliFmThreeVector<float>& v);
784 // Non-member functions
787 inline T abs(const AliFmThreeVector<T>& v) {return v.mag();}
789 template<class T, class X>
790 inline AliFmThreeVector<T>
791 cross_product(const AliFmThreeVector<T>& v1, const AliFmThreeVector<X>& v2)
798 // Non-member operators
800 template<class T, class X>
801 inline AliFmThreeVector<T>
802 operator+ (const AliFmThreeVector<T>& v1, const AliFmThreeVector<X>& v2)
804 return AliFmThreeVector<T>(v1) += v2;
807 template<class T, class X>
808 inline AliFmThreeVector<T>
809 operator- (const AliFmThreeVector<T>& v1, const AliFmThreeVector<X>& v2)
811 return AliFmThreeVector<T>(v1) -= v2;
814 template<class T, class X>
815 inline T operator* (const AliFmThreeVector<T>& v1, const AliFmThreeVector<X>& v2)
817 return AliFmThreeVector<T>(v1).dot(v2);
821 inline AliFmThreeVector<T> operator* (const AliFmThreeVector<T>& v, double c)
823 return AliFmThreeVector<T>(v) *= c;
827 inline AliFmThreeVector<T> operator* (double c, const AliFmThreeVector<T>& v)
829 return AliFmThreeVector<T>(v) *= c;
832 template<class T, class X>
833 inline AliFmThreeVector<T> operator/ (const AliFmThreeVector<T>& v, X c)
835 return AliFmThreeVector<T>(v) /= c;
839 ostream& operator<<(ostream& os, const AliFmThreeVector<T>& v)
841 return os << v.x() << '\t' << v.y() << '\t' << v.z();
845 istream& operator>>(istream& is, AliFmThreeVector<T>& v)
854 #endif /* ! __CINT__ */