StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
trgStructures.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 /* 08Dec00 JMN Changed char hdr[2] in TrgSummary to unsigned short, which is packed */
18 /* 25Feb01 JMN Redesigned and expanded abbreviations to full. */
19 /* 12Mar01 JMN Added additional changes from ZM */
20 /* 30May01 JMN NBNBNBNB Changed FORMAT version from 0x12 to 0x13 */
21 /* 02Jun01 zm defined bit 6 in addBits info FIFO3 for L2.5 abort */
22 /* 27Jun01 JMN Added definition of number of bytes used in trigger summary headers */
23 /* 28Jun01 JMN Added definition of ADD_BITs */
24 /***************************************************************************************/
25 
26 #ifndef trgStructures_h
27 #define trgStructures_h
28 #define MAX_RAW_DATA_BLOCKS 11 /* Maximum number of Raw Data Blocks: current + npre + npost */
29 #define FORMAT_VERSION 0x13 /* Format Version number for trigger data */
30 #define EVT_HEAD_LEN sizeof(TrgEvtHeader) /* Trigger Event Header Length */
31 #define EV_DESC_LEN sizeof(EvtDescData) /* Number of bytes in event descriptor */
32 #define L0DSM_DATA_LEN sizeof(L0_DSM_Data) /* Size of data block in L0 DSM Tree */
33 #define RAW_DET_DATA_LEN sizeof(RawTrgDet) /* Size of Raw Detector Data from CTB, MWC with headers */
34 #define TRG_SUM_LEN sizeof(TrgSumData) /* Number of bytes in the trigger summary for DAQ with headers */
35 
36 #define L1_DATA_LEN (EVT_HEAD_LEN+EV_DESC_LEN+TRG_SUM_LEN) /* Size of data passed from L1ANA to L1DC */
37 #define TRG_EVT_LEN (L1_DATA_LEN+(MAX_RAW_DATA_BLOCKS*RAW_DET_DATA_LEN)) /* Max size of a trigger event */
38 #define TDI_EVT_LEN (EV_DESC_LEN+TRG_SUM_LEN+(MAX_RAW_DATA_BLOCKS*RAW_DET_DATA_LEN)) /* size of event sent to TDI */
39 
40 #define L0_SUM_LEN 148 /* Number of bytes in L0 Summary + Header */
41 #define L1_SUM_LEN 132 /* Number of bytes in L1 Summary + Header */
42 #define L2_SUM_LEN 116 /* Number of bytes in L2 Summary + Header */
43 #define L0_REG_LEN 16 /* Number of bytes in L0 Register + Header */
44 
45 #define CTB_DATA_OFFSET 8 /* Number of bytes CTB Raw data is offset in raw trigger structure */
46 #define RAW_CTB_LEN 256 /* Number of bytes in raw CTB DSMs */
47 #define MWC_DATA_OFFSET 272 /* Number of bytes MWC Raw data is offset in raw trigger structure */
48 #define RAW_MWC_LEN 128 /* Number of bytes in raw CTB DSMs */
49 #define BEMC_DATA_OFFSET 408 /* Number of bytes MWC Raw data is offset in raw trigger structure */
50 #define RAW_BEMC_LEN 128 /* Number of bytes in raw CTB DSMs */
51 
52 #define ADD_BIT_PILEUP 0 /* Pileup bit in event descriptor add-bits */
53 #define ADD_BIT_PRIORITY 1 /* Priority bit */
54 #define ADD_BIT_FORCE 5 /* Force store of this event */
55 #define ADD_BIT_L2_5 6 /* Level 2.5 abort */
56 #define ADD_BIT_SIM 7 /* Simulated event - used by DAQ */
57 /********** Trigger Structures ***********/
58 
59 /*
60  *
61  * Trigger Data Headers
62  *
63  */
64 
65 typedef struct {
66  unsigned short TrgDataBytes;
67  unsigned short TrgFiller;
68  unsigned short TCUdataBytes;
69  unsigned char TrgDataFmtVer;
70  char TCUEvtDesc;
71  unsigned short TrgSumBytes;
72  unsigned short TrgSumHeader;
73  unsigned short L0SumBytes;
74  unsigned short L0SumHeader;
75  unsigned short L1SumBytes;
76  unsigned short L1SumHeader;
77  unsigned short L2SumBytes;
78  unsigned short L2SumHeader;
79  unsigned short L0RegBytes;
80  unsigned short L0RegHeader;
81  unsigned short RawDetBytes;
82  char RawDetHeader[2];
83  unsigned short CTBdataBytes;
84  char CTBdataHeader[2];
85  unsigned short MWCdataBytes;
86  char MWCdataHeader[2];
87  unsigned short EMCdataBytes;
88  char EMCdataHeader[2];
90 
91 /* Trigger Event Header */
92 
93 typedef struct {
94  unsigned short TrgDataBytes; /* Total bytes in trigger data */
95  unsigned short TrgFiller;
96 } TrgEvtHeader; /* 4 Bytes total */
97 
98 /* Event Descriptor Data Structures */
99 
100 typedef union { /* The contents of Info Fifo 1 */
101  struct {
102  unsigned short TrgToken; /* Trigger Token */
103  unsigned short TrgActionWd; /* Trigger Action Word */
104  } FIFO1;
105  unsigned int fifo1;
106 } Info1; /* 32 bits total */
107 
108 
109 typedef union { /* The contents of Info Fifo 2 */
110  struct {
111  unsigned short DSMInput; /* Last DSM */
112  unsigned short DSMAddress; /* DSM address */
113  } FIFO2;
114  unsigned int fifo2;
115 } Info2; /* 32 bits total */
116 
117 
118 typedef union { /* The contents of Info Fifo 3 */
119  struct {
120  unsigned char DetectorBusy; /* Detector Busy Bits */
121  unsigned char addBits; /* Filler Bits - bit 0=pileup; bit 1=priority; bit 6=L2.5 abort; bit 7=1 is fake data */
122  unsigned short TriggerWd; /* Trigger Word */
123  } FIFO3;
124  unsigned int fifo3;
125 } Info3; /* 32 bits total */
126 
127 /* Data structure passed from L1CTL to L1ANA */
128 
129 typedef struct {
130  unsigned short TCUdataBytes;
131  char TCUEvtDesc;
132  unsigned char TrgDataFmtVer;
133  unsigned int bunchXing_hi;
134  unsigned int bunchXing_lo; /* Two parts of RHIC bunch crossing number */
135  Info1 TCU1; /* TCU Info Fifo's */
136  Info2 TCU2;
137  Info3 TCU3;
138  unsigned short npre;
139  unsigned short npost; /* Dummy to bring total size of struct to modulo 8 bytes */
140 } EvtDescData; /* 28 bytes total */
141 
142 /* Trigger Summary Data Structures */
143 
144 /* L0 DSM data structures */
145 
146 typedef struct {
147  unsigned short CPA[32]; /* Contents of 4 CTB+MWC DSM Input Buffers (IB's) - coarse pixel array*/
148  unsigned short quadDSM[8]; /* Contents of 1 CTB+MWC DSM IB - outputs of previous 4 */
149  unsigned short lastDSM[8]; /* Contents of last DSM IB - results of all DSM trees */
150  unsigned char ZDC[16]; /* Contents of ZDC DSM IB - raw data from ZDC */
151  unsigned short BCdata[16]; /* Contents of 2 Bunch Crossing DSMs IB's */
152 } L0_DSM_Data; /* 144 bytes total */
153 
154 /* Summary data */
155 
156 typedef struct {
157  unsigned short TrgSumBytes;
158  unsigned short TrgSumHeader;
159  unsigned int L1Sum[2]; /* L1 Summary */
160  unsigned int L2Sum[2]; /* L2 Summary */
161  unsigned short L0SumBytes;
162  unsigned short L0SumHeader;
163  L0_DSM_Data DSM; /* L0 DSM Data from DSM Tree */
164  unsigned short L1SumBytes;
165  unsigned short L1SumHeader;
166  unsigned int L1Result[32]; /* Result from L1 CPU */
167  unsigned short L2SumBytes;
168  unsigned short L2SumHeader;
169  unsigned int L2Result[28]; /* Result from L2 CPU */
170  unsigned short L0RegBytes;
171  unsigned short L0RegHeader;
172  unsigned short Mult_Reg[3]; /* The 3 multiplcity thresholds */
173  unsigned short ZDC_Reg[2]; /* The 2 ZDC thresholds */
174  unsigned short Spare_Reg; /* A spare, brings total for Reg to 16 bytes */
175 } TrgSumData; /* 432 bytes total */
176 
177 /* Data structure passed between L1ANA and L1DC */
178 
179 typedef struct {
180  TrgEvtHeader TrgHead;
181  EvtDescData EvtDesc; /* L1 Event Descriptor Data */
182  TrgSumData TrgSum; /* Summary data */
183 } L1dataType; /* 464 bytes */
184 
185 /* Raw Trigger Detector data structures */
186 
187 typedef struct {
188  unsigned short RawDetBytes;
189  char RawDetHeader[2];
190  unsigned short CTBdataBytes;
191  char CTBdataHeader[2];
192  unsigned char CTB[256]; /* CTB raw data */
193  unsigned short MWCdataBytes;
194  char MWCdataHeader[2];
195  unsigned int MWCfiller; /* Dummy to bring header to mod 8 */
196  unsigned char MWC[128]; /* MWC raw data */
197  unsigned short EMCdataBytes;
198  char EMCdataHeader[2];
199  unsigned int EMCfiller; /* Dummy to bring header to mod 8 */
200  unsigned char BEMC[128]; /* BEMC raw data */ /* NOTE!!!! THIS IS TEMPORARY _ MAY CHANGE */
201 } RawTrgDet; /* 536 bytes total */
202 
203 /* Trigger Event Structure */
204 
205 struct TrgDataType {
206  TrgEvtHeader TrgHead;
207  EvtDescData EvtDesc; /* L1 Event Descriptor Data */
208  TrgSumData TrgSum; /* Summary data */
209  RawTrgDet RAW[MAX_RAW_DATA_BLOCKS]; /* Raw Detector Data with pre and post History */
210 } ; /* 6360 bytes */
211 
212 #endif
Definition: DSM.hh:16