StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
trgStructures-Jan2002.h
1 /***************************************************************************************/
2 /* Header Name: trgStructures.h */
3 /* Header Number: x.y */
4 /* Package Name: All */
5 /* Created: z. milosevich 06Dec99 */
6 /* Description: Global trigger structure header file. */
7 /* Contains definitions of trigger data structures */
8 /* History: */
9 /* */
10 /* 06Dec99 zm Created so offline can use and after modification for mod 8 DMA reads */
11 /* 08Dec99 zm Changed Event Descriptor Structure to previous length */
12 /* 03Feb00 zm Changed "ushort ZDCDSM[8]" to "BYTE ZDC[16]" in L0_DSM_Data structure */
13 /* 22Jul00 egj Added L0RegBytes and L0RegHeader to trgDataHeaders and TrgSumData. */
14 /* Also added Mult_Reg, ZDC_Reg and Spare_Reg to TrgSumData, making a */
15 /* total of 16 extra bytes. I compensated for this by removing 16 bytes, */
16 /* (4 uints) from L2Result, wich is currently unused. */
17 /***************************************************************************************/
18 #ifndef _TRG_STRUCTURES_H_
19 #define _TRG_STRUCTURES_H_
20 
21 /* several shortcut definitions */
22 
23 #ifndef uint
24 #define uint unsigned int
25 #endif
26 
27 #ifndef ushort
28 #define ushort unsigned short
29 #endif
30 
31 #ifndef ulong
32 #define ulong unsigned long
33 #endif
34 
35 typedef unsigned char BYTE;
36 typedef unsigned int WORD;
37 
38 #define MAX_RAW_DATA_BLOCKS 11 /* Maximum number of Raw Data Blocks: current + npre + npost */
39 
40 #define FORMAT_VERSION 0x12 /* Format Version number for trigger data */
41 #define EVT_HEAD_LEN sizeof(TrgEvtHeader) /* Trigger Event Header Length */
42 #define EV_DESC_LEN sizeof(EvtDescData) /* Number of bytes in event descriptor */
43 #define L0DSM_DATA_LEN sizeof(L0_DSM_Data) /* Size of data block in L0 DSM Tree */
44 #define RAW_DET_DATA_LEN sizeof(RawTrgDet) /* Size of Raw Detector Data from CTB, MWC with headers */
45 #define TRG_SUM_LEN sizeof(TrgSumData) /* Number of bytes in the trigger summary for DAQ with headers */
46 
47 #define L1_DATA_LEN (EVT_HEAD_LEN+EV_DESC_LEN+TRG_SUM_LEN) /* Size of data passed from L1ANA to L1DC */
48 
49 #define TRG_EVT_LEN (L1_DATA_LEN+(MAX_RAW_DATA_BLOCKS*RAW_DET_DATA_LEN)) /* Max size of a trigger event */
50 #define TDI_EVT_LEN (EV_DESC_LEN+TRG_SUM_LEN+(MAX_RAW_DATA_BLOCKS*RAW_DET_DATA_LEN)) /* size of event sent to TDI */
51 
52 #define CTB_DATA_OFFSET 8 /* Number of bytes CTB Raw data is offset in raw trigger structure */
53 #define RAW_CTB_LEN 256 /* Number of bytes in raw CTB DSMs */
54 
55 /********** trigger structures ***********/
56 
57 /*
58  *
59  * Trigger Data Headers
60  *
61  */
62 
63 typedef struct {
64  unsigned short TrgDataBytes;
65  unsigned short TrgFiller;
66  unsigned short TCUdataBytes;
67  BYTE TrgDataFmtVer;
68  char TCUEvtDesc;
69  unsigned short TrgSumBytes;
70  char TrgSumHeader[2];
71  unsigned short L0SumBytes;
72  char L0SumHeader[2];
73  unsigned short L1SumBytes;
74  char L1SumHeader[2];
75  unsigned short L2SumBytes;
76  char L2SumHeader[2];
77  unsigned short L0RegBytes;
78  char L0RegHeader[2];
79  unsigned short RawDetBytes;
80  char RawDetHeader[2];
81  unsigned short CTBdataBytes;
82  char CTBdataHeader[2];
83  unsigned short MWCdataBytes;
84  char MWCdataHeader[2];
85  unsigned short EMCdataBytes;
86  char EMCdataHeader[2];
88 
89 /* Trigger Event Header */
90 
91 typedef struct {
92  unsigned short TrgDataBytes; /* total bytes in trigger data */
93  unsigned short TrgFiller;
94 } TrgEvtHeader; /* 4 Bytes total */
95 
96 /* Event Descriptor Data Structures */
97 
98 typedef union { /* The contents of Info Fifo 1 */
99  struct {
100  unsigned short DetectorsIn; /* Trigger Token */
101  BYTE TRG_DAQ_cmd; /* Trigger Word */
102  BYTE empty8 ;
103  } FIFO1;
104  unsigned long fifo1;
105 } Info1; /* 32 bits total */
106 
107 typedef union { /* The contents of Info Fifo 1 */
108  struct {
109  unsigned short token ; /* Trigger Token */
110  unsigned short empty16 ;
111  } FIFO2;
112  unsigned long fifo;
113 } Info2; /* 32 bits total */
114 
115 
116 typedef union { /* The contents of Info Fifo 2 */
117  struct {
118  unsigned short DSMInput; /* Last DSM */
119  unsigned short ExternalBusy; /* DSM address */
120  } FIFO3;
121  unsigned long fifo;
122 } Info3; /* 32 bits total */
123 
124 typedef union { /* The contents of Info Fifo 3 */
125  struct {
126  unsigned short ModifiedBusy; /* detector Busy Bits */
127  unsigned short PhysicsWord ;
128  } FIFO4;
129  unsigned long fifo;
130 } Info4; /* 32 bits total */
131 
132 typedef union { /* The contents of Info Fifo 3 */
133  struct {
134  unsigned short TriggerWd ;
135  unsigned short addBits; /* filler Bits - bit 0=pileup; bit 1=priority; bit 7=1 is fake data */
136  } FIFO5;
137  unsigned long fifo;
138 } Info5; /* 32 bits total */
139 
140 typedef union { /* The contents of Info Fifo 3 */
141  struct {
142  unsigned short DSMAddress ;
143  unsigned short ContaminationBusy ;
144  } FIFO6;
145  unsigned long fifo;
146 } Info6; /* 32 bits total */
147 
148 /* Data structure passed from L1CTL to L1ANA */
149 
150 typedef struct {
151  unsigned short TCUdataBytes;
152  char TCUEvtDesc;
153  BYTE TrgDataFmtVer;
154  uint bunchXing_hi;
155  uint bunchXing_lo; /* Two parts of RHIC bunch crossing number */
156  Info1 TCU1; /* TCU Info Fifo's */
157  Info2 TCU2;
158  Info5 TCU5;
159  ushort npre;
160  ushort npost; /* Dummy to bring total size of struct to modulo 8 bytes */
161 } EvtDescData; /* 28 bytes total */
162 
163 /* Trigger Summary Data Structures */
164 
165 /* L0 DSM data structures */
166 
167 typedef struct {
168  ushort CPA[32]; /* Contents of 4 CTB+MWC DSM Input Buffers (IB's) - coarse pixel array*/
169  ushort quadDSM[8]; /* Contents of 1 CTB+MWC DSM IB - outputs of previous 4 */
170  ushort lastDSM[8]; /* Contents of last DSM IB - results of all DSM trees */
171  BYTE ZDC[16]; /* Contents of ZDC DSM IB - raw data from ZDC */
172  ushort BCdata[16]; /* Contents of 2 Bunch Crossing DSMs IB's */
173 } L0_DSM_Data; /* 144 bytes total */
174 
175 
176 /* summary data */
177 
178 typedef struct {
179  unsigned short TrgSumBytes;
180  char TrgSumHeader[2];
181  uint L1Sum[2]; /* L1 Summary */
182  uint L2Sum[2]; /* L2 Summary */
183  unsigned short L0SumBytes;
184  char L0SumHeader[2];
185  L0_DSM_Data DSM; /* L0 DSM Data from DSM Tree */
186  unsigned short L1SumBytes;
187  char L1SumHeader[2];
188  uint L1Result[32]; /* Result from L1 CPU */
189  unsigned short L2SumBytes;
190  char L2SumHeader[2];
191  uint L2Result[28]; /* Result from L2 CPU */
192  unsigned short L0RegBytes;
193  char L0RegHeader[2];
194  unsigned short Mult_Reg[3]; /* The 3 multiplcity thresholds */
195  unsigned short ZDC_Reg[2]; /* The 2 ZDC thresholds */
196  unsigned short Spare_Reg ; /* A spare, brings total for Reg to 16 bytes */
197 } TrgSumData; /* 432 bytes total */
198 
199 
200 /* Data structure passed between L1ANA and L1DC */
201 
202 typedef struct {
203  TrgEvtHeader TrgHead;
204  EvtDescData EvtDesc; /* L1 Event Descriptor Data */
205  TrgSumData TrgSum; /* summary data */
206 } L1dataType; /* 464 bytes */
207 
208 /* Raw Trigger detector data structures */
209 
210 typedef struct {
211  unsigned short RawDetBytes;
212  char RawDetHeader[2];
213  unsigned short CTBdataBytes;
214  char CTBdataHeader[2];
215  BYTE CTB[256]; /* CTB raw data */
216  unsigned short MWCdataBytes;
217  char MWCdataHeader[2];
218  unsigned long MWCfiller; /* dummy to bring header to mod 8 */
219  BYTE MWC[128]; /* MWC raw data */
220  unsigned short EMCdataBytes;
221  char EMCdataHeader[2];
222  unsigned long EMCfiller; /* dummy to bring header to mod 8 */
223 } RawTrgDet; /* 408 bytes total */
224 
225 /* Trigger Event Structure */
226 
227 typedef struct {
228  TrgEvtHeader TrgHead;
229  EvtDescData EvtDesc; /* L1 Event Descriptor Data */
230  TrgSumData TrgSum; /* summary data */
231  RawTrgDet raw[MAX_RAW_DATA_BLOCKS]; /* raw Detector Data with pre and post History */
232 } TrgDataType; /* 4952 bytes */
233 
234 
235 
236 //struct TRGD {
237 // bankHeader bh ;
238 // EvtDescData desc ;
239 // TrgSumData sum ;
240 // RawTrgDet raw[MAX_RAW_DATA_BLOCKS]; /* raw Detector Data with pre and post History */
241 //} ;
242 
243 
244 #endif
Definition: DSM.hh:16