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/04/25 15:38:41 panos
19 * Importing the HBT code dir
21 * Revision 1.1.1.1 2007/03/07 10:14:49 mchojnacki
22 * First version on CVS
24 * Revision 1.15 2005/09/22 20:09:20 fisyak
25 * Make AliFmLorentzVector persistent
27 * Revision 1.14 2005/07/19 22:27:11 perev
30 * Revision 1.13 2005/07/06 18:49:57 fisyak
31 * Replace AliFmHelixD, AliFmLorentzVectorD,AliFmLorentzVectorF,AliFmMatrixD,AliFmMatrixF,AliFmPhysicalHelixD,AliFmThreeVectorD,AliFmThreeVectorF by templated version
33 * Revision 1.12 2005/03/28 06:03:41 perev
36 * Revision 1.11 2004/12/02 20:07:32 fine
37 * define the valid method for both flavor of AliFmThreeVector
39 * Revision 1.10 2003/10/30 20:06:46 perev
40 * Check of quality added
42 * Revision 1.9 2003/09/02 17:59:35 perev
43 * gcc 3.2 updates + WarnOff
45 * Revision 1.8 2002/06/21 17:47:37 genevb
48 * Revision 1.7 2000/01/04 19:56:05 ullrich
49 * Added cpp macro for CINT.
51 * Revision 1.6 1999/12/21 15:14:31 ullrich
52 * Modified to cope with new compiler version on Sun (CC5.0).
54 * Revision 1.5 1999/10/15 15:46:54 ullrich
55 * Changed output format in operator<<
57 * Revision 1.4 1999/06/04 18:00:05 ullrich
58 * Added new constructor which takes C-style array as argument.
59 * New operators operator() and operator[] which can be used
62 * Revision 1.3 1999/02/17 11:42:19 ullrich
63 * Removed specialization for 'long double'.
65 * Revision 1.2 1999/02/14 23:11:48 fisyak
68 * Revision 1.1 1999/01/30 03:59:05 fisyak
69 * Root Version of AliFmarClassLibrary
71 * Revision 1.1 1999/01/23 00:28:04 ullrich
74 **************************************************************************/
75 #ifndef ST_THREE_VECTOR_HH
76 #define ST_THREE_VECTOR_HH
87 #if defined (__SUNPRO_CC) && __SUNPRO_CC < 0x500
90 #ifndef ST_NO_EXCEPTIONS
92 # if !defined(ST_NO_NAMESPACES)
93 using std::out_of_range;
102 class TRootIOCtor;//nic nie rozumiem
106 template<class T> class AliFmThreeVector {
108 AliFmThreeVector(T = 0, T = 0, T = 0);
109 // ROOT_VERSION(5,03,01)
110 #if ROOT_VERSION_CODE >= 328449
111 AliFmThreeVector(TRootIOCtor*) : mX1(0), mX2(0), mX3(0) {}
113 virtual ~AliFmThreeVector();
115 #ifndef ST_NO_MEMBER_TEMPLATES
116 template<class X> AliFmThreeVector(const AliFmThreeVector<X>&);
117 template<class X> AliFmThreeVector(const X*);
118 template<class X> AliFmThreeVector<T>& operator=(const AliFmThreeVector<X>&);
119 // AliFmThreeVector(const AliFmThreeVector<T>&); use default
120 // AliFmThreeVector<T>& operator=(const AliFmThreeVector<T>&); use default
122 AliFmThreeVector(const AliFmThreeVector<float>&);
123 AliFmThreeVector(const AliFmThreeVector<double>&);
125 AliFmThreeVector(const float*);
126 AliFmThreeVector(const double*);
128 AliFmThreeVector<T>& operator=(const AliFmThreeVector<float>&);
129 AliFmThreeVector<T>& operator=(const AliFmThreeVector<double>&);
139 void SetMagnitude(T);
152 T PseudoRapidity() const;
153 T operator() (size_t) const;
154 T operator[] (size_t) const;
156 T& operator() (size_t);
157 T& operator[] (size_t);
159 T MassHypothesis(T mass) const;
161 AliFmThreeVector<T> unit() const;
162 AliFmThreeVector<T> orthogonal() const;
168 AliFmThreeVector<T> operator- ();
169 AliFmThreeVector<T> operator+ ();
170 AliFmThreeVector<T>& operator*= (double);
171 AliFmThreeVector<T>& operator/= (double);
172 AliFmThreeVector<T> PseudoProduct(double,double,double) const;
174 #ifndef ST_NO_MEMBER_TEMPLATES
175 template<class X> T Angle(const AliFmThreeVector<X>&) const;
176 template<class X> AliFmThreeVector<T> Cross(const AliFmThreeVector<X>&) const;
177 template<class X> T Dot (const AliFmThreeVector<X>&) const;
178 template<class X> AliFmThreeVector<T> PseudoProduct(const AliFmThreeVector<X>&) const;
180 template<class X> bool operator == (const AliFmThreeVector<X>& v) const;
181 template<class X> bool operator != (const AliFmThreeVector<X>& v) const;
183 template<class X> AliFmThreeVector<T>& operator+= (const AliFmThreeVector<X>&);
184 template<class X> AliFmThreeVector<T>& operator-= (const AliFmThreeVector<X>&);
186 T Angle(const AliFmThreeVector<float>&) const;
187 AliFmThreeVector<T> Cross(const AliFmThreeVector<float>&) const;
188 T Dot (const AliFmThreeVector<float>&) const;
189 AliFmThreeVector<T> PseudoProduct(const AliFmThreeVector<float>&) const;
191 T Angle(const AliFmThreeVector<double>&) const;
192 T Dot (const AliFmThreeVector<double>&) const;
193 AliFmThreeVector<T> Cross(const AliFmThreeVector<double>&) const;
194 AliFmThreeVector<T> PseudoProduct(const AliFmThreeVector<double>&) const;
196 bool operator == (const AliFmThreeVector<float>& v) const;
197 bool operator != (const AliFmThreeVector<float>& v) const;
198 AliFmThreeVector<T>& operator+= (const AliFmThreeVector<float>&);
199 AliFmThreeVector<T>& operator-= (const AliFmThreeVector<float>&);
201 bool operator == (const AliFmThreeVector<double>& v) const;
202 bool operator != (const AliFmThreeVector<double>& v) const;
203 AliFmThreeVector<T>& operator+= (const AliFmThreeVector<double>&);
204 AliFmThreeVector<T>& operator-= (const AliFmThreeVector<double>&);
206 int Valid(double world = 1.e+5) const;
207 int Bad(double world = 1.e+5) const;
209 T mX1, mX2, mX3; // Vector components
211 ClassDef(AliFmThreeVector,3)
212 #endif /* __ROOT__ */
217 // Implementation of member functions
220 inline AliFmThreeVector<T>::AliFmThreeVector(T ax, T ay, T az)
221 : mX1(ax), mX2(ay), mX3(az) {/* nop */}
223 inline AliFmThreeVector<T>::~AliFmThreeVector() {/* nop */}
226 inline void AliFmThreeVector<T>::SetX(T ax) {mX1 = ax;}
229 inline void AliFmThreeVector<T>::SetY(T ay) {mX2 = ay;}
232 inline void AliFmThreeVector<T>::SetZ(T az) {mX3 = az;}
235 void AliFmThreeVector<T>::SetPhi(T aAngle)
237 double r = Magnitude();
240 mX1 = r*sin(th)*cos(aAngle);
241 mX2 = r*sin(th)*sin(aAngle);
245 void AliFmThreeVector<T>::SetTheta(T aAngle)
247 double r = Magnitude();
250 mX1 = r*sin(aAngle)*cos(ph);
251 mX2 = r*sin(aAngle)*sin(ph);
256 void AliFmThreeVector<T>::SetMagnitude(T r)
261 mX1 = r*sin(th)*cos(ph);
262 mX2 = r*sin(th)*sin(ph);
267 void AliFmThreeVector<T>::SetMag(T amag)
273 inline T AliFmThreeVector<T>::x() const {return mX1;}
276 inline T AliFmThreeVector<T>::y() const {return mX2;}
279 inline T AliFmThreeVector<T>::z() const {return mX3;}
282 inline T AliFmThreeVector<T>::Theta() const
284 return acos(CosTheta());
288 inline T AliFmThreeVector<T>::CosTheta() const
290 return mX3/(Mag()+1e-20);
294 inline T AliFmThreeVector<T>::Phi() const
296 return atan2(mX2,mX1);
300 inline T AliFmThreeVector<T>::PseudoRapidity() const
303 // change code to more optimal:
305 // return 0.5*::log( (m+z())/(m-z()) );
306 double tmp = tan(Theta()/2.); if (tmp <=0.) return 1e20;
311 inline AliFmThreeVector<T> AliFmThreeVector<T>::unit() const
313 double tmp = Mag(); if (tmp<=0.) tmp = 1e-20;
318 T AliFmThreeVector<T>::MassHypothesis(T mass) const
320 return ::sqrt((*this)*(*this) + mass*mass);
324 AliFmThreeVector<T> AliFmThreeVector<T>::orthogonal() const
326 // Direct copy from CLHEP--it is probably better to
327 // use your own dot/cross product code...
328 double ax = (mX1 < 0.0) ? -mX1 : mX1;
329 double ay = (mX2 < 0.0) ? -mX2 : mX2;
330 double az = (mX3 < 0.0) ? -mX3 : mX3;
333 return ax < az ? AliFmThreeVector<T>(0,mX3,-mX2) : AliFmThreeVector<T>(mX2,-mX1,0);
335 return mX2 < mX3 ? AliFmThreeVector<T>(-mX3,0,mX1) : AliFmThreeVector<T>(mX2,-mX1,0);
339 void AliFmThreeVector<T>::RotateX(T aAngle)
341 // may in the future make use of the AliFmRotation class!
342 double yPrime = cos(aAngle)*mX2 - sin(aAngle)*mX3;
343 double zPrime = sin(aAngle)*mX2 + cos(aAngle)*mX3;
350 void AliFmThreeVector<T>::RotateY(T aAngle)
352 // may in the future make use of the AliFmRotation class!
353 double zPrime = cos(aAngle)*mX3 - sin(aAngle)*mX1;
354 double xPrime = sin(aAngle)*mX3 + cos(aAngle)*mX1;
361 void AliFmThreeVector<T>::RotateZ(T aAngle)
363 // may in the future make use of the AliFmRotation class!
364 double xPrime = cos(aAngle)*mX1 - sin(aAngle)*mX2;
365 double yPrime = sin(aAngle)*mX1 + cos(aAngle)*mX2;
372 inline T AliFmThreeVector<T>::Perp() const
374 return ::sqrt(mX1*mX1+mX2*mX2);
378 inline T AliFmThreeVector<T>::Perp2() const
380 return mX1*mX1+mX2*mX2;
384 inline T AliFmThreeVector<T>::Magnitude() const
390 inline T AliFmThreeVector<T>::Mag() const
392 return ::sqrt(mX1*mX1+mX2*mX2+mX3*mX3);
396 inline T AliFmThreeVector<T>::Mag2() const
398 return mX1*mX1+mX2*mX2+mX3*mX3;
402 inline T AliFmThreeVector<T>::operator() (size_t i) const
404 if (i <= 2) return (&mX1)[i];
405 #ifndef ST_NO_EXCEPTIONS
406 throw out_of_range("AliFmThreeVector<T>::operator(): bad index");
408 cerr << "AliFmThreeVector<T>::operator(): bad index" << endl;
414 inline T& AliFmThreeVector<T>::operator() (size_t i)
416 if (i <= 2) return (&mX1)[i];
417 #ifndef ST_NO_EXCEPTIONS
418 throw out_of_range("AliFmThreeVector<T>::operator(): bad index");
420 cerr << "AliFmThreeVector<T>::operator(): bad index" << endl;
426 inline T AliFmThreeVector<T>::operator[] (size_t i) const
428 if (i <= 2) return (&mX1)[i];
429 #ifndef ST_NO_EXCEPTIONS
430 throw out_of_range("AliFmThreeVector<T>::operator[]: bad index");
432 cerr << "AliFmThreeVector<T>::operator[]: bad index" << endl;
438 inline T &AliFmThreeVector<T>::operator[] (size_t i)
440 if (i <= 2) return (&mX1)[i];
441 #ifndef ST_NO_EXCEPTIONS
442 throw out_of_range("AliFmThreeVector<T>::operator[]: bad index");
444 cerr << "AliFmThreeVector<T>::operator[]: bad index" << endl;
450 inline AliFmThreeVector<T>& AliFmThreeVector<T>::operator*= (double c)
452 mX1 *= c; mX2 *= c; mX3 *= c;
457 inline AliFmThreeVector<T>& AliFmThreeVector<T>::operator/= (double c)
459 mX1 /= c; mX2 /= c; mX3 /= c;
464 inline AliFmThreeVector<T>
465 AliFmThreeVector<T>::PseudoProduct(double ax,double ay,double az) const
467 return AliFmThreeVector<T>(mX1*ax,mX2*ay,mX3*az);
471 AliFmThreeVector<T> AliFmThreeVector<T>::operator- ()
473 return AliFmThreeVector<T>(-mX1, -mX2, -mX3);
477 AliFmThreeVector<T> AliFmThreeVector<T>::operator+ ()
482 #ifndef ST_NO_MEMBER_TEMPLATES
487 inline AliFmThreeVector<T>::AliFmThreeVector(const AliFmThreeVector<X>& v)
488 : mX1(v.x()), mX2(v.y()), mX3(v.z()) {/* nop */}
492 inline AliFmThreeVector<T>::AliFmThreeVector(const X *a)
501 inline AliFmThreeVector<T>&
502 AliFmThreeVector<T>::operator=(const AliFmThreeVector<X>& v)
504 mX1 = v.x(); mX2 = v.y(); mX3 = v.z();
510 inline bool AliFmThreeVector<T>::operator== (const AliFmThreeVector<X>& v) const
512 return mX1 == v.x() && mX2 == v.y() && mX3 == v.z();
517 inline bool AliFmThreeVector<T>::operator!= (const AliFmThreeVector<X>& v) const
519 return !(*this == v);
524 inline AliFmThreeVector<T>&
525 AliFmThreeVector<T>::operator+= (const AliFmThreeVector<X>& v)
527 mX1 += v.x(); mX2 += v.y(); mX3 += v.z();
533 inline AliFmThreeVector<T>&
534 AliFmThreeVector<T>::operator-= (const AliFmThreeVector<X>& v)
536 mX1 -= v.x(); mX2 -= v.y(); mX3 -= v.z();
542 inline T AliFmThreeVector<T>::Dot(const AliFmThreeVector<X>& v) const
544 return mX1*v.x() + mX2*v.y() + mX3*v.z();
549 inline AliFmThreeVector<T>
550 AliFmThreeVector<T>::Cross(const AliFmThreeVector<X>& v) const
552 return AliFmThreeVector<T>(mX2*v.z() - mX3*v.y(),
553 mX3*v.x() - mX1*v.z(),
554 mX1*v.y() - mX2*v.x());
559 inline T AliFmThreeVector<T>::Angle(const AliFmThreeVector<X>& vec) const
561 double norm = this->Mag2()*vec.Mag2();
563 return norm > 0 ? acos(this->Dot(vec)/(::sqrt(norm))) : 0;
568 inline AliFmThreeVector<T>
569 AliFmThreeVector<T>::PseudoProduct(const AliFmThreeVector<X>& v) const
571 return this->PseudoProduct(v.x(),v.y(),v.z());
578 inline AliFmThreeVector<T>::AliFmThreeVector(const AliFmThreeVector<float>& v)
579 : mX1(v.x()), mX2(v.y()), mX3(v.z()) {/* nop */}
582 inline AliFmThreeVector<T>::AliFmThreeVector(const AliFmThreeVector<double>& v)
583 : mX1(v.x()), mX2(v.y()), mX3(v.z()) {/* nop */}
586 inline AliFmThreeVector<T>::AliFmThreeVector(const float *a)
594 inline AliFmThreeVector<T>::AliFmThreeVector(const double *a)
602 inline AliFmThreeVector<T>&
603 AliFmThreeVector<T>::operator=(const AliFmThreeVector<float>& v)
605 mX1 = v.x(); mX2 = v.y(); mX3 = v.z();
610 inline AliFmThreeVector<T>&
611 AliFmThreeVector<T>::operator=(const AliFmThreeVector<double>& v)
613 mX1 = v.x(); mX2 = v.y(); mX3 = v.z();
619 AliFmThreeVector<T>::operator== (const AliFmThreeVector<float>& v) const
621 return mX1 == v.x() && mX2 == v.y() && mX3 == v.z();
626 AliFmThreeVector<T>::operator== (const AliFmThreeVector<double>& v) const
628 return mX1 == v.x() && mX2 == v.y() && mX3 == v.z();
633 AliFmThreeVector<T>::operator!= (const AliFmThreeVector<float>& v) const
635 return !(*this == v);
640 AliFmThreeVector<T>::operator!= (const AliFmThreeVector<double>& v) const
642 return !(*this == v);
646 inline AliFmThreeVector<T>&
647 AliFmThreeVector<T>::operator+= (const AliFmThreeVector<float>& v)
649 mX1 += v.x(); mX2 += v.y(); mX3 += v.z();
654 inline AliFmThreeVector<T>&
655 AliFmThreeVector<T>::operator+= (const AliFmThreeVector<double>& v)
657 mX1 += v.x(); mX2 += v.y(); mX3 += v.z();
662 inline AliFmThreeVector<T>&
663 AliFmThreeVector<T>::operator-= (const AliFmThreeVector<float>& v)
665 mX1 -= v.x(); mX2 -= v.y(); mX3 -= v.z();
670 inline AliFmThreeVector<T>&
671 AliFmThreeVector<T>::operator-= (const AliFmThreeVector<double>& v)
673 mX1 -= v.x(); mX2 -= v.y(); mX3 -= v.z();
678 inline T AliFmThreeVector<T>::Dot(const AliFmThreeVector<float>& v) const
680 return mX1*v.x() + mX2*v.y() + mX3*v.z();
684 inline T AliFmThreeVector<T>::Dot(const AliFmThreeVector<double>& v) const
686 return mX1*v.x() + mX2*v.y() + mX3*v.z();
690 inline AliFmThreeVector<T>
691 AliFmThreeVector<T>::Cross(const AliFmThreeVector<float>& v) const
693 return AliFmThreeVector<T>(mX2*v.z() - mX3*v.y(),
694 mX3*v.x() - mX1*v.z(),
695 mX1*v.y() - mX2*v.x());
699 inline AliFmThreeVector<T>
700 AliFmThreeVector<T>::Cross(const AliFmThreeVector<double>& v) const
702 return AliFmThreeVector<T>(mX2*v.z() - mX3*v.y(),
703 mX3*v.x() - mX1*v.z(),
704 mX1*v.y() - mX2*v.x());
708 inline T AliFmThreeVector<T>::Angle(const AliFmThreeVector<float>& v) const
710 double tmp = Mag()*v.Mag(); if (tmp <=0) tmp = 1e-20;
711 return acos(this->Dot(v)/tmp);
715 inline T AliFmThreeVector<T>::Angle(const AliFmThreeVector<double>& v) const
717 double tmp = Mag()*v.Mag(); if (tmp <=0) tmp = 1e-20;
718 return acos(this->Dot(v)/tmp);
722 inline AliFmThreeVector<T>
723 AliFmThreeVector<T>::PseudoProduct(const AliFmThreeVector<float>& v) const
725 return this->PseudoProduct(v.x(),v.y(),v.z());
729 inline AliFmThreeVector<T>
730 AliFmThreeVector<T>::PseudoProduct(const AliFmThreeVector<double>& v) const
732 return this->PseudoProduct(v.x(),v.y(),v.z());
734 #endif // ST_NO_MEMBER_TEMPLATES
737 AliFmThreeVector<T>::Valid(double world) const {return !Bad(world);}
741 AliFmThreeVector<T>::Bad(double world) const
743 for (int i=0;i<3;i++) {
744 if (!isfinite((&mX1)[i]) ) return 10+i;
745 if ( fabs ((&mX1)[i])>world) return 20+i;
749 #endif /*! __CINT__ */
751 template<> float abs(const AliFmThreeVector<float>& v);
752 template<> double abs(const AliFmThreeVector<double>& v);
753 template<> AliFmThreeVector<double> cross_product(const AliFmThreeVector<double>& v1, const AliFmThreeVector<double>& v2);
754 template<> AliFmThreeVector<float> cross_product(const AliFmThreeVector<float>& v1, const AliFmThreeVector<float>& v2);
755 template<> AliFmThreeVector<double> cross_product(const AliFmThreeVector<float>& v1, const AliFmThreeVector<double>& v2);
756 template<> AliFmThreeVector<double> cross_product(const AliFmThreeVector<double>& v1, const AliFmThreeVector<float>& v2);
757 template<> AliFmThreeVector<double> operator+ (const AliFmThreeVector<double>& v1, const AliFmThreeVector<double>& v2);
758 template<> AliFmThreeVector<float> operator+ (const AliFmThreeVector<float>& v1, const AliFmThreeVector<float>& v2);
759 template<> AliFmThreeVector<double> operator+ (const AliFmThreeVector<double>& v1, const AliFmThreeVector<float>& v2);
760 template<> AliFmThreeVector<double> operator+ (const AliFmThreeVector<float>& v1, const AliFmThreeVector<double>& v2);
761 template<> AliFmThreeVector<double> operator- (const AliFmThreeVector<double>& v1, const AliFmThreeVector<double>& v2);
762 template<> AliFmThreeVector<float> operator- (const AliFmThreeVector<float>& v1, const AliFmThreeVector<float>& v2);
763 template<> AliFmThreeVector<double> operator- (const AliFmThreeVector<double>& v1, const AliFmThreeVector<float>& v2);
764 template<> AliFmThreeVector<double> operator- (const AliFmThreeVector<float>& v1, const AliFmThreeVector<double>& v2);
765 template<> AliFmThreeVector<double> operator* (const AliFmThreeVector<double>& v1, const AliFmThreeVector<double>& v2);
766 template<> AliFmThreeVector<float> operator* (const AliFmThreeVector<float>& v1, const AliFmThreeVector<float>& v2);
767 template<> AliFmThreeVector<double> operator* (const AliFmThreeVector<double>& v1, const AliFmThreeVector<float>& v2);
768 template<> AliFmThreeVector<double> operator* (const AliFmThreeVector<float>& v1, const AliFmThreeVector<double>& v2);
769 template<> AliFmThreeVector<double> operator* (const double v1, const AliFmThreeVector<float>& v2);
770 template<> AliFmThreeVector<double> operator* (const AliFmThreeVector<float>& v1, const double v2);
771 template<> AliFmThreeVector<double> operator* (const double v1, const AliFmThreeVector<double>& v2);
772 template<> AliFmThreeVector<double> operator* (const AliFmThreeVector<double>& v1, const double v2);
773 template<> AliFmThreeVector<double> operator/ (const AliFmThreeVector<double>& v1, const AliFmThreeVector<double>& v2);
774 template<> AliFmThreeVector<float> operator/ (const AliFmThreeVector<float>& v1, const AliFmThreeVector<float>& v2);
775 template<> AliFmThreeVector<double> operator/ (const AliFmThreeVector<double>& v1, const AliFmThreeVector<float>& v2);
776 template<> AliFmThreeVector<double> operator/ (const AliFmThreeVector<float>& v1, const AliFmThreeVector<double>& v2);
777 template<> AliFmThreeVector<double> operator/ (const double v1, const AliFmThreeVector<double>& v2);
778 template<> AliFmThreeVector<float> operator/ (const double v1, const AliFmThreeVector<float>& v2);
779 template<> AliFmThreeVector<double> operator/ (const AliFmThreeVector<double>& v1, const double v2);
780 template<> AliFmThreeVector<double> operator/ (const AliFmThreeVector<float>& v1, const double v2);
781 template<> istream& operator>>(istream& is,const AliFmThreeVector<double>& v);
782 template<> istream& operator>>(istream& is,const AliFmThreeVector<float>& v);
783 template<> ostream& operator<<(ostream& os,const AliFmThreeVector<double>& v);
784 template<> ostream& operator<<(ostream& os,const AliFmThreeVector<float>& v);
787 // Non-member functions
790 inline T abs(const AliFmThreeVector<T>& v) {return v.Mag();}
792 template<class T, class X>
793 inline AliFmThreeVector<T>
794 cross_product(const AliFmThreeVector<T>& v1, const AliFmThreeVector<X>& v2)
801 // Non-member operators
803 template<class T, class X>
804 inline AliFmThreeVector<T>
805 operator+ (const AliFmThreeVector<T>& v1, const AliFmThreeVector<X>& v2)
807 return AliFmThreeVector<T>(v1) += v2;
810 template<class T, class X>
811 inline AliFmThreeVector<T>
812 operator- (const AliFmThreeVector<T>& v1, const AliFmThreeVector<X>& v2)
814 return AliFmThreeVector<T>(v1) -= v2;
817 template<class T, class X>
818 inline T operator* (const AliFmThreeVector<T>& v1, const AliFmThreeVector<X>& v2)
820 return AliFmThreeVector<T>(v1).Dot(v2);
824 inline AliFmThreeVector<T> operator* (const AliFmThreeVector<T>& v, double c)
826 return AliFmThreeVector<T>(v) *= c;
830 inline AliFmThreeVector<T> operator* (double c, const AliFmThreeVector<T>& v)
832 return AliFmThreeVector<T>(v) *= c;
835 template<class T, class X>
836 inline AliFmThreeVector<T> operator/ (const AliFmThreeVector<T>& v, X c)
838 return AliFmThreeVector<T>(v) /= c;
842 ostream& operator<<(ostream& os, const AliFmThreeVector<T>& v)
844 return os << v.x() << '\t' << v.y() << '\t' << v.z();
848 istream& operator>>(istream& is, AliFmThreeVector<T>& v)
857 #endif /* ! __CINT__ */