00001 /* Header Number: x.y 00002 * Package Name: All 00003 * Created: z. milosevich 06Dec99 00004 * Description: Global trigger structure header file. 00005 * Contains definitions of trigger data structures 00006 * History: 00007 * 00008 * 06Dec99 zm Created so offline can use and after modification for mod 8 DMA reads 00009 * 08Dec99 zm Changed Event Descriptor Structure to previous length 00010 * 03Feb00 zm Changed "ushort ZDCDSM[8]" to "BYTE ZDC[16]" in L0_DSM_Data structure 00011 * 22Jul00 egj Added L0RegBytes and L0RegHeader to trgDataHeaders and TrgSumData. 00012 * Also added Mult_Reg, ZDC_Reg and Spare_Reg to TrgSumData, making a 00013 * total of 16 extra bytes. I compensated for this by removing 16 bytes, 00014 * (4 uints) from L2Result, wich is currently unused. 00015 * 08Dec00 JMN Changed char hdr[2] in TrgSummary to unsigned short, which is packed 00016 * 25Feb01 JMN Redesigned and expanded abbreviations to full. 00017 * 12Mar01 JMN Added additional changes from ZM 00018 * 30May01 JMN NBNBNBNB Changed FORMAT version from 0x12 to 0x13 00019 * 02Jun01 zm defined bit 6 in addBits info FIFO3 for L2.5 abort 00020 * 27Jun01 JMN Added definition of number of bytes used in trigger summary headers 00021 * 28Jun01 JMN Added definition of ADD_BITs 00022 * 10Apr02 zm basic strawman for new structures with new TCU and added detectors 00023 * 22May02 zm removed references to current non-existent trigger event header 00024 * 24May02 zm incorporated eleanor's comments 00025 * 24May02 zm the L0_DSM_Data instance changed from DSM to DSMdata to be able to compile on linux 00026 * 19Jun02 zm removed or commented out references to TrgEvtHeader 00027 * 05Aug02 JMN changes in event descriptor - moved filler word to end 00028 * 15Aug02 HjC correct bytes for FPD 00029 * 21Nov02 zm corrections based on eleanor's email: L0 layout for bunch xing, 00030 * special and fpd elements; fpd broken down for east/west nort/south 00031 * vs top/bottom and layer 1 or 0; 00032 * also finished XXX_DATA_OFFSET and RAW_XXX_LEN for passing data from 00033 * dsm 00034 * 30Aug03 JMN Added RAW_MAX_LEN being maximum length possible in chain block transfer 00035 * 14Sep03 JMN Added new dsmMemcpy2Buf 00036 * 02Nov03 JMN Modified dsmMemcpy2Buf to ensure dsmData is 8-byte aligned. 00037 * 04Nov03 EGJ Modified RawTrgDet to add in ZDCSMD[32] 00038 * 28Oct04 JMN Modified RawTrgDet to increased BBC storage from 80 to 96 00039 * Format version changed from 0x21 to 0x22 00040 * 14Nov05 JMN Added source NodeID as first word of data buffer to L2 00041 * 16Mar06 CWP Added offsets into L2Result 00042 * 20Dec06 JMN Added changes: L2Result increased to 64 ints, 00043 * MWC name changed to MIX with 7 DSMs from MTD, VPD and TOF (112 bytes) 00044 * FPE changed to 9 DSMs (144 bytes) 00045 * FPW changed to 16 DSMs (256) bytes 00046 * new array QQT installed after BBC 00047 * Block of commented OFFSETs and LEN removed. 00048 * Commented out xx_SUM_LEN where xx is L0, L1, L2; and L0_REG_LEN. Unused? 00049 * Since these are significant changes, Format changed to 3.0 00050 * 05Jan07 JMN Changed CPA[32] to MTD[8],VPD[8],CPA[16] 00051 * 29Mar07 JMN Updated L2_Results offsets for CP 00052 * 03Apr07 JMN Order MTD,VPD,CPA is changed to CPA,MTD,VPD to reflect order of DSMs in the L1 crate 00053 * 07Oct07 JMN Added new TrgTowerTrnfer structure to define combined trigger and EMC data that will 00054 * be transmitted from L2 to DAQ in from November 2007. 00055 * 24Oct07 JMN Version number changed from 3.1 to 3.2 following re-arrangement of DSMs in MIX and 00056 * BBC crates. Two extra DSMs for PP2PP are in the MIX crate ahead of TOF, so total 00057 * length increases by 32 bytes. 00058 * 25Oct07 JMN A new set of L2_RESULTS offsets have been defined by Jan Balewski 00059 * 27Oct07 JMN Added BTOW_LEN and ETOW_LEN 00060 * 29Oct07 JMN Corrected above - removed 4 bytes for CRC not sent. 00061 * 30Oct07 JMN Now added 4 byte hole to BTOW and ETOW lengths 00062 * 13Nov07 JMN DAQ Headers no longer in EMC data - change definition of BTOW_LEN and ETOW_LEN 00063 * Pre/post data will not be sent to DAQ - change definition of TRG_TOWER_LEN 00064 */ 00065 00066 #ifndef trgStructures_h 00067 #define trgStructures_h 00068 00069 #define MAX_OFFSET 25 /* Maximum number of offsets in TrgTowerTrnfer OffsetBlock */ 00070 #define MAX_L0_DATA_BLOCKS 11 /* Maximum number of L0 Data Blocks: current + npre + npost */ 00071 #define MAX_RAW_DATA_BLOCKS 11 /* Maximum number of Raw Data Blocks: current + npre + npost */ 00072 #define FORMAT_VERSION 0x32 /* Format Version number for trigger data */ 00073 #define TRANSFER_VERSION 0x10 /* Format Version number for definition of TrgTowerTrnfer structure */ 00074 #define EV_DESC_LEN sizeof(EvtDescData) /* Number of bytes in event descriptor */ 00075 #define L0DSM_DATA_LEN sizeof(L0_DSM_Data) /* Size of data block in L0 DSM Tree */ 00076 #define RAW_DET_DATA_LEN sizeof(RawTrgDet) /* Size of Raw Detector Data from DSM clients and QT boards */ 00077 #define TRG_SUM_LEN sizeof(TrgSumData) /* Number of bytes in the trigger summary for DAQ with headers */ 00078 #define BTOW_LEN ((64 + 2 + 30*164)*2) /* BTOW header + 4 byte hole + data */ 00079 #define ETOW_LEN ((64 + 2 + 6*164)*2) /* ETOW header + 4 byte hole + data */ 00080 #define L1_DATA_LEN (EV_DESC_LEN+TRG_SUM_LEN) /* Size of data passed from L1ANA to L2 */ 00081 #define TRG_EVT_LEN (L1_DATA_LEN+(MAX_RAW_DATA_BLOCKS*RAW_DET_DATA_LEN)) /* Max size of a trigger event */ 00082 #define TRG_TOWER_LEN (4 + (MAX_OFFSET*8) + L1_DATA_LEN + RAW_DET_DATA_LEN + BTOW_LEN + ETOW_LEN) /* Max size of Trg/DAQ transfer data */ 00083 00084 #define RAW_MAX_LEN 272 /* Maximum length of any Chain Block Transfer */ 00085 00086 #define TRG_INDEX 0 /* Offset/length of trigger data: TrgDataType */ 00087 #define BTOW_INDEX 1 /* Offset/length of BTOW data: */ 00088 #define ETOW_INDEX 2 /* Offset/length of ETOW data: */ 00089 #define RAW_TRG_INDEX 3 /* Block of 11 contiguous offsets to rawTriggerDet[] */ 00090 00091 #define L2RESULTS_2008_OFFSET_TRG 0 00092 #define L2RESULTS_2008_OFFSET_EMC_CHECK 1 00093 #define L2RESULTS_2008_OFFSET_JPSI 2 00094 #define L2RESULTS_2008_OFFSET_UPS 8 00095 #define L2RESULTS_2008_OFFSET_EMC_PED 14 00096 #define L2RESULTS_2008_OFFSET_GAMMA 20 00097 #define L2RESULTS_2008_OFFSET_DIJET 32 00098 //#define L2RESULTS_2007_OFFSET_TRG 0 00099 //#define L2RESULTS_2007_OFFSET_EMC_PED 1 00100 //#define L2RESULTS_2007_OFFSET_PIG 2 00101 //#define L2RESULTS_2007_OFFSET_UPS 6 00102 //#define L2RESULTS_2007_OFFSET_DISPVER 14 00103 //#define L2RESULTS_OFFSET_TRG 0 00104 //#define L2RESULTS_OFFSET_EMC_CHECK 1 00105 //#define L2RESULTS_OFFSET_JPSI 2 00106 //#define L2RESULTS_OFFSET_UPS 8 00107 //#define L2RESULTS_OFFSET_DIJET 14 00108 //#define L2RESULTS_OFFSET_EMC_PED 19 00109 //#define L2RESULTS_OFFSET_PIG 20 00110 #define ADD_BIT_PILEUP 0 /* Contamination/Pileup bit in event descriptor add-bits */ 00111 #define ADD_BIT_FORCE 5 /* Force store of this event */ 00112 #define ADD_BIT_L2_5 6 /* Level 2.5 abort */ 00113 #define ADD_BIT_SIM 7 /* Simulated event - used by DAQ */ 00114 00115 /********** Trigger Structures ***********/ 00116 00117 /* Event Descriptor Data Structures */ 00118 00119 typedef struct { 00120 unsigned short TCUdataBytes; 00121 char TCUEvtDesc; 00122 unsigned char TrgDataFmtVer; 00123 unsigned int bunchXing_hi; 00124 unsigned int bunchXing_lo; /* Two parts of RHIC bunch crossing number */ 00125 unsigned short actionWdDetectorBitMask; /* from Fifo 1 */ 00126 unsigned char actionWdTrgCommand; /* from Fifo 1 */ 00127 unsigned char actionWdDaqCommand; /* from Fifo 1 */ 00128 unsigned short TrgToken; /* from Fifo 2 */ 00129 unsigned short addBits; /* from Fifo 2 - bit 0=Contamination; bit 6=L2.5 abort; bit 7=1 is fake data */ 00130 unsigned short DSMInput; /* from Fifo 3 */ 00131 unsigned short externalBusy; /* from Fifo 3 */ 00132 unsigned short modifiedBusyStatus; /* from Fifo 4 */ 00133 unsigned short physicsWord; /* from Fifo 4 */ 00134 unsigned short TriggerWord; /* from Fifo 5 */ 00135 unsigned short DSMAddress; /* from Fifo 6 */ 00136 unsigned short contaminationBusyStatus; /* from Fifo 6 */ 00137 unsigned short npre; /* pre value for detector raw data */ 00138 unsigned short npost; /* post value for detector raw data */ 00139 unsigned short dummy; /* dummy - filler */ 00140 } EvtDescData; /* 40 bytes total */ 00141 00142 /* Trigger Summary Data Structures */ 00143 00144 /* L0 DSM data structures */ 00145 00146 typedef struct { 00147 unsigned short CPA[16]; /* Contents of 2 CTB DSM Input Buffers (IB's) - coarse pixel array */ 00148 unsigned short MTD[8]; /* TAC values for MTD's MRPCs and overlapping CTB trays */ 00149 unsigned short VPD[8]; /* ADC & TAC values for VPD detectors*/ 00150 unsigned short CTB[8]; /* CTB ADC sums and topology for East & West combined */ 00151 unsigned short lastDSM[8]; /* Contents of last DSM IB - results of all DSM trees */ 00152 unsigned short VTX[8]; /* Separate ZDC and BBC DSMs have been replaced with this one */ 00153 unsigned short EMC[8]; /* Contents of 1 EMC IB - results of separate BEMC and EEMC DSMs */ 00154 unsigned short BCdata[16]; /* Contents of 2 Bunch Crossing DSMs IB's */ 00155 unsigned short specialTriggers[8]; /* Contents of 1 Special Trigger DSM - all the special trigger requests */ 00156 unsigned short FPD[8]; /* Contents of 1 FPD IB - we are installing this DSM this year but it */ 00157 } L0_DSM_Data; /* 192 bytes total */ 00158 00159 00160 /* Summary data */ 00161 00162 typedef struct { 00163 unsigned short TrgSumBytes; 00164 unsigned short TrgSumHeader; 00165 unsigned int L1Sum[2]; /* L1 Summary */ 00166 unsigned int L2Sum[2]; /* L2 Summary */ 00167 unsigned short L0SumBytes; 00168 unsigned short L0SumHeader; 00169 L0_DSM_Data DSMdata; /* L0 DSM Data from DSM Tree */ 00170 unsigned short L1SumBytes; 00171 unsigned short L1SumHeader; 00172 unsigned int L1Result[32]; /* Result from L1 CPU */ 00173 unsigned short L2SumBytes; 00174 unsigned short L2SumHeader; 00175 unsigned int L2Result[64]; /* Result from L2 CPU. Increased by 128 bytes from version 3.0 */ 00176 } TrgSumData; /* 608 bytes total */ 00177 00178 /* Data structure passed between L1ANA and L2 */ 00179 00180 typedef struct { 00181 EvtDescData EvtDesc; /* L1 Event Descriptor Data */ 00182 TrgSumData TrgSum; /* Summary data */ 00183 } L1dataType; /* 648 bytes */ 00184 00185 /* Raw Trigger Detector data structures */ 00186 00187 typedef struct { 00188 unsigned short RawDetBytes; 00189 char RawDetHeader[2]; 00190 unsigned short CTBdataBytes; 00191 char CTBdataHeader[2]; 00192 unsigned char CTB[256]; /* CTB raw data. Data address must be 8-byte aligned for DMA transfer */ 00193 unsigned short MIXdataBytes; 00194 char MIXdataHeader[2]; 00195 unsigned int MIXfiller; /* Dummy to bring data address to mod 8 */ 00196 unsigned char MTD[32]; /* MTD raw data from 2 DSMs */ 00197 unsigned char VPD[64]; /* VPD raw data from 4 DSMs */ 00198 unsigned char P2P[32]; /* P2P raw data from 2 DSMs */ 00199 unsigned char TOF[16]; /* TOF raw data from 1 DSM */ 00200 unsigned short BEMCdataBytes; 00201 char BEMCdataHeader[2]; 00202 unsigned int BEMCfiller; /* Dummy to bring data address to mod 8 */ 00203 unsigned char BEMCEast[240]; /* next year there will be 15 DSMs covering the East half, all in one crate */ 00204 unsigned char BEMCWest[240]; /* this year there will be 15 DSMs covering the West half, all in one crate */ 00205 unsigned short BEMClayer1[48]; /* there will be 6 DSMs at layer1 even if only 3 of them have input this year*/ 00206 unsigned short EEMCdataBytes; 00207 char EEMCdataHeader[2]; 00208 unsigned int EEMCfiller; /* Dummy to bring data address to mod 8 */ 00209 unsigned short EEMClayer1[16]; /* the two layer1 DSMs are at the LHS of the crate so they get read first */ 00210 unsigned char EEMC[144]; /* next there are the 9 layer0 DSMs, of which only 4-5 have input this year */ 00211 unsigned short FPDdataBytes; 00212 char FPDdataHeader[2]; 00213 unsigned int FPDfiller; /* Dummy to bring data address to mod 8 */ 00214 unsigned char FPDEastNSLayer0[112]; /* fpd east north/south layer 0 */ 00215 unsigned short FPDEastNSLayer1[8]; /* fpd east north/south layer 1 */ 00216 unsigned char FPDEastTBLayer0[16]; /* fpd east top/bottom layer 0 */ 00217 unsigned char FPDW[256]; /* fpd west */ 00218 unsigned short BBCdataBytes; 00219 char BBCdataHeader[2]; 00220 unsigned int BBCfiller; /* Dummy to bring data address to mod 8 */ 00221 unsigned char BBC[96]; /* increased from 80 to 96 for the addition of a DSM after layer 0 DSMs */ 00222 unsigned short BBClayer1[16]; /* this is the layer1 DSM that feeds the VTX DSM */ 00223 unsigned char ZDC[16]; /* this is the original ZDC DSM */ 00224 unsigned short ZDClayer1[8]; /* this is the new layer1 ZDC DSM that also feeds the VTX DSM */ 00225 unsigned char ZDCSMD[32]; /* this is the 2 layer0 DSM for the ZDC SMD detector */ 00226 unsigned short QQTdataBytes; /* this is new in version 3.0 for data from QT boards */ 00227 char QQTdataHeader[2]; 00228 unsigned int QQTfiller; /* Dummy to bring data address to mod 8 */ 00229 unsigned int QQTdata[1600]; /* data block for FMS. New in version 3.0 */ 00230 } RawTrgDet; /* 8200 bytes total */ 00231 00232 /* Trigger Event Structure */ 00233 00234 typedef struct { 00235 EvtDescData EvtDesc; /* L1 Event Descriptor Data : 40 bytes */ 00236 TrgSumData TrgSum; /* Summary data: 608 bytes */ 00237 RawTrgDet rawTriggerDet[MAX_RAW_DATA_BLOCKS]; /* Raw Detector Data with pre and post History: 11*8200 bytes */ 00238 } TrgDataType; /* 90848 bytes */ 00239 00240 /* Combined Trigger and EMC data block transferred from L2 to DAQ */ 00241 00242 typedef struct { 00243 int offset; /* Offset (in bytes) from the start of TrgTowerTrnfer to data */ 00244 int length; /* Length (in bytes) of data */ 00245 } TrgOfflen; 00246 00247 typedef struct { 00248 int byteCount_Version; /* Transfer count in MS 24 bits; Version in LS 8 bits */ 00249 TrgOfflen OffsetBlock[MAX_OFFSET]; /* Offset/length into transferData */ 00250 int transferData[1]; /* Place holder array for trigger, BTOW and ETOW */ 00251 } TrgTowerTrnfer; /* Maximum possible length 103124 bytes */ 00252 00253 /* Data block for DSMs and L1 to pass to L2 via myriMemcpy2 */ 00254 00255 typedef struct { 00256 int src_nodeId; /* Source nodeId */ 00257 int cur_token; 00258 int Npre,Npost; 00259 unsigned int localClock; /* Local DSM clock */ 00260 int numGroup; /* Number of DSMs in first group */ 00261 int numDSM; /* Total number of DSMs */ 00262 int dummy; /* Ensure alignment of long long */ 00263 long long dsmData[RAW_MAX_LEN*MAX_RAW_DATA_BLOCKS/8]; /* Make this 8-byte aligned */ 00264 } dsmMemcpy2Buf; 00265 00266 #endif
1.5.9