]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TEvtGen/EvtGenBase/EvtVector4C.hh
Corrections for secondaries
[u/mrichter/AliRoot.git] / TEvtGen / EvtGenBase / EvtVector4C.hh
CommitLineData
da0e9ce3 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
30class 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
48public:
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 );
72private:
73
74 EvtComplex v[4];
75
76};
77
78inline EvtVector4C& EvtVector4C::operator=(const EvtVector4C& v2){
79
80 v[0]=v2.v[0];
81 v[1]=v2.v[1];
82 v[2]=v2.v[2];
83 v[3]=v2.v[3];
84
85 return *this;
86}
87
88inline EvtVector4C& EvtVector4C::operator+=(const EvtVector4C& v2){
89
90 v[0]+=v2.v[0];
91 v[1]+=v2.v[1];
92 v[2]+=v2.v[2];
93 v[3]+=v2.v[3];
94
95 return *this;
96}
97
98inline EvtVector4C& EvtVector4C::operator-=(const EvtVector4C& v2){
99
100 v[0]-=v2.v[0];
101 v[1]-=v2.v[1];
102 v[2]-=v2.v[2];
103 v[3]-=v2.v[3];
104
105 return *this;
106}
107
108inline void EvtVector4C::set(int i,const EvtComplex& c){
109
110 v[i]=c;
111}
112
113inline EvtVector3C EvtVector4C::vec() const {
114
115 return EvtVector3C(v[1],v[2],v[3]);
116}
117
118inline void EvtVector4C::set(const EvtComplex& e,const EvtComplex& p1,
119 const EvtComplex& p2,const EvtComplex& p3){
120
121 v[0]=e; v[1]=p1; v[2]=p2; v[3]=p3;
122}
123
124inline void EvtVector4C::set(double e,double p1,
125 double p2,double p3){
126
127 v[0]=EvtComplex(e); v[1]=EvtComplex(p1); v[2]=EvtComplex(p2); v[3]=EvtComplex(p3);
128}
129
130inline const EvtComplex& EvtVector4C::get(int i) const {
131
132 return v[i];
133}
134
135inline EvtVector4C operator+(const EvtVector4C& v1,const EvtVector4C& v2) {
136
137 return EvtVector4C(v1)+=v2;
138}
139
140inline EvtVector4C operator-(const EvtVector4C& v1,const EvtVector4C& v2) {
141
142 return EvtVector4C(v1)-=v2;
143}
144
145inline EvtComplex EvtVector4C::cont(const EvtVector4C& v4) const {
146
147 return v[0]*v4.v[0]-v[1]*v4.v[1]-
148 v[2]*v4.v[2]-v[3]*v4.v[3];
149}
150
151inline EvtVector4C& EvtVector4C::operator*=(const EvtComplex& c) {
152
153 v[0]*=c;
154 v[1]*=c;
155 v[2]*=c;
156 v[3]*=c;
157
158 return *this;
159}
160
161inline EvtVector4C operator*(double d,const EvtVector4C& v2){
162
163 return EvtVector4C(v2.v[0]*d,v2.v[1]*d,v2.v[2]*d,v2.v[3]*d);
164}
165
166inline EvtVector4C operator*(const EvtComplex& c,const EvtVector4C& v2){
167
168 return EvtVector4C(v2)*=c;
169}
170
171inline EvtVector4C operator*(const EvtVector4C& v2,const EvtComplex& c){
172
173 return EvtVector4C(v2)*=c;
174}
175
176inline EvtVector4C operator*(const EvtComplex& c,const EvtVector4R& v2){
177
178 return EvtVector4C(c*v2.get(0),c*v2.get(1),c*v2.get(2),c*v2.get(3));
179}
180
181inline EvtVector4C::EvtVector4C(const EvtVector4R& v1){
182
183 v[0]=EvtComplex(v1.get(0)); v[1]=EvtComplex(v1.get(1));
184 v[2]=EvtComplex(v1.get(2)); v[3]=EvtComplex(v1.get(3));
185}
186
187inline EvtComplex operator*(const EvtVector4R& v1,const EvtVector4C& v2){
188
189 return v1.get(0)*v2.v[0]-v1.get(1)*v2.v[1]-
190 v1.get(2)*v2.v[2]-v1.get(3)*v2.v[3];
191}
192
193inline EvtComplex operator*(const EvtVector4C& v1,const EvtVector4R& v2){
194
195 return v1.v[0]*v2.get(0)-v1.v[1]*v2.get(1)-
196 v1.v[2]*v2.get(2)-v1.v[3]*v2.get(3);
197}
198
199inline EvtComplex operator*(const EvtVector4C& v1,const EvtVector4C& v2){
200
201 return v1.v[0]*v2.v[0]-v1.v[1]*v2.v[1]-
202 v1.v[2]*v2.v[2]-v1.v[3]*v2.v[3];
203}
204
205inline EvtVector4C EvtVector4C::conj() const {
206
207 return EvtVector4C(::conj(v[0]),::conj(v[1]),
208 ::conj(v[2]),::conj(v[3]));
209}
210
211#endif
212