StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
trgStructures_20.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  * 10Apr02 zm basic strawman for new structures with new TCU and added detectors
25  * 22May02 zm removed references to current non-existent trigger event header
26  * 24May02 zm incorporated eleanor's comments
27  * 24May02 zm the L0_DSM_Data instance changed from DSM to DSMdata to be able to compile on linux
28  * 19Jun02 zm removed or commented out references to TrgEvtHeader
29  * 05Aug02 JMN changes in event descriptor - moved filler word to end
30  * 15Aug02 HjC correct bytes for FPD
31  * 21Nov02 zm corrections based on eleanor's email: L0 layout for bunch xing,
32  * special and fpd elements; fpd broken down for east/west nort/south
33  * vs top/bottom and layer 1 or 0;
34  * also finished XXX_DATA_OFFSET and RAW_XXX_LEN for passing data from
35  * dsm nodes to l2
36  */
37 
38 #ifndef trgStructures_h
39 #define trgStructures_h
40 
41 #define MAX_L0_DATA_BLOCKS 11 /* Maximum number of L0 Data Blocks: current + npre + npost */
42 #define MAX_RAW_DATA_BLOCKS 11 /* Maximum number of Raw Data Blocks: current + npre + npost */
43 #define FORMAT_VERSION 0x20 /* Format Version number for trigger data */
44 #define EV_DESC_LEN sizeof(EvtDescData) /* Number of bytes in event descriptor */
45 #define L0DSM_DATA_LEN sizeof(L0_DSM_Data) /* Size of data block in L0 DSM Tree */
46 #define RAW_DET_DATA_LEN sizeof(RawTrgDet) /* Size of Raw Detector Data from CTB, MWC with headers */
47 #define TRG_SUM_LEN sizeof(TrgSumData) /* Number of bytes in the trigger summary for DAQ with headers */
48 
49 #define L1_DATA_LEN (EV_DESC_LEN+TRG_SUM_LEN) /* Size of data passed from L1ANA to L2 */
50 #define TRG_EVT_LEN (L1_DATA_LEN+(MAX_RAW_DATA_BLOCKS*RAW_DET_DATA_LEN)) /* Max size of a trigger event */
51 #define TDI_EVT_LEN (EV_DESC_LEN+TRG_SUM_LEN+(MAX_RAW_DATA_BLOCKS*RAW_DET_DATA_LEN)) /* size of event sent to TDI */
52 
53 #define L0_SUM_LEN 148 /* Number of bytes in L0 Summary + Header */
54 #define L1_SUM_LEN 132 /* Number of bytes in L1 Summary + Header */
55 #define L2_SUM_LEN 116 /* Number of bytes in L2 Summary + Header */
56 #define L0_REG_LEN 16 /* Number of bytes in L0 Register + Header */
57 
58 #define CTB_DATA_OFFSET 8 /* Number of bytes CTB Raw data is offset in raw trigger structure */
59 #define RAW_CTB_LEN 256 /* Number of bytes in raw CTB DSMs */
60 #define MWC_DATA_OFFSET 272 /* Number of bytes MWC Raw data is offset in raw trigger structure */
61 #define RAW_MWC_LEN 128 /* Number of bytes in raw CTB DSMs */
62 #define BCE_DATA_OFFSET 408 /* Number of bytes BMC Raw data is offset in raw trigger structure */
63 #define RAW_BCE_LEN 240
64 #define BCW_DATA_OFFSET 648
65 #define RAW_BCW_LEN 240
66 #define BC1_DATA_OFFSET 888
67 #define RAW_BC1_LEN 96
68 #define EEC_DATA_OFFSET 992
69 #define RAW_EEC_LEN 176
70 #define FPE_DATA_OFFSET 1176 /* everything after this will have to be re-done */
71 #define RAW_FPE_LEN 208
72 #define FPW_DATA_OFFSET 1384
73 #define RAW_FPW_LEN 208
74 #define BBC_DATA_OFFSET 1600
75 #define RAW_BBC_LEN 144 /* Number of bytes in BBC and ZDC raw data structures */
76 
77 
78 #define ADD_BIT_PILEUP 0 /* Contamination/Pileup bit in event descriptor add-bits */
79 #define ADD_BIT_FORCE 5 /* Force store of this event */
80 #define ADD_BIT_L2_5 6 /* Level 2.5 abort */
81 #define ADD_BIT_SIM 7 /* Simulated event - used by DAQ */
82 
83 /********** Trigger Structures ***********/
84 
85 /* Event Descriptor Data Structures */
86 
87 
88 typedef struct {
89  unsigned short TCUdataBytes;
90  char TCUEvtDesc;
91  unsigned char TrgDataFmtVer;
92  unsigned int bunchXing_hi;
93  unsigned int bunchXing_lo; /* Two parts of RHIC bunch crossing number */
94  unsigned short actionWdDetectorBitMask; /* from Fifo 1 */
95  unsigned char actionWdTrgCommand; /* from Fifo 1 */
96  unsigned char actionWdDaqCommand; /* from Fifo 1 */
97  unsigned short TrgToken; /* from Fifo 2 */
98  unsigned short addBits; /* from Fifo 2 - bit 0=Contamination; bit 6=L2.5 abort; bit 7=1 is fake data */
99  unsigned short DSMInput; /* from Fifo 3 */
100  unsigned short externalBusy; /* from Fifo 3 */
101  unsigned short modifiedBusyStatus; /* from Fifo 4 */
102  unsigned short physicsWord; /* from Fifo 4 */
103  unsigned short TriggerWord; /* from Fifo 5 */
104  unsigned short DSMAddress; /* from Fifo 6 */
105  unsigned short contaminationBusyStatus; /* from Fifo 6 */
106  unsigned short npre; /* pre value for detector raw data */
107  unsigned short npost; /* post value for detector raw data */
108  unsigned short dummy; /* dummy - filler */
109 } EvtDescData; /* 40 bytes total */
110 
111 /* Trigger Summary Data Structures */
112 
113 /* L0 DSM data structures */
114 
115 typedef struct {
116  unsigned short CPA[32]; /* Contents of 4 CTB+MWC DSM Input Buffers (IB's) - coarse pixel array*/
117  unsigned short quadDSM[8]; /* Contents of 1 CTB+MWC DSM IB - outputs of previous 4 */
118  unsigned short lastDSM[8]; /* Contents of last DSM IB - results of all DSM trees */
119  unsigned short VTX[8]; /* Separate ZDC and BBC DSMs have been replaced with this one */
120  unsigned short EMC[8]; /* Contents of 1 EMC IB - results of separate BEMC and EEMC DSMs */
121  unsigned short BCdata[16]; /* Contents of 2 Bunch Crossing DSMs IB's */
122  unsigned short specialTriggers[8]; /* Contents of 1 Special Trigger DSM - all the special trigger requests */
123  unsigned short FPD[8]; /* Contents of 1 FPD IB - we are installing this DSM this year but it */
124 } L0_DSM_Data; /* 192 bytes total */
125 
126 
127 /* Summary data */
128 
129 typedef struct {
130  unsigned short TrgSumBytes;
131  unsigned short TrgSumHeader;
132  unsigned int L1Sum[2]; /* L1 Summary */
133  unsigned int L2Sum[2]; /* L2 Summary */
134  unsigned short L0SumBytes;
135  unsigned short L0SumHeader;
136  L0_DSM_Data DSMdata; /* L0 DSM Data from DSM Tree */
137  unsigned short L1SumBytes;
138  unsigned short L1SumHeader;
139  unsigned int L1Result[32]; /* Result from L1 CPU */
140  unsigned short L2SumBytes;
141  unsigned short L2SumHeader;
142  unsigned int L2Result[32]; /* Result from L2 CPU */
143 } TrgSumData; /* 480 bytes total */
144 
145 /* Data structure passed between L1ANA and L2 */
146 
147 typedef struct {
148  EvtDescData EvtDesc; /* L1 Event Descriptor Data */
149  TrgSumData TrgSum; /* Summary data */
150 } L1dataType; /* 520 bytes */
151 
152 /* Raw Trigger Detector data structures */
153 
154 typedef struct {
155  unsigned short RawDetBytes;
156  char RawDetHeader[2];
157  unsigned short CTBdataBytes;
158  char CTBdataHeader[2];
159  unsigned char CTB[256]; /* CTB raw data */
160  unsigned short MWCdataBytes;
161  char MWCdataHeader[2];
162  unsigned int MWCfiller; /* Dummy to bring header to mod 8 */
163  unsigned char MWC[128]; /* MWC raw data */
164  unsigned short BEMCdataBytes;
165  char BEMCdataHeader[2];
166  unsigned int BEMCfiller; /* Dummy to bring header to mod 8 */
167  unsigned char BEMCEast[240]; /* next year there will be 15 DSMs covering the East half, all in one crate */
168  unsigned char BEMCWest[240]; /* this year there will be 15 DSMs covering the West half, all in one crate */
169  unsigned short BEMClayer1[48]; /* there will be 6 DSMs at layer1 even if only 3 of them have input this year*/
170  unsigned short EEMCdataBytes;
171  char EEMCdataHeader[2];
172  unsigned int EEMCfiller; /* Dummy to bring header to mod 8 */
173  unsigned short EEMClayer1[16]; /* the two layer1 DSMs are at the LHS of the crate so they get read first */
174  unsigned char EEMC[144]; /* next there are the 9 layer0 DSMs, of which only 4-5 have input this year */
175  unsigned short FPDdataBytes;
176  char FPDdataHeader[2];
177  unsigned int FPDfiller; /* Dummy to bring header to mod 8 */
178  unsigned char FPDEastNSLayer0[112]; /* fpd east north/south layer 0 */
179  unsigned short FPDEastNSLayer1[8]; /* fpd east north/south layer 1 */
180  unsigned char FPDEastTBLayer0[64]; /* fpd east top/bottom layer 0 */
181  unsigned short FPDEastTBLayer1[8]; /* fpd east north/south layer 1 */
182  unsigned char FPDWestNSLayer0[112]; /* fpd east north/south layer 0 */
183  unsigned short FPDWestNSLayer1[8]; /* fpd east north/south layer 1 */
184  unsigned char FPDWestTBLayer0[64]; /* fpd east north/south layer 0 */
185  unsigned short FPDWestTBLayer1[8]; /* fpd east north/south layer 1 */
186  unsigned short BBCdataBytes;
187  char BBCdataHeader[2];
188  unsigned int BBCfiller; /* Dummy to bring header to mod 8 */
189  unsigned char BBC[80]; /* this stays as is */
190  unsigned short BBClayer1[16]; /* this is the layer1 DSM that feeds the VTX DSM */
191  unsigned char ZDC[16]; /* this is the original ZDC DSM */
192  unsigned short ZDClayer1[8]; /* this is the new layer1 ZDC DSM that also feeds the VTX DSM */
193 } RawTrgDet; /* 1744 bytes total */
194 
195 /* Trigger Event Structure */
196 
197 typedef struct {
198  EvtDescData EvtDesc; /* L1 Event Descriptor Data */
199  TrgSumData TrgSum; /* Summary data */
200  RawTrgDet rawTriggerDet[MAX_RAW_DATA_BLOCKS]; /* Raw Detector Data with pre and post History */
201 } TrgDataType; /* 19704 bytes */
202 
203 
204 #endif