***************************************************************************** Subroutine gsltpasstype(sltanypas & ,fltbitpas,fltpasbits & ,slterr,err) C C C distinguish different types of GSLT passthrough events C ====================================================== C C C sltanypas =.true. for random GSLT passthrough events C --> good for trigger studies C fltbitpas =.true. for special FLT bits passed through at the C GSLT at a maximized rate C --> good for calibration/detector studies C slterr =.true. for events marked as GSLT passthrough C because some error occurred at some SLT level C (only from 1998 onwards) C fltpasbits(2) for events with fltbitpas=.true. C 64 bit mask to signify which flt bit was passed through C e.g. bit 16 gives random FLT bit, which is useful C for studies of GFLT input distributions C C err = 0 no problem C 1 no ZDSKEY table, but this is probably still OK C 2 no TLTEVT table C 3 no O2DEC table C 4 no O2SDEC information for passthrough subtrigger C C C author: Nichol Brummer C Implicit None #include "partap.inc" #include "zdskey.inc" #include "o2dec.inc" #include "o2sdec.inc" #include "tltevt.inc" logical btest logical sltpas,sltanypas,fltbitpas,slterr logical tltsltpas integer fltpasbits(2) Integer Row,passtrig,err C sltpas = .false. tltsltpas = .false. sltanypas = .false. fltbitpas = .false. slterr = .false. fltpasbits(1) = 0 fltpasbits(2) = 0 err = 0 C make sure that the TLT noticed this event as GSLT passthrough if (coutab(tltevt).eq.0) then err = 1 goto 999 else call fettab(TLTEVT,ID,1) tltsltpas = btest(TLTEVT_subtrg(1),20) if (.not.tltsltpas) goto 999 endif if (Coutab(O2DEC).eq.0) then err = 2 goto 999 endif call FETTAB(O2DEC,ID,1) C... the subtrigger number of the passthrough filter changed with time C so look at the run number to see which year we are in if (coutab(ZDSKEY).ne.0) then Call FetTab(ZDSKEY,ID,1) if (ZDSKEY_Nr1.ge.30000) then passtrig = 3 sltpas = btest(O2DEC_TriggerType,25) if (sltpas) then FltBitpas = btest(O2DEC_TriggerType,10) sltanypas = btest(O2DEC_TriggerType,11) slterr = btest(O2DEC_TriggerType,12) endif ccc elseif (ZDSKEY_Nr1.ge.26828) then elseif (ZDSKEY_Nr1.ge.26802) then c the passthrough filter moved from subtrigger 4 to 3 c near to this run number c shortly afterwards, TLT started to check for bit 25 c in stead of bit 4 in O2SDEC_triggertype passtrig = 3 sltpas = btest(O2DEC_TriggerType,25) c the following is to be sure in the transition, c when the passthroughs moved from 4 to 3 if (sltpas) then if (btest(O2DEC_triggertype,3)) then passtrig=3 elseif (btest(O2DEC_triggertype,4)) then passtrig=4 endif endif elseif (ZDSKEY_Nr1.ge.20127) then c configuration in 1996, 1997 till (shortly after) run 26801(?) c the tlt still only checked for bit 4=passtrig passtrig = 4 sltpas = btest(O2DEC_TriggerType,25) .or. & btest(O2DEC_TriggerType,passtrig) else c configuration of up to 1995 c probably bit 25 is also set for these years.. c but the tlt only ever checked the passtrig bit passtrig = 1 sltpas = btest(O2DEC_TriggerType,passtrig) endif else c try to be backwards compatible without knowing the run number c hope that bit 25 was already set in the beginnings of time.. err = 3 passtrig = 3 if (btest(O2DEC_TriggerType,25)) then sltpas = .true. if (btest(O2DEC_TriggerType,3)) then passtrig=3 elseif (btest(O2DEC_TriggerType,4)) then passtrig=4 elseif (btest(O2DEC_TriggerType,1)) then passtrig=1 endif else sltpas = .false. endif endif if (.not.sltpas) goto 999 C find the right row in O2SDEC for the passthrough subtrigger C first try it the quick way.. C (rows 1-8 should normally contain subtriggers 0-7) C search through all rows when necessary if (Coutab(O2SDEC).gt.passtrig) then call fettab(O2SDEC,ID,passtrig+1) if( O2SDEC_SubTrigNo.eq.passtrig ) goto 800 endif Do Row=1,Coutab(O2SDEC) call FETTAB(O2SDEC,ID,Row) if( O2SDEC_SubTrigNo.EQ.passtrig ) goto 800 enddo C the row for subtrigger passtrig could not be found.. error err = 4 goto 999 800 continue C C copy the passthrough subtrigger bit information C first two words : passthrough of selected flt bits, with rate maximum C third word, bit 0: set for the unbiased gslt passthrough sample C fltpasbits(1) = O2SDEC_SubTrigType(1) fltpasbits(2) = O2SDEC_SubTrigType(2) fltbitpas = fltpasbits(1).ne.0 .or. fltpasbits(2).ne.0 sltanypas = btest(O2SDEC_SubTrigType(3),0) 999 continue End