StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
trgStructures2007.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
36  * 30Aug03 JMN Added RAW_MAX_LEN being maximum length possible in chain block transfer
37  * 14Sep03 JMN Added new dsmMemcpy2Buf
38  * 02Nov03 JMN Modified dsmMemcpy2Buf to ensure dsmData is 8-byte aligned.
39  * 04Nov03 EGJ Modified RawTrgDet to add in ZDCSMD[32]
40  * 28Oct04 JMN Modified RawTrgDet to increased BBC storage from 80 to 96
41  * Format version changed from 0x21 to 0x22
42  * 14Nov05 JMN Added source NodeID as first word of data buffer to L2
43  * 16Mar06 CWP Added offsets into L2Result
44  * 20Dec06 JMN Added changes: L2Result increased to 64 ints,
45  * MWC name changed to MIX with 7 DSMs from MTD, VPD and TOF (112 bytes)
46  * FPE changed to 9 DSMs (144 bytes)
47  * FPW changed to 16 DSMs (256) bytes
48  * new array QQT installed after BBC
49  * Block of commented OFFSETs and LEN removed.
50  * Commented out xx_SUM_LEN where xx is L0, L1, L2; and L0_REG_LEN. Unused?
51  * Since these are significant changes, Format changed to 3.0
52  * 05Jan07 JMN Changed CPA[32] to MTD[8],VPD[8],CPA[16]
53  * 29Mar07 JMN Updated L2_Results offsets for CP
54  * 03Apr07 JMN Order MTD,VPD,CPA is changed to CPA,MTD,VPD to reflect order of DSMs in the L1 crate
55  */
56 
57 #ifndef trgStructures2007_h
58 #define trgStructures2007_h
59 
60 #define y7MAX_L0_DATA_BLOCKS 11 /* Maximum number of L0 Data Blocks: current + npre + npost */
61 #define y7MAX_RAW_DATA_BLOCKS 11 /* Maximum number of Raw Data Blocks: current + npre + npost */
62 #define y7FORMAT_VERSION 0x31 /* Format Version number for trigger data */
63 #define y7EV_DESC_LEN sizeof(EvtDescData) /* Number of bytes in event descriptor */
64 #define y7L0DSM_DATA_LEN sizeof(L0_DSM_Data) /* Size of data block in L0 DSM Tree */
65 #define y7RAW_DET_DATA_LEN sizeof(RawTrgDet) /* Size of Raw Detector Data from DSM clients and QT boards */
66 #define y7TRG_SUM_LEN sizeof(TrgSumData) /* Number of bytes in the trigger summary for DAQ with headers */
67 
68 #define y7L1_DATA_LEN (EV_DESC_LEN+TRG_SUM_LEN) /* Size of data passed from L1ANA to L2 */
69 #define y7TRG_EVT_LEN (L1_DATA_LEN+(MAX_RAW_DATA_BLOCKS*RAW_DET_DATA_LEN)) /* Max size of a trigger event */
70 #define y7TDI_EVT_LEN (EV_DESC_LEN+TRG_SUM_LEN+(MAX_RAW_DATA_BLOCKS*RAW_DET_DATA_LEN)) /* size of event sent to DAQ */
71 
72 #define y7RAW_MAX_LEN 272 /* Maximum length of any Chain Block Transfer */
73 
74 #define L2RESULTS_2007_OFFSET_TRG 0
75 #define L2RESULTS_2007_OFFSET_EMC_PED 1
76 #define L2RESULTS_2007_OFFSET_PIG 2
77 #define L2RESULTS_2007_OFFSET_UPS 6
78 #define L2RESULTS_2007_OFFSET_DISPVER 14
79 
80 #define y7ADD_BIT_PILEUP 0 /* Contamination/Pileup bit in event descriptor add-bits */
81 #define y7ADD_BIT_FORCE 5 /* Force store of this event */
82 #define y7ADD_BIT_L2_5 6 /* Level 2.5 abort */
83 #define y7ADD_BIT_SIM 7 /* Simulated event - used by DAQ */
84 
85 /********** Trigger Structures ***********/
86 
87 /* Event Descriptor Data Structures */
88 
89 typedef struct {
90  unsigned short TCUdataBytes;
91  char TCUEvtDesc;
92  unsigned char TrgDataFmtVer;
93  unsigned int bunchXing_hi;
94  unsigned int bunchXing_lo; /* Two parts of RHIC bunch crossing number */
95  unsigned short actionWdDetectorBitMask; /* from Fifo 1 */
96  unsigned char actionWdTrgCommand; /* from Fifo 1 */
97  unsigned char actionWdDaqCommand; /* from Fifo 1 */
98  unsigned short TrgToken; /* from Fifo 2 */
99  unsigned short addBits; /* from Fifo 2 - bit 0=Contamination; bit 6=L2.5 abort; bit 7=1 is fake data */
100  unsigned short DSMInput; /* from Fifo 3 */
101  unsigned short externalBusy; /* from Fifo 3 */
102  unsigned short modifiedBusyStatus; /* from Fifo 4 */
103  unsigned short physicsWord; /* from Fifo 4 */
104  unsigned short TriggerWord; /* from Fifo 5 */
105  unsigned short DSMAddress; /* from Fifo 6 */
106  unsigned short contaminationBusyStatus; /* from Fifo 6 */
107  unsigned short npre; /* pre value for detector raw data */
108  unsigned short npost; /* post value for detector raw data */
109  unsigned short dummy; /* dummy - filler */
110 } EvtDescData2007; /* 40 bytes total */
111 
112 /* Trigger Summary Data Structures */
113 
114 /* L0 DSM data structures */
115 
116 typedef struct {
117  unsigned short CPA[16]; /* Contents of 2 CTB DSM Input Buffers (IB's) - coarse pixel array */
118  unsigned short MTD[8]; /* TAC values for MTD's MRPCs and overlapping CTB trays */
119  unsigned short VPD[8]; /* ADC & TAC values for VPD detectors*/
120  unsigned short CTB[8]; /* CTB ADC sums and topology for East & West combined */
121  unsigned short lastDSM[8]; /* Contents of last DSM IB - results of all DSM trees */
122  unsigned short VTX[8]; /* Separate ZDC and BBC DSMs have been replaced with this one */
123  unsigned short EMC[8]; /* Contents of 1 EMC IB - results of separate BEMC and EEMC DSMs */
124  unsigned short BCdata[16]; /* Contents of 2 Bunch Crossing DSMs IB's */
125  unsigned short specialTriggers[8]; /* Contents of 1 Special Trigger DSM - all the special trigger requests */
126  unsigned short FPD[8]; /* Contents of 1 FPD IB - we are installing this DSM this year but it */
127 } L0_DSM_Data2007; /* 192 bytes total */
128 
129 
130 /* Summary data */
131 
132 typedef struct {
133  unsigned short TrgSumBytes;
134  unsigned short TrgSumHeader;
135  unsigned int L1Sum[2]; /* L1 Summary */
136  unsigned int L2Sum[2]; /* L2 Summary */
137  unsigned short L0SumBytes;
138  unsigned short L0SumHeader;
139  L0_DSM_Data2007 DSMdata; /* L0 DSM Data from DSM Tree */
140  unsigned short L1SumBytes;
141  unsigned short L1SumHeader;
142  unsigned int L1Result[32]; /* Result from L1 CPU */
143  unsigned short L2SumBytes;
144  unsigned short L2SumHeader;
145  unsigned int L2Result[64]; /* Result from L2 CPU. Increased by 128 bytes from version 3.0 */
146 } TrgSumData2007; /* 608 bytes total */
147 
148 /* Data structure passed between L1ANA and L2 */
149 
150 typedef struct {
151  EvtDescData2007 EvtDesc; /* L1 Event Descriptor Data */
152  TrgSumData2007 TrgSum; /* Summary data */
153 } L1dataType2007; /* 648 bytes */
154 
155 /* Raw Trigger Detector data structures */
156 
157 typedef struct {
158  unsigned short RawDetBytes;
159  char RawDetHeader[2];
160  unsigned short CTBdataBytes;
161  char CTBdataHeader[2];
162  unsigned char CTB[256]; /* CTB raw data. Data address must be 8-byte aligned for DMA transfer */
163  unsigned short MIXdataBytes;
164  char MIXdataHeader[2];
165  unsigned int MIXfiller; /* Dummy to bring data address to mod 8 */
166  unsigned char MTD[32]; /* MTD raw data from 2 DSMs */
167  unsigned char VPD[64]; /* VPD raw data from 4 DSMs */
168  unsigned char TOF[16]; /* TOF raw data from 1 DSM */
169  unsigned short BEMCdataBytes;
170  char BEMCdataHeader[2];
171  unsigned int BEMCfiller; /* Dummy to bring data address to mod 8 */
172  unsigned char BEMCEast[240]; /* next year there will be 15 DSMs covering the East half, all in one crate */
173  unsigned char BEMCWest[240]; /* this year there will be 15 DSMs covering the West half, all in one crate */
174  unsigned short BEMClayer1[48]; /* there will be 6 DSMs at layer1 even if only 3 of them have input this year*/
175  unsigned short EEMCdataBytes;
176  char EEMCdataHeader[2];
177  unsigned int EEMCfiller; /* Dummy to bring data address to mod 8 */
178  unsigned short EEMClayer1[16]; /* the two layer1 DSMs are at the LHS of the crate so they get read first */
179  unsigned char EEMC[144]; /* next there are the 9 layer0 DSMs, of which only 4-5 have input this year */
180  unsigned short FPDdataBytes;
181  char FPDdataHeader[2];
182  unsigned int FPDfiller; /* Dummy to bring data address to mod 8 */
183  unsigned char FPDEastNSLayer0[112]; /* fpd east north/south layer 0 */
184  unsigned short FPDEastNSLayer1[8]; /* fpd east north/south layer 1 */
185  unsigned char FPDEastTBLayer0[16]; /* fpd east top/bottom layer 0 */
186  unsigned char FPDW[256]; /* fpd west */
187  unsigned short BBCdataBytes;
188  char BBCdataHeader[2];
189  unsigned int BBCfiller; /* Dummy to bring data address to mod 8 */
190  unsigned char BBC[96]; /* increased from 80 to 96 for the addition of a DSM after layer 0 DSMs */
191  unsigned short BBClayer1[16]; /* this is the layer1 DSM that feeds the VTX DSM */
192  unsigned char ZDCSMD[32]; /* this is the 2 layer0 DSM for the ZDC SMD detector */
193  unsigned char ZDC[16]; /* this is the original ZDC DSM */
194  unsigned short ZDClayer1[8]; /* this is the new layer1 ZDC DSM that also feeds the VTX DSM */
195  unsigned short QQTdataBytes; /* this is new in version 3.0 for data from QT boards */
196  char QQTdataHeader[2];
197  unsigned int QQTfiller; /* Dummy to bring data address to mod 8 */
198  unsigned int QQTdata[1600]; /* data block for FMS. New in version 3.0 */
199 } RawTrgDet2007; /* 8168 bytes total */
200 
201 /* Data block for DSMs and L1 to pass to L2 via myriMemcpy2 */
202 
203 typedef struct {
204  int src_nodeId; /* Source nodeId */
205  int cur_token;
206  int Npre,Npost;
207  unsigned int localClock; /* Local DSM clock */
208  int numGroup; /* Number of DSMs in first group */
209  int numDSM; /* Total number of DSMs */
210  int dummy; /* Ensure alignment of long long */
211  long long dsmData[y7RAW_MAX_LEN*y7MAX_RAW_DATA_BLOCKS/8]; /* Make this 8-byte aligned */
213 
214 
215 /* Trigger Event Structure */
216 
218  EvtDescData2007 EvtDesc; /* L1 Event Descriptor Data : 40 bytes */
219  TrgSumData2007 TrgSum; /* Summary data: 608 bytes */
220  RawTrgDet2007 rawTriggerDet[y7MAX_RAW_DATA_BLOCKS]; /* Raw Detector Data with pre and post History: 11*3368 bytes */
221 } ; /* 90496 bytes */
222 
223 #endif