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