****************************************************************************** * * * File: L_Tool.Inc Rev. 21-DEC-1995 * * * * * * This is an Include file which is referenced by the Tool Code source * * files: L_Tl_Np2...L_Tl_Np5. It is not referenced by any other modules * * at this time. * * * * This file defines three symbols which describe the relative positions of * * the 4 blocks of Trigger Tower data in C40 memory. * * * * It is not my choice to use an include file for this purpose but because * * these symbols are used as immediate data in C40 instructions then they * * need to be absolute symbols and they can not be external symbols. Thus * * they need to be defined in each of the 4 instances of Tool Code source * * files (i.e. each of the 4 eta rings). * * * * At lease having these symbols in an include file lets us edit only one * * file to change their value in all 4 Tool Code files. * * * * This file also contains macros used in all Tool Code source files * * * * This file also contains some constants used in all Tool Code source files * ****************************************************************************** ****************************************************************************** * "Relative Data Positioning" constants * ****************************************************************************** Rack_1_Tot_Minus_EM_Value .set 40h ; Difference between Rack_2_Tot_Minus_EM_Value .set 40h ; Base Address of the ; EM data and the Tot ; data for each rack. Rack_2_Minus_Rack_1_Value .set 80h ; Difference between ; the ; Base Address of ; Rack #2 ; data and the Base ; Address of Rack #1 ; data. Neighbor_1 .set 00100h ; Specifies "key" to ; 1st neighbor scanned. ; MSByte = delta phi (+1) ; LSByte = delta eta (0) Neighbor_2 .set 00001h ; Specifies "key" to ; 2nd neighbor scanned. ; MSByte = delta phi (0) ; LSByte = delta eta (+1) Neighbor_3 .set 0ff00h ; Specifies "key" to ; 3rd neighbor scanned. ; MSByte = delta phi (-1) ; LSByte = delta eta (0) Neighbor_4 .set 000ffh ; Specifies "key" to ; 4th neighbor scanned. ; MSByte = delta phi (0) ; LSByte = delta eta (-1) Tool_Accept_Flag .set 000h ; Flag value indicating ; that seed is accepted. Tool_Reject_Flag .set 0ffh ; Flag value indicating ; that seed is rejected. ******** Macros ************************************************************** ****************************************************************************** * * * Macro: START_TOOL * * * * Arguments: none * * * * Purpose of macro * * ---------------- * * * * This macro performs the "Start of Tool" processing for any Eta Ring. * * * * It PUSHES the Status Register. * * * ****************************************************************************** START_TOOL .macro PUSH ST ; Save the Status Register. LDI Tool_Accept_Flag, R4 ; Set the "Accept/Reject this ; Seed" flag (in R4) to "Accept." .endm ****************************************************************************** * End of macro START_TOOL * ****************************************************************************** ****************************************************************************** * Macro: EM_TOOL * * * * Arguments: Term integer: Term Number of Term being * * evaluated * * * * Ring character string in the set * * {Nplus2, Nplus3, Nplus4, Nplus5} * * indicating Eta Ring * * Purpose of macro * * ---------------- * * * * This macro performs the EM-type Tool comparisons and makes both the * * Object List and Electron Count entries. * * * * Recall the EM-type comparisons: * * * * * * Seed EM Et (mem) >= Seed_Min_EM_Et_Cut * * (w/o pedestal) * * * * Seed | eta | (mem) <= Seed_Max_Eta_Cut * * * * 1x2 EM Et Sum (R3) >= 1x2_EM_Et_Threshold * * * * 1x2_EM_Et_Sum (R3) * * --------------------- >= EM_Fraction_Threshold * * 1x2_Total_Et_Sum (R6) * * * * 1x2_EM_Et_Sum (R3) * * --------------------- >= Isolation_Threshold * * 3x3_Total_Et_Sum (R5) * ****************************************************************************** EM_TOOL .macro Term, Ring LDI Tool_Accept_Flag, R4 ; Set the "Accept/Reject this ; Seed" flag (in R4) to "Accept." Compare_Seed_EM_Et_? LDI @Seed_EM_Et_Loc, R11 ; reject if Seed EM Et ; strictly less than CMPI @Seed_Min_EM_Et_Cut_:Term:_Loc, R11 ; Seed Min EM Et Cut ; for this Term LDIlt Tool_Reject_Flag, R4 Compare_Seed_Eta_? LB0 @Eta_:Ring:_Coord_Loc, R11 ; reject if Seed ; | eta | strictly ABSI R11 ; greater than ; Seed Max Eta Cut CMPI @Seed_Max_Eta_Cut_:Term:_Loc, R11 ; for this Term LDIgt Tool_Reject_Flag, R4 Compare_1x2_EM_Et_? CMPI @EM_Et_1x2_Thresh_:Term:_Loc, R3 ; reject if 1x2 EM Et ; strictly less than LDIlt Tool_Reject_Flag, R4 ; 1x2 EM Et Threshold ; for this Term Compare_EM_Fraction_? FLOAT R3, R11 ; put |1x2_EM_Et_Sum| in R9 ABSF R11, R9 ; (numerator) FLOAT R6, R11 ; put |1x2_Total_Et_Sum| in R10 ABSF R11, R10 ; (denominator) MPYF @EM_Frac_Ratio_Thresh_:Term:_Loc, R10 ; multiply the denominator by ; the Ratio Threshold CMPF R10, R9 ; Compare the floating-poing ; Numerator to the Ratio ; Threshold * Denominator LDIlt Tool_Reject_Flag, R4 ; If the Numerator is strictly ; less than the Ratio Threshold ; times the Denominator, ; then set the Tool Accept/ ; Reject Flag to "Reject." Compare_Isolation_? * FLOAT R3, R11 ; R9 already contains the * ABSF R11, R9 ; desired numerator FLOAT R5, R11 ; put |3x3_Total_Et_Sum| in R10 ABSF R11, R10 ; (denominator) MPYF @Isolation_Ratio_Thresh_:Term:_Loc, R10 ; multiply the denominator by ; the Ratio Threshold CMPF R10, R9 ; Compare the floating-poing ; Numerator to the Ratio ; Threshold * Denominator LDIlt Tool_Reject_Flag, R4 ; If the Numerator is strictly ; less than the Ratio Threshold ; times the Denominator, ; then set the Tool Accept/ ; Reject Flag to "Reject." EM_Accept_Reject_? ; at this point, if R4 still ; says "Accept" then we take it LDI R3, R9 ; EM_Et_1x2_Sum (R3) will ; be in Object List CMPI Tool_Accept_Flag, R4 ; Does the Accept/Reject ; Flag say "Accept?" BeqAF Write_EM_Object_Entry_? ; If so, make a delayed ; branch to the Write Obj. ; routine. The next 3 ; instructions are also ; executed but ANNULED ; if the branch is NOT taken ; (i.e. if this Object ; has been REJECTED) LDI @Term_:Term:_Object_Count_Loc, R11 ; Get the Term Number Object ; Count into a working ; register (R11) ADDI 1, R11 ; Increment it by 1 STI R11, @Term_:Term:_Object_Count_Loc ; Return incremented Term ; Object Count to memory ; we only reach this ; point if the Accept/ ; Reject flag says ; "Reject." The ; 3 instructions ; above are ANNULED. LBU1 @Wake_Up_Word_Loc, R11 ; Get the Flags Byte ; from the Wake Up Word. CMPI MFP_Wakeup_Word_Flag, R11 ; Compare the Flags Byte ; to the MFP Flag ; we only reach this point if ; the Accept/Reject flag says ; "Reject" Bne EM_Tool_Exit_Point_? ; If this is NOT an MFP event ; (and the Seed has been ; Rejected), then branch to ; the end of this macro ; (skipping the Write Object ; routine). ; note that we DON'T ; increment the Electron ; Count for failed candidates ; even when we record them ; during MFP events Write_EM_Object_Entry_? WRITE_OBJECT :Term:, :Ring: ; insert the WRITE_OBJECT ; macro EM_Tool_Exit_Point_? .endm ****************************************************************************** * End of macro EM_TOOL * ****************************************************************************** ****************************************************************************** * Macro: JET_TOOL * * * * Arguments: Term integer: Term Number of Term being * * evaluated * * * * Ring character string in the set * * {Nplus2, Nplus3, Nplus4, Nplus5} * * indicating Eta Ring * * Purpose of macro * * ---------------- * * * * This macro performs the jet-type Tool comparisons and makes both the * * Object List and Jet Phi Mask entries. * * * * Recall the EM-type comparisons: * * * * * * Seed Tot Et (mem) >= Seed_Min_Tot_Et_Cut * * (w/o pedestal) * * * * Seed | eta | (mem) <= Seed_Max_Eta_Cut * * * * 5x5 Tot Et Sum (R7) >= 5x5_Tot_Et_Threshold * * * ****************************************************************************** JET_TOOL .macro Term, Ring LDI Tool_Accept_Flag, R4 ; Set the "Accept/Reject this ; Seed" flag (in R4) to "Accept." Compare_Seed_Tot_Et_? LDI @Seed_Tot_Et_Loc, R11 ; reject if Seed Tot Et ; strictly less than CMPI @Seed_Min_Tot_Et_Cut_:Term:_Loc, R11 ; Seed Min Tot Et Cut ; for this Term LDIlt Tool_Reject_Flag, R4 Compare_Seed_Eta_? LB0 @Eta_:Ring:_Coord_Loc, R11 ; reject if Seed ; | eta | strictly ABSI R11 ; greater than ; Seed Max Eta Cut CMPI @Seed_Max_Eta_Cut_:Term:_Loc, R11 ; for this Term LDIgt Tool_Reject_Flag, R4 Compare_5x5_Tot_Et_? CMPI @Tot_Et_5x5_Thresh_:Term:_Loc, R7 ; reject if 5x5 Tot Et ; strictly less than LDIlt Tool_Reject_Flag, R4 ; 5x5 Tot Et Threshold ; for this Term Jet_Accept_Reject_? ; at this point, if R4 still ; says "Accept" then we take it LDI R7, R9 ; Tot_Et_5x5_Sum (R7) will ; be in Object List LDI 1, R10 ; put phi=1 mask ; into R10 LDI 31, R11 ; load phi-1 into R11 SUBI RC, R11 ; (RC=31 -> phi = 1, R11 = 0 ; RC= 0 -> phi = 32, R11 = 31) CMPI Tool_Accept_Flag, R4 ; Does the Accept/Reject ; Flag say "Accept?" BeqAF Write_Jet_Object_Entry_? ; If so, make a delayed ; branch to the Write Obj. ; routine. The next 3 ; instructions are also ; executed but ANNULED ; if the branch is NOT taken ; (i.e. if this Object ; has been REJECTED) LSH R11, R10 ; shift phi=1 mask ; left by phi-1 to ; get this jet's phi ; mask OR @Term_:Term:_Jet_Phi_Mask_Loc, R10 ; or this jet's phi ; mask into the running STI R10, @Term_:Term:_Jet_Phi_Mask_Loc ; phi mask for this Term ; we only reach this ; point if the Accept/ ; Reject flag says ; "Reject." The ; 3 instructions ; above are ANNULED. LBU1 @Wake_Up_Word_Loc, R11 ; Get the Flags Byte ; from the Wake Up Word. CMPI MFP_Wakeup_Word_Flag, R11 ; Compare the Flags Byte ; to the MFP Flag ; we only reach this point if ; the Accept/Reject flag says ; "Reject" Bne Jet_Tool_Exit_Point_? ; If this is NOT an MFP event ; (and the Seed has been ; Rejected), then branch to ; the end of this macro ; (skipping the Write Object ; routine). ; note that we DON'T update ; the Jet Phi Mask for ; failed jets during MFP ; running. Write_Jet_Object_Entry_? WRITE_OBJECT :Term:, :Ring: ; insert the WRITE_OBJECT ; macro Jet_Tool_Exit_Point_? .endm ****************************************************************************** * End of macro JET_TOOL * ****************************************************************************** ****************************************************************************** * Macro: WRITE_OBJECT * * * * Arguments: Term integer: Term Number of Term being * * evaluated * * * * Ring character string in the set * * {Nplus2, Nplus3, Nplus4, Nplus5} * * indicating Eta Ring * * Purpose of macro * * ---------------- * * * * This macro writes the Object List entry for either EM or Jet-type * * Objects. * * * * IF * * writing the data from this Object would overrun the Identified * * Object List * * THEN * * do not make an entry in the Object List but skip to the end of * * this macro * ELSE * * write the data from this Object to the Identified Object List * * increment the Identified Object Counter * * * * Recall that the 3 Longwords which describe the Identified Object are * * exactly the Entry in the L1.5 Cal Trig Data Block Local DSP Section * * corresponding to this Object, as well as the data transferred to the * * Global DSP * * * * Recall the format of these Entries: * * D D D D D D D D * * 3 2 2 1 1 0 0 0 * * 1 4 3 6 5 8 7 0 * * |------------|------------|--------------|----------| * * 1st Longword: | Phi coord. | Eta coord. | Local Tool # | Term # | * * | of center | of center | | | * * | Tower | Tower | | | * * |( 1..32) | (-20..-1, | | | * * | | +1..+20) | | | * * |---------------------------------------------------| * * 2nd Longword: | EM_type: | Real or Mark | Object | * * | 1x2 EM Et Sum | and Pass Data| Type | * * | | (00: real | Code | * * | jet_type: | (FF: mark and| | * * | 5x5 Tot Et Sum | force | | * * | units = 1/4 Gev per | pass) | (in | * * | count | | (Term_ | * * | (in R9) | (in R4) | Type) | * |---------------------------------------------------| * * 3rd Longword: | Phi coord. | Eta coord. | Total Et 1x2 Sum | * * | of neighbr | of neighbr | | * * | Tower used | Tower used | units = 1/4 GeV per | * * | in 1x2 EM | in 1x2 EM | count | * * | Et Sum | Et Sum | | * * | ( 1..32) | (-20..-1, | | * * | | (+1..+20) | (in R6) | * * |---------------------------------------------------| * * * * * * Finally I keep a running pointer (in AR3) to the next Longword to write * * in the List of Identified Objects. I use "pre-displacement increment" * * because the first time we enter the routine the pointer points at the * * location of the Local DSP Header longword. * ****************************************************************************** WRITE_OBJECT .macro Term, Ring LDI :Term:, R11 ; Load the current Term ; Number into R11 ADDI 1,R2 ; Increment the Valid ; Object Counter CMPI @LDSP_Entries_per_List_Loc,R2 ; If this Object would ; overrun the Local BhiAT Write_Object_Exit_Point_? ; List of Identified ; Objects, then make a ; delayed branch to the ; Exit Point of this macro. ; The next 3 instructions ; are all executed, but ; ANNULED if the branch ; is taken (i.e. if ; the List has ; overflowed SUBI3 RC,BK,R10 ; LOAD phi into R10 ; This instruction is ; a bit on the weird ; side but using AR1 ; one runs into problems ; at phi = 32 because of ; circular addressing. ; Recall BK = 32 and RC ; counts down from 31 to 0 ; as phi goes up from 1 to ; 32. LSH 24,R10 ; Shift phi into the MSB ; of R10. MB2 @Eta_:Ring:_Coord_Loc,R10 ; MERGE the eta coord of ; the center tower into ; the next to MSB of ; R10 ; we only reach this ; point if the list ; is NOT being overrun. MB1 @Tool_Number_Loc,R10 ; MERGE the Tool Number ; of this Tool into the ; next to LSB of R9 MB0 R11, R10 ; MERGE the Term Number ; of the Term being ; evaluated into the LSB ; of R10 STI R10, *++AR3(1) ; Write this word (LW #1 ; of the 3 Longwords ; in each entry in the ; List of Identified ; Objects). BEFORE ; storing the word ; increment AR3 by 1. LSH3 16,R9,R10 ; LOAD the 1x2 EM Sum ; (e- objects) or the ; 5x5 Tot Sum (jet ; objects) ; into the MSW of R10 MB1 R4, R10 ; MERGE the Accept/Reject ; Flag into the next to ; LSB of R9 (this is ; used as the Real vs. ; MFP flag). MB0 @Term_Type_:Term:_Loc, R10 ; MERGE the Object Type ; (1 = e-, 2 = jet, same ; as Term_Type) ; into the LSB of R10 STI R10, *++AR3(1) ; Write this word (LW #2 ; of the 3 Longwords ; in each entry in the ; List of Identified ; Objects). BEFORE ; storing the word ; increment AR3 by 1. LDI R6, R10 ; LOAD the 1x2 Total ; Et Sum into R10 MH1 @Largest_Neighbor_ID_Loc, R10 ; MERGE the key to the ; ID of the neighbor ; TT used to calculate ; the 1x2 EM Et Sum ; into the 2 MSBytes ; of R10. STI R10, *++AR3(1) ; Write this word (LW #3 ; of the 3 Longwords ; in each entry in the ; List of Identified ; Objects). BEFORE ; storing the word ; increment AR3 by 1. Write_Object_Exit_Point_? .endm ****************************************************************************** * End of macro WRITE_OBJECT * ****************************************************************************** ****************************************************************************** * * * Macro: END_TOOL * * * * Arguments: Ring character string in the set * * {Nplus2, NPlus3, Nplus4, Nplus5} * * indicating Eta Ring * * * * Purpose of macro * * ---------------- * * * * This macro performs the "End of Tool" processing for any Eta Ring. * * * * It makes a delayed branch back to the appropriate point in the Scan * * Routine, and it POPs the Status Register. * * ****************************************************************************** END_TOOL .macro Ring BRD Return_from_Tool_Ring_:Ring: ; Make a delayed branch to ; the appropriate return ; location in the Scan ; Routine. The next 3 ; instructions are all ; executed. NOP ; execute this instruction NOP ; execute this instruction POP ST ; Restore the Status Reg. .endm ****************************************************************************** * End of macro END_TOOL * ******************************************************************************