]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/FEMTOSCOPY/AliFemto/AliFemtoLorentzVector.h
Fix coding convention violations
[u/mrichter/AliRoot.git] / PWG2 / FEMTOSCOPY / AliFemto / AliFemtoLorentzVector.h
CommitLineData
67427ff7 1/***************************************************************************
2 *
3 * $Id$
4 *
5 * Author: Brian Lasiuk, Thomas Ullrich, April 1998
6 ***************************************************************************
7 *
8 * Description:
9 *
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.
14 *
15 * In the near future when all compilers can handle member
16 * templates this class should be cleaned up. A lot of
17 * redundant code can be removed as soon as the compilers
18 * are up-to-date. tu
19 *
20 ***************************************************************************
21 *
22 * $Log$
d0e92d9a 23 * Revision 1.1.1.1 2007/04/25 15:38:41 panos
24 * Importing the HBT code dir
25 *
67427ff7 26 * Revision 1.1.1.1 2007/03/07 10:14:49 mchojnacki
27 * First version on CVS
28 *
29 * Revision 1.11 2005/09/22 20:09:20 fisyak
30 * Make AliFemtoLorentzVector persistent
31 *
32 * Revision 1.10 2005/07/06 18:49:56 fisyak
33 * Replace AliFemtoHelixD, AliFemtoLorentzVectorD,AliFemtoLorentzVectorF,AliFemtoMatrixD,AliFemtoMatrixF,AliFemtoPhysicalHelixD,AliFemtoThreeVectorD,AliFemtoThreeVectorF by templated version
34 *
35 * Revision 1.9 2005/03/28 06:02:45 perev
36 * Defence FPE added
37 *
38 * Revision 1.8 2003/09/02 17:59:35 perev
39 * gcc 3.2 updates + WarnOff
40 *
41 * Revision 1.7 2003/05/01 19:24:31 ullrich
42 * Corrected problem in boost().
43 *
44 * Revision 1.6 1999/10/15 15:56:36 ullrich
45 * Changed output format in operator<<, added operator>>
46 *
47 * Revision 1.5 1999/06/04 18:01:36 ullrich
48 * New operators operator() and operator[] which can be used
49 * as lvalues.
50 *
51 * Revision 1.4 1999/04/14 23:12:07 fisyak
52 * Add __CINT__ to handle references
53 *
54 * Revision 1.3 1999/02/17 11:38:36 ullrich
55 * Removed specialization for 'long double'.
56 *
57 * Revision 1.2 1999/02/14 23:11:42 fisyak
58 * Fixes for Rootcint
59 *
60 * Revision 1.1 1999/01/30 03:59:02 fisyak
61 * Root Version of AliFemtoarClassLibrary
62 *
63 * Revision 1.1 1999/01/23 00:27:52 ullrich
64 * Initial Revision
65 *
66 **************************************************************************/
59c8f7b2 67/*//
68//// General class for a Lorentz four-vector
69///*/
67427ff7 70#ifndef ST_LORENTZ_VECTOR_HH
71#define ST_LORENTZ_VECTOR_HH
72
73#include "AliFemtoThreeVector.h"
74template<class T> class AliFemtoLorentzVector {
75public:
76 AliFemtoLorentzVector(T = 0, T = 0, T = 0, T = 0);
77 virtual ~AliFemtoLorentzVector();
78
79#ifndef ST_NO_MEMBER_TEMPLATES
80 template<class X> AliFemtoLorentzVector(const AliFemtoThreeVector<X>&, T);
81 template<class X> AliFemtoLorentzVector(T, const AliFemtoThreeVector<X>&);
82
83 template<class X> AliFemtoLorentzVector(const AliFemtoLorentzVector<X>&);
84 template<class X> AliFemtoLorentzVector<T>& operator=(const AliFemtoLorentzVector<X>&);
85 // AliFemtoLorentzVector(const AliFemtoLorentzVector<T>&); use default
86 // AliFemtoLorentzVector<T>& operator=(const AliFemtoLorentzVector<T>&); use default
87#else
88 AliFemtoLorentzVector(const AliFemtoThreeVector<float>&, T);
89 AliFemtoLorentzVector(T, const AliFemtoThreeVector<float>&);
90 AliFemtoLorentzVector(const AliFemtoLorentzVector<float>&);
91
92 AliFemtoLorentzVector(const AliFemtoThreeVector<double>&, T);
93 AliFemtoLorentzVector(T, const AliFemtoThreeVector<double>&);
94 AliFemtoLorentzVector(const AliFemtoLorentzVector<double>&);
95
96 AliFemtoLorentzVector<T>& operator=(const AliFemtoLorentzVector<float>&);
97 AliFemtoLorentzVector<T>& operator=(const AliFemtoLorentzVector<double>&);
98#endif
99
100 T x() const;
101 T y() const;
102 T z() const;
103 T t() const;
104 T px() const;
105 T py() const;
106 T pz() const;
107 T e() const;
108 T operator() (size_t) const;
109 T operator[] (size_t) const;
110
111 T& operator() (size_t);
112 T& operator[] (size_t);
113
114 const AliFemtoThreeVector<T>& vect() const;
115
a19edcc9 116 void SetX(T);
117 void SetY(T);
118 void SetZ(T);
119 void SetPx(T);
120 void SetPy(T);
121 void SetPz(T);
122 void SetE(T);
123 void SetT(T);
67427ff7 124
125#ifndef ST_NO_MEMBER_TEMPLATES
a19edcc9 126 template <class X> void SetVect(const AliFemtoThreeVector<X>&);
67427ff7 127#else
a19edcc9 128 void SetVect(const AliFemtoThreeVector<float>&);
129 void SetVect(const AliFemtoThreeVector<double>&);
67427ff7 130#endif
131
59c8f7b2 132 T Perp() const;
133 T Perp2() const;
134 T PseudoRapidity() const;
135 T Phi() const;
136 T Theta() const;
137 T CosTheta() const;
67427ff7 138
59c8f7b2 139 T Plus() const;
140 T Minus() const;
67427ff7 141
142 T m() const;
143 T m2() const;
144 T mt() const;
145 T mt2() const;
59c8f7b2 146 T Rapidity() const;
67427ff7 147
148#ifndef ST_NO_MEMBER_TEMPLATES
149 template<class X> AliFemtoLorentzVector<T> boost(const AliFemtoLorentzVector<X>&) const;
150#else
151 AliFemtoLorentzVector<T> boost(const AliFemtoLorentzVector<float>&) const;
152 AliFemtoLorentzVector<T> boost(const AliFemtoLorentzVector<double>&) const;
153#endif
154
155 AliFemtoLorentzVector<T> operator- ();
156 AliFemtoLorentzVector<T> operator+ ();
157 AliFemtoLorentzVector<T>& operator*= (double);
158 AliFemtoLorentzVector<T>& operator/= (double);
159
160#ifndef ST_NO_MEMBER_TEMPLATES
161 template<class X> bool operator == (const AliFemtoLorentzVector<X>&) const;
162 template<class X> bool operator != (const AliFemtoLorentzVector<X>&) const;
163 template<class X> AliFemtoLorentzVector<T>& operator+= (const AliFemtoLorentzVector<X>&);
164 template<class X> AliFemtoLorentzVector<T>& operator-= (const AliFemtoLorentzVector<X>&);
165#else
166 bool operator == (const AliFemtoLorentzVector<float>&) const;
167 bool operator != (const AliFemtoLorentzVector<float>&) const;
168 bool operator == (const AliFemtoLorentzVector<double>&) const;
169 bool operator != (const AliFemtoLorentzVector<double>&) const;
170
171 AliFemtoLorentzVector<T>& operator+= (const AliFemtoLorentzVector<float>&);
172 AliFemtoLorentzVector<T>& operator-= (const AliFemtoLorentzVector<float>&);
173 AliFemtoLorentzVector<T>& operator+= (const AliFemtoLorentzVector<double>&);
174 AliFemtoLorentzVector<T>& operator-= (const AliFemtoLorentzVector<double>&);
175#endif
176
177protected:
178 AliFemtoThreeVector<T> mThreeVector;
179 T mX4;
180#ifdef __ROOT__
181 ClassDef(AliFemtoLorentzVector,3)
182#endif
183};
184#ifndef __CINT__
185//
186// Implementation of member functions
187//
188template<class T>
189AliFemtoLorentzVector<T>::AliFemtoLorentzVector(T x, T y, T z, T t)
190 : mThreeVector(x, y, z), mX4(t) { /* nop */ }
191
192template<class T>
193AliFemtoLorentzVector<T>::~AliFemtoLorentzVector() { /* nopt */ }
194
195template<class T>
196const AliFemtoThreeVector<T>& AliFemtoLorentzVector<T>::vect() const
197{
198 return mThreeVector;
199}
200
201template<class T>
202T AliFemtoLorentzVector<T>::m2() const
203{
204 return (mX4*mX4 - mThreeVector*mThreeVector);
205}
206
207template<class T>
59c8f7b2 208T AliFemtoLorentzVector<T>::Plus() const { return (e() + pz()); }
67427ff7 209
210template<class T>
59c8f7b2 211T AliFemtoLorentzVector<T>::Minus() const { return (e() - pz()); }
67427ff7 212
213template<class T>
214T AliFemtoLorentzVector<T>::m() const
215{
216 T mass2 = m2();
217 if (mass2 < 0)
218 return -::sqrt(-mass2);
219 else
220 return ::sqrt(mass2);
221}
222
223template<class T>
224T AliFemtoLorentzVector<T>::mt2() const
225{
59c8f7b2 226 return this->Perp2() + m2();
67427ff7 227}
228
229template<class T>
230T AliFemtoLorentzVector<T>::mt() const
231{
232 //
233 // change to more optimal code ?
234 // return e()*e() - pz()*pz();
235 T massPerp2 = mt2();
236 if (massPerp2 < 0)
237 return -::sqrt(-massPerp2);
238 else
239 return ::sqrt(massPerp2);
240}
241
242template<class T>
a19edcc9 243void AliFemtoLorentzVector<T>::SetPx(T x) {mThreeVector.SetX(x);}
67427ff7 244
245template<class T>
a19edcc9 246void AliFemtoLorentzVector<T>::SetPy(T y) {mThreeVector.SetY(y);}
67427ff7 247
248template<class T>
a19edcc9 249void AliFemtoLorentzVector<T>::SetPz(T z) {mThreeVector.SetZ(z);}
67427ff7 250
251template<class T>
a19edcc9 252void AliFemtoLorentzVector<T>::SetX(T x) {mThreeVector.SetX(x);}
67427ff7 253
254template<class T>
a19edcc9 255void AliFemtoLorentzVector<T>::SetY(T y) {mThreeVector.SetY(y);}
67427ff7 256
257template<class T>
a19edcc9 258void AliFemtoLorentzVector<T>::SetZ(T z) {mThreeVector.SetZ(z);}
67427ff7 259
260template<class T>
a19edcc9 261void AliFemtoLorentzVector<T>::SetT(T t) {mX4 = t;}
67427ff7 262
263template<class T>
a19edcc9 264void AliFemtoLorentzVector<T>::SetE(T e) {mX4 = e;}
67427ff7 265
266template<class T>
267T AliFemtoLorentzVector<T>::x() const {return mThreeVector.x();}
268
269template<class T>
270T AliFemtoLorentzVector<T>::y() const {return mThreeVector.y();}
271
272template<class T>
273T AliFemtoLorentzVector<T>::z() const {return mThreeVector.z();}
274
275template<class T>
276T AliFemtoLorentzVector<T>::px() const {return mThreeVector.x();}
277
278template<class T>
279T AliFemtoLorentzVector<T>::py() const {return mThreeVector.y();}
280
281template<class T>
282T AliFemtoLorentzVector<T>::pz() const {return mThreeVector.z();}
283
284template<class T>
285T AliFemtoLorentzVector<T>::e() const {return mX4;}
286
287template<class T>
288T AliFemtoLorentzVector<T>::t() const {return mX4;}
289
290template<class T>
59c8f7b2 291T AliFemtoLorentzVector<T>::Perp() const {return mThreeVector.Perp();}
67427ff7 292
293template<class T>
59c8f7b2 294T AliFemtoLorentzVector<T>::Perp2() const {return mThreeVector.Perp2();}
67427ff7 295
296template<class T>
59c8f7b2 297T AliFemtoLorentzVector<T>::PseudoRapidity() const {return mThreeVector.PseudoRapidity();}
67427ff7 298
299template<class T>
59c8f7b2 300T AliFemtoLorentzVector<T>::Phi() const {return mThreeVector.Phi();}
67427ff7 301
302template<class T>
59c8f7b2 303T AliFemtoLorentzVector<T>::Theta() const {return mThreeVector.Theta();}
67427ff7 304
305template<class T>
59c8f7b2 306T AliFemtoLorentzVector<T>::CosTheta() const {return mThreeVector.CosTheta();}
67427ff7 307
308template<class T>
309T AliFemtoLorentzVector<T>::operator() (size_t i) const
310{
311 if (i < 3)
312 return mThreeVector(i);
313 else if (i == 3)
314 return mX4;
315 else {
316#ifndef ST_NO_EXCEPTIONS
317 throw out_of_range("AliFemtoLorentzVector<T>::operator(): bad index");
318#else
319 cerr << "AliFemtoLorentzVector<T>::operator(): bad index." << endl;
320#endif
321 return 0;
322 }
323}
324
325template<class T>
326T& AliFemtoLorentzVector<T>::operator() (size_t i)
327{
328 if (i < 3)
329 return mThreeVector(i);
330 else if (i == 3)
331 return mX4;
332 else {
333#ifndef ST_NO_EXCEPTIONS
334 throw out_of_range("AliFemtoLorentzVector<T>::operator(): bad index");
335#else
336 cerr << "AliFemtoLorentzVector<T>::operator(): bad index." << endl;
337#endif
338 return mX4;
339 }
340}
341
342template<class T>
343T AliFemtoLorentzVector<T>::operator[] (size_t i) const
344{
345 if (i < 3)
346 return mThreeVector[i];
347 else if (i == 3)
348 return mX4;
349 else {
350#ifndef ST_NO_EXCEPTIONS
351 throw out_of_range("AliFemtoLorentzVector<T>::operator[]: bad index");
352#else
353 cerr << "AliFemtoLorentzVector<T>::operator[]: bad index." << endl;
354#endif
355 return 0;
356 }
357}
358
359template<class T>
360T& AliFemtoLorentzVector<T>::operator[] (size_t i)
361{
362 if (i < 3)
363 return mThreeVector[i];
364 else if (i == 3)
365 return mX4;
366 else {
367#ifndef ST_NO_EXCEPTIONS
368 throw out_of_range("AliFemtoLorentzVector<T>::operator[]: bad index");
369#else
370 cerr << "AliFemtoLorentzVector<T>::operator[]: bad index." << endl;
371#endif
372 return mX4;
373 }
374}
375
376template<class T>
59c8f7b2 377T AliFemtoLorentzVector<T>::Rapidity() const
67427ff7 378{
379 return 0.5*::log((mX4+mThreeVector.z())/(mX4-mThreeVector.z())+1e-20);
380}
381
382template<class T>
383AliFemtoLorentzVector<T> AliFemtoLorentzVector<T>::operator- ()
384{
385 return AliFemtoLorentzVector<T>(-mX4,-mThreeVector);
386}
387
388template<class T>
389AliFemtoLorentzVector<T> AliFemtoLorentzVector<T>::operator+ ()
390{
391 return *this;
392}
393
394template<class T>
395AliFemtoLorentzVector<T>& AliFemtoLorentzVector<T>::operator*= (double c)
396{
397 mThreeVector *= c;
398 mX4 *= c;
399 return *this;
400}
401
402template<class T>
403AliFemtoLorentzVector<T>& AliFemtoLorentzVector<T>::operator/= (double c)
404{
405 mThreeVector /= c;
406 mX4 /= c;
407 return *this;
408}
409
410#ifndef ST_NO_MEMBER_TEMPLATES
411#ifndef WIN32
412
413template<class T>
414template<class X>
415AliFemtoLorentzVector<T>::AliFemtoLorentzVector(const AliFemtoThreeVector<X> &vec, T t)
416 : mThreeVector(vec), mX4(t) { /* nop */ }
417
418template<class T>
419template<class X>
420AliFemtoLorentzVector<T>::AliFemtoLorentzVector(T t, const AliFemtoThreeVector<X> &vec)
421 : mThreeVector(vec), mX4(t) { /* nop */ }
422
423template<class T>
424template<class X>
425AliFemtoLorentzVector<T>::AliFemtoLorentzVector(const AliFemtoLorentzVector<X> &vec)
426 : mThreeVector(vec.vect()), mX4(vec.t()) { /* nop */ }
427
428template<class T>
429template<class X>
430AliFemtoLorentzVector<T>
431AliFemtoLorentzVector<T>::boost(const AliFemtoLorentzVector<X>& pframe) const
432{
433 T mass = abs(pframe);
434 AliFemtoThreeVector<T> eta = (-1./mass)*pframe.vect(); // gamma*beta
435 T gamma = fabs(pframe.e())/mass;
436 AliFemtoThreeVector<T> pl = ((this->vect()*eta)/(eta*eta))*eta; // longitudinal momentum
437 return AliFemtoLorentzVector<T>(gamma*this->e() - this->vect()*eta,
438 this->vect() + (gamma-1.)*pl - this->e()*eta);
439}
440
441template<class T>
442template<class X>
a19edcc9 443void AliFemtoLorentzVector<T>::SetVect(const AliFemtoThreeVector<X>& v)
67427ff7 444{
445 mThreeVector = v;
446}
447
448template<class T>
449template<class X>
450AliFemtoLorentzVector<T>&
451AliFemtoLorentzVector<T>::operator=(const AliFemtoLorentzVector<X>& vec)
452{
453 mThreeVector = vec.vect();
454 mX4 = vec.t();
455 return *this;
456}
457
458template<class T>
459template<class X>
460bool
461AliFemtoLorentzVector<T>::operator== (const AliFemtoLorentzVector<X>& v) const
462{
463 return (mThreeVector == v.vect()) && (mX4 == v.t());
464}
465
466template<class T>
467template<class X>
468bool
469AliFemtoLorentzVector<T>::operator!= (const AliFemtoLorentzVector<X>& v) const
470{
471 return !(*this == v);
472}
473
474template<class T>
475template<class X>
476AliFemtoLorentzVector<T>&
477AliFemtoLorentzVector<T>::operator+= (const AliFemtoLorentzVector<X>& v)
478{
479 mThreeVector += v.vect();
480 mX4 += v.t();
481 return *this;
482}
483
484template<class T>
485template<class X>
486AliFemtoLorentzVector<T>&
487AliFemtoLorentzVector<T>::operator-= (const AliFemtoLorentzVector<X>& v)
488{
489 mThreeVector -= v.vect();
490 mX4 -= v.t();
491 return *this;
492}
493
494#endif
495#else
496
497template<class T>
498AliFemtoLorentzVector<T>::AliFemtoLorentzVector(const AliFemtoThreeVector<float> &vec, T t)
499 : mThreeVector(vec), mX4(t) { /* nop */ }
500
501template<class T>
502AliFemtoLorentzVector<T>::AliFemtoLorentzVector(const AliFemtoThreeVector<double> &vec, T t)
503 : mThreeVector(vec), mX4(t) { /* nop */ }
504
505template<class T>
506AliFemtoLorentzVector<T>::AliFemtoLorentzVector(T t, const AliFemtoThreeVector<float> &vec)
507 : mThreeVector(vec), mX4(t) { /* nop */ }
508
509template<class T>
510AliFemtoLorentzVector<T>::AliFemtoLorentzVector(T t, const AliFemtoThreeVector<double> &vec)
511 : mThreeVector(vec), mX4(t) { /* nop */ }
512
513template<class T>
514AliFemtoLorentzVector<T>::AliFemtoLorentzVector(const AliFemtoLorentzVector<float> &vec)
515 : mThreeVector(vec.vect()), mX4(vec.t()) { /* nop */ }
516
517template<class T>
518AliFemtoLorentzVector<T>::AliFemtoLorentzVector(const AliFemtoLorentzVector<double> &vec)
519 : mThreeVector(vec.vect()), mX4(vec.t()) { /* nop */ }
520
521template<class T>
522AliFemtoLorentzVector<T>
523AliFemtoLorentzVector<T>::boost(const AliFemtoLorentzVector<float>& pframe) const
524{
525 T mass = abs(pframe);
526 AliFemtoThreeVector<T> eta = (-1./mass)*pframe.vect(); // gamma*beta
527 T gamma = fabs(pframe.e())/mass;
528 AliFemtoThreeVector<T> pl = ((this->vect()*eta)/(eta*eta))*eta; // longitudinal momentum
529 return AliFemtoLorentzVector<T>(gamma*this->e() - this->vect()*eta,
530 this->vect() + (gamma-1.)*pl - this->e()*eta);
531}
532
533template<class T>
534AliFemtoLorentzVector<T>
535AliFemtoLorentzVector<T>::boost(const AliFemtoLorentzVector<double>& pframe) const
536{
537 T mass = abs(pframe);
538 AliFemtoThreeVector<T> eta = (-1./mass)*pframe.vect(); // gamma*beta
539 T gamma = fabs(pframe.e())/mass;
540 AliFemtoThreeVector<T> pl = ((this->vect()*eta)/(eta*eta))*eta; // longitudinal momentum
541 return AliFemtoLorentzVector<T>(gamma*this->e() - this->vect()*eta,
542 this->vect() + (gamma-1.)*pl - this->e()*eta);
543}
544
545template<class T>
a19edcc9 546void AliFemtoLorentzVector<T>::SetVect(const AliFemtoThreeVector<float>& v)
67427ff7 547{
548 mThreeVector = v;
549}
550
551template<class T>
a19edcc9 552void AliFemtoLorentzVector<T>::SetVect(const AliFemtoThreeVector<double>& v)
67427ff7 553{
554 mThreeVector = v;
555}
556
557template<class T>
558AliFemtoLorentzVector<T>&
559AliFemtoLorentzVector<T>::operator=(const AliFemtoLorentzVector<float>& vec)
560{
561 mThreeVector = vec.vect();
562 mX4 = vec.t();
563 return *this;
564}
565
566template<class T>
567AliFemtoLorentzVector<T>&
568AliFemtoLorentzVector<T>::operator=(const AliFemtoLorentzVector<double>& vec)
569{
570 mThreeVector = vec.vect();
571 mX4 = vec.t();
572 return *this;
573}
574
575template<class T>
576bool
577AliFemtoLorentzVector<T>::operator== (const AliFemtoLorentzVector<float>& v) const
578{
579 return (this->vect() == v.vect()) && (mX4 == v.t());
580}
581
582template<class T>
583bool
584AliFemtoLorentzVector<T>::operator== (const AliFemtoLorentzVector<double>& v) const
585{
586 return (mThreeVector == v.vect()) && (mX4 == v.t());
587}
588
589template<class T>
590bool
591AliFemtoLorentzVector<T>::operator!= (const AliFemtoLorentzVector<float>& v) const
592{
593 return !(*this == v);
594}
595
596template<class T>
597bool
598AliFemtoLorentzVector<T>::operator!= (const AliFemtoLorentzVector<double>& v) const
599{
600 return !(*this == v);
601}
602
603template<class T>
604AliFemtoLorentzVector<T>&
605AliFemtoLorentzVector<T>::operator+= (const AliFemtoLorentzVector<float>& v)
606{
607 mThreeVector += v.vect();
608 mX4 += v.t();
609 return *this;
610}
611
612template<class T>
613AliFemtoLorentzVector<T>&
614AliFemtoLorentzVector<T>::operator+= (const AliFemtoLorentzVector<double>& v)
615{
616 mThreeVector += v.vect();
617 mX4 += v.t();
618 return *this;
619}
620
621template<class T>
622AliFemtoLorentzVector<T>&
623AliFemtoLorentzVector<T>::operator-= (const AliFemtoLorentzVector<float>& v)
624{
625 mThreeVector -= v.vect();
626 mX4 -= v.t();
627 return *this;
628}
629
630template<class T>
631AliFemtoLorentzVector<T>&
632AliFemtoLorentzVector<T>::operator-= (const AliFemtoLorentzVector<double>& v)
633{
634 mThreeVector -= v.vect();
635 mX4 -= v.t();
636 return *this;
637}
638
639#endif // ST_NO_MEMBER_TEMPLATES
640#endif /* ! __CINT__ */
641#ifdef __CINT__
642template<> AliFemtoLorentzVector<double> operator+ (const AliFemtoLorentzVector<double>& v1, const AliFemtoLorentzVector<double>& v2);
643template<> AliFemtoLorentzVector<double> operator+ (const AliFemtoLorentzVector<double>& v1, const AliFemtoLorentzVector<float>& v2);
644template<> AliFemtoLorentzVector<double> operator+ (const AliFemtoLorentzVector<float>& v1, const AliFemtoLorentzVector<double>& v2);
645template<> AliFemtoLorentzVector<float> operator+ (const AliFemtoLorentzVector<float>& v1, const AliFemtoLorentzVector<float>& v2);
646template<> AliFemtoLorentzVector<double> operator- (const AliFemtoLorentzVector<double>& v1, const AliFemtoLorentzVector<double>& v2);
647template<> AliFemtoLorentzVector<double> operator- (const AliFemtoLorentzVector<double>& v1, const AliFemtoLorentzVector<float>& v2);
648template<> AliFemtoLorentzVector<double> operator- (const AliFemtoLorentzVector<float>& v1, const AliFemtoLorentzVector<double>& v2);
649template<> AliFemtoLorentzVector<float> operator- (const AliFemtoLorentzVector<float>& v1, const AliFemtoLorentzVector<float>& v2);
650template<> AliFemtoLorentzVector<double> operator* (const AliFemtoLorentzVector<double>& v1, const AliFemtoLorentzVector<double>& v2);
651template<> AliFemtoLorentzVector<double> operator* (const AliFemtoLorentzVector<double>& v1, const AliFemtoLorentzVector<float>& v2);
652template<> AliFemtoLorentzVector<double> operator* (const AliFemtoLorentzVector<float>& v1, const AliFemtoLorentzVector<double>& v2);
653template<> AliFemtoLorentzVector<float> operator* (const AliFemtoLorentzVector<float>& v1, const AliFemtoLorentzVector<float>& v2);
654template<> AliFemtoLorentzVector<double> operator* (const double v1, const AliFemtoLorentzVector<double>& v2);
655template<> AliFemtoLorentzVector<double> operator* (const double v1, const AliFemtoLorentzVector<float>& v2);
656template<> AliFemtoLorentzVector<double> operator* (const AliFemtoLorentzVector<double>& v1, const double v2);
657template<> AliFemtoLorentzVector<double> operator* (const AliFemtoLorentzVector<float>& v1, const double v2);
658template<> AliFemtoLorentzVector<double> operator/ (const AliFemtoLorentzVector<double>& v1, const AliFemtoLorentzVector<double>& v2);
659template<> AliFemtoLorentzVector<double> operator/ (const AliFemtoLorentzVector<double>& v1, const AliFemtoLorentzVector<float>& v2);
660template<> AliFemtoLorentzVector<double> operator/ (const AliFemtoLorentzVector<float>& v1, const AliFemtoLorentzVector<double>& v2);
661template<> AliFemtoLorentzVector<float> operator/ (const AliFemtoLorentzVector<float>& v1, const AliFemtoLorentzVector<float>& v2);
662template<> AliFemtoLorentzVector<double> operator/ (const double v1, const AliFemtoLorentzVector<double>& v2);
663template<> AliFemtoLorentzVector<double> operator/ (const double v1, const AliFemtoLorentzVector<float>& v2);
664template<> AliFemtoLorentzVector<double> operator/ (const AliFemtoLorentzVector<double>& v1, const double v2);
665template<> AliFemtoLorentzVector<double> operator/ (const AliFemtoLorentzVector<float>& v1, const double v2);
666template<> istream& operator>> (istream& is, const AliFemtoLorentzVector<double>& v);
667template<> ostream& operator<< (ostream& os, const AliFemtoLorentzVector<double>& v);
668template<> istream& operator>> (istream& is, const AliFemtoLorentzVector<float>& v);
669template<> ostream& operator<< (ostream& os, const AliFemtoLorentzVector<float>& v);
670template<> double abs(const AliFemtoLorentzVector<double>& v);
671template<> float abs(const AliFemtoLorentzVector<float>& v);
672#else
673//
674// Non-member operators
675//
676template<class T, class X>
677AliFemtoLorentzVector<T>
678operator+ (const AliFemtoLorentzVector<T>& v1, const AliFemtoLorentzVector<X>& v2)
679{
680 return AliFemtoLorentzVector<T>(v1) += v2;
681}
682
683template<class T, class X>
684AliFemtoLorentzVector<T>
685operator- (const AliFemtoLorentzVector<T>& v1, const AliFemtoLorentzVector<X>& v2)
686{
687 return AliFemtoLorentzVector<T>(v1) -= v2;
688}
689
690template<class T, class X>
691T
692operator* (const AliFemtoLorentzVector<T>& v1, const AliFemtoLorentzVector<X>& v2)
693{
694 return v1.t()*v2.t() - v1.vect()*v2.vect();
695}
696
697template<class T>
698AliFemtoLorentzVector<T>
699operator* (const AliFemtoLorentzVector<T>& v, double c)
700{
701 return AliFemtoLorentzVector<T>(v) *= c;
702}
703
704template<class T>
705AliFemtoLorentzVector<T> operator* (double c, const AliFemtoLorentzVector<T>& v)
706{
707 return AliFemtoLorentzVector<T>(v) *= c;
708}
709
710template<class T, class X>
711AliFemtoLorentzVector<T> operator/ (const AliFemtoLorentzVector<T>& v, X c)
712{
713 return AliFemtoLorentzVector<T>(v) /= c;
714}
715
716template<class T>
717ostream& operator<< (ostream& os, const AliFemtoLorentzVector<T>& v)
718{
719 return os << v.vect() << "\t\t" << v.t();
720}
721
722template<class T>
723istream& operator>>(istream& is, AliFemtoLorentzVector<T>& v)
724{
725 T x, y, z, t;
726 is >> x >> y >> z >> t;
a19edcc9 727 v.SetX(x);
728 v.SetY(y);
729 v.SetZ(z);
730 v.SetT(t);
67427ff7 731 return is;
732}
733
734//
735// Non-member functions
736//
737template<class T>
738T abs(const AliFemtoLorentzVector<T>& v) {return v.m();}
739
740#endif /* __CINT__ */
741#endif