]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TEvtGen/EvtGenBase/EvtVector3C.hh
New plots for trending injector efficiencies (Melinda)
[u/mrichter/AliRoot.git] / TEvtGen / EvtGenBase / EvtVector3C.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/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 "EvtGenBase/EvtComplex.hh"
25#include "EvtGenBase/EvtVector3R.hh"
26#include <iosfwd>
27
28class EvtVector3C {
29
30 friend EvtVector3C rotateEuler(const EvtVector3C& v,
31 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
42
43public:
44
45 EvtVector3C();
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 );
62private:
63
64 EvtComplex v[3];
65};
66
67inline EvtVector3C::EvtVector3C(const EvtVector3R& v1){
68
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);
72
73}
74
75inline void EvtVector3C::set(const int i,const EvtComplex& c){
76
77 v[i]=c;
78
79}
80
81inline void EvtVector3C::set(const EvtComplex& x,const EvtComplex& y,
82 const EvtComplex& z){
83
84 v[0]=x; v[1]=y; v[2]=z;
85}
86
87inline void EvtVector3C::set(double x,
88 double y,double z){
89
90 v[0]=EvtComplex(x); v[1]=EvtComplex(y); v[2]=EvtComplex(z);
91}
92
93inline const EvtComplex& EvtVector3C::get(int i) const {
94
95 return v[i];
96}
97
98inline EvtVector3C& EvtVector3C::operator*=(const EvtComplex& c){
99
100 v[0]*=c;
101 v[1]*=c;
102 v[2]*=c;
103 return *this;
104}
105
106inline EvtVector3C& EvtVector3C::operator/=(const EvtComplex& c){
107
108 v[0]/=c;
109 v[1]/=c;
110 v[2]/=c;
111 return *this;
112}
113
114inline EvtVector3C& EvtVector3C::operator+=(const EvtVector3C& v2){
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& EvtVector3C::operator-=(const EvtVector3C& v2){
123
124 v[0]-=v2.v[0];
125 v[1]-=v2.v[1];
126 v[2]-=v2.v[2];
127 return *this;
128}
129
130inline EvtVector3C operator+(const EvtVector3C& v1,const EvtVector3C& v2) {
131
132 return EvtVector3C(v1)+=v2;
133}
134
135inline EvtVector3C operator-(const EvtVector3C& v1,const EvtVector3C& v2) {
136
137 return EvtVector3C(v1)-=v2;
138}
139
140inline EvtVector3C operator*(const EvtVector3C& v1,const EvtComplex& c) {
141
142 return EvtVector3C(v1)*=c;
143}
144
145inline EvtVector3C operator*(const EvtComplex& c,const EvtVector3C& v2){
146
147 return EvtVector3C(v2)*=c;
148}
149
150inline EvtVector3C operator*(const EvtComplex& c,const EvtVector3R& v2){
151
152 return EvtVector3C(v2)*=c;
153}
154
155inline EvtComplex operator*(const EvtVector3R& v1,const EvtVector3C& v2){
156
157 return v1.get(0)*v2.v[0]+v1.get(1)*v2.v[1]+v1.get(2)*v2.v[2];
158}
159
160inline EvtComplex operator*(const EvtVector3C& v1,const EvtVector3R& v2){
161
162 return v1.v[0]*v2.get(0)+v1.v[1]*v2.get(1)+v1.v[2]*v2.get(2);
163}
164
165inline EvtComplex operator*(const EvtVector3C& v1,const EvtVector3C& v2){
166
167 return v1.v[0]*v2.v[0]+v1.v[1]*v2.v[1]+v1.v[2]*v2.v[2];
168}
169
170inline EvtVector3C EvtVector3C::conj() const {
171
172 return EvtVector3C(::conj(v[0]),::conj(v[1]),
173 ::conj(v[2]));
174}
175
176#endif
177