]>
Commit | Line | Data |
---|---|---|
da0e9ce3 | 1 | //-------------------------------------------------------------------------- |
2 | // | |
3 | // Environment: | |
4 | // This software is part of the EvtGen package developed jointly | |
5 | // for the BaBar and CLEO collaborations. If you use all or part | |
6 | // of it, please give an appropriate acknowledgement. | |
7 | // | |
8 | // Copyright Information: See EvtGen/COPYRIGHT | |
9 | // Copyright (C) 1998 Caltech, UCSB | |
10 | // | |
11 | // Module: EvtGen/EvtTensor4C.hh | |
12 | // | |
13 | // Description: Class to handle complex tensor manipulation | |
14 | // | |
15 | // Modification history: | |
16 | // | |
17 | // DJL/RYD September 25, 1996 Module created | |
18 | // | |
19 | //------------------------------------------------------------------------ | |
20 | ||
21 | #ifndef EvtTensor4C_HH | |
22 | #define EvtTensor4C_HH | |
23 | ||
24 | #include "EvtGenBase/EvtComplex.hh" | |
25 | ||
26 | //Class to handle 4D complex valued tensors. | |
27 | class EvtTensor4C; | |
28 | class EvtVector4C; | |
29 | class EvtVector4R; | |
30 | class EvtVector3R; | |
31 | ||
32 | EvtTensor4C directProd(const EvtVector4C& c1,const EvtVector4C& c2); | |
33 | EvtTensor4C directProd(const EvtVector4C& c1,const EvtVector4R& c2); | |
34 | EvtTensor4C directProd(const EvtVector4R& c1,const EvtVector4R& c2); | |
35 | EvtTensor4C dual(const EvtTensor4C& t2); | |
36 | ||
37 | class EvtTensor4C { | |
38 | ||
39 | friend EvtTensor4C rotateEuler(const EvtTensor4C& e, | |
40 | double alpha,double beta,double gamma); | |
41 | friend EvtTensor4C boostTo(const EvtTensor4C& e, | |
42 | const EvtVector4R p4); | |
43 | friend EvtTensor4C boostTo(const EvtTensor4C& e, | |
44 | const EvtVector3R boost); | |
45 | friend EvtTensor4C directProd(const EvtVector4C& c1,const EvtVector4C& c2); | |
46 | friend EvtTensor4C directProd(const EvtVector4C& c1,const EvtVector4R& c2); | |
47 | friend EvtTensor4C directProd(const EvtVector4R& c1,const EvtVector4R& c2); | |
48 | friend EvtTensor4C dual(const EvtTensor4C& t2); | |
49 | friend EvtTensor4C conj(const EvtTensor4C& t2); | |
50 | friend EvtTensor4C cont22(const EvtTensor4C& t1,const EvtTensor4C& t2); | |
51 | friend EvtTensor4C cont11(const EvtTensor4C& t1,const EvtTensor4C& t2); | |
52 | friend EvtTensor4C operator*(const EvtTensor4C& t1,const EvtComplex& c); | |
53 | friend EvtTensor4C operator*(const EvtComplex& c,const EvtTensor4C& t1); | |
54 | friend EvtTensor4C operator*(const EvtTensor4C& t1,double d); | |
55 | friend EvtTensor4C operator*(double d,const EvtTensor4C& t1); | |
56 | friend EvtComplex cont(const EvtTensor4C& t1,const EvtTensor4C& t2); | |
57 | friend EvtTensor4C operator+(const EvtTensor4C& t1,const EvtTensor4C& t2); | |
58 | friend EvtTensor4C operator-(const EvtTensor4C& t1,const EvtTensor4C& t2); | |
59 | ||
60 | public: | |
61 | ||
62 | EvtTensor4C() {;} | |
63 | ||
64 | EvtTensor4C(double t00,double t11,double t22, double t33) { setdiag(t00,t11,t22,t33);} | |
65 | ||
66 | ||
67 | EvtTensor4C(const EvtTensor4C& t1 ); | |
68 | virtual ~EvtTensor4C(); | |
69 | EvtTensor4C& operator=(const EvtTensor4C& t1); | |
70 | EvtTensor4C& operator*=(const EvtComplex& c); | |
71 | EvtTensor4C& operator*=(double d); | |
72 | EvtTensor4C& addDirProd(const EvtVector4R& p1,const EvtVector4R& p2); | |
73 | static const EvtTensor4C& g(); | |
74 | inline void set(int i,int j,const EvtComplex& c); | |
75 | void setdiag(double t00,double t11,double t22, double t33); | |
76 | inline const EvtComplex& get(int i, int j) const; | |
77 | inline EvtComplex trace() const; | |
78 | void zero(); | |
79 | void applyRotateEuler(double alpha,double beta,double gamma); | |
80 | void applyBoostTo(const EvtVector4R& p4); | |
81 | void applyBoostTo(const EvtVector3R& boost); | |
82 | friend std::ostream& operator<<(std::ostream& s, const EvtTensor4C& t); | |
83 | EvtTensor4C& operator+=(const EvtTensor4C& t2); | |
84 | EvtTensor4C& operator-=(const EvtTensor4C& t2); | |
85 | EvtTensor4C conj() const; | |
86 | EvtVector4C cont1(const EvtVector4C& v4) const; | |
87 | EvtVector4C cont2(const EvtVector4C& v4) const; | |
88 | EvtVector4C cont1(const EvtVector4R& v4) const; | |
89 | EvtVector4C cont2(const EvtVector4R& v4) const; | |
90 | ||
91 | ||
92 | private: | |
93 | ||
94 | EvtComplex t[4][4]; | |
95 | ||
96 | }; | |
97 | ||
98 | inline EvtTensor4C operator+(const EvtTensor4C& t1,const EvtTensor4C& t2){ | |
99 | ||
100 | return EvtTensor4C(t1)+=t2; | |
101 | } | |
102 | ||
103 | inline EvtTensor4C operator-(const EvtTensor4C& t1,const EvtTensor4C& t2){ | |
104 | ||
105 | return EvtTensor4C(t1)-=t2; | |
106 | } | |
107 | ||
108 | inline void EvtTensor4C::set(int i,int j,const EvtComplex& c){ | |
109 | t[i][j]=c; | |
110 | } | |
111 | ||
112 | inline const EvtComplex& EvtTensor4C::get(int i,int j) const{ | |
113 | return t[i][j]; | |
114 | } | |
115 | ||
116 | inline EvtComplex EvtTensor4C::trace() const{ | |
117 | return t[0][0]-t[1][1]-t[2][2]-t[3][3]; | |
118 | } | |
119 | ||
120 | #endif | |
121 |