      REAL FUNCTION disp_pid(idnum)
*
* return true if particle truth matches the input id
*   details: absolute value is assumed
*            special values: 3000 (any strange baryon)
*            special values: 300 (any strange meson)
*            special values: 30000 (300 or 3000)
*            special values: 100 (any non-strange neutral meson)
*            
*
*********************************************************
*                                                       *
* This file was generated by HUWFUN.                    *
*                                                       *
*********************************************************
*
*     Ntuple Id:      1    
*     Ntuple Title:   Event nTuple
*     Creation:       15/08/2003 09.56.08
*
*********************************************************
*
      LOGICAL         CHAIN
      CHARACTER*128   CFILE
      INTEGER         IDNEVT,NCHEVT,ICHEVT
      REAL            OBS(13)
*
      COMMON /PAWIDN/ IDNEVT,OBS
      COMMON /PAWCHN/ CHAIN, NCHEVT, ICHEVT
      COMMON /PAWCHC/ CFILE
*
*--   Ntuple Variable Declarations
*
      REAL polar,qsq,w,x,y,p_neutrino(4),p_targ(5),vertex(4),start(4)
     + ,depth,flux,LEWGT,MEWGT,HEWGT,p_ltot(5),p_lepton(5,10),p_htot(5)
     + ,p_hadron(5,50),VXTRUE(128),VYTRUE(128),VZTRUE(128),VTTRUE(128)
     + ,PXTRUE(128),PYTRUE(128),PZTRUE(128),PETRUE(128),QTRUEID(128)
     + ,ETRUEEX(128),NXE(100),NYE(100),NZE(100),NPEX(100),NPEY(100)
     + ,NPEZ(100),NPEE(100),NMIX(50),NMIY(50),NMIZ(50),NMIPX(50)
     + ,NMIPY(50),NMIPZ(50),NMIE(50),NMISTX(50),NMISTY(50),NMISTZ(50)
     + ,NXSTSIDE(50),NYSTSIDE(50),NZSTSIDE(50),NPXSTSIDE(50)
     + ,NPYSTSIDE(50),NPZSTSIDE(50),NPESTSIDE(50),NXLVSIDE(50)
     + ,NYLVSIDE(50),NZLVSIDE(50),NPXLVSIDE(50),NPYLVSIDE(50)
     + ,NPZLVSIDE(50),NPELVSIDE(50),XHIT(2500),YHIT(2500),ZHIT(2500)
     + ,ELOSS(2500)
      INTEGER RUN,EVENT,EVENTCODE,ICC,neutrino,target,iniQ,finQ,lepton0
     + ,channel,n_leptons,lepton(10),n_hadrons,hadron(50),NTRUTH
     + ,NPTRUE(128),NTMOTH(128),NORIG(128),NESCAPE,NPESCAPE(100)
     + ,NTESCAPE(100),NMINOS,NPMINOS(50),NTMINOS(50),NSTMINOS
     + ,NPSTMINOS(50),NTSTMINOS(50),NPLST(50),NSTSIDE,NPSTSIDE(50)
     + ,NTSTSIDE(50),NLVSIDE,NPLVSIDE(50),NTLVSIDE(50),NHIT,MODHIT(2500)
     + ,SCINTHIT(2500),ORIENT(2500),NTHIT(2500)
      LOGICAL cc,bound
*
      COMMON /PAWCR4/ RUN,EVENT,EVENTCODE,ICC,cc,bound,neutrino,target
     + ,iniQ,finQ,lepton0,polar,channel,qsq,w,x,y,p_neutrino,p_targ
     + ,vertex,start,depth,flux,LEWGT,MEWGT,HEWGT,n_leptons,p_ltot
     + ,lepton,p_lepton,n_hadrons,p_htot,hadron,p_hadron,NTRUTH,NPTRUE
     + ,NTMOTH,NORIG,VXTRUE,VYTRUE,VZTRUE,VTTRUE,PXTRUE,PYTRUE,PZTRUE
     + ,PETRUE,QTRUEID,ETRUEEX,NESCAPE,NPESCAPE,NTESCAPE,NXE,NYE,NZE
     + ,NPEX,NPEY,NPEZ,NPEE,NMINOS,NPMINOS,NTMINOS,NMIX,NMIY,NMIZ,NMIPX
     + ,NMIPY,NMIPZ,NMIE,NSTMINOS,NPSTMINOS,NTSTMINOS,NPLST,NMISTX
     + ,NMISTY,NMISTZ,NSTSIDE,NPSTSIDE,NTSTSIDE,NXSTSIDE,NYSTSIDE
     + ,NZSTSIDE,NPXSTSIDE,NPYSTSIDE,NPZSTSIDE,NPESTSIDE,NLVSIDE
     + ,NPLVSIDE,NTLVSIDE,NXLVSIDE,NYLVSIDE,NZLVSIDE,NPXLVSIDE,NPYLVSIDE
     + ,NPZLVSIDE,NPELVSIDE,NHIT,MODHIT,SCINTHIT,ORIENT,NTHIT,XHIT,YHIT
     + ,ZHIT,ELOSS
*
      integer idnum,i
      integer truth,mother,pid
      logical ok
      data init/1/
      save init

      if (init.eq.1) then
        call hbook2(999000,'yhit vs zhit',250,-125.,125.,
     +                                    200,-100.,100.,1000.)
        call hbook2(999001,'xhit vs zhit',250,-125.,125.,
     +                                    200,-100.,100.,1000.)
        init=0
      endif
 

C----------------------------------------------------
C want to trace back particle to the ultimate mother
C----------------------------------------------------

      do i=1,nhit
        truth=nthit(i)
        mother=ntmoth(truth)
 100    if (mother.eq.0) goto 101
           truth=mother
           mother=ntmoth(truth)
           goto 100
 101    pid=abs(nptrue(truth))
        if (idnum.eq.3000) then
          ok=pid.ge.3000.and.pid.lt.4000
        elseif (idnum.eq.300) then
          ok=pid.ge.300.and.pid.lt.400
        elseif (idnum.eq.30000) then
          ok=(pid.ge.300.and.pid.lt.400).or.
     +       (pid.ge.3000.and.pid.lt.4000)  
        elseif (idnum.eq.100) then
          ok=pid.ge.100.and.pid.lt.200
        else
          ok=pid.eq.idnum
        endif
*        print *,pid,idnum,ok
        if (ok) then
*           print *,'plotting',xhit(i),yhit(i),zhit(i),eloss(i)
           call hfill(999000,zhit(i),yhit(i),eloss(i))
           call hfill(999001,zhit(i),xhit(i),eloss(i))
        endif
      enddo
*
      disp_pid = 1.
*
      END









