BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
EvtVector4C.hh
Go to the documentation of this file.
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 <iostream.h>
25#include "EvtComplex.hh"
26#include "EvtVector3C.hh"
27#include "EvtVector4R.hh"
28
29#include <iosfwd>
30
32
33 friend EvtVector4C rotateEuler( const EvtVector4C& e, double alpha, double beta,
34 double gamma );
35 friend EvtVector4C boostTo( const EvtVector4C& e, const EvtVector4R p4 );
36 friend EvtVector4C boostTo( const EvtVector4C& e, const EvtVector3R boost );
37 inline friend EvtVector4C operator*( double d, const EvtVector4C& v2 );
38 inline friend EvtVector4C operator*( const EvtComplex& c, const EvtVector4C& v2 );
39 inline friend EvtVector4C operator*( const EvtVector4C& v2, const EvtComplex& c );
40 inline friend EvtVector4C operator*( const EvtComplex& c, const EvtVector4R& v2 );
41 inline friend EvtComplex operator*( const EvtVector4R& v1, const EvtVector4C& v2 );
42 inline friend EvtComplex operator*( const EvtVector4C& v1, const EvtVector4R& v2 );
43 inline friend EvtComplex operator*( const EvtVector4C& v1, const EvtVector4C& v2 );
44 friend EvtVector4C operator+( const EvtVector4C& v1, const EvtVector4C& v2 );
45 friend EvtVector4C operator-( const EvtVector4C& v1, const EvtVector4C& v2 );
46
47public:
49 EvtVector4C( const EvtComplex&, const EvtComplex&, const EvtComplex&, const EvtComplex& );
50 virtual ~EvtVector4C();
51 inline void set( int, const EvtComplex& );
52 inline void set( const EvtComplex&, const EvtComplex&, const EvtComplex&,
53 const EvtComplex& );
54 inline void set( double, double, double, double );
55 inline EvtVector4C( const EvtVector4R& v1 );
56 inline const EvtComplex& get( int ) const;
57 inline EvtComplex cont( const EvtVector4C& v4 ) const;
58 inline EvtVector4C conj() const;
59 EvtVector3C vec() const;
60 inline EvtVector4C& operator=( const EvtVector4C& v2 );
61 inline EvtVector4C& operator-=( const EvtVector4C& v2 );
62 inline EvtVector4C& operator+=( const EvtVector4C& v2 );
63 inline EvtVector4C& operator*=( const EvtComplex& c );
64 void applyRotateEuler( double alpha, double beta, double gamma );
65 void applyBoostTo( const EvtVector4R& p4 );
66 void applyBoostTo( const EvtVector3R& boost );
67 friend std::ostream& operator<<( std::ostream& s, const EvtVector4C& v );
68 double dot( const EvtVector4C& p2 );
69
70private:
71 EvtComplex v[4];
72};
73
75
76 v[0] = v2.v[0];
77 v[1] = v2.v[1];
78 v[2] = v2.v[2];
79 v[3] = v2.v[3];
80
81 return *this;
82}
83
85
86 v[0] += v2.v[0];
87 v[1] += v2.v[1];
88 v[2] += v2.v[2];
89 v[3] += v2.v[3];
90
91 return *this;
92}
93
95
96 v[0] -= v2.v[0];
97 v[1] -= v2.v[1];
98 v[2] -= v2.v[2];
99 v[3] -= v2.v[3];
100
101 return *this;
102}
103
104inline void EvtVector4C::set( int i, const EvtComplex& c ) { v[i] = c; }
105
106inline EvtVector3C EvtVector4C::vec() const { return EvtVector3C( v[1], v[2], v[3] ); }
107
108inline void EvtVector4C::set( const EvtComplex& e, const EvtComplex& p1, const EvtComplex& p2,
109 const EvtComplex& p3 ) {
110
111 v[0] = e;
112 v[1] = p1;
113 v[2] = p2;
114 v[3] = p3;
115}
116
117inline void EvtVector4C::set( double e, double p1, double p2, double p3 ) {
118
119 v[0] = EvtComplex( e );
120 v[1] = EvtComplex( p1 );
121 v[2] = EvtComplex( p2 );
122 v[3] = EvtComplex( p3 );
123}
124
125inline const EvtComplex& EvtVector4C::get( int i ) const { return v[i]; }
126
127inline EvtVector4C operator+( const EvtVector4C& v1, const EvtVector4C& v2 ) {
128
129 return EvtVector4C( v1 ) += v2;
130}
131
132inline EvtVector4C operator-( const EvtVector4C& v1, const EvtVector4C& v2 ) {
133
134 return EvtVector4C( v1 ) -= v2;
135}
136
137inline EvtComplex EvtVector4C::cont( const EvtVector4C& v4 ) const {
138
139 return v[0] * v4.v[0] - v[1] * v4.v[1] - v[2] * v4.v[2] - v[3] * v4.v[3];
140}
141
143
144 v[0] *= c;
145 v[1] *= c;
146 v[2] *= c;
147 v[3] *= c;
148
149 return *this;
150}
151
152inline EvtVector4C operator*( double d, const EvtVector4C& v2 ) {
153
154 return EvtVector4C( v2.v[0] * d, v2.v[1] * d, v2.v[2] * d, v2.v[3] * d );
155}
156
157inline EvtVector4C operator*( const EvtComplex& c, const EvtVector4C& v2 ) {
158
159 return EvtVector4C( v2 ) *= c;
160}
161
162inline EvtVector4C operator*( const EvtVector4C& v2, const EvtComplex& c ) {
163
164 return EvtVector4C( v2 ) *= c;
165}
166
167inline EvtVector4C operator*( const EvtComplex& c, const EvtVector4R& v2 ) {
168
169 return EvtVector4C( c * v2.get( 0 ), c * v2.get( 1 ), c * v2.get( 2 ), c * v2.get( 3 ) );
170}
171
173
174 v[0] = EvtComplex( v1.get( 0 ) );
175 v[1] = EvtComplex( v1.get( 1 ) );
176 v[2] = EvtComplex( v1.get( 2 ) );
177 v[3] = EvtComplex( v1.get( 3 ) );
178}
179
180inline EvtComplex operator*( const EvtVector4R& v1, const EvtVector4C& v2 ) {
181
182 return v1.get( 0 ) * v2.v[0] - v1.get( 1 ) * v2.v[1] - v1.get( 2 ) * v2.v[2] -
183 v1.get( 3 ) * v2.v[3];
184}
185
186inline EvtComplex operator*( const EvtVector4C& v1, const EvtVector4R& v2 ) {
187
188 return v1.v[0] * v2.get( 0 ) - v1.v[1] * v2.get( 1 ) - v1.v[2] * v2.get( 2 ) -
189 v1.v[3] * v2.get( 3 );
190}
191
192inline EvtComplex operator*( const EvtVector4C& v1, const EvtVector4C& v2 ) {
193
194 return v1.v[0] * v2.v[0] - v1.v[1] * v2.v[1] - v1.v[2] * v2.v[2] - v1.v[3] * v2.v[3];
195}
196
198
199 return EvtVector4C( ::conj( v[0] ), ::conj( v[1] ), ::conj( v[2] ), ::conj( v[3] ) );
200}
201
202#endif
double p2[4]
double p1[4]
double alpha
EvtVector4C operator-(const EvtVector4C &v1, const EvtVector4C &v2)
EvtVector4C operator+(const EvtVector4C &v1, const EvtVector4C &v2)
EvtVector4C operator*(double d, const EvtVector4C &v2)
XmlRpcServer s
virtual ~EvtVector4C()
double dot(const EvtVector4C &p2)
void applyRotateEuler(double alpha, double beta, double gamma)
EvtVector4C conj() const
friend EvtVector4C boostTo(const EvtVector4C &e, const EvtVector4R p4)
void set(int, const EvtComplex &)
EvtVector4C & operator+=(const EvtVector4C &v2)
friend std::ostream & operator<<(std::ostream &s, const EvtVector4C &v)
friend EvtVector4C operator-(const EvtVector4C &v1, const EvtVector4C &v2)
friend EvtVector4C operator+(const EvtVector4C &v1, const EvtVector4C &v2)
const EvtComplex & get(int) const
EvtVector4C & operator-=(const EvtVector4C &v2)
friend EvtVector4C rotateEuler(const EvtVector4C &e, double alpha, double beta, double gamma)
friend EvtVector4C operator*(double d, const EvtVector4C &v2)
void applyBoostTo(const EvtVector4R &p4)
EvtVector4C & operator=(const EvtVector4C &v2)
EvtVector4C & operator*=(const EvtComplex &c)
EvtComplex cont(const EvtVector4C &v4) const
EvtVector3C vec() const
double get(int i) const