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
EvtVector4C.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 EVTVECTOR4C_HH
22#define EVTVECTOR4C_HH
23
27
28#include <iosfwd>
29
30class EvtVector4C final {
31 inline friend EvtVector4C operator*( double d, const EvtVector4C& v2 );
32 inline friend EvtVector4C operator*( const EvtComplex& c,
33 const EvtVector4C& v2 );
34 inline friend EvtVector4C operator*( const EvtVector4C& v2,
35 const EvtComplex& c );
36 inline friend EvtVector4C operator*( const EvtComplex& c,
37 const EvtVector4R& v2 );
38 inline friend EvtComplex operator*( const EvtVector4R& v1,
39 const EvtVector4C& v2 );
40 inline friend EvtComplex operator*( const EvtVector4C& v1,
41 const EvtVector4R& v2 );
42 inline friend EvtComplex operator*( const EvtVector4C& v1,
43 const EvtVector4C& v2 );
44 friend EvtVector4C operator+( const EvtVector4C& v1, const EvtVector4C& v2 );
45 friend EvtVector4C operator-( const EvtVector4C& v1, const EvtVector4C& v2 );
46
47 public:
49 EvtVector4C( const EvtComplex&, const EvtComplex&, const EvtComplex&,
50 const EvtComplex& );
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 EvtComplex& c );
63 void applyRotateEuler( double alpha, double beta, double gamma );
64 void applyBoostTo( const EvtVector4R& p4 );
65 void applyBoostTo( const EvtVector3R& boost );
66 friend std::ostream& operator<<( std::ostream& s, const EvtVector4C& v );
67 double dot( const EvtVector4C& p2 );
68
69 private:
71};
72
73EvtVector4C rotateEuler( const EvtVector4C& e, double alpha, double beta,
74 double gamma );
75EvtVector4C boostTo( const EvtVector4C& e, const EvtVector4R p4 );
76EvtVector4C boostTo( const EvtVector4C& e, const EvtVector3R boost );
77
79{
80 m_v[0] += v2.m_v[0];
81 m_v[1] += v2.m_v[1];
82 m_v[2] += v2.m_v[2];
83 m_v[3] += v2.m_v[3];
84
85 return *this;
86}
87
89{
90 m_v[0] -= v2.m_v[0];
91 m_v[1] -= v2.m_v[1];
92 m_v[2] -= v2.m_v[2];
93 m_v[3] -= v2.m_v[3];
94
95 return *this;
96}
97
98inline void EvtVector4C::set( int i, const EvtComplex& c )
99{
100 m_v[i] = c;
101}
102
104{
105 return EvtVector3C( m_v[1], m_v[2], m_v[3] );
106}
107
108inline void EvtVector4C::set( const EvtComplex& e, const EvtComplex& p1,
109 const EvtComplex& p2, const EvtComplex& p3 )
110{
111 m_v[0] = e;
112 m_v[1] = p1;
113 m_v[2] = p2;
114 m_v[3] = p3;
115}
116
117inline void EvtVector4C::set( double e, double p1, double p2, double p3 )
118{
119 m_v[0] = EvtComplex( e );
120 m_v[1] = EvtComplex( p1 );
121 m_v[2] = EvtComplex( p2 );
122 m_v[3] = EvtComplex( p3 );
123}
124
125inline const EvtComplex& EvtVector4C::get( int i ) const
126{
127 return m_v[i];
128}
129
130inline EvtVector4C operator+( const EvtVector4C& v1, const EvtVector4C& v2 )
131{
132 return EvtVector4C( v1 ) += v2;
133}
134
135inline EvtVector4C operator-( const EvtVector4C& v1, const EvtVector4C& v2 )
136{
137 return EvtVector4C( v1 ) -= v2;
138}
139
140inline EvtComplex EvtVector4C::cont( const EvtVector4C& v4 ) const
141{
142 return m_v[0] * v4.m_v[0] - m_v[1] * v4.m_v[1] - m_v[2] * v4.m_v[2] -
143 m_v[3] * v4.m_v[3];
144}
145
147{
148 m_v[0] *= c;
149 m_v[1] *= c;
150 m_v[2] *= c;
151 m_v[3] *= c;
152
153 return *this;
154}
155
156inline EvtVector4C operator*( double d, const EvtVector4C& v2 )
157{
158 return EvtVector4C( v2.m_v[0] * d, v2.m_v[1] * d, v2.m_v[2] * d,
159 v2.m_v[3] * d );
160}
161
162inline EvtVector4C operator*( const EvtComplex& c, const EvtVector4C& v2 )
163{
164 return EvtVector4C( v2 ) *= c;
165}
166
167inline EvtVector4C operator*( const EvtVector4C& v2, const EvtComplex& c )
168{
169 return EvtVector4C( v2 ) *= c;
170}
171
172inline EvtVector4C operator*( const EvtComplex& c, const EvtVector4R& v2 )
173{
174 return EvtVector4C( c * v2.get( 0 ), c * v2.get( 1 ), c * v2.get( 2 ),
175 c * v2.get( 3 ) );
176}
177
179{
180 m_v[0] = EvtComplex( v1.get( 0 ) );
181 m_v[1] = EvtComplex( v1.get( 1 ) );
182 m_v[2] = EvtComplex( v1.get( 2 ) );
183 m_v[3] = EvtComplex( v1.get( 3 ) );
184}
185
186inline EvtComplex operator*( const EvtVector4R& v1, const EvtVector4C& v2 )
187{
188 return v1.get( 0 ) * v2.m_v[0] - v1.get( 1 ) * v2.m_v[1] -
189 v1.get( 2 ) * v2.m_v[2] - v1.get( 3 ) * v2.m_v[3];
190}
191
192inline EvtComplex operator*( const EvtVector4C& v1, const EvtVector4R& v2 )
193{
194 return v1.m_v[0] * v2.get( 0 ) - v1.m_v[1] * v2.get( 1 ) -
195 v1.m_v[2] * v2.get( 2 ) - v1.m_v[3] * v2.get( 3 );
196}
197
198inline EvtComplex operator*( const EvtVector4C& v1, const EvtVector4C& v2 )
199{
200 return v1.m_v[0] * v2.m_v[0] - v1.m_v[1] * v2.m_v[1] -
201 v1.m_v[2] * v2.m_v[2] - v1.m_v[3] * v2.m_v[3];
202}
203
205{
206 return EvtVector4C( ::conj( m_v[0] ), ::conj( m_v[1] ), ::conj( m_v[2] ),
207 ::conj( m_v[3] ) );
208}
209
210#endif
EvtVector4C boostTo(const EvtVector4C &e, const EvtVector4R p4)
EvtVector4C operator-(const EvtVector4C &v1, const EvtVector4C &v2)
EvtVector4C operator+(const EvtVector4C &v1, const EvtVector4C &v2)
EvtVector4C rotateEuler(const EvtVector4C &e, double alpha, double beta, double gamma)
EvtVector4C operator*(double d, const EvtVector4C &v2)
double dot(const EvtVector4C &p2)
void applyRotateEuler(double alpha, double beta, double gamma)
EvtVector4C conj() const
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)
EvtComplex m_v[4]
friend EvtVector4C operator+(const EvtVector4C &v1, const EvtVector4C &v2)
const EvtComplex & get(int) const
EvtVector4C & operator-=(const EvtVector4C &v2)
friend EvtVector4C operator*(double d, const EvtVector4C &v2)
void applyBoostTo(const EvtVector4R &p4)
EvtVector4C & operator*=(const EvtComplex &c)
EvtComplex cont(const EvtVector4C &v4) const
EvtVector3C vec() const
double get(int i) const