StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
trgStructures2016.h
1 #ifndef trgStructures2016_h
2 #define trgStructures2016_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 #define y16FORMAT_VERSION 0x15113043 /* Format: yymmddvv */
22 #define y16MAX_TRG_BLK_SIZE 122896 /* Current total: 113.25k bytes for pre/post non-zero suppressed data. Allow 120k */
23 #define y16MAX_OFFLEN 20 /* Depends on the number of crates in the system */
24 
25 #define y16L1_CONF_NUM 1
26 #define y16BC1_CONF_NUM 2
27 #define y16MXQ_CONF_NUM 3
28 #define y16MIX_CONF_NUM 4
29 #define y16BCW_CONF_NUM 5
30 #define y16BCE_CONF_NUM 6
31 #define y16FEQ_CONF_NUM 7
32 #define y16BBC_CONF_NUM 8
33 #define y16BBQ_CONF_NUM 9
34 #define y16FMS_CONF_NUM 10
35 #define y16QT1_CONF_NUM 11
36 #define y16QT2_CONF_NUM 12
37 #define y16QT3_CONF_NUM 13
38 #define y16QT4_CONF_NUM 14
39 
40 #define y16ADD_BIT_FORCE 5 /* Force store of this event */
41 #define y16ADD_BIT_L2_5 6 /* Level 2.5 abort */
42 #define y16ADD_BIT_SIM 7 /* Simulated event - used by DAQ */
43 
44 #define L2RESULTS_2016_OFFSET_EMC_CHECK 1
45 #define L2RESULTS_2016_OFFSET_EMC_PED 2
46 #define L2RESULTS_2016_OFFSET_BGAMMA 3
47 #define L2RESULTS_2016_OFFSET_EGAMMA 6
48 #define L2RESULTS_2016_OFFSET_DIJET 9
49 #define L2RESULTS_2016_OFFSET_UPSILON 17
50 #define L2RESULTS_2016_OFFSET_BEMCW 20
51 #define L2RESULTS_2016_OFFSET_BHIEN 42
52 #define L2RESULTS_2016_OFFSET_EHIEN 0
53 #define L2RESULTS_2016_OFFSET_BTOW_CAL 0
54 #define L2RESULTS_2016_OFFSET_ETOW_CAL 0
55 
56  /* Event Descriptor Data Structures */
57 
58 //#pragma pack(1)
59 
60 typedef struct {
61  char name[3]; /* Contains EVD */
62  char TrgDataFmtVer; /* Exception for use by DAQ (LS byte of FORMAT_VERSION) */
63  int length; /* Byte count of data that follows */
64  unsigned int bunchXing_hi;
65  unsigned int bunchXing_lo; /* Two parts of RHIC bunch crossing number */
66  unsigned short actionWdDetectorBitMask; /* from Fifo 1 */
67  unsigned char actionWdTrgCommand; /* from Fifo 1 */
68  unsigned char actionWdDaqCommand; /* from Fifo 1 */
69  unsigned short TrgToken; /* from Fifo 2 */
70  unsigned short addBits; /* used by trigger/daq: bit 5=Force store; bit 6=L2.5 abort; bit 7=1 is fake data */
71  unsigned short DSMInput; /* only for use with Mk1 TCU. 0 if Mk2 TCU is used */
72  unsigned short externalBusy; /* from Fifo 9 (Fifo 3 Mk1 TCU) */
73  unsigned short internalBusy; /* from Fifo 9 (Mk2 TCU) */
74 
75  //#ifndef __linux
76  //unsigned int tcuCtrBunch;
77  //#else
78  //union {
79  // struct {
80  unsigned short physicsWord; /* Fifo 4 Mk1 TCU. 0 if Mk2 TCU is used */
81  unsigned short TriggerWord; /* Fifo 5 Mk1 TCU. 0 if Mk2 TCU is used */
82  // };
83  // unsigned int tcuCtrBunch;
84  //};
85  //#endif
86 
87  unsigned short DSMAddress; /* from Fifo 10 (Fifo 6 Mk1 TCU) */
88  unsigned short TCU_Mark; /* TCU_Mark Mk1=1 Mk2=2 */
89  unsigned short npre; /* pre value for detector raw data */
90  unsigned short npost; /* post value for detector raw data */
91  unsigned short res1; /* Reserved for future use */
93 
94 //#pragma pack()
95 
96  /* L1 DSM data structures */
97 
98 typedef struct {
99  char name[4]; /* Contains L1DS */
100  int length; /* Byte count of data that follows */
101  unsigned short TOF[8]; /* TOF and MTD data */
102  unsigned short VTX[8]; /* Separate VPD, ZDC and BBC DSMs have been replaced with this one */
103  unsigned short EMC[8]; /* Contents of 1 EMC IB - results of separate BEMC and EEMC DSMs */
104  unsigned short TPCMask[8]; /* TPC mask for DAQ10K */
105  unsigned short BCdata[16]; /* Contents of 2 Bunch Crossing DSMs IB's */
106  unsigned short specialTriggers[8]; /* Contents of 1 Special Trigger DSM - all the special trigger requests */
107  unsigned short FPD[8]; /* Contents of 1 FMS and FPD IB */
108  unsigned short lastDSM[8]; /* Contents of last DSM IB - results of all DSM trees */
110 
111  /* Trigger Summary Data Structures */
112 
113 typedef struct {
114  char name[4]; /* Contains TSUM */
115  int length; /* Byte count of data that follows */
116  unsigned int L1Sum[2]; /* L1 Summary */
117  unsigned int L2Sum[2]; /* L2 Summary */
118  unsigned int L1Result[32]; /* Result from L1 CPU */
119  unsigned int L2Result[64]; /* Result from L2 CPU */
120  unsigned int C2Result[64]; /* Result from last algorithm */
121  unsigned int LocalClocks[32]; /* localClock values from RCC2*/
123 
124 typedef struct {
125  char name[4];
126  int length; /* Byte count of data that follows */
127  unsigned int data[1]; /* NB: this definition is generic but would vary depending on actual data */
128 } DataBlock2016;
129 
130 typedef struct {
131  char name[4]; /* Contains BBC */
132  int length; /* Byte count of data that follows */
133  unsigned short BBClayer1[16]; /* This is the layer1 DSM that feeds the VTX DSM */
134  unsigned short ZDClayer1[8]; /* This is the new layer1 ZDC DSM that also feeds the VTX DSM */
135  unsigned short VPD[8]; /* ADC & TAC values for VPD detectors*/
136 } BBCBlock2016;
137 
138 typedef struct {
139  char name[4]; /* Contains MIX */
140  int length; /* Byte count of data that follows */
141  unsigned short FPDEastNSLayer1[8]; /* FPD east north/south layer 1 */
142  unsigned char MTD_P2PLayer1[16]; /* Data from MTD and PP2PP */
143  unsigned short TOFLayer1[8]; /* This is TOF Layer 1 */
144  unsigned short TOF[48]; /* TOF data */
145  unsigned short TPCpreMask[24]; /* EMC, MTD, & TOF TPC Grid Masks */
146 } MIXBlock2016;
147 
148 typedef struct {
149  char name[4];
150  int length; /* Byte count of data that follows */
151  int dataLoss; /* Byte count of data truncated due to buffer limitations */
152  unsigned int data[1]; /* NB: this definition is generic but would vary depending on actual data */
153 } QTBlock2016;
154 
155 typedef struct {
156  char name[4];
157  int length;
158  unsigned char BEMCEast[240]; /* 15 DSMs covering the East half of BEMC */
160 
161 typedef struct {
162  char name[4];
163  int length;
164  unsigned char BEMCWest[240]; /* 15 DSMs covering the West half of BEMC */
166 
167 typedef struct {
168  char name[4];
169  int length;
170  unsigned short BEMClayer1[48]; /* 6 DSMs for BEMC at layer1 */
171  unsigned short EEMClayer1[16]; /* 2 DSMs for EEMC at layer1 */
172  unsigned char EEMC[144]; /* 9 DSMs for EEMC at layer0 */
174 
175 typedef struct {
176  char name[4];
177  int length;
178  unsigned char FMS[256]; /* 16 DSMs for FMS */
179 } FMSBlock2016;
180 
181 typedef struct {
182  int offset; /* Offset (in bytes) from the start of Trigger block to data */
183  int length; /* Length (in bytes) of data */
184 } TrgOfflen2016;
185 
186 typedef struct {
187  int FormatVersion; /* Trigger Data Definition Version yymmddvv */
188  int totalTriggerLength; /* Total length (bytes) of complete Trigger Block */
189  int eventNumber; /* Event number in this run */
190  TrgOfflen2016 EventDesc_ofl; /* Offset/length pair to Event Descriptor */
191  TrgOfflen2016 L1_DSM_ofl; /* Offset/length pair to L1 DSM Data */
192  TrgOfflen2016 Summary_ofl; /* Offset/length pair to Summary Data */
193  TrgOfflen2016 MainX[y16MAX_OFFLEN]; /* Offset/length pairs for main crossing */
194  int PrePostList[10]; /* Offsets to offset/length pairs to Pre and Post crossing */
195  int raw_data[y16MAX_TRG_BLK_SIZE/4]; /* Storage for raw data */
197 
198 #endif
199