Line data Source code
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 : namespace EvtGenFunctions {
33 : EvtTensor4C directProd(const EvtVector4R& c1,const EvtVector4R& c2);
34 : EvtTensor4C directProd(const EvtVector4C& c1,const EvtVector4C& c2);
35 : EvtTensor4C directProd(const EvtVector4C& c1,const EvtVector4R& c2);
36 : };
37 :
38 : class EvtTensor4C {
39 : friend EvtTensor4C EvtGenFunctions::directProd(const EvtVector4R& c1,const EvtVector4R& c2);
40 : friend EvtTensor4C EvtGenFunctions::directProd(const EvtVector4C& c1,const EvtVector4C& c2);
41 : friend EvtTensor4C EvtGenFunctions::directProd(const EvtVector4C& c1,const EvtVector4R& c2);
42 :
43 : friend EvtTensor4C rotateEuler(const EvtTensor4C& e,
44 : double alpha,double beta,double gamma);
45 : friend EvtTensor4C boostTo(const EvtTensor4C& e,
46 : const EvtVector4R p4);
47 : friend EvtTensor4C boostTo(const EvtTensor4C& e,
48 : const EvtVector3R boost);
49 : friend EvtTensor4C dual(const EvtTensor4C& t2);
50 : friend EvtTensor4C conj(const EvtTensor4C& t2);
51 : friend EvtTensor4C cont22(const EvtTensor4C& t1,const EvtTensor4C& t2);
52 : friend EvtTensor4C cont11(const EvtTensor4C& t1,const EvtTensor4C& t2);
53 : friend EvtTensor4C operator*(const EvtTensor4C& t1,const EvtComplex& c);
54 : friend EvtTensor4C operator*(const EvtComplex& c,const EvtTensor4C& t1);
55 : friend EvtTensor4C operator*(const EvtTensor4C& t1,double d);
56 : friend EvtTensor4C operator*(double d,const EvtTensor4C& t1);
57 : friend EvtComplex cont(const EvtTensor4C& t1,const EvtTensor4C& t2);
58 : friend EvtTensor4C operator+(const EvtTensor4C& t1,const EvtTensor4C& t2);
59 : friend EvtTensor4C operator-(const EvtTensor4C& t1,const EvtTensor4C& t2);
60 :
61 : public:
62 :
63 0 : EvtTensor4C() {;}
64 :
65 0 : EvtTensor4C(double t00,double t11,double t22, double t33) { setdiag(t00,t11,t22,t33);}
66 :
67 :
68 : EvtTensor4C(const EvtTensor4C& t1 );
69 : virtual ~EvtTensor4C();
70 : EvtTensor4C& operator=(const EvtTensor4C& t1);
71 : EvtTensor4C& operator*=(const EvtComplex& c);
72 : EvtTensor4C& operator*=(double d);
73 : EvtTensor4C& addDirProd(const EvtVector4R& p1,const EvtVector4R& p2);
74 : static const EvtTensor4C& g();
75 : inline void set(int i,int j,const EvtComplex& c);
76 : void setdiag(double t00,double t11,double t22, double t33);
77 : inline const EvtComplex& get(int i, int j) const;
78 : inline EvtComplex trace() const;
79 : void zero();
80 : void applyRotateEuler(double alpha,double beta,double gamma);
81 : void applyBoostTo(const EvtVector4R& p4);
82 : void applyBoostTo(const EvtVector3R& boost);
83 : friend std::ostream& operator<<(std::ostream& s, const EvtTensor4C& t);
84 : EvtTensor4C& operator+=(const EvtTensor4C& t2);
85 : EvtTensor4C& operator-=(const EvtTensor4C& t2);
86 : EvtTensor4C conj() const;
87 : EvtVector4C cont1(const EvtVector4C& v4) const;
88 : EvtVector4C cont2(const EvtVector4C& v4) const;
89 : EvtVector4C cont1(const EvtVector4R& v4) const;
90 : EvtVector4C cont2(const EvtVector4R& v4) const;
91 :
92 :
93 : private:
94 :
95 : EvtComplex t[4][4];
96 :
97 : };
98 :
99 : inline EvtTensor4C operator+(const EvtTensor4C& t1,const EvtTensor4C& t2){
100 :
101 0 : return EvtTensor4C(t1)+=t2;
102 0 : }
103 :
104 : inline EvtTensor4C operator-(const EvtTensor4C& t1,const EvtTensor4C& t2){
105 :
106 0 : return EvtTensor4C(t1)-=t2;
107 0 : }
108 :
109 : inline void EvtTensor4C::set(int i,int j,const EvtComplex& c){
110 0 : t[i][j]=c;
111 0 : }
112 :
113 : inline const EvtComplex& EvtTensor4C::get(int i,int j) const{
114 0 : return t[i][j];
115 : }
116 :
117 : inline EvtComplex EvtTensor4C::trace() const{
118 : return t[0][0]-t[1][1]-t[2][2]-t[3][3];
119 : }
120 :
121 : #endif
122 :
|