StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
trgStructures2018.h
1 #ifndef trgStructures2018_h
2 #define trgStructures2018_h
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 y18FORMAT_VERSION 0x17101045 /* Format: yymmddvv */
26 #define y18MAX_TRG_BLK_SIZE 122896 /* Current total: 113.25k bytes for pre/post non-zero suppressed data. Allow 120k */
27 #define y18MAX_OFFLEN 20 /* Depends on the number of crates in the system */
28 
29 #define y18MAX_CONF_NUM 20
30 #define y18RCC_CONF_NUM 0
31 #define y18L1_CONF_NUM 1
32 #define y18BC1_CONF_NUM 2
33 #define y18MXQ_CONF_NUM 3
34 #define y18MIX_CONF_NUM 4
35 #define y18BCW_CONF_NUM 5
36 #define y18BCE_CONF_NUM 6
37 #define y18EQ3_CONF_NUM 7
38 #define y18BBC_CONF_NUM 8
39 #define y18BBQ_CONF_NUM 9
40 #define y18FMS_CONF_NUM 10
41 #define y18QT1_CONF_NUM 11
42 #define y18QT2_CONF_NUM 12
43 #define y18QT3_CONF_NUM 13
44 #define y18QT4_CONF_NUM 14
45 #define y18EQ1_CONF_NUM 15
46 #define y18EQ2_CONF_NUM 16
47 #define y18INF_CONF_NUM 20
48 
49 #define y18ADD_BIT_FORCE 5 /* Force store of this event */
50 #define y18ADD_BIT_L2_5 6 /* Level 2.5 abort */
51 #define y18ADD_BIT_SIM 7 /* Simulated event - used by DAQ */
52 
53 #define L2RESULTS_2018_OFFSET_EMC_CHECK 1
54 #define L2RESULTS_2018_OFFSET_EMC_PED 2
55 #define L2RESULTS_2018_OFFSET_BGAMMA 3
56 #define L2RESULTS_2018_OFFSET_EGAMMA 6
57 #define L2RESULTS_2018_OFFSET_DIJET 9
58 #define L2RESULTS_2018_OFFSET_UPSILON 17
59 #define L2RESULTS_2018_OFFSET_BEMCW 20
60 #define L2RESULTS_2018_OFFSET_BHIEN 42
61 #define L2RESULTS_2018_OFFSET_EHIEN 0
62 #define L2RESULTS_2018_OFFSET_BTOW_CAL 0
63 #define L2RESULTS_2018_OFFSET_ETOW_CAL 0
64 
65  /* Event Descriptor Data Structures */
66 
67 //#pragma pack(1)
68 
69 typedef struct {
70  char name[3]; /* Contains EVD */
71  char TrgDataFmtVer; /* Exception for use by DAQ (LS byte of FORMAT_VERSION) */
72  int length; /* Byte count of data that follows */
73  unsigned int bunchXing_hi;
74  unsigned int bunchXing_lo; /* Two parts of RHIC bunch crossing number */
75  unsigned short actionWdDetectorBitMask; /* from Fifo 1 */
76  unsigned char actionWdTrgCommand; /* from Fifo 1 */
77  unsigned char actionWdDaqCommand; /* from Fifo 1 */
78  unsigned short TrgToken; /* from Fifo 2 */
79  unsigned short addBits; /* used by trigger/daq: bit 5=Force store; bit 6=L2.5 abort; bit 7=1 is fake data */
80  unsigned short DSMInput; /* only for use with Mk1 TCU. 0 if Mk2 TCU is used */
81  unsigned short externalBusy; /* from Fifo 9 (Fifo 3 Mk1 TCU) */
82  unsigned short internalBusy; /* from Fifo 9 (Mk2 TCU) */
83  unsigned short trgDetMask; /* After 11/8/16 was physicsWord */
84  unsigned short tcuCtrBunch_hi; /* After 11/8/16 was TriggerWord */
85  unsigned short DSMAddress; /* from Fifo 10 (Fifo 6 Mk1 TCU) */
86  unsigned short TCU_Mark; /* TCU_Mark Mk1=1 Mk2=2 */
87  unsigned short npre; // (crate_mask & 0xfff) << 4 | npre (after 11/8/16)
88  unsigned short npost; // (crate_mask & 0xfff000)>>8| npost (after 11/8/16)
89  unsigned short res1; // (crate_mask & 0xff000000)>>20 | res1&0xf (after 11/8/16)
91 
92 //#pragma pack()
93 
94  /* L1 DSM data structures */
95 
96 typedef struct {
97  char name[4]; /* Contains L1DS */
98  int length; /* Byte count of data that follows */
99  unsigned short TOF[8]; /* TOF and MTD data */
100  unsigned short VTX[8]; /* Separate VPD, ZDC and BBC DSMs have been replaced with this one */
101  unsigned short EMC[8]; /* Contents of 1 EMC IB - results of separate BEMC and EEMC DSMs */
102  unsigned short TPCMask[8]; /* TPC mask for DAQ10K */
103  unsigned short BCdata[16]; /* Contents of 2 Bunch Crossing DSMs IB's */
104  unsigned short specialTriggers[8]; /* Contents of 1 Special Trigger DSM - all the special trigger requests */
105  unsigned short FPD[8]; /* Contents of 1 FMS and FPD IB */
106  unsigned short lastDSM[8]; /* Contents of last DSM IB - results of all DSM trees */
108 
109  /* Trigger Summary Data Structures */
110 
111 typedef struct {
112  char name[4]; /* Contains TSUM */
113  int length; /* Byte count of data that follows */
114  unsigned int L1Sum[2]; /* L1 Summary */
115  unsigned int L2Sum[2]; /* L2 Summary */
116  unsigned int L1Result[32]; /* Result from L1 CPU */
117  unsigned int L2Result[64]; /* Result from L2 CPU */
118  unsigned int C2Result[64]; /* Result from last algorithm */
119  unsigned int LocalClocks[32]; /* localClock values from RCC2*/
121 
122 typedef struct {
123  char name[4];
124  int length; /* Byte count of data that follows */
125  unsigned int data[1]; /* NB: this definition is generic but would vary depending on actual data */
126 } DataBlock2018;
127 
128 typedef struct {
129  char name[4]; /* Contains BBC */
130  int length; /* Byte count of data that follows */
131  unsigned short BBClayer1[16]; /* This is the layer1 DSM that feeds the VTX DSM */
132  unsigned short ZDClayer1[8]; /* This is the new layer1 ZDC DSM that also feeds the VTX DSM */
133  unsigned short VPD[8]; /* ADC & TAC values for VPD detectors*/
134  unsigned short EPDlayer0t[16]; /* EPD data from east & west QT TAC boards je-added run 18 */
135  unsigned short EPDlayer1[8]; /* This is the layer0 DSM that feeds the EPD DSM je-added run 18 */
136  unsigned short EPDlayer0a[8]; /* EPD data from east & west QT ADC boards je-added run 18 */
137 } BBCBlock2018;
138 
139 typedef struct {
140  char name[4]; /* Contains MIX */
141  int length; /* Byte count of data that follows */
142  unsigned short FPDEastNSLayer1[8]; /* FPD east north/south layer 1 */
143  unsigned char MTD_P2PLayer1[16]; /* Data from MTD and PP2PP */
144  unsigned short TOFLayer1[8]; /* This is TOF Layer 1 */
145  unsigned short TOF[48]; /* TOF data */
146 /* unsigned short TPCpreMask[24]; */ /* EMC, MTD, & TOF TPC Grid Masks je-removed starting run 18 */
147 } MIXBlock2018;
148 
149 typedef struct {
150  char name[4];
151  int length; /* Byte count of data that follows */
152  int dataLoss; /* Byte count of data truncated due to buffer limitations */
153  unsigned int data[1]; /* NB: this definition is generic but would vary depending on actual data */
154 } QTBlock2018;
155 
156 typedef struct {
157  char name[4];
158  int length;
159  unsigned char BEMCEast[240]; /* 15 DSMs covering the East half of BEMC */
160 } BEastBlock2018;
161 
162 typedef struct {
163  char name[4];
164  int length;
165  unsigned char BEMCWest[240]; /* 15 DSMs covering the West half of BEMC */
167 
168 typedef struct {
169  char name[4];
170  int length;
171  unsigned short BEMClayer1[48]; /* 6 DSMs for BEMC at layer1 */
172  unsigned short EEMClayer1[16]; /* 2 DSMs for EEMC at layer1 */
173  unsigned char EEMC[144]; /* 9 DSMs for EEMC at layer0 */
175 
176 typedef struct {
177  char name[4];
178  int length;
179  unsigned char FMS[256]; /* 16 DSMs for FMS */
180 } FMSBlock2018;
181 
182 typedef struct {
183  int offset; /* Offset (in bytes) from the start of Trigger block to data */
184  int length; /* Length (in bytes) of data */
185 } TrgOfflen2018;
186 
187 typedef struct {
188  int FormatVersion; /* Trigger Data Definition Version yymmddvv */
189  int totalTriggerLength; /* Total length (bytes) of complete Trigger Block */
190  int eventNumber; /* Event number in this run */
191  TrgOfflen2018 EventDesc_ofl; /* Offset/length pair to Event Descriptor */
192  TrgOfflen2018 L1_DSM_ofl; /* Offset/length pair to L1 DSM Data */
193  TrgOfflen2018 Summary_ofl; /* Offset/length pair to Summary Data */
194  TrgOfflen2018 MainX[y18MAX_OFFLEN]; /* Offset/length pairs for main crossing */
195  int PrePostList[10]; /* Offsets to offset/length pairs to Pre and Post crossing */
196  int raw_data[y18MAX_TRG_BLK_SIZE/4]; /* Storage for raw data */
198 
199 #endif
200