evtgen is hosted by Hepforge, IPPP Durham
EvtGen  2.0.0
Monte Carlo generator of particle decays, in particular the weak decays of heavy flavour particles such as B mesons.
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 
24 #include "EvtGenBase/EvtComplex.hh"
25 
26 #include <iostream>
27 
28 class EvtVector3C;
29 class EvtVector3R;
30 
31 class EvtTensor3C;
32 
33 namespace 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 
42 class 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
61  friend EvtTensor3C EvtGenFunctions::eps( const EvtVector3R& v );
62  friend std::ostream& operator<<( std::ostream& c, const EvtTensor3C& v );
63 
64  public:
65  EvtTensor3C();
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 
76  EvtTensor3C operator+=( const EvtTensor3C& t2 );
77  EvtTensor3C operator-=( const EvtTensor3C& t2 );
78  EvtTensor3C operator*=( const double d );
79  EvtTensor3C operator*=( const EvtComplex& c );
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:
87  EvtComplex t[3][3];
88 };
89 
90 inline EvtTensor3C operator*( const EvtComplex& c, const EvtTensor3C& t2 )
91 {
92  return EvtTensor3C( t2 ) *= c;
93 }
94 
95 inline EvtTensor3C operator*( const double d, const EvtTensor3C& t2 )
96 {
97  return EvtTensor3C( t2 ) *= d;
98 }
99 
100 inline EvtTensor3C operator*( const EvtTensor3C& t2, const EvtComplex& c )
101 {
102  return EvtTensor3C( t2 ) *= c;
103 }
104 
105 inline EvtTensor3C operator*( const EvtTensor3C& t2, const double d )
106 {
107  return EvtTensor3C( t2 ) *= d;
108 }
109 
110 inline EvtTensor3C operator+( const EvtTensor3C& t1, const EvtTensor3C& t2 )
111 {
112  return EvtTensor3C( t1 ) += t2;
113 }
114 
115 inline EvtTensor3C operator-( const EvtTensor3C& t1, const EvtTensor3C& t2 )
116 {
117  return EvtTensor3C( t1 ) -= t2;
118 }
119 
120 inline void EvtTensor3C::set( int i, int j, const EvtComplex& c )
121 {
122  t[i][j] = c;
123 }
124 
125 inline const EvtComplex& EvtTensor3C::get( int i, int j ) const
126 {
127  return t[i][j];
128 }
129 
131 {
132  return t[0][0] + t[1][1] + t[2][2];
133 }
134 
135 #endif
EvtTensor3C directProd(const EvtVector3C &c1, const EvtVector3C &c2)
static const EvtTensor3C & id()
friend EvtTensor3C operator+(const EvtTensor3C &t1, const EvtTensor3C &t2)
Definition: EvtTensor3C.hh:110
EvtTensor3C & operator=(const EvtTensor3C &t1)
Definition: EvtTensor3C.cpp:59
friend EvtTensor3C operator *(const EvtComplex &c, const EvtTensor3C &t2)
Definition: EvtTensor3C.hh:90
EvtTensor3C rotateEuler(const EvtTensor3C &v, double phi, double theta, double ksi)
EvtVector3C cont1(const EvtVector3C &v) const
EvtComplex trace() const
Definition: EvtTensor3C.hh:130
friend EvtTensor3C cont22(const EvtTensor3C &t1, const EvtTensor3C &t2)
friend std::ostream & operator<<(std::ostream &c, const EvtTensor3C &v)
EvtTensor3C operator+=(const EvtTensor3C &t2)
EvtTensor3C operator-=(const EvtTensor3C &t2)
EvtVector3C cont2(const EvtVector3C &v) const
friend EvtTensor3C operator-(const EvtTensor3C &t1, const EvtTensor3C &t2)
Definition: EvtTensor3C.hh:115
EvtTensor3C operator+(const EvtTensor3C &t1, const EvtTensor3C &t2)
Definition: EvtTensor3C.hh:110
EvtTensor3C operator *=(const double d)
const EvtComplex & get(int i, int j) const
Definition: EvtTensor3C.hh:125
void applyRotateEuler(double phi, double theta, double ksi)
friend EvtTensor3C cont11(const EvtTensor3C &t1, const EvtTensor3C &t2)
void set(int i, int j, const EvtComplex &c)
Definition: EvtTensor3C.hh:120
EvtTensor3C eps(const EvtVector3R &v)
EvtTensor3C operator-(const EvtTensor3C &t1, const EvtTensor3C &t2)
Definition: EvtTensor3C.hh:115
EvtTensor3C operator *(const EvtComplex &c, const EvtTensor3C &t2)
Definition: EvtTensor3C.hh:90
EvtComplex t[3][3]
Definition: EvtTensor3C.hh:87
EvtTensor3C conj() const
Definition: EvtTensor3C.cpp:71