StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
trgDataDefs_40.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 #include "daqFormats.h"
22 #define FORMAT_VERSION 0x09013040 /* 30 Jan 2009; Version 4.0 Format: yymmddvv */
23 #define MAX_TRG_BLK_SIZE 122880 /* Current total: 113.25k bytes for pre/post non-zero suppressed data. Allow 120k */
24 #define MAX_OFFLEN 20 /* Depends on the number of crates in the system */
25 
26 #define ADD_BIT_CONTAMINATION 4
27 #define ADD_BIT_FORCE 5 /* Force store of this event */
28 #define ADD_BIT_L2_5 6 /* Level 2.5 abort */
29 #define ADD_BIT_SIM 7 /* Simulated event - used by DAQ */
30 
31  /* Event Descriptor Data Structures */
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  unsigned short physicsWord; /* Fifo 4 Mk1 TCU. 0 if Mk2 TCU is used */
48  unsigned short TriggerWord; /* Fifo 5 Mk1 TCU. 0 if Mk2 TCU is used */
49  unsigned short DSMAddress; /* from Fifo 10 (Fifo 6 Mk1 TCU) */
50  unsigned short TCU_Mark; /* TCU_Mark Mk1=1 Mk2=2 */
51  unsigned short npre; /* pre value for detector raw data */
52  unsigned short npost; /* post value for detector raw data */
53  unsigned short res1; /* Reserved for future use */
54 } EvtDescData;
55 
56  /* L1 DSM data structures */
57 
58 typedef struct {
59  char name[4]; /* Contains L1DS */
60  int length; /* Byte count of data that follows */
61  unsigned short TOF[8]; /* TOF and MTD data */
62  unsigned short VTX[8]; /* Separate VPD, ZDC and BBC DSMs have been replaced with this one */
63  unsigned short EMC[8]; /* Contents of 1 EMC IB - results of separate BEMC and EEMC DSMs */
64  unsigned short BCdata[16]; /* Contents of 2 Bunch Crossing DSMs IB's */
65  unsigned short specialTriggers[8]; /* Contents of 1 Special Trigger DSM - all the special trigger requests */
66  unsigned short FPD[8]; /* Contents of 1 FMS and FPD IB */
67  unsigned short lastDSM[8]; /* Contents of last DSM IB - results of all DSM trees */
68 } L1_DSM_Data;
69 
70  /* Trigger Summary Data Structures */
71 
72 typedef struct {
73  char name[4]; /* Contains TSUM */
74  int length; /* Byte count of data that follows */
75  unsigned int L1Sum[2]; /* L1 Summary */
76  unsigned int L2Sum[2]; /* L2 Summary */
77  unsigned int L1Result[32]; /* Result from L1 CPU */
78  unsigned int L2Result[64]; /* Result from L2 CPU */
79  unsigned int C2Result[64]; /* Result from last algorithm */
80 } TrgSumData;
81 
82 typedef struct {
83  char name[4];
84  int length; /* Byte count of data that follows */
85  unsigned int data[1]; /* NB: this definition is generic but would vary depending on actual data */
86 } DataBlock;
87 
88 typedef struct {
89  char name[4]; /* Contains BBC */
90  int length; /* Byte count of data that follows */
91  unsigned short BBClayer1[16]; /* This is the layer1 DSM that feeds the VTX DSM */
92  unsigned short ZDClayer1[8]; /* This is the new layer1 ZDC DSM that also feeds the VTX DSM */
93  unsigned short VPD[8]; /* ADC & TAC values for VPD detectors*/
94 } BBCBlock;
95 
96 typedef struct {
97  char name[4]; /* Contains MIX */
98  int length; /* Byte count of data that follows */
99  unsigned short FPDEastNSLayer1[8]; /* FPD east north/south layer 1 */
100  unsigned char MTD_P2PLayer1[16]; /* Data from MTD and PP2PP */
101  unsigned short TOFLayer1[8]; /* This is TOF Layer 1 */
102  unsigned short TOF[48]; /* TOF data */
103 } MIXBlock;
104 
105 typedef struct {
106  char name[4];
107  int length; /* Byte count of data that follows */
108  int dataLoss; /* Byte count of data truncated due to buffer limitations */
109  unsigned int data[1]; /* NB: this definition is generic but would vary depending on actual data */
110 } QTBlock;
111 
112 typedef struct {
113  char name[4];
114  int length;
115  unsigned char BEMCEast[240]; /* 15 DSMs covering the East half of BEMC */
116 } BEastBlock;
117 
118 typedef struct {
119  char name[4];
120  int length;
121  unsigned char BEMCWest[240]; /* 15 DSMs covering the West half of BEMC */
122 } BWestBlock;
123 
124 typedef struct {
125  char name[4];
126  int length;
127  unsigned short BEMClayer1[48]; /* 6 DSMs for BEMC at layer1 */
128  unsigned short EEMClayer1[16]; /* 2 DSMs for EEMC at layer1 */
129  unsigned char EEMC[144]; /* 9 DSMs for EEMC at layer0 */
130 } BELayerBlock;
131 
132 typedef struct {
133  char name[4];
134  int length;
135  unsigned char FMS[256]; /* 16 DSMs for FMS */
136 } FMSBlock;
137 
138 typedef struct {
139  int offset; /* Offset (in bytes) from the start of Trigger block to data */
140  int length; /* Length (in bytes) of data */
141 } TrgOfflen;
142 
143 typedef struct {
144  int FormatVersion; /* Trigger Data Definition Version yymmddvv */
145  int totalTriggerLength; /* Total length (bytes) of complete Trigger Block */
146  int eventNumber; /* Event number in this run */
147  TrgOfflen EventDesc_ofl; /* Offset/length pair to Event Descriptor */
148  TrgOfflen L1_DSM_ofl; /* Offset/length pair to L1 DSM Data */
149  TrgOfflen Summary_ofl; /* Offset/length pair to Summary Data */
150  TrgOfflen MainX[MAX_OFFLEN]; /* Offset/length pairs for main crossing */
151  int PrePostList[10]; /* Offsets to offset/length pairs to Pre and Post crossing */
152  int raw_data[MAX_TRG_BLK_SIZE/4]; /* Storage for raw data */
154 
155 
156 
157 
158 // jml - 9/12/11
159 //
160 // These are the data blocks transferred from L1 --> L2 via stp
161 // Back engineered and relabled.
162 // Originally there were multiple instances of these structures in a very confusing set of
163 // of local directories and trgStructures.h etc... Many structs were not consistent
164 //
165 // The 2011 nomenclature is just to differentiate between these structs and the obsolete ones. The
166 // underlying format does not change in 2011
167 
168 // These are the datum that L1 creates...
169 typedef struct {
170  EvtDescData EvtDesc; /* L1 Event Descriptor Data */
171  L1_DSM_Data L1_DSM; /* L1 DSM Data */
172  TrgSumData TrgSum; /* Summary data */
174 
175 // This is the specialized L1 version of the dsmMemcpy2Buf packet
176 // which is shipped L1-->L2 Note that the size is 876 bytes which is not 8 byte aligned
177 // The start of this buffer has to be 8 byte aligned for STP sends, however...
178 typedef struct {
179  int src_nodeId; /* Source nodeId */
180  int cur_token;
181  int Npre;
182  int Npost;
183  unsigned int localClock; /* Local DSM clock */
184  int numGroup; /* Number of DSMs in first group */
185  int numDSM; /* Total number of DSMs */
186  int byteCount; /* Ensure alignment of long long */
187 
188  //long long dsmData[RAW_MAX_LEN*11/8]; /* Make this 8-byte aligned */
189  L1DataType2011 l1Data; // This is the true format of the "dsmData" for L1
191 
192 // This structure is for internal use in L1. This structure has a length that is 8-byte
193 // aligned so that elements of an array remain 8 byte aligned.
194 typedef struct {
196  unsigned int pad;
198 
199 #endif
200