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
EvtTensor3C.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 EVTTENSOR3C_HH
22#define EVTTENSOR3C_HH
23
25
26#include <iostream>
27
28class EvtVector3C;
29class EvtVector3R;
30
31class EvtTensor3C;
32
33namespace EvtGenFunctions {
34 EvtTensor3C eps( const EvtVector3R& v );
35 EvtTensor3C rotateEuler( const EvtTensor3C& v, double phi, double theta,
36 double ksi );
37 EvtTensor3C directProd( const EvtVector3C& c1, const EvtVector3C& c2 );
38 EvtTensor3C directProd( const EvtVector3C& c1, const EvtVector3R& c2 );
39 EvtTensor3C directProd( const EvtVector3R& c1, const EvtVector3R& c2 );
40} // namespace EvtGenFunctions
41
42class EvtTensor3C final {
43 friend EvtTensor3C operator*( const EvtComplex& c, const EvtTensor3C& t2 );
44 friend EvtTensor3C operator*( const double d, const EvtTensor3C& t2 );
45 friend EvtTensor3C operator*( const EvtTensor3C& t2, const EvtComplex& c );
46 friend EvtTensor3C operator*( const EvtTensor3C& t2, const double d );
47 friend EvtTensor3C operator+( const EvtTensor3C& t1, const EvtTensor3C& t2 );
48 friend EvtTensor3C operator-( const EvtTensor3C& t1, const EvtTensor3C& t2 );
50 const EvtVector3C& c2 );
52 const EvtVector3R& c2 );
54 const EvtVector3R& c2 );
55 friend EvtTensor3C conj( const EvtTensor3C& t2 );
56 //Contract the second index of two tensors result(i,j) = t1(i,k)t2(j,k)
57 friend EvtTensor3C cont22( const EvtTensor3C& t1, const EvtTensor3C& t2 );
58 //Contract the first index of two tensors result(i,j) = t1(k,i)t2(k,j)
59 friend EvtTensor3C cont11( const EvtTensor3C& t1, const EvtTensor3C& t2 );
60 //Contract the last index of eps_{ijk} with w
62 friend std::ostream& operator<<( std::ostream& c, const EvtTensor3C& v );
63
64 public:
66 EvtTensor3C( const EvtTensor3C& t1 );
67 EvtTensor3C( double d11, double d22, double d33 );
68 EvtTensor3C& operator=( const EvtTensor3C& t1 );
69 inline void set( int i, int j, const EvtComplex& c );
70 inline const EvtComplex& get( int i, int j ) const;
71 inline EvtComplex trace() const;
72 static const EvtTensor3C& id();
73 void zero();
74 void applyRotateEuler( double phi, double theta, double ksi );
75
78 EvtTensor3C operator*=( const double d );
80 EvtTensor3C conj() const;
81 EvtVector3C cont1( const EvtVector3C& v ) const;
82 EvtVector3C cont2( const EvtVector3C& v ) const;
83 EvtVector3C cont1( const EvtVector3R& v ) const;
84 EvtVector3C cont2( const EvtVector3R& v ) const;
85
86 private:
88};
89
90inline EvtTensor3C operator*( const EvtComplex& c, const EvtTensor3C& t2 )
91{
92 return EvtTensor3C( t2 ) *= c;
93}
94
95inline EvtTensor3C operator*( const double d, const EvtTensor3C& t2 )
96{
97 return EvtTensor3C( t2 ) *= d;
98}
99
100inline EvtTensor3C operator*( const EvtTensor3C& t2, const EvtComplex& c )
101{
102 return EvtTensor3C( t2 ) *= c;
103}
104
105inline EvtTensor3C operator*( const EvtTensor3C& t2, const double d )
106{
107 return EvtTensor3C( t2 ) *= d;
108}
109
110inline EvtTensor3C operator+( const EvtTensor3C& t1, const EvtTensor3C& t2 )
111{
112 return EvtTensor3C( t1 ) += t2;
113}
114
115inline EvtTensor3C operator-( const EvtTensor3C& t1, const EvtTensor3C& t2 )
116{
117 return EvtTensor3C( t1 ) -= t2;
118}
119
120inline void EvtTensor3C::set( int i, int j, const EvtComplex& c )
121{
122 m_t[i][j] = c;
123}
124
125inline const EvtComplex& EvtTensor3C::get( int i, int j ) const
126{
127 return m_t[i][j];
128}
129
131{
132 return m_t[0][0] + m_t[1][1] + m_t[2][2];
133}
134
135#endif
EvtTensor3C operator*(const EvtComplex &c, const EvtTensor3C &t2)
EvtTensor3C operator-(const EvtTensor3C &t1, const EvtTensor3C &t2)
EvtTensor3C operator+(const EvtTensor3C &t1, const EvtTensor3C &t2)
const EvtComplex & get(int i, int j) const
EvtVector3C cont1(const EvtVector3C &v) const
void set(int i, int j, const EvtComplex &c)
EvtComplex m_t[3][3]
friend std::ostream & operator<<(std::ostream &c, const EvtTensor3C &v)
void applyRotateEuler(double phi, double theta, double ksi)
friend EvtTensor3C cont22(const EvtTensor3C &t1, const EvtTensor3C &t2)
friend EvtTensor3C operator*(const EvtComplex &c, const EvtTensor3C &t2)
EvtVector3C cont2(const EvtVector3C &v) const
EvtTensor3C operator-=(const EvtTensor3C &t2)
friend EvtTensor3C operator-(const EvtTensor3C &t1, const EvtTensor3C &t2)
friend EvtTensor3C operator+(const EvtTensor3C &t1, const EvtTensor3C &t2)
static const EvtTensor3C & id()
EvtTensor3C conj() const
EvtTensor3C & operator=(const EvtTensor3C &t1)
EvtComplex trace() const
EvtTensor3C operator*=(const double d)
EvtTensor3C operator+=(const EvtTensor3C &t2)
friend EvtTensor3C cont11(const EvtTensor3C &t1, const EvtTensor3C &t2)
EvtTensor3C rotateEuler(const EvtTensor3C &v, double phi, double theta, double ksi)
EvtTensor3C eps(const EvtVector3R &v)
EvtTensor3C directProd(const EvtVector3C &c1, const EvtVector3C &c2)