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