Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-08-06 09:20:01

0001 
0002 /***********************************************************************
0003 * Copyright 1998-2020 CERN for the benefit of the EvtGen authors       *
0004 *                                                                      *
0005 * This file is part of EvtGen.                                         *
0006 *                                                                      *
0007 * EvtGen is free software: you can redistribute it and/or modify       *
0008 * it under the terms of the GNU General Public License as published by *
0009 * the Free Software Foundation, either version 3 of the License, or    *
0010 * (at your option) any later version.                                  *
0011 *                                                                      *
0012 * EvtGen is distributed in the hope that it will be useful,            *
0013 * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
0014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
0015 * GNU General Public License for more details.                         *
0016 *                                                                      *
0017 * You should have received a copy of the GNU General Public License    *
0018 * along with EvtGen.  If not, see <https://www.gnu.org/licenses/>.     *
0019 ***********************************************************************/
0020 
0021 #ifndef EVT3RANK3C_HH
0022 #define EVT3RANK3C_HH
0023 
0024 #include "EvtGenBase/EvtComplex.hh"
0025 
0026 #include <iostream>
0027 
0028 class EvtTensor3C;
0029 class EvtVector3C;
0030 class EvtVector3R;
0031 
0032 class Evt3Rank3C;
0033 inline Evt3Rank3C operator*( const EvtComplex& c, const Evt3Rank3C& t2 );
0034 inline Evt3Rank3C operator*( const double d, const Evt3Rank3C& t2 );
0035 inline Evt3Rank3C operator*( const Evt3Rank3C& t2, const EvtComplex& c );
0036 inline Evt3Rank3C operator*( const Evt3Rank3C& t2, const double d );
0037 inline Evt3Rank3C operator+( const Evt3Rank3C& t1, const Evt3Rank3C& t2 );
0038 inline Evt3Rank3C operator-( const Evt3Rank3C& t1, const Evt3Rank3C& t2 );
0039 Evt3Rank3C directProd( const EvtVector3C& c1, const EvtVector3C& c2,
0040                        const EvtVector3C& c3 );
0041 Evt3Rank3C conj( const Evt3Rank3C& t2 );
0042 
0043 class Evt3Rank3C final {
0044     friend Evt3Rank3C operator*( const EvtComplex& c, const Evt3Rank3C& t2 );
0045     friend Evt3Rank3C operator*( const double d, const Evt3Rank3C& t2 );
0046     friend Evt3Rank3C operator*( const Evt3Rank3C& t2, const EvtComplex& c );
0047     friend Evt3Rank3C operator*( const Evt3Rank3C& t2, const double d );
0048     friend Evt3Rank3C operator+( const Evt3Rank3C& t1, const Evt3Rank3C& t2 );
0049     friend Evt3Rank3C operator-( const Evt3Rank3C& t1, const Evt3Rank3C& t2 );
0050     friend Evt3Rank3C directProd( const EvtVector3C& c1, const EvtVector3C& c2,
0051                                   const EvtVector3C& c3 );
0052     friend Evt3Rank3C conj( const Evt3Rank3C& t2 );
0053 
0054     friend std::ostream& operator<<( std::ostream& s, const Evt3Rank3C& t2 );
0055 
0056   public:
0057     Evt3Rank3C();
0058     Evt3Rank3C( const Evt3Rank3C& t1 );
0059     Evt3Rank3C& operator=( const Evt3Rank3C& t1 );
0060     inline void set( int i, int j, int k, const EvtComplex& c );
0061     inline const EvtComplex& get( int i, int j, int k ) const;
0062     void zero();
0063 
0064     Evt3Rank3C& operator+=( const Evt3Rank3C& t2 );
0065     Evt3Rank3C& operator-=( const Evt3Rank3C& t2 );
0066     Evt3Rank3C& operator*=( const double d );
0067     Evt3Rank3C& operator*=( const EvtComplex& c );
0068     Evt3Rank3C conj() const;
0069     EvtTensor3C cont1( const EvtVector3C& v ) const;
0070     EvtTensor3C cont2( const EvtVector3C& v ) const;
0071     EvtTensor3C cont3( const EvtVector3C& v ) const;
0072     EvtTensor3C cont1( const EvtVector3R& v ) const;
0073     EvtTensor3C cont2( const EvtVector3R& v ) const;
0074     EvtTensor3C cont3( const EvtVector3R& v ) const;
0075 
0076   private:
0077     EvtComplex t[3][3][3];
0078 };
0079 
0080 inline Evt3Rank3C operator*( const EvtComplex& c, const Evt3Rank3C& t2 )
0081 {
0082     return Evt3Rank3C( t2 ) *= c;
0083 }
0084 
0085 inline Evt3Rank3C operator*( const double d, const Evt3Rank3C& t2 )
0086 {
0087     return Evt3Rank3C( t2 ) *= d;
0088 }
0089 
0090 inline Evt3Rank3C operator*( const Evt3Rank3C& t2, const EvtComplex& c )
0091 {
0092     return Evt3Rank3C( t2 ) *= c;
0093 }
0094 
0095 inline Evt3Rank3C operator*( const Evt3Rank3C& t2, const double d )
0096 {
0097     return Evt3Rank3C( t2 ) *= d;
0098 }
0099 
0100 inline Evt3Rank3C operator+( const Evt3Rank3C& t1, const Evt3Rank3C& t2 )
0101 {
0102     return Evt3Rank3C( t1 ) += t2;
0103 }
0104 
0105 inline Evt3Rank3C operator-( const Evt3Rank3C& t1, const Evt3Rank3C& t2 )
0106 {
0107     return Evt3Rank3C( t1 ) -= t2;
0108 }
0109 
0110 inline void Evt3Rank3C::set( int i, int j, int k, const EvtComplex& c )
0111 {
0112     t[i][j][k] = c;
0113 }
0114 
0115 inline const EvtComplex& Evt3Rank3C::get( int i, int j, int k ) const
0116 {
0117     return t[i][j][k];
0118 }
0119 
0120 #endif