StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
trgDataDefs_43.h
1 #ifndef TRG_DATA_DEFS
2 #define TRG_DATA_DEFS
3 /******
4 *
5 * Layout of new Trigger Data Block
6 *
7 * J.M. Nelson 30 January 2009
8 *
9 * Notes: The event descriptor will describe data from either
10 * the Mk1 or Mk2 TCUs. The variable TCU_Mark will be 1 for Mk1
11 * and 2 for the Mk2 TCU. Variables not used by one or other of the
12 * TCUs will be zero.
13 *
14 * The data block structure will always begin with a 4 character
15 * name, followed by the byte-count of data following. The structure of
16 * data will depend on the configuration of particular crates.
17 *
18 * Note: PrePost data will only be available on local trigger disks and
19 * will not be present in event files.
20 ******************************************************************************/
21 #define FORMAT_VERSION 0x15113043 /* Format: yymmddvv */
22 #define MAX_TRG_BLK_SIZE 122896 /* Current total: 113.25k bytes for pre/post non-zero suppressed data. Allow 120k */
23 #define MAX_OFFLEN 20 /* Depends on the number of crates in the system */
24 
25 #define ADD_BIT_FORCE 5 /* Force store of this event */
26 #define ADD_BIT_L2_5 6 /* Level 2.5 abort */
27 #define ADD_BIT_SIM 7 /* Simulated event - used by DAQ */
28 
29  /* Event Descriptor Data Structures */
30 
31 #pragma pack(1)
32 
33 typedef struct {
34  char name[3]; /* Contains EVD */
35  char TrgDataFmtVer; /* Exception for use by DAQ (LS byte of FORMAT_VERSION) */
36  int length; /* Byte count of data that follows */
37  unsigned int bunchXing_hi;
38  unsigned int bunchXing_lo; /* Two parts of RHIC bunch crossing number */
39  unsigned short actionWdDetectorBitMask; /* from Fifo 1 */
40  unsigned char actionWdTrgCommand; /* from Fifo 1 */
41  unsigned char actionWdDaqCommand; /* from Fifo 1 */
42  unsigned short TrgToken; /* from Fifo 2 */
43  unsigned short addBits; /* used by trigger/daq: bit 5=Force store; bit 6=L2.5 abort; bit 7=1 is fake data */
44  unsigned short DSMInput; /* only for use with Mk1 TCU. 0 if Mk2 TCU is used */
45  unsigned short externalBusy; /* from Fifo 9 (Fifo 3 Mk1 TCU) */
46  unsigned short internalBusy; /* from Fifo 9 (Mk2 TCU) */
47 
48 
49 #ifndef __linux
50  unsigned int tcuCtrBunch;
51 #else
52  union {
53  struct {
54  unsigned short physicsWord; /* Fifo 4 Mk1 TCU. 0 if Mk2 TCU is used */
55  unsigned short TriggerWord; /* Fifo 5 Mk1 TCU. 0 if Mk2 TCU is used */
56  };
57  unsigned int tcuCtrBunch;
58  };
59 #endif
60 
61 
62  unsigned short DSMAddress; /* from Fifo 10 (Fifo 6 Mk1 TCU) */
63  unsigned short TCU_Mark; /* TCU_Mark Mk1=1 Mk2=2 */
64  unsigned short npre; /* pre value for detector raw data */
65  unsigned short npost; /* post value for detector raw data */
66  unsigned short res1; /* Reserved for future use */
67 } EvtDescData;
68 
69 #pragma pack()
70 
71  /* L1 DSM data structures */
72 
73 typedef struct {
74  char name[4]; /* Contains L1DS */
75  int length; /* Byte count of data that follows */
76  unsigned short TOF[8]; /* TOF and MTD data */
77  unsigned short VTX[8]; /* Separate VPD, ZDC and BBC DSMs have been replaced with this one */
78  unsigned short EMC[8]; /* Contents of 1 EMC IB - results of separate BEMC and EEMC DSMs */
79  unsigned short TPCMask[8]; /* TPC mask for DAQ10K */
80  unsigned short BCdata[16]; /* Contents of 2 Bunch Crossing DSMs IB's */
81  unsigned short specialTriggers[8]; /* Contents of 1 Special Trigger DSM - all the special trigger requests */
82  unsigned short FPD[8]; /* Contents of 1 FMS and FPD IB */
83  unsigned short lastDSM[8]; /* Contents of last DSM IB - results of all DSM trees */
84 } L1_DSM_Data;
85 
86  /* Trigger Summary Data Structures */
87 
88 typedef struct {
89  char name[4]; /* Contains TSUM */
90  int length; /* Byte count of data that follows */
91  unsigned int L1Sum[2]; /* L1 Summary */
92  unsigned int L2Sum[2]; /* L2 Summary */
93  unsigned int L1Result[32]; /* Result from L1 CPU */
94  unsigned int L2Result[64]; /* Result from L2 CPU */
95  unsigned int C2Result[64]; /* Result from last algorithm */
96  unsigned int LocalClocks[32]; /* localClock values from RCC2*/
97 } TrgSumData;
98 
99 typedef struct {
100  char name[4];
101  int length; /* Byte count of data that follows */
102  unsigned int data[1]; /* NB: this definition is generic but would vary depending on actual data */
103 } DataBlock;
104 
105 typedef struct {
106  char name[4]; /* Contains BBC */
107  int length; /* Byte count of data that follows */
108  unsigned short BBClayer1[16]; /* This is the layer1 DSM that feeds the VTX DSM */
109  unsigned short ZDClayer1[8]; /* This is the new layer1 ZDC DSM that also feeds the VTX DSM */
110  unsigned short VPD[8]; /* ADC & TAC values for VPD detectors*/
111 } BBCBlock;
112 
113 typedef struct {
114  char name[4]; /* Contains MIX */
115  int length; /* Byte count of data that follows */
116  unsigned short FPDEastNSLayer1[8]; /* FPD east north/south layer 1 */
117  unsigned char MTD_P2PLayer1[16]; /* Data from MTD and PP2PP */
118  unsigned short TOFLayer1[8]; /* This is TOF Layer 1 */
119  unsigned short TOF[48]; /* TOF data */
120  unsigned short TPCpreMask[24]; /* EMC, MTD, & TOF TPC Grid Masks */
121 } MIXBlock;
122 
123 typedef struct {
124  char name[4];
125  int length; /* Byte count of data that follows */
126  int dataLoss; /* Byte count of data truncated due to buffer limitations */
127  unsigned int data[1]; /* NB: this definition is generic but would vary depending on actual data */
128 } QTBlock;
129 
130 typedef struct {
131  char name[4];
132  int length;
133  unsigned char BEMCEast[240]; /* 15 DSMs covering the East half of BEMC */
134 } BEastBlock;
135 
136 typedef struct {
137  char name[4];
138  int length;
139  unsigned char BEMCWest[240]; /* 15 DSMs covering the West half of BEMC */
140 } BWestBlock;
141 
142 typedef struct {
143  char name[4];
144  int length;
145  unsigned short BEMClayer1[48]; /* 6 DSMs for BEMC at layer1 */
146  unsigned short EEMClayer1[16]; /* 2 DSMs for EEMC at layer1 */
147  unsigned char EEMC[144]; /* 9 DSMs for EEMC at layer0 */
148 } BELayerBlock;
149 
150 typedef struct {
151  char name[4];
152  int length;
153  unsigned char FMS[256]; /* 16 DSMs for FMS */
154 } FMSBlock;
155 
156 typedef struct {
157  int offset; /* Offset (in bytes) from the start of Trigger block to data */
158  int length; /* Length (in bytes) of data */
159 } TrgOfflen;
160 
161 typedef struct {
162  int FormatVersion; /* Trigger Data Definition Version yymmddvv */
163  int totalTriggerLength; /* Total length (bytes) of complete Trigger Block */
164  int eventNumber; /* Event number in this run */
165  TrgOfflen EventDesc_ofl; /* Offset/length pair to Event Descriptor */
166  TrgOfflen L1_DSM_ofl; /* Offset/length pair to L1 DSM Data */
167  TrgOfflen Summary_ofl; /* Offset/length pair to Summary Data */
168  TrgOfflen MainX[MAX_OFFLEN]; /* Offset/length pairs for main crossing */
169  int PrePostList[10]; /* Offsets to offset/length pairs to Pre and Post crossing */
170  int raw_data[MAX_TRG_BLK_SIZE/4]; /* Storage for raw data */
172 
173 
174 
175 // jml - 9/12/11
176 //
177 // These are the data blocks transferred from L1 --> L2 via stp
178 // Back engineered and relabled.
179 // Originally there were multiple instances of these structures in a very confusing set of
180 // of local directories and trgStructures.h etc... Many structs were not consistent
181 //
182 // The 2011 nomenclature is just to differentiate between these structs and the obsolete ones. The
183 // underlying format does not change in 2011
184 
185 // These are the datum that L1 creates...
186 typedef struct {
187  EvtDescData EvtDesc; /* L1 Event Descriptor Data */
188  L1_DSM_Data L1_DSM; /* L1 DSM Data */
189  TrgSumData TrgSum; /* Summary data */
191 
192 // This is the specialized L1 version of the dsmMemcpy2Buf packet
193 // which is shipped L1-->L2 Note that the size is 876 bytes which is not 8 byte aligned
194 // The start of this buffer has to be 8 byte aligned for STP sends, however...
195 typedef struct {
196  int src_nodeId; /* Source nodeId */
197  int cur_token;
198  int Npre;
199  int Npost;
200  unsigned int localClock; /* Local RCC2 clock */
201  int numGroup; /* Number of DSMs in first group */
202  int numDSM; /* Total number of DSMs */
203  int byteCount; /* Ensure alignment of long long */
204 
205  //long long dsmData[RAW_MAX_LEN*11/8]; /* Make this 8-byte aligned */
206  L1DataType2011 l1Data; // This is the true format of the "dsmData" for L1
208 
209 // This structure is for internal use in L1. This structure has a length that is 8-byte
210 // aligned so that elements of an array remain 8 byte aligned.
211 typedef struct {
213  unsigned int currentBusy; // keep padded though!
214  // UINT32 pad;
216 
217 #endif
218