LCOV - code coverage report
Current view: top level - TEvtGen/EvtGen/EvtGenBase - EvtRaritaSchwinger.cpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 0 114 0.0 %
Date: 2016-06-14 17:26:59 Functions: 0 23 0.0 %

          Line data    Source code
       1             : //--------------------------------------------------------------------------
       2             : //
       3             : // Environment:
       4             : //      This software is part of the EvtGen package developed jointly
       5             : //      for the BaBar and CLEO collaborations.  If you use all or part
       6             : //      of it, please give an appropriate acknowledgement.
       7             : //
       8             : // Copyright Information: See EvtGen/COPYRIGHT
       9             : //      Copyright (C) 2000      Caltech, UCSB
      10             : //
      11             : // Module: EvtGen/EvtRaritaSchwing.hh
      12             : //
      13             : // Description:Class to handle spin 3/2
      14             : //
      15             : // Modification history:
      16             : //
      17             : //    RYD     April 23, 2000         Module created
      18             : //
      19             : //------------------------------------------------------------------------
      20             : #include "EvtGenBase/EvtPatches.hh"
      21             : 
      22             : 
      23             : #include "EvtGenBase/EvtRaritaSchwinger.hh"
      24             : using std::endl;
      25             : using std::ostream;
      26             : 
      27           0 : EvtRaritaSchwinger::~EvtRaritaSchwinger(){}
      28             : 
      29             : 
      30             : EvtRaritaSchwinger rotateEuler(const EvtRaritaSchwinger& rs,
      31             :                                double alpha,double beta,double gamma){
      32             : 
      33           0 :   EvtRaritaSchwinger tmp(rs);
      34           0 :   tmp.applyRotateEuler(alpha,beta,gamma);
      35             :   return tmp;
      36             : 
      37           0 : }
      38             : 
      39             : EvtRaritaSchwinger boostTo(const EvtRaritaSchwinger& rs,
      40             :                            const EvtVector4R p4){
      41             : 
      42           0 :   EvtRaritaSchwinger tmp(rs);
      43           0 :   tmp.applyBoostTo(p4);
      44             :   return tmp;
      45             : 
      46           0 : }
      47             : 
      48             : EvtRaritaSchwinger boostTo(const EvtRaritaSchwinger& rs,
      49             :                            const EvtVector3R boost){
      50             : 
      51           0 :   EvtRaritaSchwinger tmp(rs);
      52           0 :   tmp.applyBoostTo(boost);
      53             :   return tmp;
      54             : 
      55           0 : }
      56             : 
      57             : 
      58           0 : void EvtRaritaSchwinger::set(int i,int j,const EvtComplex& sp){_rs[i][j]=sp;}
      59             : 
      60           0 : EvtComplex EvtRaritaSchwinger::get(int i,int j) const {return _rs[i][j];} 
      61             : 
      62             : void EvtRaritaSchwinger::applyRotateEuler(double alpha,double beta,
      63             :                                           double gamma){
      64             : 
      65             :   //inefficient but simple to code...
      66           0 :   EvtVector4C v0=getVector(0);
      67           0 :   EvtVector4C v1=getVector(1);
      68           0 :   EvtVector4C v2=getVector(2);
      69           0 :   EvtVector4C v3=getVector(3);
      70           0 :   v0.applyRotateEuler(alpha,beta,gamma);
      71           0 :   v1.applyRotateEuler(alpha,beta,gamma);
      72           0 :   v2.applyRotateEuler(alpha,beta,gamma);
      73           0 :   v3.applyRotateEuler(alpha,beta,gamma);
      74           0 :   setVector(0,v0);
      75           0 :   setVector(1,v1);
      76           0 :   setVector(2,v2);
      77           0 :   setVector(3,v3);
      78           0 :   EvtDiracSpinor sp0=getSpinor(0);
      79           0 :   EvtDiracSpinor sp1=getSpinor(1);
      80           0 :   EvtDiracSpinor sp2=getSpinor(2);
      81           0 :   EvtDiracSpinor sp3=getSpinor(3);
      82           0 :   sp0.applyRotateEuler(alpha,beta,gamma);
      83           0 :   sp1.applyRotateEuler(alpha,beta,gamma);
      84           0 :   sp2.applyRotateEuler(alpha,beta,gamma);
      85           0 :   sp3.applyRotateEuler(alpha,beta,gamma);
      86           0 :   setSpinor(0,sp0);
      87           0 :   setSpinor(1,sp1);
      88           0 :   setSpinor(2,sp2);
      89           0 :   setSpinor(3,sp3);
      90             : 
      91           0 : }
      92             :   
      93             : 
      94             : void EvtRaritaSchwinger::applyBoostTo(const EvtVector4R p4){
      95             : 
      96           0 :   double e=p4.get(0);
      97             : 
      98           0 :   EvtVector3R boost(p4.get(1)/e,p4.get(2)/e,p4.get(3)/e);
      99             : 
     100           0 :   applyBoostTo(boost);
     101             :   
     102             :   return;
     103             : 
     104           0 : }
     105             :   
     106             : 
     107             : void EvtRaritaSchwinger::applyBoostTo(const EvtVector3R boost){
     108             : 
     109             :   //inefficient but simple to code...
     110           0 :   EvtVector4C v0=getVector(0);
     111           0 :   EvtVector4C v1=getVector(1);
     112           0 :   EvtVector4C v2=getVector(2);
     113           0 :   EvtVector4C v3=getVector(3);
     114           0 :   v0.applyBoostTo(boost);
     115           0 :   v1.applyBoostTo(boost);
     116           0 :   v2.applyBoostTo(boost);
     117           0 :   v3.applyBoostTo(boost);
     118           0 :   setVector(0,v0);
     119           0 :   setVector(1,v1);
     120           0 :   setVector(2,v2);
     121           0 :   setVector(3,v3);
     122           0 :   EvtDiracSpinor sp0=getSpinor(0);
     123           0 :   EvtDiracSpinor sp1=getSpinor(1);
     124           0 :   EvtDiracSpinor sp2=getSpinor(2);
     125           0 :   EvtDiracSpinor sp3=getSpinor(3);
     126           0 :   sp0.applyBoostTo(boost);
     127           0 :   sp1.applyBoostTo(boost);
     128           0 :   sp2.applyBoostTo(boost);
     129           0 :   sp3.applyBoostTo(boost);
     130           0 :   setSpinor(0,sp0);
     131           0 :   setSpinor(1,sp1);
     132           0 :   setSpinor(2,sp2);
     133           0 :   setSpinor(3,sp3);
     134             : 
     135             : 
     136           0 : }
     137             : 
     138             : 
     139             : ostream& operator<<(ostream& s, const EvtRaritaSchwinger& rs){
     140             : 
     141             :   int i,j;
     142           0 :   s<< endl;
     143           0 :   for(i=0;i<4;i++){
     144           0 :     for(j=0;j<4;j++){
     145           0 :       s << rs._rs[i][j];
     146             :     }
     147           0 :     s << endl;
     148             :   }
     149           0 :   return s;
     150             :   
     151             : }
     152             : 
     153             : 
     154             : 
     155             : EvtVector4C EvtRaritaSchwinger::getVector(int i) const{
     156             : 
     157           0 :   EvtVector4C tmp(_rs[i][0],_rs[i][1],_rs[i][2],_rs[i][3]);
     158             :   return tmp;
     159             : 
     160           0 : }
     161             :  
     162             : EvtDiracSpinor EvtRaritaSchwinger::getSpinor(int i) const{
     163             : 
     164           0 :   EvtDiracSpinor tmp;
     165           0 :   tmp.set(_rs[0][i],_rs[1][i],_rs[2][i],_rs[3][i]);
     166             :   return tmp;
     167             : 
     168           0 : }
     169             : 
     170             : void EvtRaritaSchwinger::setVector(int i,const EvtVector4C& v){
     171             :   
     172           0 :   _rs[i][0]=v.get(0);
     173           0 :   _rs[i][1]=v.get(1);
     174           0 :   _rs[i][2]=v.get(2);
     175           0 :   _rs[i][3]=v.get(3);
     176             : 
     177           0 : }
     178             : 
     179             : void EvtRaritaSchwinger::setSpinor(int i,const EvtDiracSpinor& sp){
     180             : 
     181           0 :   _rs[0][i]=sp.get_spinor(0);
     182           0 :   _rs[1][i]=sp.get_spinor(1);
     183           0 :   _rs[2][i]=sp.get_spinor(2);
     184           0 :   _rs[3][i]=sp.get_spinor(3);
     185             : 
     186           0 : }
     187             : 
     188             : 
     189             : EvtRaritaSchwinger dirProd(EvtVector4R v,EvtDiracSpinor u){
     190             : 
     191             :   int i,j;
     192             : 
     193           0 :   EvtRaritaSchwinger tmp;
     194             : 
     195           0 :   for(i=0;i<4;i++){
     196           0 :     for(j=0;j<4;j++){
     197           0 :       tmp._rs[i][j]=u.get_spinor(i)*v.get(j);
     198             :     }
     199             :   }
     200             : 
     201             :   return tmp;
     202             : 
     203           0 : }
     204             : 
     205             : 
     206             : EvtRaritaSchwinger dirProd(EvtVector4C v,EvtDiracSpinor u){
     207             : 
     208             :   int i,j;
     209             : 
     210           0 :   EvtRaritaSchwinger tmp;
     211             : 
     212           0 :   for(i=0;i<4;i++){
     213           0 :     for(j=0;j<4;j++){
     214           0 :       tmp._rs[i][j]=u.get_spinor(i)*v.get(j);
     215             :     }
     216             :   }
     217             : 
     218             :   return tmp;
     219             : 
     220           0 : }
     221             : 
     222             : 
     223             : EvtComplex operator*(const EvtRaritaSchwinger& u1,
     224             :                      const EvtRaritaSchwinger& u2){
     225             : 
     226             :   int i,j;
     227           0 :   EvtComplex tmp=0.0;
     228             : 
     229           0 :   for(i=0;i<4;i++){
     230           0 :     for(j=0;j<4;j++){
     231           0 :       tmp+=conj(u1._rs[i][j])*u2._rs[i][j];
     232             :     }
     233             :   }
     234             : 
     235             :   return tmp;
     236             : 
     237           0 : }
     238             : 
     239             : 
     240             : 
     241             : EvtRaritaSchwinger& EvtRaritaSchwinger::operator+=(const EvtRaritaSchwinger& u2){
     242             : 
     243             :   int i,j;
     244             : 
     245           0 :   for(i=0;i<4;i++){
     246           0 :     for(j=0;j<4;j++){
     247           0 :       _rs[i][j]+=u2._rs[i][j];
     248             :     }
     249             :   }
     250             :   
     251           0 :   return *this; 
     252             : }
     253             : 
     254             : EvtRaritaSchwinger operator+(const EvtRaritaSchwinger& u1,
     255             :                                 const EvtRaritaSchwinger& u2){
     256             :   
     257           0 :   return EvtRaritaSchwinger(u1)+=u2;
     258             : 
     259           0 : }
     260             : 
     261             : EvtRaritaSchwinger& EvtRaritaSchwinger::operator-=(const EvtRaritaSchwinger& u2){
     262             : 
     263             :   int i,j;
     264             : 
     265           0 :   for(i=0;i<4;i++){
     266           0 :     for(j=0;j<4;j++){
     267           0 :       _rs[i][j]+=u2._rs[i][j];
     268             :     }
     269             :   }
     270             :   
     271           0 :   return *this; 
     272             : }
     273             : 
     274             : EvtRaritaSchwinger operator-(const EvtRaritaSchwinger& u1,
     275             :                                 const EvtRaritaSchwinger& u2){
     276             :   
     277           0 :   return EvtRaritaSchwinger(u1)-=u2;
     278             : 
     279           0 : }
     280             : 
     281             : 

Generated by: LCOV version 1.11