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/EvtVector3C.hh
13 // Description: Class for complex 3 vectors
15 // Modification history:
17 // RYD September 6, 1997 Module created
19 //------------------------------------------------------------------------
24 #include "EvtGenBase/EvtComplex.hh"
25 #include "EvtGenBase/EvtVector3R.hh"
30 friend EvtVector3C rotateEuler(const EvtVector3C& v,
31 double phi,double theta,double ksi);
33 inline friend EvtVector3C operator*(const EvtComplex& c,const EvtVector3C& v2);
34 inline friend EvtVector3C operator*(const EvtComplex& c,const EvtVector3R& v2);
35 inline friend EvtComplex operator*(const EvtVector3R& v1,const EvtVector3C& v2);
36 inline friend EvtComplex operator*(const EvtVector3C& v1,const EvtVector3R& v2);
37 inline friend EvtComplex operator*(const EvtVector3C& v1,const EvtVector3C& v2);
38 inline friend EvtVector3C operator+(const EvtVector3C& v1,const EvtVector3C& v2);
39 inline friend EvtVector3C operator-(const EvtVector3C& v1,const EvtVector3C& v2);
40 inline friend EvtVector3C operator*(const EvtVector3C& v1,const EvtComplex& c);
46 EvtVector3C(const EvtComplex&,const EvtComplex&,const EvtComplex&);
47 virtual ~EvtVector3C();
48 inline void set(const int,const EvtComplex&);
49 inline void set(const EvtComplex&,const EvtComplex&,const EvtComplex&);
50 inline void set(double,double,double);
51 inline EvtVector3C& operator*=(const EvtComplex& c);
52 inline EvtVector3C& operator/=(const EvtComplex& c);
53 inline EvtVector3C& operator+=(const EvtVector3C& v2);
54 inline EvtVector3C& operator-=(const EvtVector3C& v2);
55 inline EvtVector3C(const EvtVector3R& v1);
56 void applyRotateEuler(double phi,double theta,double ksi);
57 inline const EvtComplex& get(int) const;
58 inline EvtVector3C conj() const;
59 EvtVector3C cross(const EvtVector3C& v2);
60 friend std::ostream& operator<<(std::ostream& c,const EvtVector3C& v);
61 double dot( const EvtVector3C& p2 );
67 inline EvtVector3C::EvtVector3C(const EvtVector3R& v1){
69 v[0]=EvtComplex(v1.get(0),0.0);
70 v[1]=EvtComplex(v1.get(1),0.0);
71 v[2]=EvtComplex(v1.get(2),0.0);
75 inline void EvtVector3C::set(const int i,const EvtComplex& c){
81 inline void EvtVector3C::set(const EvtComplex& x,const EvtComplex& y,
84 v[0]=x; v[1]=y; v[2]=z;
87 inline void EvtVector3C::set(double x,
90 v[0]=EvtComplex(x); v[1]=EvtComplex(y); v[2]=EvtComplex(z);
93 inline const EvtComplex& EvtVector3C::get(int i) const {
98 inline EvtVector3C& EvtVector3C::operator*=(const EvtComplex& c){
106 inline EvtVector3C& EvtVector3C::operator/=(const EvtComplex& c){
114 inline EvtVector3C& EvtVector3C::operator+=(const EvtVector3C& v2){
122 inline EvtVector3C& EvtVector3C::operator-=(const EvtVector3C& v2){
130 inline EvtVector3C operator+(const EvtVector3C& v1,const EvtVector3C& v2) {
132 return EvtVector3C(v1)+=v2;
135 inline EvtVector3C operator-(const EvtVector3C& v1,const EvtVector3C& v2) {
137 return EvtVector3C(v1)-=v2;
140 inline EvtVector3C operator*(const EvtVector3C& v1,const EvtComplex& c) {
142 return EvtVector3C(v1)*=c;
145 inline EvtVector3C operator*(const EvtComplex& c,const EvtVector3C& v2){
147 return EvtVector3C(v2)*=c;
150 inline EvtVector3C operator*(const EvtComplex& c,const EvtVector3R& v2){
152 return EvtVector3C(v2)*=c;
155 inline EvtComplex operator*(const EvtVector3R& v1,const EvtVector3C& v2){
157 return v1.get(0)*v2.v[0]+v1.get(1)*v2.v[1]+v1.get(2)*v2.v[2];
160 inline EvtComplex operator*(const EvtVector3C& v1,const EvtVector3R& v2){
162 return v1.v[0]*v2.get(0)+v1.v[1]*v2.get(1)+v1.v[2]*v2.get(2);
165 inline EvtComplex operator*(const EvtVector3C& v1,const EvtVector3C& v2){
167 return v1.v[0]*v2.v[0]+v1.v[1]*v2.v[1]+v1.v[2]*v2.v[2];
170 inline EvtVector3C EvtVector3C::conj() const {
172 return EvtVector3C(::conj(v[0]),::conj(v[1]),