Back to home page

EIC code displayed by LXR

 
 

    


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

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 EVTRARITASCHWINGER_HH
0022 #define EVTRARITASCHWINGER_HH
0023 
0024 #include "EvtGenBase/EvtComplex.hh"
0025 #include "EvtGenBase/EvtDiracSpinor.hh"
0026 #include "EvtGenBase/EvtVector4C.hh"
0027 #include "EvtGenBase/EvtVector4R.hh"
0028 
0029 class EvtRaritaSchwinger;
0030 EvtRaritaSchwinger rotateEuler( const EvtRaritaSchwinger& rs, double alpha,
0031                                 double beta, double gamma );
0032 EvtRaritaSchwinger boostTo( const EvtRaritaSchwinger& rs, const EvtVector4R p4 );
0033 EvtRaritaSchwinger boostTo( const EvtRaritaSchwinger& rs,
0034                             const EvtVector3R boost );
0035 EvtRaritaSchwinger dirProd( EvtVector4R v, EvtDiracSpinor u );
0036 EvtRaritaSchwinger dirProd( EvtVector4C v, EvtDiracSpinor u );
0037 EvtRaritaSchwinger operator+( const EvtRaritaSchwinger& u1,
0038                               const EvtRaritaSchwinger& u2 );
0039 EvtRaritaSchwinger operator-( const EvtRaritaSchwinger& u1,
0040                               const EvtRaritaSchwinger& u2 );
0041 EvtComplex operator*( const EvtRaritaSchwinger& u1, const EvtRaritaSchwinger& u2 );
0042 
0043 class EvtRaritaSchwinger final {
0044     friend EvtRaritaSchwinger rotateEuler( const EvtRaritaSchwinger& rs,
0045                                            double alpha, double beta,
0046                                            double gamma );
0047     friend EvtRaritaSchwinger boostTo( const EvtRaritaSchwinger& rs,
0048                                        const EvtVector4R p4 );
0049     friend EvtRaritaSchwinger boostTo( const EvtRaritaSchwinger& rs,
0050                                        const EvtVector3R boost );
0051 
0052     friend EvtRaritaSchwinger dirProd( EvtVector4R v, EvtDiracSpinor u );
0053     friend EvtRaritaSchwinger dirProd( EvtVector4C v, EvtDiracSpinor u );
0054 
0055     friend EvtRaritaSchwinger operator+( const EvtRaritaSchwinger& u1,
0056                                          const EvtRaritaSchwinger& u2 );
0057     friend EvtRaritaSchwinger operator-( const EvtRaritaSchwinger& u1,
0058                                          const EvtRaritaSchwinger& u2 );
0059 
0060     friend EvtComplex operator*( const EvtRaritaSchwinger& u1,
0061                                  const EvtRaritaSchwinger& u2 );
0062 
0063   public:
0064     inline EvtRaritaSchwinger();
0065     inline EvtRaritaSchwinger( const EvtRaritaSchwinger& rs );
0066     inline EvtRaritaSchwinger& operator=( const EvtRaritaSchwinger& rs );
0067 
0068     void set( int i, int j, const EvtComplex& sp );
0069 
0070     void applyRotateEuler( double alpha, double beta, double gamma );
0071     void applyBoostTo( const EvtVector4R p4 );
0072     void applyBoostTo( const EvtVector3R boost );
0073 
0074     EvtRaritaSchwinger& operator+=( const EvtRaritaSchwinger& u2 );
0075     EvtRaritaSchwinger& operator-=( const EvtRaritaSchwinger& u2 );
0076 
0077     EvtComplex get( int i, int j ) const;
0078     friend std::ostream& operator<<( std::ostream& s,
0079                                      const EvtRaritaSchwinger& rs );
0080 
0081     EvtVector4C getVector( int i ) const;
0082     EvtDiracSpinor getSpinor( int i ) const;
0083 
0084     void setVector( int i, const EvtVector4C& v );
0085     void setSpinor( int i, const EvtDiracSpinor& sp );
0086 
0087   private:
0088     //First index in spinor index, second is Lorentz index.
0089     EvtComplex _rs[4][4];
0090 };
0091 
0092 EvtRaritaSchwinger::EvtRaritaSchwinger()
0093 {
0094     int i, j;
0095     for ( i = 0; i < 4; i++ ) {
0096         for ( j = 0; j < 4; j++ ) {
0097             _rs[i][j] = 0.0;
0098         }
0099     }
0100 }
0101 
0102 EvtRaritaSchwinger::EvtRaritaSchwinger( const EvtRaritaSchwinger& rs )
0103 {
0104     int i, j;
0105     for ( i = 0; i < 4; i++ ) {
0106         for ( j = 0; j < 4; j++ ) {
0107             _rs[i][j] = rs._rs[i][j];
0108         }
0109     }
0110 }
0111 
0112 EvtRaritaSchwinger& EvtRaritaSchwinger::operator=( const EvtRaritaSchwinger& rs )
0113 {
0114     int i, j;
0115     for ( i = 0; i < 4; i++ ) {
0116         for ( j = 0; j < 4; j++ ) {
0117             _rs[i][j] = rs._rs[i][j];
0118         }
0119     }
0120 
0121     return *this;
0122 }
0123 
0124 #endif