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/EvtVector4C.hh
12 : //
13 : // Description: Class for complex 4 vectors
14 : //
15 : // Modification history:
16 : //
17 : // DJL/RYD September 25, 1996 Module created
18 : //
19 : //------------------------------------------------------------------------
20 :
21 : #ifndef EVTVECTOR4C_HH
22 : #define EVTVECTOR4C_HH
23 :
24 : #include "EvtGenBase/EvtComplex.hh"
25 : #include "EvtGenBase/EvtVector3C.hh"
26 : #include "EvtGenBase/EvtVector4R.hh"
27 :
28 : #include <iosfwd>
29 :
30 0 : class EvtVector4C {
31 :
32 : friend EvtVector4C rotateEuler(const EvtVector4C& e,
33 : double alpha,double beta,double gamma);
34 : friend EvtVector4C boostTo(const EvtVector4C& e,
35 : const EvtVector4R p4);
36 : friend EvtVector4C boostTo(const EvtVector4C& e,
37 : const EvtVector3R boost);
38 : inline friend EvtVector4C operator*(double d,const EvtVector4C& v2);
39 : inline friend EvtVector4C operator*(const EvtComplex& c,const EvtVector4C& v2);
40 : inline friend EvtVector4C operator*(const EvtVector4C& v2,const EvtComplex& c);
41 : inline friend EvtVector4C operator*(const EvtComplex& c,const EvtVector4R& v2);
42 : inline friend EvtComplex operator*(const EvtVector4R& v1,const EvtVector4C& v2);
43 : inline friend EvtComplex operator*(const EvtVector4C& v1,const EvtVector4R& v2);
44 : inline friend EvtComplex operator*(const EvtVector4C& v1,const EvtVector4C& v2);
45 : friend EvtVector4C operator+(const EvtVector4C& v1,const EvtVector4C& v2);
46 : friend EvtVector4C operator-(const EvtVector4C& v1,const EvtVector4C& v2);
47 :
48 : public:
49 :
50 : EvtVector4C();
51 : EvtVector4C(const EvtComplex&,const EvtComplex&,
52 : const EvtComplex&,const EvtComplex&);
53 : virtual ~EvtVector4C();
54 : inline void set(int,const EvtComplex&);
55 : inline void set(const EvtComplex&,const EvtComplex&,
56 : const EvtComplex&,const EvtComplex&);
57 : inline void set(double,double,double,double);
58 : inline EvtVector4C(const EvtVector4R& v1);
59 : inline const EvtComplex& get(int) const;
60 : inline EvtComplex cont(const EvtVector4C& v4) const;
61 : inline EvtVector4C conj() const;
62 : EvtVector3C vec() const;
63 : inline EvtVector4C& operator=(const EvtVector4C& v2);
64 : inline EvtVector4C& operator-=(const EvtVector4C& v2);
65 : inline EvtVector4C& operator+=(const EvtVector4C& v2);
66 : inline EvtVector4C& operator*=(const EvtComplex& c);
67 : void applyRotateEuler(double alpha,double beta,double gamma);
68 : void applyBoostTo(const EvtVector4R& p4);
69 : void applyBoostTo(const EvtVector3R& boost);
70 : friend std::ostream& operator<<(std::ostream& s, const EvtVector4C& v);
71 : double dot( const EvtVector4C& p2 );
72 : private:
73 :
74 : EvtComplex v[4];
75 :
76 : };
77 :
78 : inline EvtVector4C& EvtVector4C::operator=(const EvtVector4C& v2){
79 :
80 0 : v[0]=v2.v[0];
81 0 : v[1]=v2.v[1];
82 0 : v[2]=v2.v[2];
83 0 : v[3]=v2.v[3];
84 :
85 0 : return *this;
86 : }
87 :
88 : inline EvtVector4C& EvtVector4C::operator+=(const EvtVector4C& v2){
89 :
90 0 : v[0]+=v2.v[0];
91 0 : v[1]+=v2.v[1];
92 0 : v[2]+=v2.v[2];
93 0 : v[3]+=v2.v[3];
94 :
95 0 : return *this;
96 : }
97 :
98 : inline EvtVector4C& EvtVector4C::operator-=(const EvtVector4C& v2){
99 :
100 0 : v[0]-=v2.v[0];
101 0 : v[1]-=v2.v[1];
102 0 : v[2]-=v2.v[2];
103 0 : v[3]-=v2.v[3];
104 :
105 0 : return *this;
106 : }
107 :
108 : inline void EvtVector4C::set(int i,const EvtComplex& c){
109 :
110 0 : v[i]=c;
111 0 : }
112 :
113 : inline EvtVector3C EvtVector4C::vec() const {
114 :
115 0 : return EvtVector3C(v[1],v[2],v[3]);
116 : }
117 :
118 : inline void EvtVector4C::set(const EvtComplex& e,const EvtComplex& p1,
119 : const EvtComplex& p2,const EvtComplex& p3){
120 :
121 0 : v[0]=e; v[1]=p1; v[2]=p2; v[3]=p3;
122 0 : }
123 :
124 : inline void EvtVector4C::set(double e,double p1,
125 : double p2,double p3){
126 :
127 0 : v[0]=EvtComplex(e); v[1]=EvtComplex(p1); v[2]=EvtComplex(p2); v[3]=EvtComplex(p3);
128 0 : }
129 :
130 : inline const EvtComplex& EvtVector4C::get(int i) const {
131 :
132 0 : return v[i];
133 : }
134 :
135 : inline EvtVector4C operator+(const EvtVector4C& v1,const EvtVector4C& v2) {
136 :
137 0 : return EvtVector4C(v1)+=v2;
138 0 : }
139 :
140 : inline EvtVector4C operator-(const EvtVector4C& v1,const EvtVector4C& v2) {
141 :
142 0 : return EvtVector4C(v1)-=v2;
143 0 : }
144 :
145 : inline EvtComplex EvtVector4C::cont(const EvtVector4C& v4) const {
146 :
147 0 : return v[0]*v4.v[0]-v[1]*v4.v[1]-
148 0 : v[2]*v4.v[2]-v[3]*v4.v[3];
149 : }
150 :
151 : inline EvtVector4C& EvtVector4C::operator*=(const EvtComplex& c) {
152 :
153 0 : v[0]*=c;
154 0 : v[1]*=c;
155 0 : v[2]*=c;
156 0 : v[3]*=c;
157 :
158 0 : return *this;
159 : }
160 :
161 : inline EvtVector4C operator*(double d,const EvtVector4C& v2){
162 :
163 0 : return EvtVector4C(v2.v[0]*d,v2.v[1]*d,v2.v[2]*d,v2.v[3]*d);
164 : }
165 :
166 : inline EvtVector4C operator*(const EvtComplex& c,const EvtVector4C& v2){
167 :
168 0 : return EvtVector4C(v2)*=c;
169 0 : }
170 :
171 : inline EvtVector4C operator*(const EvtVector4C& v2,const EvtComplex& c){
172 :
173 0 : return EvtVector4C(v2)*=c;
174 0 : }
175 :
176 : inline EvtVector4C operator*(const EvtComplex& c,const EvtVector4R& v2){
177 :
178 0 : return EvtVector4C(c*v2.get(0),c*v2.get(1),c*v2.get(2),c*v2.get(3));
179 : }
180 :
181 0 : inline EvtVector4C::EvtVector4C(const EvtVector4R& v1){
182 :
183 0 : v[0]=EvtComplex(v1.get(0)); v[1]=EvtComplex(v1.get(1));
184 0 : v[2]=EvtComplex(v1.get(2)); v[3]=EvtComplex(v1.get(3));
185 0 : }
186 :
187 : inline EvtComplex operator*(const EvtVector4R& v1,const EvtVector4C& v2){
188 :
189 0 : return v1.get(0)*v2.v[0]-v1.get(1)*v2.v[1]-
190 0 : v1.get(2)*v2.v[2]-v1.get(3)*v2.v[3];
191 : }
192 :
193 : inline EvtComplex operator*(const EvtVector4C& v1,const EvtVector4R& v2){
194 :
195 0 : return v1.v[0]*v2.get(0)-v1.v[1]*v2.get(1)-
196 0 : v1.v[2]*v2.get(2)-v1.v[3]*v2.get(3);
197 : }
198 :
199 : inline EvtComplex operator*(const EvtVector4C& v1,const EvtVector4C& v2){
200 :
201 0 : return v1.v[0]*v2.v[0]-v1.v[1]*v2.v[1]-
202 0 : v1.v[2]*v2.v[2]-v1.v[3]*v2.v[3];
203 : }
204 :
205 : inline EvtVector4C EvtVector4C::conj() const {
206 :
207 0 : return EvtVector4C(::conj(v[0]),::conj(v[1]),
208 0 : ::conj(v[2]),::conj(v[3]));
209 : }
210 :
211 : #endif
212 :
|