00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef EVTVECTOR4C_HH
00022 #define EVTVECTOR4C_HH
00023
00024
00025 #include "EvtGenBase/EvtComplex.hh"
00026 #include "EvtGenBase/EvtVector3C.hh"
00027 #include "EvtGenBase/EvtVector4R.hh"
00028
00029 #include <iosfwd>
00030
00031 class EvtVector4C {
00032
00033 friend EvtVector4C rotateEuler(const EvtVector4C& e,
00034 double alpha,double beta,double gamma);
00035 friend EvtVector4C boostTo(const EvtVector4C& e,
00036 const EvtVector4R p4);
00037 friend EvtVector4C boostTo(const EvtVector4C& e,
00038 const EvtVector3R boost);
00039 inline friend EvtVector4C operator*(double d,const EvtVector4C& v2);
00040 inline friend EvtVector4C operator*(const EvtComplex& c,const EvtVector4C& v2);
00041 inline friend EvtVector4C operator*(const EvtVector4C& v2,const EvtComplex& c);
00042 inline friend EvtVector4C operator*(const EvtComplex& c,const EvtVector4R& v2);
00043 inline friend EvtComplex operator*(const EvtVector4R& v1,const EvtVector4C& v2);
00044 inline friend EvtComplex operator*(const EvtVector4C& v1,const EvtVector4R& v2);
00045 inline friend EvtComplex operator*(const EvtVector4C& v1,const EvtVector4C& v2);
00046 friend EvtVector4C operator+(const EvtVector4C& v1,const EvtVector4C& v2);
00047 friend EvtVector4C operator-(const EvtVector4C& v1,const EvtVector4C& v2);
00048
00049 public:
00050
00051 EvtVector4C();
00052 EvtVector4C(const EvtComplex&,const EvtComplex&,
00053 const EvtComplex&,const EvtComplex&);
00054 virtual ~EvtVector4C();
00055 inline void set(int,const EvtComplex&);
00056 inline void set(const EvtComplex&,const EvtComplex&,
00057 const EvtComplex&,const EvtComplex&);
00058 inline void set(double,double,double,double);
00059 inline EvtVector4C(const EvtVector4R& v1);
00060 inline const EvtComplex& get(int) const;
00061 inline EvtComplex cont(const EvtVector4C& v4) const;
00062 inline EvtVector4C conj() const;
00063 EvtVector3C vec() const;
00064 inline EvtVector4C& operator=(const EvtVector4C& v2);
00065 inline EvtVector4C& operator-=(const EvtVector4C& v2);
00066 inline EvtVector4C& operator+=(const EvtVector4C& v2);
00067 inline EvtVector4C& operator*=(const EvtComplex& c);
00068 void applyRotateEuler(double alpha,double beta,double gamma);
00069 void applyBoostTo(const EvtVector4R& p4);
00070 void applyBoostTo(const EvtVector3R& boost);
00071 friend std::ostream& operator<<(std::ostream& s, const EvtVector4C& v);
00072 double dot( const EvtVector4C& p2 );
00073 private:
00074
00075 EvtComplex v[4];
00076
00077 };
00078
00079 inline EvtVector4C& EvtVector4C::operator=(const EvtVector4C& v2){
00080
00081 v[0]=v2.v[0];
00082 v[1]=v2.v[1];
00083 v[2]=v2.v[2];
00084 v[3]=v2.v[3];
00085
00086 return *this;
00087 }
00088
00089 inline EvtVector4C& EvtVector4C::operator+=(const EvtVector4C& v2){
00090
00091 v[0]+=v2.v[0];
00092 v[1]+=v2.v[1];
00093 v[2]+=v2.v[2];
00094 v[3]+=v2.v[3];
00095
00096 return *this;
00097 }
00098
00099 inline EvtVector4C& EvtVector4C::operator-=(const EvtVector4C& v2){
00100
00101 v[0]-=v2.v[0];
00102 v[1]-=v2.v[1];
00103 v[2]-=v2.v[2];
00104 v[3]-=v2.v[3];
00105
00106 return *this;
00107 }
00108
00109 inline void EvtVector4C::set(int i,const EvtComplex& c){
00110
00111 v[i]=c;
00112 }
00113
00114 inline EvtVector3C EvtVector4C::vec() const {
00115
00116 return EvtVector3C(v[1],v[2],v[3]);
00117 }
00118
00119 inline void EvtVector4C::set(const EvtComplex& e,const EvtComplex& p1,
00120 const EvtComplex& p2,const EvtComplex& p3){
00121
00122 v[0]=e; v[1]=p1; v[2]=p2; v[3]=p3;
00123 }
00124
00125 inline void EvtVector4C::set(double e,double p1,
00126 double p2,double p3){
00127
00128 v[0]=EvtComplex(e); v[1]=EvtComplex(p1); v[2]=EvtComplex(p2); v[3]=EvtComplex(p3);
00129 }
00130
00131 inline const EvtComplex& EvtVector4C::get(int i) const {
00132
00133 return v[i];
00134 }
00135
00136 inline EvtVector4C operator+(const EvtVector4C& v1,const EvtVector4C& v2) {
00137
00138 return EvtVector4C(v1)+=v2;
00139 }
00140
00141 inline EvtVector4C operator-(const EvtVector4C& v1,const EvtVector4C& v2) {
00142
00143 return EvtVector4C(v1)-=v2;
00144 }
00145
00146 inline EvtComplex EvtVector4C::cont(const EvtVector4C& v4) const {
00147
00148 return v[0]*v4.v[0]-v[1]*v4.v[1]-
00149 v[2]*v4.v[2]-v[3]*v4.v[3];
00150 }
00151
00152 inline EvtVector4C& EvtVector4C::operator*=(const EvtComplex& c) {
00153
00154 v[0]*=c;
00155 v[1]*=c;
00156 v[2]*=c;
00157 v[3]*=c;
00158
00159 return *this;
00160 }
00161
00162 inline EvtVector4C operator*(double d,const EvtVector4C& v2){
00163
00164 return EvtVector4C(v2.v[0]*d,v2.v[1]*d,v2.v[2]*d,v2.v[3]*d);
00165 }
00166
00167 inline EvtVector4C operator*(const EvtComplex& c,const EvtVector4C& v2){
00168
00169 return EvtVector4C(v2)*=c;
00170 }
00171
00172 inline EvtVector4C operator*(const EvtVector4C& v2,const EvtComplex& c){
00173
00174 return EvtVector4C(v2)*=c;
00175 }
00176
00177 inline EvtVector4C operator*(const EvtComplex& c,const EvtVector4R& v2){
00178
00179 return EvtVector4C(c*v2.get(0),c*v2.get(1),c*v2.get(2),c*v2.get(3));
00180 }
00181
00182 inline EvtVector4C::EvtVector4C(const EvtVector4R& v1){
00183
00184 v[0]=EvtComplex(v1.get(0)); v[1]=EvtComplex(v1.get(1));
00185 v[2]=EvtComplex(v1.get(2)); v[3]=EvtComplex(v1.get(3));
00186 }
00187
00188 inline EvtComplex operator*(const EvtVector4R& v1,const EvtVector4C& v2){
00189
00190 return v1.get(0)*v2.v[0]-v1.get(1)*v2.v[1]-
00191 v1.get(2)*v2.v[2]-v1.get(3)*v2.v[3];
00192 }
00193
00194 inline EvtComplex operator*(const EvtVector4C& v1,const EvtVector4R& v2){
00195
00196 return v1.v[0]*v2.get(0)-v1.v[1]*v2.get(1)-
00197 v1.v[2]*v2.get(2)-v1.v[3]*v2.get(3);
00198 }
00199
00200 inline EvtComplex operator*(const EvtVector4C& v1,const EvtVector4C& v2){
00201
00202 return v1.v[0]*v2.v[0]-v1.v[1]*v2.v[1]-
00203 v1.v[2]*v2.v[2]-v1.v[3]*v2.v[3];
00204 }
00205
00206 inline EvtVector4C EvtVector4C::conj() const {
00207
00208 return EvtVector4C(::conj(v[0]),::conj(v[1]),
00209 ::conj(v[2]),::conj(v[3]));
00210 }
00211
00212 #endif
00213