]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TEvtGen/EvtGenBase/EvtTensor3C.hh
An effective FD corretion
[u/mrichter/AliRoot.git] / TEvtGen / EvtGenBase / EvtTensor3C.hh
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/EvtTensor3C.hh
12 //
13 // Description: Class to handle complex 3 tensors
14 //
15 // Modification history:
16 //
17 //    RYD     September 14, 1997         Module created
18 //
19 //------------------------------------------------------------------------
20
21 #ifndef EVTTENSOR3C_HH
22 #define EVTTENSOR3C_HH
23
24 #include <iostream>
25 #include "EvtGenBase/EvtComplex.hh"
26
27 class EvtVector3C;
28 class EvtVector3R;
29
30 class EvtTensor3C;
31
32 EvtTensor3C eps(const EvtVector3R& v);
33
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);
37
38 class EvtTensor3C {
39
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); 
63
64 public:
65   EvtTensor3C();
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();
74   void zero();
75   void applyRotateEuler(double phi,double theta,double ksi);
76
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; 
86   
87 private:
88
89   EvtComplex t[3][3];
90
91 };
92
93 inline EvtTensor3C operator*(const EvtComplex& c,const EvtTensor3C& t2){
94   return EvtTensor3C(t2)*=c;
95 }
96
97 inline EvtTensor3C operator*(const double d,const EvtTensor3C& t2){
98   return EvtTensor3C(t2)*=d;
99 }
100
101 inline EvtTensor3C operator*(const EvtTensor3C& t2,const EvtComplex& c){
102   return EvtTensor3C(t2)*=c;
103 }
104
105 inline EvtTensor3C operator*(const EvtTensor3C& t2,double d){
106   return EvtTensor3C(t2)*=d;
107 }
108
109 inline EvtTensor3C operator+(const EvtTensor3C& t1,const EvtTensor3C& t2){
110   return EvtTensor3C(t1)+=t2;
111 }
112
113 inline EvtTensor3C operator-(const EvtTensor3C& t1,const EvtTensor3C& t2){
114   return EvtTensor3C(t1)-=t2;
115 }
116
117 inline void EvtTensor3C::set(int i,int j,const EvtComplex& c){
118    t[i][j]=c;
119 }
120
121 inline const EvtComplex& EvtTensor3C::get(int i,int j) const{
122    return t[i][j];
123 }
124
125 inline EvtComplex EvtTensor3C::trace() const{
126    return t[0][0]+t[1][1]+t[2][2];
127 }
128
129 #endif
130