00001 /* 00002 * Header Name: trgStructures.h 00003 * Header Number: x.y 00004 * Package Name: All 00005 * Created: z. milosevich 06Dec99 00006 * Description: Global trigger structure header file. 00007 * Contains definitions of trigger data structures 00008 * History: 00009 * 00010 * 06Dec99 zm Created so offline can use and after modification for mod 8 DMA reads 00011 * 08Dec99 zm Changed Event Descriptor Structure to previous length 00012 * 03Feb00 zm Changed "UShort_t ZDCDSM[8]" to "BYTE ZDC[16]" in L0_DSM_Data structure 00013 * 22Jul00 egj Added L0RegBytes and L0RegHeader to trgDataHeaders and TrgSumData. 00014 * Also added Mult_Reg, ZDC_Reg and Spare_Reg to TrgSumData, making a 00015 * total of 16 extra bytes. I compensated for this by removing 16 bytes, 00016 * (4 uints) from L2Result, wich is currently unused. 00017 * 08Dec00 JMN Changed char hdr[2] in TrgSummary to unsigned short, which is packed 00018 * 25Feb01 JMN Redesigned and expanded abbreviations to full. 00019 * 12Mar01 JMN Added additional changes from ZM 00020 * 30May01 JMN NBNBNBNB Changed FORMAT version from 0x12 to 0x13 00021 * 02Jun01 zm defined bit 6 in addBits info FIFO3 for L2.5 abort 00022 * 27Jun01 JMN Added definition of number of bytes used in trigger summary headers 00023 * 28Jun01 JMN Added definition of ADD_BITs 00024 * 10Apr02 zm basic strawman for new structures with new TCU and added detectors 00025 * 22May02 zm removed references to current non-existent trigger event header 00026 * 24May02 zm incorporated eleanor's comments 00027 * 24May02 zm the L0_DSM_Data instance changed from DSM to DSMdata to be able to compile on linux 00028 * 19Jun02 zm removed or commented out references to TrgEvtHeader 00029 * 05Aug02 JMN changes in event descriptor - moved filler word to end 00030 * 15Aug02 HjC correct bytes for FPD 00031 * 21Nov02 zm corrections based on eleanor's email: L0 layout for bunch xing, 00032 * special and fpd elements; fpd broken down for east/west nort/south 00033 * vs top/bottom and layer 1 or 0; 00034 * also finished XXX_DATA_OFFSET and RAW_XXX_LEN for passing data from 00035 * dsm 00036 * 30Aug03 JMN Added RAW_MAX_LEN being maximum length possible in chain block transfer 00037 * 14Sep03 JMN Added new dsmMemcpy2Buf 00038 * 02Nov03 JMN Modified dsmMemcpy2Buf to ensure dsmData is 8-byte aligned. 00039 * 04Nov03 EGJ Modified RawTrgDet to add in ZDCSMD[32] 00040 * 28Oct04 JMN Modified RawTrgDet to increased BBC storage from 80 to 96 00041 * Format version changed from 0x21 to 0x22 00042 */ 00043 00044 #ifndef trgStructures_h 00045 #define trgStructures_h 00046 00047 #define MAX_L0_DATA_BLOCKS 11 /* Maximum number of L0 Data Blocks: current + npre + npost */ 00048 #define MAX_RAW_DATA_BLOCKS 11 /* Maximum number of Raw Data Blocks: current + npre + npost */ 00049 #define FORMAT_VERSION 0x22 /* Format Version number for trigger data */ 00050 #define EV_DESC_LEN sizeof(EvtDescData) /* Number of bytes in event descriptor */ 00051 #define L0DSM_DATA_LEN sizeof(L0_DSM_Data) /* Size of data block in L0 DSM Tree */ 00052 #define RAW_DET_DATA_LEN sizeof(RawTrgDet) /* Size of Raw Detector Data from CTB, MWC with headers */ 00053 #define TRG_SUM_LEN sizeof(TrgSumData) /* Number of bytes in the trigger summary for DAQ with headers */ 00054 00055 #define L1_DATA_LEN (EV_DESC_LEN+TRG_SUM_LEN) /* Size of data passed from L1ANA to L2 */ 00056 #define TRG_EVT_LEN (L1_DATA_LEN+(MAX_RAW_DATA_BLOCKS*RAW_DET_DATA_LEN)) /* Max size of a trigger event */ 00057 #define TDI_EVT_LEN (EV_DESC_LEN+TRG_SUM_LEN+(MAX_RAW_DATA_BLOCKS*RAW_DET_DATA_LEN)) /* size of event sent to TDI */ 00058 00059 #define L0_SUM_LEN 148 /* Number of bytes in L0 Summary + Header */ 00060 #define L1_SUM_LEN 132 /* Number of bytes in L1 Summary + Header */ 00061 #define L2_SUM_LEN 116 /* Number of bytes in L2 Summary + Header */ 00062 #define L0_REG_LEN 16 /* Number of bytes in L0 Register + Header */ 00063 00064 #define RAW_MAX_LEN 272 /* Maximum length of any Chain Block Transfer */ 00065 //#define CTB_DATA_OFFSET 8 /* Number of bytes CTB Raw data is offset in raw trigger structure */ 00066 //#define RAW_CTB_LEN 256 /* Number of bytes in raw CTB DSMs */ 00067 //#define MWC_DATA_OFFSET 272 /* Number of bytes MWC Raw data is offset in raw trigger structure */ 00068 //#define RAW_MWC_LEN 128 /* Number of bytes in raw CTB DSMs */ 00069 //#define BCE_DATA_OFFSET 408 /* Number of bytes BMC Raw data is offset in raw trigger structure */ 00070 //#define RAW_BCE_LEN 240 00071 //#define BCW_DATA_OFFSET 648 00072 //#define RAW_BCW_LEN 240 00073 //#define BC1_DATA_OFFSET 888 00074 //#define RAW_BC1_LEN 96 00075 //#define EEC_DATA_OFFSET 992 00076 //#define RAW_EEC_LEN 176 00077 //#define FPE_DATA_OFFSET 1176 /* everything after this will have to be re-done */ 00078 //#define RAW_FPE_LEN 208 00079 //#define FPW_DATA_OFFSET 1384 00080 //#define RAW_FPW_LEN 208 00081 //#define BBC_DATA_OFFSET 1600 00082 //#define RAW_BBC_LEN 176 /* Number of bytes in BBC and ZDC raw data structures */ 00083 00084 00085 #define ADD_BIT_PILEUP 0 /* Contamination/Pileup bit in event descriptor add-bits */ 00086 #define ADD_BIT_FORCE 5 /* Force store of this event */ 00087 #define ADD_BIT_L2_5 6 /* Level 2.5 abort */ 00088 #define ADD_BIT_SIM 7 /* Simulated event - used by DAQ */ 00089 00090 /********** Trigger Structures ***********/ 00091 00092 /* Event Descriptor Data Structures */ 00093 00094 00095 typedef struct { 00096 unsigned short TCUdataBytes; 00097 char TCUEvtDesc; 00098 unsigned char TrgDataFmtVer; 00099 unsigned int bunchXing_hi; 00100 unsigned int bunchXing_lo; /* Two parts of RHIC bunch crossing number */ 00101 unsigned short actionWdDetectorBitMask; /* from Fifo 1 */ 00102 unsigned char actionWdTrgCommand; /* from Fifo 1 */ 00103 unsigned char actionWdDaqCommand; /* from Fifo 1 */ 00104 unsigned short TrgToken; /* from Fifo 2 */ 00105 unsigned short addBits; /* from Fifo 2 - bit 0=Contamination; bit 6=L2.5 abort; bit 7=1 is fake data */ 00106 unsigned short DSMInput; /* from Fifo 3 */ 00107 unsigned short externalBusy; /* from Fifo 3 */ 00108 unsigned short modifiedBusyStatus; /* from Fifo 4 */ 00109 unsigned short physicsWord; /* from Fifo 4 */ 00110 unsigned short TriggerWord; /* from Fifo 5 */ 00111 unsigned short DSMAddress; /* from Fifo 6 */ 00112 unsigned short contaminationBusyStatus; /* from Fifo 6 */ 00113 unsigned short npre; /* pre value for detector raw data */ 00114 unsigned short npost; /* post value for detector raw data */ 00115 unsigned short dummy; /* dummy - filler */ 00116 } EvtDescData; /* 40 bytes total */ 00117 00118 /* Trigger Summary Data Structures */ 00119 00120 /* L0 DSM data structures */ 00121 00122 typedef struct { 00123 unsigned short CPA[32]; /* Contents of 4 CTB+MWC DSM Input Buffers (IB's) - coarse pixel array*/ 00124 unsigned short quadDSM[8]; /* Contents of 1 CTB+MWC DSM IB - outputs of previous 4 */ 00125 unsigned short lastDSM[8]; /* Contents of last DSM IB - results of all DSM trees */ 00126 unsigned short VTX[8]; /* Separate ZDC and BBC DSMs have been replaced with this one */ 00127 unsigned short EMC[8]; /* Contents of 1 EMC IB - results of separate BEMC and EEMC DSMs */ 00128 unsigned short BCdata[16]; /* Contents of 2 Bunch Crossing DSMs IB's */ 00129 unsigned short specialTriggers[8]; /* Contents of 1 Special Trigger DSM - all the special trigger requests */ 00130 unsigned short FPD[8]; /* Contents of 1 FPD IB - we are installing this DSM this year but it */ 00131 } L0_DSM_Data; /* 192 bytes total */ 00132 00133 00134 /* Summary data */ 00135 00136 typedef struct { 00137 unsigned short TrgSumBytes; 00138 unsigned short TrgSumHeader; 00139 unsigned int L1Sum[2]; /* L1 Summary */ 00140 unsigned int L2Sum[2]; /* L2 Summary */ 00141 unsigned short L0SumBytes; 00142 unsigned short L0SumHeader; 00143 L0_DSM_Data DSMdata; /* L0 DSM Data from DSM Tree */ 00144 unsigned short L1SumBytes; 00145 unsigned short L1SumHeader; 00146 unsigned int L1Result[32]; /* Result from L1 CPU */ 00147 unsigned short L2SumBytes; 00148 unsigned short L2SumHeader; 00149 unsigned int L2Result[32]; /* Result from L2 CPU */ 00150 } TrgSumData; /* 480 bytes total */ 00151 00152 /* Data structure passed between L1ANA and L2 */ 00153 00154 typedef struct { 00155 EvtDescData EvtDesc; /* L1 Event Descriptor Data */ 00156 TrgSumData TrgSum; /* Summary data */ 00157 } L1dataType; /* 520 bytes */ 00158 00159 /* Raw Trigger Detector data structures */ 00160 00161 typedef struct { 00162 unsigned short RawDetBytes; 00163 char RawDetHeader[2]; 00164 unsigned short CTBdataBytes; 00165 char CTBdataHeader[2]; 00166 unsigned char CTB[256]; /* CTB raw data */ 00167 unsigned short MWCdataBytes; 00168 char MWCdataHeader[2]; 00169 unsigned int MWCfiller; /* Dummy to bring header to mod 8 */ 00170 unsigned char MWC[128]; /* MWC raw data */ 00171 unsigned short BEMCdataBytes; 00172 char BEMCdataHeader[2]; 00173 unsigned int BEMCfiller; /* Dummy to bring header to mod 8 */ 00174 unsigned char BEMCEast[240]; /* next year there will be 15 DSMs covering the East half, all in one crate */ 00175 unsigned char BEMCWest[240]; /* this year there will be 15 DSMs covering the West half, all in one crate */ 00176 unsigned short BEMClayer1[48]; /* there will be 6 DSMs at layer1 even if only 3 of them have input this year*/ 00177 unsigned short EEMCdataBytes; 00178 char EEMCdataHeader[2]; 00179 unsigned int EEMCfiller; /* Dummy to bring header to mod 8 */ 00180 unsigned short EEMClayer1[16]; /* the two layer1 DSMs are at the LHS of the crate so they get read first */ 00181 unsigned char EEMC[144]; /* next there are the 9 layer0 DSMs, of which only 4-5 have input this year */ 00182 unsigned short FPDdataBytes; 00183 char FPDdataHeader[2]; 00184 unsigned int FPDfiller; /* Dummy to bring header to mod 8 */ 00185 unsigned char FPDEastNSLayer0[112]; /* fpd east north/south layer 0 */ 00186 unsigned short FPDEastNSLayer1[8]; /* fpd east north/south layer 1 */ 00187 unsigned char FPDEastTBLayer0[64]; /* fpd east top/bottom layer 0 */ 00188 unsigned short FPDEastTBLayer1[8]; /* fpd east north/south layer 1 */ 00189 unsigned char FPDWestNSLayer0[112]; /* fpd east north/south layer 0 */ 00190 unsigned short FPDWestNSLayer1[8]; /* fpd east north/south layer 1 */ 00191 unsigned char FPDWestTBLayer0[64]; /* fpd east north/south layer 0 */ 00192 unsigned short FPDWestTBLayer1[8]; /* fpd east north/south layer 1 */ 00193 unsigned short BBCdataBytes; 00194 char BBCdataHeader[2]; 00195 unsigned int BBCfiller; /* Dummy to bring header to mod 8 */ 00196 unsigned char BBC[96]; /* increased from 80 to 96 for the addition of a DSM after layer 0 DSMs */ 00197 unsigned short BBClayer1[16]; /* this is the layer1 DSM that feeds the VTX DSM */ 00198 unsigned char ZDCSMD[32]; /* this is the 2 layer0 DSM for the ZDC SMD detector */ 00199 unsigned char ZDC[16]; /* this is the original ZDC DSM */ 00200 unsigned short ZDClayer1[8]; /* this is the new layer1 ZDC DSM that also feeds the VTX DSM */ 00201 } RawTrgDet; /* 1792 bytes total */ 00202 00203 /* Trigger Event Structure */ 00204 00205 typedef struct { 00206 EvtDescData EvtDesc; /* L1 Event Descriptor Data : 40 bytes */ 00207 TrgSumData TrgSum; /* Summary data: 480 bytes */ 00208 RawTrgDet rawTriggerDet[MAX_RAW_DATA_BLOCKS]; /* Raw Detector Data with pre and post History: 11*1792 bytes */ 00209 } TrgDataType; /* 20232 bytes */ 00210 00211 /* Data block for DSMs and L1 to pass to L2 via myriMemcpy2 */ 00212 00213 typedef struct { 00214 int cur_token; 00215 int Npre,Npost; 00216 unsigned int localClock; /* Local DSM clock */ 00217 int numGroup; /* Number of DSMs in first group */ 00218 int numDSM; /* Total number of DSMs */ 00219 long long dsmData[RAW_MAX_LEN*MAX_RAW_DATA_BLOCKS/8]; /* Make this 8-byte aligned */ 00220 } dsmMemcpy2Buf; 00221 00222 #endif
1.5.9