EvtGen 2.2.0
Monte Carlo generator of particle decays, in particular the weak decays of heavy flavour particles such as B mesons.
Loading...
Searching...
No Matches
EvtVector3C.hh
Go to the documentation of this file.
1
2/***********************************************************************
3* Copyright 1998-2020 CERN for the benefit of the EvtGen authors *
4* *
5* This file is part of EvtGen. *
6* *
7* EvtGen is free software: you can redistribute it and/or modify *
8* it under the terms of the GNU General Public License as published by *
9* the Free Software Foundation, either version 3 of the License, or *
10* (at your option) any later version. *
11* *
12* EvtGen is distributed in the hope that it will be useful, *
13* but WITHOUT ANY WARRANTY; without even the implied warranty of *
14* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15* GNU General Public License for more details. *
16* *
17* You should have received a copy of the GNU General Public License *
18* along with EvtGen. If not, see <https://www.gnu.org/licenses/>. *
19***********************************************************************/
20
21#ifndef EVTVECTOR3C_N
22#define EVTVECTOR3C_N
23
26
27#include <iosfwd>
28
29class EvtVector3C final {
30 friend EvtVector3C rotateEuler( const EvtVector3C& v, double phi,
31 double theta, double ksi );
32
33 inline friend EvtVector3C operator*( const EvtComplex& c,
34 const EvtVector3C& v2 );
35 inline friend EvtVector3C operator*( const EvtComplex& c,
36 const EvtVector3R& v2 );
37 inline friend EvtComplex operator*( const EvtVector3R& v1,
38 const EvtVector3C& v2 );
39 inline friend EvtComplex operator*( const EvtVector3C& v1,
40 const EvtVector3R& v2 );
41 inline friend EvtComplex operator*( const EvtVector3C& v1,
42 const EvtVector3C& v2 );
43 inline friend EvtVector3C operator+( const EvtVector3C& v1,
44 const EvtVector3C& v2 );
45 inline friend EvtVector3C operator-( const EvtVector3C& v1,
46 const EvtVector3C& v2 );
47 inline friend EvtVector3C operator*( const EvtVector3C& v1,
48 const EvtComplex& c );
49
50 public:
52 EvtVector3C( const EvtComplex&, const EvtComplex&, const EvtComplex& );
53 inline void set( const int, const EvtComplex& );
54 inline void set( const EvtComplex&, const EvtComplex&, const EvtComplex& );
55 inline void set( double, double, double );
56 inline EvtVector3C& operator*=( const EvtComplex& c );
57 inline EvtVector3C& operator/=( const EvtComplex& c );
58 inline EvtVector3C& operator+=( const EvtVector3C& v2 );
59 inline EvtVector3C& operator-=( const EvtVector3C& v2 );
60 inline EvtVector3C( const EvtVector3R& v1 );
61 void applyRotateEuler( double phi, double theta, double ksi );
62 inline const EvtComplex& get( int ) const;
63 inline EvtVector3C conj() const;
64 EvtVector3C cross( const EvtVector3C& v2 );
65 friend std::ostream& operator<<( std::ostream& c, const EvtVector3C& v );
66 double dot( const EvtVector3C& p2 );
67
68 private:
70};
71
73{
74 m_v[0] = EvtComplex( v1.get( 0 ), 0.0 );
75 m_v[1] = EvtComplex( v1.get( 1 ), 0.0 );
76 m_v[2] = EvtComplex( v1.get( 2 ), 0.0 );
77}
78
79inline void EvtVector3C::set( const int i, const EvtComplex& c )
80{
81 m_v[i] = c;
82}
83
84inline void EvtVector3C::set( const EvtComplex& x, const EvtComplex& y,
85 const EvtComplex& z )
86{
87 m_v[0] = x;
88 m_v[1] = y;
89 m_v[2] = z;
90}
91
92inline void EvtVector3C::set( double x, double y, double z )
93{
94 m_v[0] = EvtComplex( x );
95 m_v[1] = EvtComplex( y );
96 m_v[2] = EvtComplex( z );
97}
98
99inline const EvtComplex& EvtVector3C::get( int i ) const
100{
101 return m_v[i];
102}
103
105{
106 m_v[0] *= c;
107 m_v[1] *= c;
108 m_v[2] *= c;
109 return *this;
110}
111
113{
114 m_v[0] /= c;
115 m_v[1] /= c;
116 m_v[2] /= c;
117 return *this;
118}
119
121{
122 m_v[0] += v2.m_v[0];
123 m_v[1] += v2.m_v[1];
124 m_v[2] += v2.m_v[2];
125 return *this;
126}
127
129{
130 m_v[0] -= v2.m_v[0];
131 m_v[1] -= v2.m_v[1];
132 m_v[2] -= v2.m_v[2];
133 return *this;
134}
135
136inline EvtVector3C operator+( const EvtVector3C& v1, const EvtVector3C& v2 )
137{
138 return EvtVector3C( v1 ) += v2;
139}
140
141inline EvtVector3C operator-( const EvtVector3C& v1, const EvtVector3C& v2 )
142{
143 return EvtVector3C( v1 ) -= v2;
144}
145
146inline EvtVector3C operator*( const EvtVector3C& v1, const EvtComplex& c )
147{
148 return EvtVector3C( v1 ) *= c;
149}
150
151inline EvtVector3C operator*( const EvtComplex& c, const EvtVector3C& v2 )
152{
153 return EvtVector3C( v2 ) *= c;
154}
155
156inline EvtVector3C operator*( const EvtComplex& c, const EvtVector3R& v2 )
157{
158 return EvtVector3C( v2 ) *= c;
159}
160
161inline EvtComplex operator*( const EvtVector3R& v1, const EvtVector3C& v2 )
162{
163 return v1.get( 0 ) * v2.m_v[0] + v1.get( 1 ) * v2.m_v[1] +
164 v1.get( 2 ) * v2.m_v[2];
165}
166
167inline EvtComplex operator*( const EvtVector3C& v1, const EvtVector3R& v2 )
168{
169 return v1.m_v[0] * v2.get( 0 ) + v1.m_v[1] * v2.get( 1 ) +
170 v1.m_v[2] * v2.get( 2 );
171}
172
173inline EvtComplex operator*( const EvtVector3C& v1, const EvtVector3C& v2 )
174{
175 return v1.m_v[0] * v2.m_v[0] + v1.m_v[1] * v2.m_v[1] + v1.m_v[2] * v2.m_v[2];
176}
177
179{
180 return EvtVector3C( ::conj( m_v[0] ), ::conj( m_v[1] ), ::conj( m_v[2] ) );
181}
182
183#endif
EvtVector3C operator+(const EvtVector3C &v1, const EvtVector3C &v2)
EvtVector3C operator-(const EvtVector3C &v1, const EvtVector3C &v2)
EvtVector3C operator*(const EvtVector3C &v1, const EvtComplex &c)
EvtComplex m_v[3]
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)
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