MINT2
TLorentzVectorC.h
Go to the documentation of this file.
1 #ifndef TLORENTZ_VECTOR_COMPLEX_HH
2 #define TLORENTZ_VECTOR_COMPLEX_HH
3 // author: Philippe d'Argent (p.dargent@cern.ch)
4 // status: Tu 6 May 2014
5 
6 #include "TLorentzVector.h"
7 #include <math.h>
8 #include <iostream>
9 #include <complex>
10 
11 using namespace std;
12 
14  protected:
15  TLorentzVector _v[2];
16  // we'll follow the x, y, z, E convention, i.e. E is 4
17  bool makeZero(){
18  Re().SetXYZT(0,0,0,0);
19  Im().SetXYZT(0,0,0,0);
20  return true;
21  }
22  public:
23  const TLorentzVector& v(int i) const{return _v[i];}
24 
26  TLorentzVectorC(const TLorentzVector& re, const TLorentzVector& im){
27  _v[0] = re;
28  _v[1] = im;
29  }
30 
31  TLorentzVectorC(const TLorentzVector& re){
32  _v[0] = re;
33  _v[1].SetXYZT(0.,0.,0.,0.);
34  }
35 
36  TLorentzVectorC(const TLorentzVectorC& other, bool conj = false){
37  _v[0] = other._v[0];
38  _v[1] = other._v[1];
39  if (conj==true) {
40  _v[1]*=-1.;
41  }
42  }
43  const TLorentzVector& Re() const{return _v[0];}
44  const TLorentzVector& Im() const{return _v[1];}
45 
46  TLorentzVector& Re() {return _v[0];}
47  TLorentzVector& Im() {return _v[1];}
48 
49  void conj(){
50  _v[1]=-_v[1];
51  }
52 
53  complex<double> Dot(const TLorentzVectorC& rhs){
54  return complex<double>(_v[0].Dot(rhs._v[0]) - _v[1].Dot(rhs._v[1]),_v[0].Dot(rhs._v[1]) + _v[1].Dot(rhs._v[0]));
55  }
56 
57  complex<double> Dot(const TLorentzVector& rhs){
59  return Dot(other);
60  }
61 
62  inline TLorentzVectorC & operator = (const TLorentzVectorC & other) {
63  _v[0] = other._v[0];
64  _v[1] = other._v[1];
65  return *this;
66  }
67 
68  inline TLorentzVectorC operator + (const TLorentzVectorC & other) const {
69  return TLorentzVectorC(_v[0] + other._v[0], _v[1] + other._v[1]);
70  }
71 
72  inline TLorentzVectorC operator * (Double_t a) const {
73  return TLorentzVectorC(a*_v[0], a*_v[1]);
74  }
75 
76  inline Bool_t operator == (const TLorentzVectorC & other) const {
77  return (_v[0] == other._v[0] && _v[1] == other._v[1]);
78  }
79 
80  void Print(){
81  cout << "Re = " ; _v[0].Print();
82  cout << "Im = " ; _v[1].Print();
83  }
84 };
85 #endif
86 //
TLorentzVectorC(const TLorentzVector &re)
TLorentzVector & Re()
TLorentzVector _v[2]
complex< double > Dot(const TLorentzVector &rhs)
TLorentzVector & Im()
const TLorentzVector & Re() const
TLorentzVectorC(const TLorentzVector &re, const TLorentzVector &im)
complex< double > Dot(const TLorentzVectorC &rhs)
std::complex< double > operator+(const std::complex< double > &cplx, const MINT::FitComplex &fc)
Definition: FitComplex.cpp:95
const TLorentzVector & Im() const
DalitzHistoSet operator *(double sf, const DalitzHistoSet &dhs)
const TLorentzVector & v(int i) const
TLorentzVectorC(const TLorentzVectorC &other, bool conj=false)