StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
trgStructures2008.h
1 /* Header Number: x.y
2 * Package Name: All
3 * Created: z. milosevich 06Dec99
4 * Description: Global trigger structure header file.
5 * Contains definitions of trigger data structures
6 * History:
7 *
8 * 06Dec99 zm Created so offline can use and after modification for mod 8 DMA reads
9 * 08Dec99 zm Changed Event Descriptor Structure to previous length
10 * 03Feb00 zm Changed "ushort ZDCDSM[8]" to "BYTE ZDC[16]" in L0_DSM_Data structure
11 * 22Jul00 egj Added L0RegBytes and L0RegHeader to trgDataHeaders and TrgSumData.
12 * Also added Mult_Reg, ZDC_Reg and Spare_Reg to TrgSumData, making a
13 * total of 16 extra bytes. I compensated for this by removing 16 bytes,
14 * (4 uints) from L2Result, wich is currently unused.
15 * 08Dec00 JMN Changed char hdr[2] in TrgSummary to unsigned short, which is packed
16 * 25Feb01 JMN Redesigned and expanded abbreviations to full.
17 * 12Mar01 JMN Added additional changes from ZM
18 * 30May01 JMN NBNBNBNB Changed FORMAT version from 0x12 to 0x13
19 * 02Jun01 zm defined bit 6 in addBits info FIFO3 for L2.5 abort
20 * 27Jun01 JMN Added definition of number of bytes used in trigger summary headers
21 * 28Jun01 JMN Added definition of ADD_BITs
22 * 10Apr02 zm basic strawman for new structures with new TCU and added detectors
23 * 22May02 zm removed references to current non-existent trigger event header
24 * 24May02 zm incorporated eleanor's comments
25 * 24May02 zm the L0_DSM_Data instance changed from DSM to DSMdata to be able to compile on linux
26 * 19Jun02 zm removed or commented out references to TrgEvtHeader
27 * 05Aug02 JMN changes in event descriptor - moved filler word to end
28 * 15Aug02 HjC correct bytes for FPD
29 * 21Nov02 zm corrections based on eleanor's email: L0 layout for bunch xing,
30 * special and fpd elements; fpd broken down for east/west nort/south
31 * vs top/bottom and layer 1 or 0;
32 * also finished XXX_DATA_OFFSET and RAW_XXX_LEN for passing data from
33 * dsm
34 * 30Aug03 JMN Added RAW_MAX_LEN being maximum length possible in chain block transfer
35 * 14Sep03 JMN Added new dsmMemcpy2Buf
36 * 02Nov03 JMN Modified dsmMemcpy2Buf to ensure dsmData is 8-byte aligned.
37 * 04Nov03 EGJ Modified RawTrgDet to add in ZDCSMD[32]
38 * 28Oct04 JMN Modified RawTrgDet to increased BBC storage from 80 to 96
39 * Format version changed from 0x21 to 0x22
40 * 14Nov05 JMN Added source NodeID as first word of data buffer to L2
41 * 16Mar06 CWP Added offsets into L2Result
42 * 20Dec06 JMN Added changes: L2Result increased to 64 ints,
43 * MWC name changed to MIX with 7 DSMs from MTD, VPD and TOF (112 bytes)
44 * FPE changed to 9 DSMs (144 bytes)
45 * FPW changed to 16 DSMs (256) bytes
46 * new array QQT installed after BBC
47 * Block of commented OFFSETs and LEN removed.
48 * Commented out xx_SUM_LEN where xx is L0, L1, L2; and L0_REG_LEN. Unused?
49 * Since these are significant changes, Format changed to 3.0
50 * 05Jan07 JMN Changed CPA[32] to MTD[8],VPD[8],CPA[16]
51 * 29Mar07 JMN Updated L2_Results offsets for CP
52 * 03Apr07 JMN Order MTD,VPD,CPA is changed to CPA,MTD,VPD to reflect order of DSMs in the L1 crate
53 * 07Oct07 JMN Added new TrgTowerTrnfer structure to define combined trigger and EMC data that will
54 * be transmitted from L2 to DAQ in from November 2007.
55 * 24Oct07 JMN Version number changed from 3.1 to 3.2 following re-arrangement of DSMs in MIX and
56 * BBC crates. Two extra DSMs for PP2PP are in the MIX crate ahead of TOF, so total
57 * length increases by 32 bytes.
58 * 25Oct07 JMN A new set of L2_RESULTS offsets have been defined by Jan Balewski
59 * 27Oct07 JMN Added BTOW_LEN and ETOW_LEN
60 * 29Oct07 JMN Corrected above - removed 4 bytes for CRC not sent.
61 * 30Oct07 JMN Now added 4 byte hole to BTOW and ETOW lengths
62 * 13Nov07 JMN DAQ Headers no longer in EMC data - change definition of BTOW_LEN and ETOW_LEN
63 * Pre/post data will not be sent to DAQ - change definition of TRG_TOWER_LEN
64 */
65 
66 #ifndef trgStructures2008_h
67 #define trgStructures2008_h
68 
69 #define y8MAX_OFFSET 25 /* Maximum number of offsets in TrgTowerTrnfer OffsetBlock */
70 #define y8MAX_L0_DATA_BLOCKS 11 /* Maximum number of L0 Data Blocks: current + npre + npost */
71 #define y8MAX_RAW_DATA_BLOCKS 11 /* Maximum number of Raw Data Blocks: current + npre + npost */
72 #define y8FORMAT_VERSION 0x32 /* Format Version number for trigger data */
73 #define y8TRANSFER_VERSION 0x10 /* Format Version number for definition of TrgTowerTrnfer structure */
74 #define y8EV_DESC_LEN sizeof(EvtDescData2008) /* Number of bytes in event descriptor */
75 #define y8L0DSM_DATA_LEN sizeof(L0_DSM_Data2008) /* Size of data block in L0 DSM Tree */
76 #define y8RAW_DET_DATA_LEN sizeof(RawTrgDet2008) /* Size of Raw Detector Data from DSM clients and QT boards */
77 #define y8TRG_SUM_LEN sizeof(TrgSumData2008) /* Number of bytes in the trigger summary for DAQ with headers */
78 #define y8BTOW_LEN ((64 + 2 + 30*164)*2) /* BTOW header + 4 byte hole + data */
79 #define y8ETOW_LEN ((64 + 2 + 6*164)*2) /* ETOW header + 4 byte hole + data */
80 #define y8L1_DATA_LEN (y8EV_DESC_LEN+y8TRG_SUM_LEN) /* Size of data passed from L1ANA to L2 */
81 #define y8TRG_EVT_LEN (y8L1_DATA_LEN+(y8MAX_RAW_DATA_BLOCKS*y8RAW_DET_DATA_LEN)) /* Max size of a trigger event */
82 #define y8TRG_TOWER_LEN (4 + (y8MAX_OFFSET*8) + y8L1_DATA_LEN + y8RAW_DET_DATA_LEN + y8BTOW_LEN + y8ETOW_LEN) /* Max size of Trg/DAQ transfer data */
83 
84 #define y8RAW_MAX_LEN 272 /* Maximum length of any Chain Block Transfer */
85 
86 #define y8TRG_INDEX 0 /* Offset/length of trigger data: TrgDataType */
87 #define y8BTOW_INDEX 1 /* Offset/length of BTOW data: */
88 #define y8ETOW_INDEX 2 /* Offset/length of ETOW data: */
89 #define y8RAW_TRG_INDEX 3 /* Block of 11 contiguous offsets to rawTriggerDet[] */
90 
91 #define L2RESULTS_2008_OFFSET_TRG 0
92 #define L2RESULTS_2008_OFFSET_EMC_CHECK 1
93 #define L2RESULTS_2008_OFFSET_JPSI 2
94 #define L2RESULTS_2008_OFFSET_UPS 8
95 #define L2RESULTS_2008_OFFSET_EMC_PED 14
96 #define L2RESULTS_2008_OFFSET_GAMMA 20
97 #define L2RESULTS_2008_OFFSET_DIJET 32
98 
99 #define y8ADD_BIT_PILEUP 0 /* Contamination/Pileup bit in event descriptor add-bits */
100 #define y8ADD_BIT_FORCE 5 /* Force store of this event */
101 #define y8ADD_BIT_L2_5 6 /* Level 2.5 abort */
102 #define y8ADD_BIT_SIM 7 /* Simulated event - used by DAQ */
103 
104 /********** Trigger Structures ***********/
105 
106 /* Event Descriptor Data Structures */
107 
108 typedef struct {
109 unsigned short TCUdataBytes;
110 char TCUEvtDesc;
111 unsigned char TrgDataFmtVer;
112 unsigned int bunchXing_hi;
113 unsigned int bunchXing_lo; /* Two parts of RHIC bunch crossing number */
114 unsigned short actionWdDetectorBitMask; /* from Fifo 1 */
115 unsigned char actionWdTrgCommand; /* from Fifo 1 */
116 unsigned char actionWdDaqCommand; /* from Fifo 1 */
117 unsigned short TrgToken; /* from Fifo 2 */
118 unsigned short addBits; /* from Fifo 2 - bit 0=Contamination; bit 6=L2.5 abort; bit 7=1 is fake data */
119 unsigned short DSMInput; /* from Fifo 3 */
120 unsigned short externalBusy; /* from Fifo 3 */
121 unsigned short modifiedBusyStatus; /* from Fifo 4 */
122 unsigned short physicsWord; /* from Fifo 4 */
123 unsigned short TriggerWord; /* from Fifo 5 */
124 unsigned short DSMAddress; /* from Fifo 6 */
125 unsigned short contaminationBusyStatus; /* from Fifo 6 */
126 unsigned short npre; /* pre value for detector raw data */
127 unsigned short npost; /* post value for detector raw data */
128 unsigned short dummy; /* dummy - filler */
129 } EvtDescData2008; /* 40 bytes total */
130 
131 /* Trigger Summary Data Structures */
132 
133 /* L0 DSM data structures */
134 
135 typedef struct {
136 unsigned short CPA[16]; /* Contents of 2 CTB DSM Input Buffers (IB's) - coarse pixel array */
137 unsigned short MTD[8]; /* TAC values for MTD's MRPCs and overlapping CTB trays */
138 unsigned short VPD[8]; /* ADC & TAC values for VPD detectors*/
139 unsigned short CTB[8]; /* CTB ADC sums and topology for East & West combined */
140 unsigned short lastDSM[8]; /* Contents of last DSM IB - results of all DSM trees */
141 unsigned short VTX[8]; /* Separate ZDC and BBC DSMs have been replaced with this one */
142 unsigned short EMC[8]; /* Contents of 1 EMC IB - results of separate BEMC and EEMC DSMs */
143 unsigned short BCdata[16]; /* Contents of 2 Bunch Crossing DSMs IB's */
144 unsigned short specialTriggers[8]; /* Contents of 1 Special Trigger DSM - all the special trigger requests */
145 unsigned short FPD[8]; /* Contents of 1 FPD IB - we are installing this DSM this year but it */
146 } L0_DSM_Data2008; /* 192 bytes total */
147 
148 
149 /* Summary data */
150 
151 typedef struct {
152 unsigned short TrgSumBytes;
153 unsigned short TrgSumHeader;
154 unsigned int L1Sum[2]; /* L1 Summary */
155 unsigned int L2Sum[2]; /* L2 Summary */
156 unsigned short L0SumBytes;
157 unsigned short L0SumHeader;
158 L0_DSM_Data2008 DSMdata; /* L0 DSM Data from DSM Tree */
159 unsigned short L1SumBytes;
160 unsigned short L1SumHeader;
161 unsigned int L1Result[32]; /* Result from L1 CPU */
162 unsigned short L2SumBytes;
163 unsigned short L2SumHeader;
164 unsigned int L2Result[64]; /* Result from L2 CPU. Increased by 128 bytes from version 3.0 */
165 } TrgSumData2008; /* 608 bytes total */
166 
167 /* Data structure passed between L1ANA and L2 */
168 
169 typedef struct {
170 EvtDescData2008 EvtDesc; /* L1 Event Descriptor Data */
171 TrgSumData2008 TrgSum; /* Summary data */
172 } L1dataType2008; /* 648 bytes */
173 
174 /* Raw Trigger Detector data structures */
175 
176 typedef struct {
177 unsigned short RawDetBytes;
178 char RawDetHeader[2];
179 unsigned short CTBdataBytes;
180 char CTBdataHeader[2];
181 unsigned char CTB[256]; /* CTB raw data. Data address must be 8-byte aligned for DMA transfer */
182 unsigned short MIXdataBytes;
183 char MIXdataHeader[2];
184 unsigned int MIXfiller; /* Dummy to bring data address to mod 8 */
185 unsigned char MTD[32]; /* MTD raw data from 2 DSMs */
186 unsigned char VPD[64]; /* VPD raw data from 4 DSMs */
187 unsigned char P2P[32]; /* P2P raw data from 2 DSMs */
188 unsigned char TOF[16]; /* TOF raw data from 1 DSM */
189 unsigned short BEMCdataBytes;
190 char BEMCdataHeader[2];
191 unsigned int BEMCfiller; /* Dummy to bring data address to mod 8 */
192 unsigned char BEMCEast[240]; /* next year there will be 15 DSMs covering the East half, all in one crate */
193 unsigned char BEMCWest[240]; /* this year there will be 15 DSMs covering the West half, all in one crate */
194 unsigned short BEMClayer1[48]; /* there will be 6 DSMs at layer1 even if only 3 of them have input this year*/
195 unsigned short EEMCdataBytes;
196 char EEMCdataHeader[2];
197 unsigned int EEMCfiller; /* Dummy to bring data address to mod 8 */
198 unsigned short EEMClayer1[16]; /* the two layer1 DSMs are at the LHS of the crate so they get read first */
199 unsigned char EEMC[144]; /* next there are the 9 layer0 DSMs, of which only 4-5 have input this year */
200 unsigned short FPDdataBytes;
201 char FPDdataHeader[2];
202 unsigned int FPDfiller; /* Dummy to bring data address to mod 8 */
203 unsigned char FPDEastNSLayer0[112]; /* fpd east north/south layer 0 */
204 unsigned short FPDEastNSLayer1[8]; /* fpd east north/south layer 1 */
205 unsigned char FPDEastTBLayer0[16]; /* fpd east top/bottom layer 0 */
206 unsigned char FPDW[256]; /* fpd west */
207 unsigned short BBCdataBytes;
208 char BBCdataHeader[2];
209 unsigned int BBCfiller; /* Dummy to bring data address to mod 8 */
210 unsigned char BBC[96]; /* increased from 80 to 96 for the addition of a DSM after layer 0 DSMs */
211 unsigned short BBClayer1[16]; /* this is the layer1 DSM that feeds the VTX DSM */
212 unsigned char ZDC[16]; /* this is the original ZDC DSM */
213 unsigned short ZDClayer1[8]; /* this is the new layer1 ZDC DSM that also feeds the VTX DSM */
214 unsigned char ZDCSMD[32]; /* this is the 2 layer0 DSM for the ZDC SMD detector */
215 unsigned short QQTdataBytes; /* this is new in version 3.0 for data from QT boards */
216 char QQTdataHeader[2];
217 unsigned int QQTfiller; /* Dummy to bring data address to mod 8 */
218 unsigned int QQTdata[1600]; /* data block for FMS. New in version 3.0 */
219 } RawTrgDet2008; /* 8200 bytes total */
220 
221 /* Trigger Event Structure */
222 
224 EvtDescData2008 EvtDesc; /* L1 Event Descriptor Data : 40 bytes */
225 TrgSumData2008 TrgSum; /* Summary data: 608 bytes */
226 RawTrgDet2008 rawTriggerDet[y8MAX_RAW_DATA_BLOCKS]; /* Raw Detector Data with pre and post History: 11*8200 bytes */
227 } ; /* 90848 bytes */
228 
229 /* Combined Trigger and EMC data block transferred from L2 to DAQ */
230 
231 typedef struct {
232  int offset; /* Offset (in bytes) from the start of TrgTowerTrnfer to data */
233  int length; /* Length (in bytes) of data */
234 } TrgOfflen2008;
235 
236 typedef struct {
237  int byteCount_Version; /* Transfer count in MS 24 bits; Version in LS 8 bits */
238  TrgOfflen2008 OffsetBlock[y8MAX_OFFSET]; /* Offset/length into transferData */
239  int transferData[1]; /* Place holder array for trigger, BTOW and ETOW */
240 } TrgTowerTrnfer2008; /* Maximum possible length 103124 bytes */
241 
242 #endif
243