*
* $Id: gpgig.F,v 1.1 2005/12/20 12:21:05 cafagna Exp $
*
* $Log: gpgig.F,v $
* Revision 1.1  2005/12/20 12:21:05  cafagna
* gpnd directory added along with ND files
*
* Revision 3.1.1.1  2002/07/11 16:02:00  cafagna
* First GPAMELA release on CVS
*
*
*CMZ :  3.00/00 11/05/2001  13.44.09  by  Marialuigia Ambriola
*CMZ :  2.01/00 05/04/2000  14.35.18  by  Marialuigia Ambriola
*CMZ :  2.00/00 03/03/2000  15.39.05  by  Francesco Cafagna
*CMZ :  1.01/00 30/04/96  18.28.33  by  Francesco Cafagna
*CMZ :  1.00/03 29/04/96  16.56.08  by  Francesco Cafagna
*-- Author :    Francesco Cafagna   29/04/96
      SUBROUTINE GPGIG
************************************************************************
*                                                                      *
* User action in GUSTEP                                                *
*                                                                      *
* Variables definition:                                                *
* IN:                                                                  *
*  IFLAG = 1, just entered GUSTEP                                      *
*  IFLAG = 2, leaving GUSTEP                                           *
*                                                                      *
* Called by: GUSTEP                                                    *
* Author: Francesco Cafagna, 29/04/96 16.56.08                         *
*                                                                      *
************************************************************************
#include "gctmed.inc"
#include "gcking.inc"
#include "gctrak.inc"
#include "gckine.inc"
#include "gpgig.inc"
#include "gpgneut.inc"
*
      LOGICAL W,GPLOOK
      INTEGER IFLAG
      INTEGER IFL,IN,MECNAM(MAXMEC)
c$$$      IN = INWVOL
c$$$      IF(IN.NE.0) RETURN

      IF ((GETOT.GT.0.009097).AND.(GETOT.LT.0.028608)
     +     .AND.IPART.EQ.1) THEN
*
* Call the Gigantic resonance routine. 
* 
         CALL GPGRES(STEP,GETOT,VECT(4)*VECT(7),
     +        VECT(5)*VECT(7),VECT(6)*VECT(7))
*
* First of all let's stop the gamma tracking if neutron(s) is(are) generated
*
         IF(Number_N.gt.0) THEN
            ISTOP = 1
            DO I=1,Number_n
*     
*     Increment the produced secondaries number
*     
               NGKINE = NGKINE + 1
*     
*     Store the mechnism number
*     
               KASE = IGMEC
*     
*     Store the secondaries position in the GCKING common
*     
               GPOS(1,NGKINE) = VECT(1)
               GPOS(2,NGKINE) = VECT(2)
               GPOS(2,NGKINE) = VECT(3)
*     
*     Now the other parameters: px, py, pz, E, Particle ID, TOF
*     
               GKIN(1,NGKINE) = SQRT(NEUT_EN(I)**2-AMGIG**2)*
     +              SIN(TETA_N(I))*COS(FI_N(I))
               GKIN(2,NGKINE) = SQRT(NEUT_EN(I)**2-AMGIG**2)*
     +              SIN(TETA_N(I))*SIN(FI_N(I))
               GKIN(3,NGKINE) = SQRT(NEUT_EN(I)**2-AMGIG**2)*
     +              COS(TETA_N(I))
               GKIN(4,NGKINE) = NEUT_EN(I)
               GKIN(5,NGKINE) = IPGIG
               TOFD(NGKINE) = TOFG
            ENDDO
         ENDIF
      ENDIF
 999  CONTINUE
      
      RETURN
      END
      
