*********************************************************** * subroutine prtinfo(prt1ene,prt2ene,ierr) * * returns: mean 'energy' values for the 2 counter * pairs of PRT1 (prt1ene) and the 3 pairs of * PRT2 located around the proton beam pipe * (prt2ene). * ierr: 0 OK * 1 no PRT info because PTTENE not filled * 2 no PRT info because of hardware/readout problem * * author: K.Desler * last change: 12/08/97 * *********************************************************** implicit none #include "partap.inc" #include "pttene.inc" #include "ptpqms.inc" #include "ptpmno.inc" #include "ptcoen.inc" #include "zdskey.inc" #include "zescommon.inc" integer i,j,k,n,ierr integer run integer pre, prt integer nprt integer jbyt integer eword(4) integer crow, cword integer pmtnr(20), n_coen(20) real prt1ene, prt2ene real prtdata(14,2) parameter (nprt=14) save pmtnr do i = 1, nprt prtdata(i,1) =0. prtdata(i,2) =0. enddo prt1ene = 0. prt2ene = 0. ierr = 0 C run = ZDSKEY_Nr1 run = ZES_RunNr do i = 1, 20 n_coen(i) = 0. enddo * * read PTPMNO from BOR record * if (zdskey_gaftyp(1:3).eq.'BOR') then do i = 1, coutab(ptpmno) call fettab(ptpmno, id, i ) if ((2*i-1).le.nprt) then pmtnr(2*i-1) = jbyt(PTPMNO_PMNrs,1,16) endif if ((2*i).le.nprt) then pmtnr(2*i) = jbyt(PTPMNO_PMNrs,17,32) endif enddo else * * read PRT data (energy, time) from physics events only * if (zdskey_gaftyp(1:3).eq.'EVT') then do i = 1, nprt n_coen(i) = pmtnr(i) enddo * * ---------- loop over channels --------------- * * nprt is the total number of channels; 2 FECs, that's 24 channels * channel ids (chnid): 1-10 (PRT) * 11-14 (C3) * 15-18 (FNC) * 19-24 (not used) if (coutab(PTTENE).eq.0.and.coutab(PTCOEN).eq.0) then ierr = 1 return endif do i = 1, nprt * ---------- get time and energy -------------- if (i .le. coutab(PTTENE)) then call fettab( PTTENE, id, i ) * * a channel found in PTTENE will be flagged with 0. The other * entries have to be looked up in PTCOEN. * call UnpackTEWord( PTTENE_ETWord, pre, prt ) if (PTTENE_PMNr.ge.1.and.PTTENE_PMNr.le.14) then * * DSP reports energy in units of 1/200 pC; values stored * in ntuple are real pC! prtdata(PTTENE_PMNr,1) = pre/200. prtdata(PTTENE_PMNr,2) = ( 128 - prt ) / 2.0 n_coen(PTTENE_PMNr) = 0 endif endif enddo C grab E for those PMTs which did not show up in PTTENE from PTCOEN do i = 1, nprt if (n_coen(i) .ne. 0) then crow = (n_coen(i)-1)/4 + 1 cword = n_coen(i)-(crow-1)*4 if (coutab(ptcoen) .lt. crow) then C print '(A,I2,A)', '*** ERROR: PMTNr ', n_coen(i), C + ' NOTin PTTENE and NOT in PTCOEN!!!' else call fettab(ptcoen, cword, crow) call UnpackEnLowBytes(ptcoen_pmenlowbytes,eword) prtdata(n_coen(i),1) = eword(cword)/200. endif endif enddo endif endif c apply cuts if (run.eq.1) then c Monte Carlo call prthitmc(prtdata,prt1ene,prt2ene,ierr) else if (run.ge.10748.and.run.le.14397) then c Data 1995 call prthit95(run,prtdata,prt1ene,prt2ene,ierr) else if (run.ge.20568.and.run.le.22954) then c Data 1996 call prthit96(run,prtdata,prt1ene,prt2ene,ierr) else if (run.ge.25189.and.run.le.27889) then c Data 1997 call prthit97(prtdata,prt1ene,prt2ene,ierr) endif return end