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.
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 
24 #include "EvtGenBase/EvtComplex.hh"
25 
26 //Class to handle 4D complex valued tensors.
27 class EvtTensor4C;
28 class EvtVector4C;
29 class EvtVector4R;
30 class EvtVector3R;
31 
32 namespace 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 
38 class 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:
63  EvtTensor4C() { ; }
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 );
72  EvtTensor4C& operator*=( const EvtComplex& c );
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 );
85  EvtTensor4C& operator+=( const EvtTensor4C& t2 );
86  EvtTensor4C& operator-=( const EvtTensor4C& t2 );
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:
94  EvtComplex t[4][4];
95 };
96 
97 inline EvtTensor4C operator+( const EvtTensor4C& t1, const EvtTensor4C& t2 )
98 {
99  return EvtTensor4C( t1 ) += t2;
100 }
101 
102 inline EvtTensor4C operator-( const EvtTensor4C& t1, const EvtTensor4C& t2 )
103 {
104  return EvtTensor4C( t1 ) -= t2;
105 }
106 
107 inline void EvtTensor4C::set( int i, int j, const EvtComplex& c )
108 {
109  t[i][j] = c;
110 }
111 
112 inline const EvtComplex& EvtTensor4C::get( int i, int j ) const
113 {
114  return t[i][j];
115 }
116 
118 {
119  return t[0][0] - t[1][1] - t[2][2] - t[3][3];
120 }
121 
122 #endif
EvtTensor3C directProd(const EvtVector3C &c1, const EvtVector3C &c2)
EvtTensor4C conj() const
Definition: EvtTensor4C.cpp:63
friend EvtTensor4C operator *(const EvtTensor4C &t1, const EvtComplex &c)
void set(int i, int j, const EvtComplex &c)
Definition: EvtTensor4C.hh:107
EvtTensor4C & operator *=(const EvtComplex &c)
void setdiag(double t00, double t11, double t22, double t33)
friend EvtTensor4C dual(const EvtTensor4C &t2)
EvtComplex trace() const
Definition: EvtTensor4C.hh:117
static const EvtTensor4C & g()
Definition: EvtTensor4C.cpp:44
friend EvtTensor4C cont22(const EvtTensor4C &t1, const EvtTensor4C &t2)
void applyBoostTo(const EvtVector4R &p4)
Definition: EvtTensor4C.cpp:99
EvtTensor4C operator-(const EvtTensor4C &t1, const EvtTensor4C &t2)
Definition: EvtTensor4C.hh:102
EvtVector4C cont2(const EvtVector4C &v4) const
EvtVector4C cont1(const EvtVector4C &v4) const
friend EvtTensor4C operator-(const EvtTensor4C &t1, const EvtTensor4C &t2)
Definition: EvtTensor4C.hh:102
friend EvtTensor4C cont11(const EvtTensor4C &t1, const EvtTensor4C &t2)
void applyRotateEuler(double alpha, double beta, double gamma)
EvtTensor4C & operator-=(const EvtTensor4C &t2)
EvtTensor4C operator+(const EvtTensor4C &t1, const EvtTensor4C &t2)
Definition: EvtTensor4C.hh:97
EvtTensor4C(double t00, double t11, double t22, double t33)
Definition: EvtTensor4C.hh:65
friend EvtComplex cont(const EvtTensor4C &t1, const EvtTensor4C &t2)
EvtComplex t[4][4]
Definition: EvtTensor4C.hh:94
friend std::ostream & operator<<(std::ostream &s, const EvtTensor4C &t)
EvtTensor4C & operator=(const EvtTensor4C &t1)
Definition: EvtTensor4C.cpp:51
friend EvtTensor4C rotateEuler(const EvtTensor4C &e, double alpha, double beta, double gamma)
Definition: EvtTensor4C.cpp:77
friend EvtTensor4C boostTo(const EvtTensor4C &e, const EvtVector4R p4)
Definition: EvtTensor4C.cpp:85
friend EvtTensor4C operator+(const EvtTensor4C &t1, const EvtTensor4C &t2)
Definition: EvtTensor4C.hh:97
EvtTensor4C & operator+=(const EvtTensor4C &t2)
const EvtComplex & get(int i, int j) const
Definition: EvtTensor4C.hh:112
EvtTensor4C & addDirProd(const EvtVector4R &p1, const EvtVector4R &p2)