BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
EvtVector3C.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/EvtVector3C.hh
12//
13// Description: Class for complex 3 vectors
14//
15// Modification history:
16//
17// RYD September 6, 1997 Module created
18//
19//------------------------------------------------------------------------
20
21#ifndef EVTVECTOR3C_N
22#define EVTVECTOR3C_N
23
24// #include <iostream.h>
25#include "EvtComplex.hh"
26#include "EvtVector3R.hh"
27#include <iosfwd>
28
30
31 friend EvtVector3C rotateEuler( const EvtVector3C& v, double phi, double theta, double ksi );
32
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 );
41
42public:
44 EvtVector3C( const EvtComplex&, const EvtComplex&, const EvtComplex& );
45 virtual ~EvtVector3C();
46 inline void set( const int, const EvtComplex& );
47 inline void set( const EvtComplex&, const EvtComplex&, const EvtComplex& );
48 inline void set( double, double, double );
49 inline EvtVector3C& operator*=( const EvtComplex& c );
50 inline EvtVector3C& operator/=( const EvtComplex& c );
51 inline EvtVector3C& operator+=( const EvtVector3C& v2 );
52 inline EvtVector3C& operator-=( const EvtVector3C& v2 );
53 inline EvtVector3C( const EvtVector3R& v1 );
54 void applyRotateEuler( double phi, double theta, double ksi );
55 inline const EvtComplex& get( int ) const;
56 inline EvtVector3C conj() const;
57 EvtVector3C cross( const EvtVector3C& v2 );
58 friend std::ostream& operator<<( std::ostream& c, const EvtVector3C& v );
59 double dot( const EvtVector3C& p2 );
60
61private:
62 EvtComplex v[3];
63};
64
66
67 v[0] = EvtComplex( v1.get( 0 ), 0.0 );
68 v[1] = EvtComplex( v1.get( 1 ), 0.0 );
69 v[2] = EvtComplex( v1.get( 2 ), 0.0 );
70}
71
72inline void EvtVector3C::set( const int i, const EvtComplex& c ) { v[i] = c; }
73
74inline void EvtVector3C::set( const EvtComplex& x, const EvtComplex& y, const EvtComplex& z ) {
75
76 v[0] = x;
77 v[1] = y;
78 v[2] = z;
79}
80
81inline void EvtVector3C::set( double x, double y, double z ) {
82
83 v[0] = EvtComplex( x );
84 v[1] = EvtComplex( y );
85 v[2] = EvtComplex( z );
86}
87
88inline const EvtComplex& EvtVector3C::get( int i ) const { return v[i]; }
89
91
92 v[0] *= c;
93 v[1] *= c;
94 v[2] *= c;
95 return *this;
96}
97
99
100 v[0] /= c;
101 v[1] /= c;
102 v[2] /= c;
103 return *this;
104}
105
107
108 v[0] += v2.v[0];
109 v[1] += v2.v[1];
110 v[2] += v2.v[2];
111 return *this;
112}
113
115
116 v[0] -= v2.v[0];
117 v[1] -= v2.v[1];
118 v[2] -= v2.v[2];
119 return *this;
120}
121
122inline EvtVector3C operator+( const EvtVector3C& v1, const EvtVector3C& v2 ) {
123
124 return EvtVector3C( v1 ) += v2;
125}
126
127inline EvtVector3C operator-( const EvtVector3C& v1, const EvtVector3C& v2 ) {
128
129 return EvtVector3C( v1 ) -= v2;
130}
131
132inline EvtVector3C operator*( const EvtVector3C& v1, const EvtComplex& c ) {
133
134 return EvtVector3C( v1 ) *= c;
135}
136
137inline EvtVector3C operator*( const EvtComplex& c, const EvtVector3C& v2 ) {
138
139 return EvtVector3C( v2 ) *= c;
140}
141
142inline EvtVector3C operator*( const EvtComplex& c, const EvtVector3R& v2 ) {
143
144 return EvtVector3C( v2 ) *= c;
145}
146
147inline EvtComplex operator*( const EvtVector3R& v1, const EvtVector3C& v2 ) {
148
149 return v1.get( 0 ) * v2.v[0] + v1.get( 1 ) * v2.v[1] + v1.get( 2 ) * v2.v[2];
150}
151
152inline EvtComplex operator*( const EvtVector3C& v1, const EvtVector3R& v2 ) {
153
154 return v1.v[0] * v2.get( 0 ) + v1.v[1] * v2.get( 1 ) + v1.v[2] * v2.get( 2 );
155}
156
157inline EvtComplex operator*( const EvtVector3C& v1, const EvtVector3C& v2 ) {
158
159 return v1.v[0] * v2.v[0] + v1.v[1] * v2.v[1] + v1.v[2] * v2.v[2];
160}
161
163
164 return EvtVector3C( ::conj( v[0] ), ::conj( v[1] ), ::conj( v[2] ) );
165}
166
167#endif
double p2[4]
EvtVector3C operator+(const EvtVector3C &v1, const EvtVector3C &v2)
EvtVector3C operator-(const EvtVector3C &v1, const EvtVector3C &v2)
EvtVector3C operator*(const EvtVector3C &v1, const EvtComplex &c)
EvtVector3C & operator/=(const EvtComplex &c)
friend EvtVector3C operator+(const EvtVector3C &v1, const EvtVector3C &v2)
EvtVector3C & operator-=(const EvtVector3C &v2)
double dot(const EvtVector3C &p2)
EvtVector3C cross(const EvtVector3C &v2)
friend std::ostream & operator<<(std::ostream &c, const EvtVector3C &v)
EvtVector3C & operator+=(const EvtVector3C &v2)
virtual ~EvtVector3C()
friend EvtVector3C rotateEuler(const EvtVector3C &v, double phi, double theta, double ksi)
friend EvtVector3C operator-(const EvtVector3C &v1, const EvtVector3C &v2)
EvtVector3C & operator*=(const EvtComplex &c)
const EvtComplex & get(int) const
void set(const int, const EvtComplex &)
void applyRotateEuler(double phi, double theta, double ksi)
friend EvtVector3C operator*(const EvtComplex &c, const EvtVector3C &v2)
EvtVector3C conj() const
double get(int i) const