File indexing completed on 2026-08-06 09:20:04
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021 #ifndef EVTVECTOR4C_HH
0022 #define EVTVECTOR4C_HH
0023
0024 #include "EvtGenBase/EvtComplex.hh"
0025 #include "EvtGenBase/EvtVector3C.hh"
0026 #include "EvtGenBase/EvtVector4R.hh"
0027
0028 #include <iosfwd>
0029
0030 class EvtVector4C final {
0031 inline friend EvtVector4C operator*( double d, const EvtVector4C& v2 );
0032 inline friend EvtVector4C operator*( const EvtComplex& c,
0033 const EvtVector4C& v2 );
0034 inline friend EvtVector4C operator*( const EvtVector4C& v2,
0035 const EvtComplex& c );
0036 inline friend EvtVector4C operator*( const EvtComplex& c,
0037 const EvtVector4R& v2 );
0038 inline friend EvtComplex operator*( const EvtVector4R& v1,
0039 const EvtVector4C& v2 );
0040 inline friend EvtComplex operator*( const EvtVector4C& v1,
0041 const EvtVector4R& v2 );
0042 inline friend EvtComplex operator*( const EvtVector4C& v1,
0043 const EvtVector4C& v2 );
0044 friend EvtVector4C operator+( const EvtVector4C& v1, const EvtVector4C& v2 );
0045 friend EvtVector4C operator-( const EvtVector4C& v1, const EvtVector4C& v2 );
0046
0047 public:
0048 EvtVector4C();
0049 EvtVector4C( const EvtComplex&, const EvtComplex&, const EvtComplex&,
0050 const EvtComplex& );
0051 inline void set( int, const EvtComplex& );
0052 inline void set( const EvtComplex&, const EvtComplex&, const EvtComplex&,
0053 const EvtComplex& );
0054 inline void set( double, double, double, double );
0055 inline EvtVector4C( const EvtVector4R& v1 );
0056 inline const EvtComplex& get( int ) const;
0057 inline EvtComplex cont( const EvtVector4C& v4 ) const;
0058 inline EvtVector4C conj() const;
0059 EvtVector3C vec() const;
0060 inline EvtVector4C& operator-=( const EvtVector4C& v2 );
0061 inline EvtVector4C& operator+=( const EvtVector4C& v2 );
0062 inline EvtVector4C& operator*=( const EvtComplex& c );
0063 void applyRotateEuler( double alpha, double beta, double gamma );
0064 void applyBoostTo( const EvtVector4R& p4 );
0065 void applyBoostTo( const EvtVector3R& boost );
0066 friend std::ostream& operator<<( std::ostream& s, const EvtVector4C& v );
0067 double dot( const EvtVector4C& p2 );
0068
0069 private:
0070 EvtComplex v[4];
0071 };
0072
0073 EvtVector4C rotateEuler( const EvtVector4C& e, double alpha, double beta,
0074 double gamma );
0075 EvtVector4C boostTo( const EvtVector4C& e, const EvtVector4R p4 );
0076 EvtVector4C boostTo( const EvtVector4C& e, const EvtVector3R boost );
0077
0078 inline EvtVector4C& EvtVector4C::operator+=( const EvtVector4C& v2 )
0079 {
0080 v[0] += v2.v[0];
0081 v[1] += v2.v[1];
0082 v[2] += v2.v[2];
0083 v[3] += v2.v[3];
0084
0085 return *this;
0086 }
0087
0088 inline EvtVector4C& EvtVector4C::operator-=( const EvtVector4C& v2 )
0089 {
0090 v[0] -= v2.v[0];
0091 v[1] -= v2.v[1];
0092 v[2] -= v2.v[2];
0093 v[3] -= v2.v[3];
0094
0095 return *this;
0096 }
0097
0098 inline void EvtVector4C::set( int i, const EvtComplex& c )
0099 {
0100 v[i] = c;
0101 }
0102
0103 inline EvtVector3C EvtVector4C::vec() const
0104 {
0105 return EvtVector3C( v[1], v[2], v[3] );
0106 }
0107
0108 inline void EvtVector4C::set( const EvtComplex& e, const EvtComplex& p1,
0109 const EvtComplex& p2, const EvtComplex& p3 )
0110 {
0111 v[0] = e;
0112 v[1] = p1;
0113 v[2] = p2;
0114 v[3] = p3;
0115 }
0116
0117 inline void EvtVector4C::set( double e, double p1, double p2, double p3 )
0118 {
0119 v[0] = EvtComplex( e );
0120 v[1] = EvtComplex( p1 );
0121 v[2] = EvtComplex( p2 );
0122 v[3] = EvtComplex( p3 );
0123 }
0124
0125 inline const EvtComplex& EvtVector4C::get( int i ) const
0126 {
0127 return v[i];
0128 }
0129
0130 inline EvtVector4C operator+( const EvtVector4C& v1, const EvtVector4C& v2 )
0131 {
0132 return EvtVector4C( v1 ) += v2;
0133 }
0134
0135 inline EvtVector4C operator-( const EvtVector4C& v1, const EvtVector4C& v2 )
0136 {
0137 return EvtVector4C( v1 ) -= v2;
0138 }
0139
0140 inline EvtComplex EvtVector4C::cont( const EvtVector4C& v4 ) const
0141 {
0142 return v[0] * v4.v[0] - v[1] * v4.v[1] - v[2] * v4.v[2] - v[3] * v4.v[3];
0143 }
0144
0145 inline EvtVector4C& EvtVector4C::operator*=( const EvtComplex& c )
0146 {
0147 v[0] *= c;
0148 v[1] *= c;
0149 v[2] *= c;
0150 v[3] *= c;
0151
0152 return *this;
0153 }
0154
0155 inline EvtVector4C operator*( double d, const EvtVector4C& v2 )
0156 {
0157 return EvtVector4C( v2.v[0] * d, v2.v[1] * d, v2.v[2] * d, v2.v[3] * d );
0158 }
0159
0160 inline EvtVector4C operator*( const EvtComplex& c, const EvtVector4C& v2 )
0161 {
0162 return EvtVector4C( v2 ) *= c;
0163 }
0164
0165 inline EvtVector4C operator*( const EvtVector4C& v2, const EvtComplex& c )
0166 {
0167 return EvtVector4C( v2 ) *= c;
0168 }
0169
0170 inline EvtVector4C operator*( const EvtComplex& c, const EvtVector4R& v2 )
0171 {
0172 return EvtVector4C( c * v2.get( 0 ), c * v2.get( 1 ), c * v2.get( 2 ),
0173 c * v2.get( 3 ) );
0174 }
0175
0176 inline EvtVector4C::EvtVector4C( const EvtVector4R& v1 )
0177 {
0178 v[0] = EvtComplex( v1.get( 0 ) );
0179 v[1] = EvtComplex( v1.get( 1 ) );
0180 v[2] = EvtComplex( v1.get( 2 ) );
0181 v[3] = EvtComplex( v1.get( 3 ) );
0182 }
0183
0184 inline EvtComplex operator*( const EvtVector4R& v1, const EvtVector4C& v2 )
0185 {
0186 return v1.get( 0 ) * v2.v[0] - v1.get( 1 ) * v2.v[1] -
0187 v1.get( 2 ) * v2.v[2] - v1.get( 3 ) * v2.v[3];
0188 }
0189
0190 inline EvtComplex operator*( const EvtVector4C& v1, const EvtVector4R& v2 )
0191 {
0192 return v1.v[0] * v2.get( 0 ) - v1.v[1] * v2.get( 1 ) -
0193 v1.v[2] * v2.get( 2 ) - v1.v[3] * v2.get( 3 );
0194 }
0195
0196 inline EvtComplex operator*( const EvtVector4C& v1, const EvtVector4C& v2 )
0197 {
0198 return v1.v[0] * v2.v[0] - v1.v[1] * v2.v[1] - v1.v[2] * v2.v[2] -
0199 v1.v[3] * v2.v[3];
0200 }
0201
0202 inline EvtVector4C EvtVector4C::conj() const
0203 {
0204 return EvtVector4C( ::conj( v[0] ), ::conj( v[1] ), ::conj( v[2] ),
0205 ::conj( v[3] ) );
0206 }
0207
0208 #endif