1 //--------------------------------------------------------------------------
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.
8 // Copyright Information: See EvtGen/COPYRIGHT
9 // Copyright (C) 1998 Caltech, UCSB
11 // Module: EvtGen/EvtTensor3C.hh
13 // Description: Class to handle complex 3 tensors
15 // Modification history:
17 // RYD September 14, 1997 Module created
19 //------------------------------------------------------------------------
21 #ifndef EVTTENSOR3C_HH
22 #define EVTTENSOR3C_HH
25 #include "EvtGenBase/EvtComplex.hh"
32 EvtTensor3C eps(const EvtVector3R& v);
34 EvtTensor3C directProd(const EvtVector3C& c1,const EvtVector3C& c2);
35 EvtTensor3C directProd(const EvtVector3C& c1,const EvtVector3R& c2);
36 EvtTensor3C directProd(const EvtVector3R& c1,const EvtVector3R& c2);
40 friend EvtTensor3C rotateEuler(const EvtTensor3C& v,
41 double phi,double theta,double ksi);
42 friend EvtTensor3C operator*(
43 const EvtComplex& c,const EvtTensor3C& t2);
44 friend EvtTensor3C operator*(double d,const EvtTensor3C& t2);
45 friend EvtTensor3C operator*(
46 const EvtTensor3C& t2,const EvtComplex& c);
47 friend EvtTensor3C operator*(const EvtTensor3C& t2,double d);
48 friend EvtTensor3C operator+(
49 const EvtTensor3C& t1,const EvtTensor3C& t2);
50 friend EvtTensor3C operator-(
51 const EvtTensor3C& t1,const EvtTensor3C& t2);
52 friend EvtTensor3C directProd(const EvtVector3C& c1,const EvtVector3C& c2);
53 friend EvtTensor3C directProd(const EvtVector3C& c1,const EvtVector3R& c2);
54 friend EvtTensor3C directProd(const EvtVector3R& c1,const EvtVector3R& c2);
55 friend EvtTensor3C conj(const EvtTensor3C& t2);
56 //Contract the second index of two tensors result(i,j) = t1(i,k)t2(j,k)
57 friend EvtTensor3C cont22(const EvtTensor3C& t1,const EvtTensor3C& t2);
58 //Contract the first index of two tensors result(i,j) = t1(k,i)t2(k,j)
59 friend EvtTensor3C cont11(const EvtTensor3C& t1,const EvtTensor3C& t2);
60 //Contract the last index of eps_{ijk} with w
61 friend EvtTensor3C eps(const EvtVector3R& v);
62 friend std::ostream& operator<<(std::ostream& c,const EvtTensor3C& v);
66 EvtTensor3C(const EvtTensor3C& t1 );
67 EvtTensor3C(double d11, double d22, double d33);
68 virtual ~EvtTensor3C();
69 EvtTensor3C& operator=(const EvtTensor3C& t1);
70 inline void set(int i,int j,const EvtComplex& c);
71 inline const EvtComplex& get(int i, int j) const;
72 inline EvtComplex trace() const;
73 static const EvtTensor3C& id();
75 void applyRotateEuler(double phi,double theta,double ksi);
77 EvtTensor3C operator+=(const EvtTensor3C& t2);
78 EvtTensor3C operator-=(const EvtTensor3C& t2);
79 EvtTensor3C operator*=(double d);
80 EvtTensor3C operator*=(const EvtComplex& c);
81 EvtTensor3C conj() const;
82 EvtVector3C cont1(const EvtVector3C& v) const;
83 EvtVector3C cont2(const EvtVector3C& v) const;
84 EvtVector3C cont1(const EvtVector3R& v) const;
85 EvtVector3C cont2(const EvtVector3R& v) const;
93 inline EvtTensor3C operator*(const EvtComplex& c,const EvtTensor3C& t2){
94 return EvtTensor3C(t2)*=c;
97 inline EvtTensor3C operator*(const double d,const EvtTensor3C& t2){
98 return EvtTensor3C(t2)*=d;
101 inline EvtTensor3C operator*(const EvtTensor3C& t2,const EvtComplex& c){
102 return EvtTensor3C(t2)*=c;
105 inline EvtTensor3C operator*(const EvtTensor3C& t2,double d){
106 return EvtTensor3C(t2)*=d;
109 inline EvtTensor3C operator+(const EvtTensor3C& t1,const EvtTensor3C& t2){
110 return EvtTensor3C(t1)+=t2;
113 inline EvtTensor3C operator-(const EvtTensor3C& t1,const EvtTensor3C& t2){
114 return EvtTensor3C(t1)-=t2;
117 inline void EvtTensor3C::set(int i,int j,const EvtComplex& c){
121 inline const EvtComplex& EvtTensor3C::get(int i,int j) const{
125 inline EvtComplex EvtTensor3C::trace() const{
126 return t[0][0]+t[1][1]+t[2][2];