StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
trgDataDefs_v45.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 * 26Jul17: JMN removed specific DSM definitions and replaced with variable
23 * blocks as for QT. New FORMAT_VERSION
24 * 09Aug17: JMN changed FORMAT_VERSION
25 * trgDataDefs.h now defines trigger block
26 * All DSM and QT crate definitions are now in trgCrateDefs.h
27 * An include line joins crate definitions with trigger block defs.
28 ******************************************************************************/
29 #include "StRoot/RTS/trg/include/trgCrateDefs.h"
30 //#include "StRoot/RTS/include/daqFormats.h"
31 #define FORMAT_VERSION 0x17072645 /* Format: yymmddvv */
32 #define MAX_TRG_BLK_SIZE 122896 /* Current total: 113.25k bytes for pre/post non-zero suppressed data. Allow 120k */
33 #define MAX_OFFLEN 20 /* Depends on the number of crates in the system */
34 
35 #define ADD_BIT_FORCE 5 /* Force store of this event */
36 #define ADD_BIT_L2_5 6 /* Level 2.5 abort */
37 #define ADD_BIT_SIM 7 /* Simulated event - used by DAQ */
38 
39  /* Event Descriptor Data Structures */
40 
41 #pragma pack(1)
42 
43 typedef struct {
44  char name[3]; /* Contains EVD */
45  char TrgDataFmtVer; /* Exception for use by DAQ (LS byte of FORMAT_VERSION) */
46  int length; /* Byte count of data that follows */
47  unsigned int bunchXing_hi;
48  unsigned int bunchXing_lo; /* Two parts of RHIC bunch crossing number */
49  unsigned short actionWdDetectorBitMask; /* from Fifo 1 */
50  unsigned char actionWdTrgCommand; /* from Fifo 1 */
51  unsigned char actionWdDaqCommand; /* from Fifo 1 */
52  unsigned short TrgToken; /* from Fifo 2 */
53  unsigned short addBits; /* used by trigger/daq: bit 5=Force store; bit 6=L2.5 abort; bit 7=1 is fake data */
54  unsigned short DSMInput; /* only for use with Mk1 TCU. 0 if Mk2 TCU is used */
55  unsigned short externalBusy; /* from Fifo 9 (Fifo 3 Mk1 TCU) */
56  unsigned short internalBusy; /* from Fifo 9 (Mk2 TCU) */
57 
58 
59 #ifndef __linux
60  unsigned int tcuCtrBunch;
61 #else
62  union {
63  struct {
64  unsigned short physicsWord; /* Fifo 4 Mk1 TCU. 0 if Mk2 TCU is used */
65  unsigned short TriggerWord; /* Fifo 5 Mk1 TCU. 0 if Mk2 TCU is used */
66  };
67  struct {
68  unsigned short trgDetMask; // After 11/8/16
69  unsigned short tcuCtrBunch_hi; // After 11/8/16
70  };
71  unsigned int tcuCtrBunch;
72  };
73 #endif
74 
75  unsigned short DSMAddress; /* from Fifo 10 (Fifo 6 Mk1 TCU) */
76 
77  unsigned short TCU_Mark; /* TCU_Mark Mk1=1 Mk2=2 */
78  unsigned short npre; // (crate_mask & 0xfff) << 4 | npre (after 11/8/16)
79 
80  unsigned short npost; // (crate_mask & 0xfff000)>>8| npost (after 11/8/16)
81  unsigned short res1; // (crate_mask & 0xff000000)>>20 | res1&0xf (after 11/8/16)
82 } EvtDescData;
83 
84 #pragma pack()
85 
86  /* L1 DSM data structures */
87 
88 typedef struct {
89  char name[4]; /* Contains L1DS */
90  int length; /* Byte count of data that follows */
91  unsigned short TOF[8]; /* TOF and MTD data */
92  unsigned short VTX[8]; /* Separate VPD, ZDC and BBC DSMs have been replaced with this one */
93  unsigned short EMC[8]; /* Contents of 1 EMC IB - results of separate BEMC and EEMC DSMs */
94  unsigned short TPCMask[8]; /* TPC mask for DAQ10K */
95  unsigned short BCdata[16]; /* Contents of 2 Bunch Crossing DSMs IB's */
96  unsigned short specialTriggers[8]; /* Contents of 1 Special Trigger DSM - all the special trigger requests */
97  unsigned short FPD[8]; /* Contents of 1 FMS and FPD IB */
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  int offset; /* Offset (in bytes) from the start of Trigger block to data */
116  int length; /* Length (in bytes) of data */
117 } TrgOfflen;
118 
119 typedef struct {
120  int FormatVersion; /* Trigger Data Definition Version yymmddvv */
121  int totalTriggerLength; /* Total length (bytes) of complete Trigger Block */
122  int eventNumber; /* Event number in this run */
123  TrgOfflen EventDesc_ofl; /* Offset/length pair to Event Descriptor */
124  TrgOfflen L1_DSM_ofl; /* Offset/length pair to L1 DSM Data */
125  TrgOfflen Summary_ofl; /* Offset/length pair to Summary Data */
126  TrgOfflen MainX[MAX_OFFLEN]; /* Offset/length pairs for main crossing */
127  int PrePostList[10]; /* Offsets to offset/length pairs to Pre and Post crossing */
128  int raw_data[MAX_TRG_BLK_SIZE/4]; /* Storage for raw data */
130 
131 
132 
133 // jml - 9/12/11
134 //
135 // These are the data blocks transferred from L1 --> L2 via stp
136 // Back engineered and relabled.
137 // Originally there were multiple instances of these structures in a very confusing set of
138 // of local directories and trgStructures.h etc... Many structs were not consistent
139 //
140 // The 2011 nomenclature is just to differentiate between these structs and the obsolete ones. The
141 // underlying format does not change in 2011
142 
143 // These are the datum that L1 creates...
144 typedef struct {
145  EvtDescData EvtDesc; /* L1 Event Descriptor Data */
146  L1_DSM_Data L1_DSM; /* L1 DSM Data */
147  TrgSumData TrgSum; /* Summary data */
149 
150 // This is the specialized L1 version of the dsmMemcpy2Buf packet
151 // which is shipped L1-->L2 Note that the size is 876 bytes which is not 8 byte aligned
152 // The start of this buffer has to be 8 byte aligned for STP sends, however...
153 typedef struct {
154  int src_nodeId; /* Source nodeId */
155  int cur_token;
156  int Npre;
157  int Npost;
158  unsigned int localClock; /* Local RCC2 clock */
159  int numGroup; /* Number of DSMs in first group */
160  int numDSM; /* Total number of DSMs */
161  int byteCount; /* Ensure alignment of long long */
162 
163  //long long dsmData[RAW_MAX_LEN*11/8]; /* Make this 8-byte aligned */
164  L1DataType2011 l1Data; // This is the true format of the "dsmData" for L1
166 
167 // This structure is for internal use in L1. This structure has a length that is 8-byte
168 // aligned so that elements of an array remain 8 byte aligned.
169 typedef struct {
171  unsigned int currentBusy; // keep padded though!
172  // UINT32 pad;
174 
175 #endif
176