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