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