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