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
EvtTensor4C.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 EvtTensor4C_HH
22#define EvtTensor4C_HH
23
25
26//Class to handle 4D complex valued tensors.
27class EvtTensor4C;
28class EvtVector4C;
29class EvtVector4R;
30class EvtVector3R;
31
32namespace EvtGenFunctions {
33 EvtTensor4C directProd( const EvtVector4R& c1, const EvtVector4R& c2 );
34 EvtTensor4C directProd( const EvtVector4C& c1, const EvtVector4C& c2 );
35 EvtTensor4C directProd( const EvtVector4C& c1, const EvtVector4R& c2 );
36} // namespace EvtGenFunctions
37
38class EvtTensor4C final {
40 const EvtVector4R& c2 );
42 const EvtVector4C& c2 );
44 const EvtVector4R& c2 );
45
46 friend EvtTensor4C rotateEuler( const EvtTensor4C& e, double alpha,
47 double beta, double gamma );
48 friend EvtTensor4C boostTo( const EvtTensor4C& e, const EvtVector4R p4 );
49 friend EvtTensor4C boostTo( const EvtTensor4C& e, const EvtVector3R boost );
50 friend EvtTensor4C dual( const EvtTensor4C& t2 );
51 friend EvtTensor4C conj( const EvtTensor4C& t2 );
52 friend EvtTensor4C cont22( const EvtTensor4C& t1, const EvtTensor4C& t2 );
53 friend EvtTensor4C cont11( const EvtTensor4C& t1, const EvtTensor4C& t2 );
54 friend EvtTensor4C operator*( const EvtTensor4C& t1, const EvtComplex& c );
55 friend EvtTensor4C operator*( const EvtComplex& c, const EvtTensor4C& t1 );
56 friend EvtTensor4C operator*( const EvtTensor4C& t1, double d );
57 friend EvtTensor4C operator*( double d, const EvtTensor4C& t1 );
58 friend EvtComplex cont( const EvtTensor4C& t1, const EvtTensor4C& t2 );
59 friend EvtTensor4C operator+( const EvtTensor4C& t1, const EvtTensor4C& t2 );
60 friend EvtTensor4C operator-( const EvtTensor4C& t1, const EvtTensor4C& t2 );
61
62 public:
64
65 EvtTensor4C( double t00, double t11, double t22, double t33 )
66 {
67 setdiag( t00, t11, t22, t33 );
68 }
69
70 EvtTensor4C( const EvtTensor4C& t1 );
71 EvtTensor4C& operator=( const EvtTensor4C& t1 );
73 EvtTensor4C& operator*=( double d );
74 EvtTensor4C& addDirProd( const EvtVector4R& p1, const EvtVector4R& p2 );
75 static const EvtTensor4C& g();
76 inline void set( int i, int j, const EvtComplex& c );
77 void setdiag( double t00, double t11, double t22, double t33 );
78 inline const EvtComplex& get( int i, int j ) const;
79 inline EvtComplex trace() const;
80 void zero();
81 void applyRotateEuler( double alpha, double beta, double gamma );
82 void applyBoostTo( const EvtVector4R& p4 );
83 void applyBoostTo( const EvtVector3R& boost );
84 friend std::ostream& operator<<( std::ostream& s, const EvtTensor4C& t );
87 EvtTensor4C conj() const;
88 EvtVector4C cont1( const EvtVector4C& v4 ) const;
89 EvtVector4C cont2( const EvtVector4C& v4 ) const;
90 EvtVector4C cont1( const EvtVector4R& v4 ) const;
91 EvtVector4C cont2( const EvtVector4R& v4 ) const;
92
93 private:
95};
96
97inline EvtTensor4C operator+( const EvtTensor4C& t1, const EvtTensor4C& t2 )
98{
99 return EvtTensor4C( t1 ) += t2;
100}
101
102inline EvtTensor4C operator-( const EvtTensor4C& t1, const EvtTensor4C& t2 )
103{
104 return EvtTensor4C( t1 ) -= t2;
105}
106
107inline void EvtTensor4C::set( int i, int j, const EvtComplex& c )
108{
109 m_t[i][j] = c;
110}
111
112inline const EvtComplex& EvtTensor4C::get( int i, int j ) const
113{
114 return m_t[i][j];
115}
116
118{
119 return m_t[0][0] - m_t[1][1] - m_t[2][2] - m_t[3][3];
120}
121
122#endif
EvtTensor4C operator-(const EvtTensor4C &t1, const EvtTensor4C &t2)
EvtTensor4C operator+(const EvtTensor4C &t1, const EvtTensor4C &t2)
friend EvtTensor4C operator-(const EvtTensor4C &t1, const EvtTensor4C &t2)
friend EvtTensor4C dual(const EvtTensor4C &t2)
void setdiag(double t00, double t11, double t22, double t33)
friend EvtTensor4C rotateEuler(const EvtTensor4C &e, double alpha, double beta, double gamma)
friend EvtComplex cont(const EvtTensor4C &t1, const EvtTensor4C &t2)
EvtComplex trace() const
void set(int i, int j, const EvtComplex &c)
const EvtComplex & get(int i, int j) const
EvtTensor4C & operator=(const EvtTensor4C &t1)
EvtTensor4C & operator-=(const EvtTensor4C &t2)
EvtVector4C cont1(const EvtVector4C &v4) const
static const EvtTensor4C & g()
void applyBoostTo(const EvtVector4R &p4)
EvtTensor4C conj() const
friend EvtTensor4C operator+(const EvtTensor4C &t1, const EvtTensor4C &t2)
friend std::ostream & operator<<(std::ostream &s, const EvtTensor4C &t)
EvtTensor4C & addDirProd(const EvtVector4R &p1, const EvtVector4R &p2)
friend EvtTensor4C cont22(const EvtTensor4C &t1, const EvtTensor4C &t2)
EvtTensor4C & operator*=(const EvtComplex &c)
friend EvtTensor4C cont11(const EvtTensor4C &t1, const EvtTensor4C &t2)
EvtVector4C cont2(const EvtVector4C &v4) const
EvtComplex m_t[4][4]
EvtTensor4C & operator+=(const EvtTensor4C &t2)
friend EvtTensor4C operator*(const EvtTensor4C &t1, const EvtComplex &c)
void applyRotateEuler(double alpha, double beta, double gamma)
friend EvtTensor4C boostTo(const EvtTensor4C &e, const EvtVector4R p4)
EvtTensor4C(double t00, double t11, double t22, double t33)
EvtTensor3C directProd(const EvtVector3C &c1, const EvtVector3C &c2)