      SUBROUTINE ZZ(IWW,IZZ)
* This routine tells you if the 4 final state event could
* have been produced by WW pair ( IWW=.TRUE.) or a ZZ pair (IZZ=.TRUE.)
* To run this routine , run the program s4f.F just before
* This routine was written by S. Jezequel
*
#include "qcde.h"
#include "qdecl.h"
      DIMENSION IPART(11),IPW(3),ITYPE(4)
      LOGICAL IWW,IZZ
      COMMON/WW4F/IGAMI(10),IWW4F(4),IGAMF(5)
      DATA IPART/2,5,33,58,60,62,101,102,103,104,105/ 
#include "qmacro.h"  
*
      DO I=1,4
       ITYPE(I)=KTPCOD(IWW4F(I))
      ENDDO
*
      call info(ITYPE(1),ipo,nw,ipw)
      ICO=0
      DO IU=2,4
       DO IY=1,NW
        IF(ITYPE(IU).EQ.IPW(IY)) THEN
         IR=IU
         ICO=ICO+1
        ENDIF
       ENDDO
      ENDDO
*
      IF(ICO.GE.2) print *,'probleme',kevt
      IF(ICO.EQ.1) THEN
       IWW=.TRUE.
      ELSEIF(ICO.EQ.0) THEN
       IWW=.FALSE.
      ELSE
       print *,'problem',itype,ico
      ENDIF
*
      ICZ=0
      DO IU=2,4
        IF(ITYPE(IU).EQ.IPO) THEN
         IR=IU
         ICZ=ICZ+1
        ENDIF
      ENDDO
      IF(ICZ.EQ.1.OR.ICZ.EQ.2) THEN
       CALL TRI(IR,IP1,IP2)
       call info(itype(ip1),ipo1,nw,ipw)
       IF(ITYPE(IP2).NE.IPO1) THEN
        IZZ=.FALSE.
       ELSE
        IZZ=.TRUE.
       ENDIF
      ELSEIF(ICZ.EQ.0) THEN
        IZZ=.FALSE.
      ELSE
        print *,'problem zz',itype,icz
      ENDIF
*       
      END

      SUBROUTINE INFO(IP,IPO,NW,IPW)
      DIMENSION ILIST(12),IOPP(12),ISOLW(12),IPW(3),ISOWQP(6),ISOWQM(6)
      DATA ILIST/2,3,5,6,33,34,58,59,60,61,62,63/
      DATA IOPP/3,2,6,5,34,33,59,58,61,60,63,62/
      DATA ISOLW/58,59,60,61,62,63,2,3,5,6,33,34/
      DATA ISOWQP/101,104,106,107,110,112/
      DATA ISOWQM/102,103,105,108,109,111/
*
      NW=0
      IF(IP.LT.100) THEN
       NW=1
       DO I=1,12
        IF(ILIST(I).EQ.IP) IR=I
       ENDDO
       IPO=IOPP(IR)
       IPW(1)=ISOLW(IR)
      ELSE
       NW=3
       IF(IP.LE.106) THEN
         IPO=IP+6
         IF(IP.EQ.ISOWQP(1).OR.IP.EQ.ISOWQP(2).OR.IP.EQ.ISOWQP(3)) THEN
          IPW(1)=ISOWQM(4)
          IPW(2)=ISOWQM(5)
          IPW(3)=ISOWQM(6)
         ELSE
          IPW(1)=ISOWQP(4)
          IPW(2)=ISOWQP(5)
          IPW(3)=ISOWQP(6)
         ENDIF
       ELSE 
         IPO=IP-6
         IF(IP.EQ.ISOWQP(4).OR.IP.EQ.ISOWQP(5).OR.IP.EQ.ISOWQP(6)) THEN
          IPW(1)=ISOWQM(1)
          IPW(2)=ISOWQM(2)
          IPW(3)=ISOWQM(3)
         ELSE
          IPW(1)=ISOWQP(1)
          IPW(2)=ISOWQP(2)
          IPW(3)=ISOWQP(3)
         ENDIF
       ENDIF
      ENDIF
*
      END

      SUBROUTINE TRI(J,IR1,IR2)
*
         IF(J.EQ.2) THEN
          IR1=3
          IR2=4
         ELSEIF(J.EQ.3) THEN
          IR1=2
          IR2=4        
         ELSEIF(J.EQ.4) THEN
          IR1=2
          IR2=3
         ENDIF 
      END

