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