Adding the AliAnalysisGUI class which is the main class that controls the GUI.
[u/mrichter/AliRoot.git] / RAW / event.h
CommitLineData
f3a800f8 1/****************************************************************************
2 *
3 * event.h: DATE event data format
4 *
5 * Revision History:
6 * V01.00 RD PVV 09-Jan-97 Initial version
7 * V01.01 AV 24-Feb-97 Added START_OF_RUN_FILES and triggerNb
8 * V02.02 RD 13-Mar-97 Detector ID mask type added
9 * V02.03 PVV 20-Mar-97 Detector ID on 128 bits
10 * V02.03 RD PVV 20-Mar-97 Added EVENT_DATA_TRUNCATED
11 * V02.04 PVV 06-May-97 Added EVENT_TYPE_MASK
12 * V02.05 RD PVV 09-May-97 Increase EVENT_DATA_MAX_SIZE to 50 K
13 * V02.06 WB MG 22-May-97 Added END_OF_RUN_FILES
14 * V02.07 WB 23-May-97 Added errorCode, deadTime, deadTimeusec
15 * EVENT_DATA_MAX_SIZE set to 100 * 1024
16 * MAX_DETECTORS set to 126
17 * V02.08 PVV 02-Jun-97 Modify the encoding of types
18 * V02.09 WB RD PVV 28-Jul-98 Add fileSeqNb in the header.
19 * Reduce detector mask to 3 long
20 * V02.10 RD 31-Jul-98 (start|end)OfRunFiles added to eventType
21 * V02.11 PVV RD 02-Sep-98 Event type re-numbered
22 * Equipment bit added to event type
23 * V02.12 AV PVV RD 03-Sep-98 FileSeqNo moved before detectorId
24 * V02.13 RD 08-Oct-98 32 bits fields defined as long32
25 * V02.13 RD 19-Feb-99 Endianness/swap definitions added
26 * V02.14 WB PVV RD 21-Jun-99 typeAttribute added
27 * V02.15 RD 27-Jul-99 Macros for typeAttribute handling added
28 * V02.16 RD 19-Nov-99 Bug in Attributes test/set fixed
29 * V02.17 WB PVV RD 08-May-00 System attributes for SOR and EOR added
30 * V02.18 RD 18-May-00 EVENT_H_ID added
31 * V02.19 RD 10-Aug-00 Macros for detectorId handling added
32 * V03.00 RD 23-Nov-00 Version for DATE V4
33 * V03.01 AV KS 05-Apr-02 Introduction of eventLocationDescriptorStruct
34 * V03.02 KS 10-May-02 Added ATTR_KEEP_PAGES for COLE
35 * RD 30-Apr-04 Added definitions for the Common Data Header
36 * RD 24-Jun-04 Added definitions for HLT DECISION
37 * RD 13-Jul-04 Added macros to OR attributes
38 * V03.03 RD 25-May-05 Added eventTimestamp
39 * V03.04 RD 17-Aug-05 Added VANGUARD and REARGUARD events
40 * V03.05 RD 05-Sep-05 Added SYSTEM and DETECTOR software tri evts
41 * V03.06 RD 14-Sep-05 VANGUARD/REARGUARD changed into START_OF_DATA
42 * and END_OF_DATA
43 *
44 * Preprocessor definitions:
45 * NDEBUG Define BEFORE including this file to disable run-time checks on
46 * various parameters
47 *
48 * Related facilities:
49 * validateEvent.c Validation program, should be run after EACH change to
50 * the definitions given here below
51 ***************************************************************************/
52#ifndef __event_h__
53#define __event_h__
54
55#define EVENT_MAJOR_VERSION_NUMBER 0x0003
56#define EVENT_MINOR_VERSION_NUMBER 0x0006
57
58/* ========== System includes ========= */
59#include <string.h> /* Needed by: memset, memcpy */
60#include <assert.h> /* Needed by: assert */
61
62/* ========== Definitions for the event header ========== */
63
64/* ---------- Header base size ---------- */
65/* This value must be updated for each change in the eventHeaderStruct */
66#define EVENT_HEAD_BASE_SIZE 68
67
68/* ---------- Event size ---------- */
69typedef unsigned long32 eventSizeType;
70
71/* ---------- Magic signature and its byte-swapped version ---------- */
72typedef unsigned long32 eventMagicType;
73#define EVENT_MAGIC_NUMBER ((eventMagicType)0xDA1E5AFE)
74#define EVENT_MAGIC_NUMBER_SWAPPED ((eventMagicType)0xFE5A1EDA)
75
76/* ---------- Header size ---------- */
77typedef unsigned long32 eventHeadSizeType;
78
79/* ---------- Unique version identifier ---------- */
80#define EVENT_CURRENT_VERSION \
81 (((EVENT_MAJOR_VERSION_NUMBER<<16)&0xffff0000)|\
82 (EVENT_MINOR_VERSION_NUMBER&0x0000ffff))
83typedef unsigned long32 eventVersionType;
84
85/* ---------- Event type ---------- */
86typedef unsigned long32 eventTypeType;
87#define START_OF_RUN ((eventTypeType) 1)
88#define END_OF_RUN ((eventTypeType) 2)
89#define START_OF_RUN_FILES ((eventTypeType) 3)
90#define END_OF_RUN_FILES ((eventTypeType) 4)
91#define START_OF_BURST ((eventTypeType) 5)
92#define END_OF_BURST ((eventTypeType) 6)
93#define PHYSICS_EVENT ((eventTypeType) 7)
94#define CALIBRATION_EVENT ((eventTypeType) 8)
95#define EVENT_FORMAT_ERROR ((eventTypeType) 9)
96#define START_OF_DATA ((eventTypeType)10)
97#define END_OF_DATA ((eventTypeType)11)
98#define SYSTEM_SOFTWARE_TRIGGER_EVENT ((eventTypeType)12)
99#define DETECTOR_SOFTWARE_TRIGGER_EVENT ((eventTypeType)13)
100#define EVENT_TYPE_MIN 1
101#define EVENT_TYPE_MAX 13
102enum eventTypeEnum {
103 startOfRun = START_OF_RUN,
104 endOfRun = END_OF_RUN,
105 startOfRunFiles = START_OF_RUN_FILES,
106 endOfRunFiles = END_OF_RUN_FILES,
107 startOfBurst = START_OF_BURST,
108 endOfBurst = END_OF_BURST,
109 physicsEvent = PHYSICS_EVENT,
110 calibrationEvent = CALIBRATION_EVENT,
111 formatError = EVENT_FORMAT_ERROR,
112 startOfData = START_OF_DATA,
113 endOfData = END_OF_DATA,
114 systemSoftwareTriggerEvent = SYSTEM_SOFTWARE_TRIGGER_EVENT,
115 detectorSoftwareTriggerEvent = DETECTOR_SOFTWARE_TRIGGER_EVENT
116};
117#define EVENT_TYPE_OK(t) (((t) >= EVENT_TYPE_MIN) && (((t) <= EVENT_TYPE_MAX)))
118
119/* ---------- Run number ---------- */
120typedef unsigned long32 eventRunNbType;
121
122/* ---------- The eventId field ---------- */
123#define EVENT_ID_BYTES 8
124#define EVENT_ID_WORDS ((EVENT_ID_BYTES) >> 2)
125typedef unsigned long32 eventIdType[EVENT_ID_WORDS];
126
127 /* PERIOD - ORBIT - BUNCH crossing type events */
128#define EVENT_ID_MAX_PERIOD 0x0fffffff
129#define EVENT_ID_MAX_ORBIT 0x00ffffff
130#define EVENT_ID_MAX_BUNCH_CROSSING 0x00000fff
131#define LOAD_EVENT_ID(id,s,o,bc) \
132 (EVENT_ID_SET_PERIOD(id,s), \
133 EVENT_ID_SET_ORBIT(id,o), \
134 EVENT_ID_SET_BUNCH_CROSSING(id,bc))
135#define EVENT_ID_GET_BUNCH_CROSSING(id) ((id)[1]&0x00000fff)
136#define EVENT_ID_GET_ORBIT(id) \
137 ((((id)[0]<<20)&0xf00000)|(((id)[1]>>12)&0xfffff))
138#define EVENT_ID_GET_PERIOD(id) (((id)[0]>>4)&0x0fffffff)
139
140#define EVENT_ID_SET_BUNCH_CROSSING(id,v) \
141 (assert(((v)>=0)&&((v)<=EVENT_ID_MAX_BUNCH_CROSSING)), \
142 (id)[1]=((id)[1]&0xfffff000)|((v)&0xfff))
143#define EVENT_ID_SET_ORBIT(id,v) \
144 (assert(((v)>=0)&&((v)<=EVENT_ID_MAX_ORBIT)), \
145 (id)[0]=(((id)[0])&0xfffffff0)|(((v)&0x00f00000)>>20), \
146 (id)[1]=(((id)[1])&0x00000fff)|(((v)&0x000fffff)<<12))
147#define EVENT_ID_SET_PERIOD(id,v) \
148 (assert(((v)>=0)&&((v)<=EVENT_ID_MAX_PERIOD)), \
149 (id)[0]=(((id)[0])&0x0000000f)|(((v)&0x0fffffff)<<4))
150
151 /* RAW type event */
152#define EVENT_ID_MAX_NB_IN_RUN 0xffffffff
153#define EVENT_ID_MAX_BURST_NB 0x00000fff
154#define EVENT_ID_MAX_NB_IN_BURST 0x000fffff
155#define LOAD_RAW_EVENT_ID(id,nir,bn,nib) \
156 (assert(((bn)>=0) && ((bn)<=EVENT_ID_MAX_BURST_NB) && \
157 ((nib)>=0) && ((nib)<=EVENT_ID_MAX_NB_IN_BURST)), \
158 (id)[0]=nir, \
159 (id)[1]=((bn<<20)&0xfff00000)|(nib&0x000fffff))
160#define EVENT_ID_SET_NB_IN_RUN(id,nir) \
161 (assert(((nir)>=0)&&((nir)<=EVENT_ID_MAX_NB_IN_RUN)), \
162 (id)[0]=(nir))
163#define EVENT_ID_SET_BURST_NB(id,bn) \
164 (assert(((bn)>=0)&&((bn)<=EVENT_ID_MAX_BURST_NB)), \
165 (id)[1]=((id)[1]&0x000fffff)|(((bn)<<20)&0xfff00000))
166#define EVENT_ID_SET_NB_IN_BURST(id,nib) \
167 (assert(((nib)>=0)&&((nib)<=EVENT_ID_MAX_NB_IN_BURST)), \
168 (id)[1]=((id)[1]&0xfff00000)|((nib)&0x000fffff))
169#define EVENT_ID_GET_NB_IN_RUN(id) ((id)[0])
170#define EVENT_ID_GET_BURST_NB(id) (((id)[1]>>20)&0x00000fff)
171#define EVENT_ID_GET_NB_IN_BURST(id) ((id)[1]&0x000fffff)
172
173 /* All events */
174#define EQ_EVENT_ID(a,b) ((((a)[0])==((b)[0]))&&(((a)[1])==((b)[1])))
175#define GT_EVENT_ID(a,b) \
176 (((((a)[0])>((b)[0])))||((((a)[0])==((b)[0]))&&(((a)[1])>((b)[1]))))
177#define LT_EVENT_ID(a,b) \
178 ((((a)[0])<((b)[0])) || ((((a)[0])==((b)[0]))&&(((a)[1])<((b)[1]))))
179#define GE_EVENT_ID(a,b) (!LT_EVENT_ID(a,b))
180#define LE_EVENT_ID(a,b) (!GT_EVENT_ID(a,b))
181#define COPY_EVENT_ID(from,to) \
182 memcpy((void*)to,(const void*)from,EVENT_ID_BYTES)
183#define ADD_EVENT_ID(a,b) ((a)[1]+=(b)[1],(a)[0]+=(b)[0])
184#define SUB_EVENT_ID(a,b) ((a)[1]-=(b)[1],(a)[0]-=(b)[0])
185#define ZERO_EVENT_ID(id) memset(id,0,EVENT_ID_BYTES)
186
187/* ---------- Trigger pattern (and relative masks) ---------- */
188#define EVENT_TRIGGER_PATTERN_BYTES 8
189#define EVENT_TRIGGER_PATTERN_WORDS ((EVENT_TRIGGER_PATTERN_BYTES)>>2)
190typedef unsigned long32 eventTriggerPatternType[EVENT_TRIGGER_PATTERN_WORDS];
191#define EVENT_TRIGGER_ID_MIN 1
192#define EVENT_TRIGGER_ID_MAX 50
193#define CHECK_TRIGGER(t) (assert(((t)>=EVENT_TRIGGER_ID_MIN) && \
194 ((t)<=EVENT_TRIGGER_ID_MAX)))
195#define TRIGGER_TO_BIT(t) (1<<((t)&0x1f))
196#define TRIGGER_TO_WORD(t) (CHECK_TRIGGER(t), (t)>>5)
197#define ZERO_TRIGGER_PATTERN(p) memset(p,0,EVENT_TRIGGER_PATTERN_BYTES)
198#define SET_TRIGGER_IN_PATTERN(p,id) (p)[TRIGGER_TO_WORD(id)] |= \
199 TRIGGER_TO_BIT(id)
200#define CLEAR_TRIGGER_IN_PATTERN(p,id) (p)[TRIGGER_TO_WORD(id)] &= \
201 ~(TRIGGER_TO_BIT(id))
202#define FLIP_TRIGGER_IN_PATTERN(p,id) (p)[TRIGGER_TO_WORD(id)] ^= \
203 TRIGGER_TO_BIT(id)
204#define TEST_TRIGGER_IN_PATTERN(p,id) (((p)[TRIGGER_TO_WORD(id)] & \
205 TRIGGER_TO_BIT(id)) != 0)
206#define TRIGGER_PATTERN_INVALID(p) (((p)[0] & 1) == 0)
207#define TRIGGER_PATTERN_VALID(p) (((p)[0] & 1) != 0)
208#define VALIDATE_TRIGGER_PATTERN(p) ((p)[0] |= 1)
209#define INVALIDATE_TRIGGER_PATTERN(p) ((p)[0] &= 0xfffffffe)
210#define COPY_TRIGGER_PATTERN(f,t) memcpy(t,f,EVENT_TRIGGER_PATTERN_BYTES)
211#define TRIGGER_PATTERN_OK(p) (((p)[1] & 0xfff80000) == 0)
212
213/* ---------- Detectors cluster (and relative masks) ---------- */
214#define EVENT_DETECTOR_PATTERN_BYTES 4
215#define EVENT_DETECTOR_PATTERN_WORDS (EVENT_DETECTOR_PATTERN_BYTES>>2)
216typedef unsigned long32 eventDetectorPatternType[EVENT_DETECTOR_PATTERN_WORDS];
217#define EVENT_DETECTOR_ID_MIN 1
218#define EVENT_DETECTOR_ID_MAX 24
219#define CHECK_DETECTOR(d) (assert(((d) >= EVENT_DETECTOR_ID_MIN) &&\
220 ((d) <= EVENT_DETECTOR_ID_MAX)))
221#define DETECTOR_TO_BIT(d) (CHECK_DETECTOR(d), 1<<(d))
222#define ZERO_DETECTOR_PATTERN(p) ((p)[0] = 0)
223#define SET_DETECTOR_IN_PATTERN(p,d) ((p)[0] |= DETECTOR_TO_BIT(d))
224#define CLEAR_DETECTOR_IN_PATTERN(p,d) ((p)[0] &= ~(DETECTOR_TO_BIT(d)))
225#define FLIP_DETECTOR_IN_PATTERN(p,d) ((p)[0] ^= DETECTOR_TO_BIT(d))
226#define TEST_DETECTOR_IN_PATTERN(p,d) (((p)[0] & DETECTOR_TO_BIT(d))!=0)
227#define DETECTOR_PATTERN_INVALID(p) (((p)[0] & 1) == 0)
228#define DETECTOR_PATTERN_VALID(p) (((p)[0] & 1) != 0)
229#define VALIDATE_DETECTOR_PATTERN(p) ((p)[0] |= 1)
230#define INVALIDATE_DETECTOR_PATTERN(p) ((p)[0] &= 0xfffffffe)
231#define COPY_DETECTOR_PATTERN(f,t) ((t)[0] = (f)[0])
232#define DETECTOR_PATTERN_OK(p) (((p)[0] & 0xfe000000) == 0)
233
234/* ---------- The sizes and positions of the typeAttribute field ---------- */
235#define ALL_ATTRIBUTE_WORDS 3
236#define ALL_ATTRIBUTE_BYTES (ALL_ATTRIBUTE_WORDS * 4)
237#define ALL_ATTRIBUTE_BITS (ALL_ATTRIBUTE_BYTES * 8)
238#define USER_ATTRIBUTE_WORDS 2
239#define USER_ATTRIBUTE_BYTES (USER_ATTRIBUTE_WORDS * 4)
240#define USER_ATTRIBUTE_BITS (USER_ATTRIBUTE_BYTES * 8)
241#define FIRST_USER_ATTRIBUTE 0
242#define LAST_USER_ATTRIBUTE (USER_ATTRIBUTE_BITS - 1)
243#define SYSTEM_ATTRIBUTE_WORDS 1
244#define SYSTEM_ATTRIBUTE_BYTES (SYSTEM_ATTRIBUTE_WORDS * 4)
245#define SYSTEM_ATTRIBUTE_BITS (SYSTEM_ATTRIBUTE_BYTES * 8)
246#define FIRST_SYSTEM_ATTRIBUTE USER_ATTRIBUTE_BITS
247#define LAST_SYSTEM_ATTRIBUTE (USER_ATTRIBUTE_BITS + \
248 SYSTEM_ATTRIBUTE_BITS - 1)
249typedef unsigned long32 eventTypeAttributeType[ALL_ATTRIBUTE_WORDS];
250
251 /* Word and bit definitions */
252#define SYS_ATTR_2_W(b) (assert(((b)>=64)&&((b)<=95)),2)
253#define USR_ATTR_2_W(b) (assert(((b)>= 0)&&((b)<=63)),(b)>>5)
254#define ATTR_2_W(b) (assert(((b)>= 0)&&((b)<=95)),(b)>>5)
255#define ATTR_2_B(b) (1<<((b)&0x1f))
256
257 /* Macros to handle all attributes without distinction */
258#define RESET_ATTRIBUTES(m) ((m)[2] = (m)[1] = (m)[0] = 0)
259#define SET_ANY_ATTRIBUTE(m,b) (m)[ATTR_2_W(b)] |= ATTR_2_B(b)
260#define CLEAR_ANY_ATTRIBUTE(m,b) (m)[ATTR_2_W(b)] &= ~(ATTR_2_B(b))
261#define FLIP_ANY_ATTRIBUTE(m,b) (m)[ATTR_2_W(b)] ^= ATTR_2_B(b)
262#define TEST_ANY_ATTRIBUTE(m,b) (((m)[ATTR_2_W(b)] & ATTR_2_B(b))!= 0)
263#define COPY_ALL_ATTRIBUTES( from, to ) \
264 memcpy((void *)&to[0], (const void *)&from[0], ALL_ATTRIBUTE_BYTES)
265#define OR_ALL_ATTRIBUTES( from, to ) \
266 ((to)[2] |= (from)[2], (to)[1] |= (from)[1], (to)[0] |= (from)[0])
267
268 /* Macros to handle SYSTEM attributes */
269#define RESET_SYSTEM_ATTRIBUTES(m) ((m)[2] = 0)
270#define SET_SYSTEM_ATTRIBUTE(m,b) (m)[SYS_ATTR_2_W(b)] |= ATTR_2_B(b)
271#define CLEAR_SYSTEM_ATTRIBUTE(m,b) (m)[SYS_ATTR_2_W(b)] &= ~(ATTR_2_B(b))
272#define FLIP_SYSTEM_ATTRIBUTE(m,b) (m)[SYS_ATTR_2_W(b)] ^= ATTR_2_B(b)
273#define TEST_SYSTEM_ATTRIBUTE(m,b) (((m)[SYS_ATTR_2_W(b)] & ATTR_2_B(b)) != 0)
274#define COPY_SYSTEM_ATTRIBUTES( from, to ) \
275 memcpy((void *)&to[2], (const void *)&from[2], SYSTEM_ATTRIBUTE_BYTES)
276#define OR_SYSTEM_ATTRIBUTES( from, to ) ((to)[2] |= (from)[2])
277
278 /* Macros to handle USER attributes */
279#define RESET_USER_ATTRIBUTES(m) ((m)[0] = (m)[1] = 0)
280#define SET_USER_ATTRIBUTE(m,b) (m)[USR_ATTR_2_W(b)] |= ATTR_2_B(b)
281#define CLEAR_USER_ATTRIBUTE(m,b) (m)[USR_ATTR_2_W(b)] &= ~(ATTR_2_B(b))
282#define FLIP_USER_ATTRIBUTE(m,b) (m)[USR_ATTR_2_W(b)] ^= ATTR_2_B(b)
283#define TEST_USER_ATTRIBUTE(m,b) (((m)[USR_ATTR_2_W(b)] & ATTR_2_B(b)) != 0)
284#define COPY_USER_ATTRIBUTES( from, to ) \
285 memcpy((void *)&to[0], (const void *)&from[0], USER_ATTRIBUTE_BYTES)
286#define OR_USER_ATTRIBUTES( from, to ) \
287 ((to)[1] |= (from)[1], (to)[0] |= (from)[0])
288
289 /* System attributes assignment */
290#define ATTR_P_START 64 /* Start of a phase */
291#define ATTR_P_END 65 /* End of a phase */
292#define ATTR_START_OF_RUN_START ATTR_P_START/* Start of SOR phase */
293#define ATTR_START_OF_RUN_END ATTR_P_END /* End of SOR phase */
294#define ATTR_END_OF_RUN_START ATTR_P_START/* Start of EOR phase */
295#define ATTR_END_OF_RUN_END ATTR_P_END /* End of SOR phase */
296#define ATTR_EVENT_SWAPPED 66 /* Swapped event header */
297#define ATTR_EVENT_PAGED 67 /* Paged event */
298#define ATTR_SUPER_EVENT 68 /* Super event */
299#define ATTR_ORBIT_BC 69 /* Orbit/bunch crossing in ID*/
300#define ATTR_KEEP_PAGES 70 /* Do not deallocate pages */
301#define ATTR_HLT_DECISION 71 /* Event contains HLT decis. */
302
303#define ATTR_EVENT_DATA_TRUNCATED 94 /* Truncated payload */
304#define ATTR_EVENT_ERROR 95 /* Invalid event content */
305
306#define SYSTEM_ATTRIBUTES_OK(m) \
307 ((((m)[2]) & ~(ATTR_2_B(ATTR_P_START) | \
308 ATTR_2_B(ATTR_P_END) | \
309 ATTR_2_B(ATTR_EVENT_SWAPPED) | \
310 ATTR_2_B(ATTR_EVENT_PAGED) | \
311 ATTR_2_B(ATTR_SUPER_EVENT) | \
312 ATTR_2_B(ATTR_ORBIT_BC) | \
313 ATTR_2_B(ATTR_KEEP_PAGES) | \
314 ATTR_2_B(ATTR_HLT_DECISION) | \
315 ATTR_2_B(ATTR_EVENT_DATA_TRUNCATED) | \
316 ATTR_2_B(ATTR_EVENT_ERROR))) == 0)
317
318/* ---------- LDC and GDC identifier ---------- */
319typedef unsigned long32 eventHostIdType;
320typedef eventHostIdType eventLdcIdType;
321typedef eventHostIdType eventGdcIdType;
322#define HOST_ID_MIN ((eventHostIdType)0) /* The minimum allowed ID */
323#define HOST_ID_MAX ((eventHostIdType)511) /* The maximum allowed ID */
324#define VOID_ID ((eventHostIdType)-1) /* Unloaded ID */
325
326/* ---------- timestamp ---------- */
327/* The following definition is in common for 32 and 64 bit machines.
328 In both architectures, the field must be loaded into a time_t
329 variable before being used. Failure to do so may cause undefined
330 results up to the early termination of the process.
331
332 The recommended procedure to use this field is the following:
333
334 #include <time.h>
335
336 time_t t;
337
338 t = eventHeaderStruct.eventTimestamp;
339 cTime( &t ); (or whatever else can be done with a time_t)
340
341 Please note that the available timestamp will wrap sometime
342 around Jan 18, 19:14:07, 2038...
343*/
344typedef unsigned long32 eventTimestampType;
345
346/* ---------- The event header structure (with + without data) ---------- */
347struct eventHeaderStruct {
348 eventSizeType eventSize;
349 eventMagicType eventMagic;
350 eventHeadSizeType eventHeadSize;
351 eventVersionType eventVersion;
352 eventTypeType eventType;
353 eventRunNbType eventRunNb;
354 eventIdType eventId;
355 eventTriggerPatternType eventTriggerPattern;
356 eventDetectorPatternType eventDetectorPattern;
357 eventTypeAttributeType eventTypeAttribute;
358 eventLdcIdType eventLdcId;
359 eventGdcIdType eventGdcId;
360 eventTimestampType eventTimestamp;
361};
362
363struct eventStruct {
364 struct eventHeaderStruct eventHeader;
365 unsigned short eventRawData[1];
366};
367
368/* ========== Definitions for the Vector ========== */
369typedef short eventVectorBankIdType;
370typedef unsigned int eventVectorSizeType;
371typedef unsigned int eventVectorOffsetType;
372
373struct eventVectorStruct {
374 eventVectorBankIdType eventVectorBankId;
375 unsigned eventVectorPointsToVector : 1;
376 eventVectorSizeType eventVectorSize;
377 eventVectorOffsetType eventVectorStartOffset;
378};
379
380/* ========== Definitions for the payload descriptor ========== */
381typedef unsigned long32 eventNumEquipmentsType;
382typedef struct eventVectorStruct eventExtensionVectorType;
383
384struct vectorPayloadDescriptorStruct {
385 eventNumEquipmentsType eventNumEquipments;
386 eventExtensionVectorType eventExtensionVector;
387};
388
389/* ========== Definitions for the equipment header ========== */
390typedef long32 equipmentSizeType;
391typedef long32 equipmentTypeType;
392typedef long32 equipmentIdType;
393typedef eventTypeAttributeType equipmentTypeAttributeType;
394typedef long32 equipmentBasicElementSizeType;
395
396struct equipmentHeaderStruct {
397 equipmentSizeType equipmentSize;
398 equipmentTypeType equipmentType;
399 equipmentIdType equipmentId;
400 equipmentTypeAttributeType equipmentTypeAttribute;
401 equipmentBasicElementSizeType equipmentBasicElementSize;
402};
403
404struct equipmentDescriptorStruct {
405 struct equipmentHeaderStruct equipmentHeader;
406 struct eventVectorStruct equipmentVector;
407};
408
409struct equipmentStruct {
410 struct equipmentHeaderStruct equipmentHeader;
411 unsigned short equipmentRawData[1];
412};
413
414/* ========== Definition of the event location for the simpleFifo ========== */
415struct eventLocationDescriptorStruct {
416 eventVectorBankIdType eventBankId;
417 eventVectorOffsetType eventOffset;
418};
419
420/* ========== Global macros ========== */
421
422/* The macro PAGED_EVENT_SIZE receives in input the ADDRESS of a paged
423 event and returns the size (in bytes) of the first page of the
424 event */
425#define PAGED_EVENT_SIZE( event ) \
426 (EVENT_HEAD_BASE_SIZE +sizeof( struct vectorPayloadDescriptorStruct ) + \
427 ((*(eventNumEquipmentsType *)((void*)event+EVENT_HEAD_BASE_SIZE))* \
428 (sizeof( struct equipmentDescriptorStruct ))))
429
430/* ========== Common data header ========== */
431#define CDH_SIZE (8 * 4)
432#define CDH_VERSION 1
433
434#define CDH_TRIGGER_OVERLAP_ERROR_BIT 0
435#define CDH_TRIGGER_MISSING_ERROR_BIT 1
436#define CDH_DATA_PARITY_ERROR_BIT 2
437#define CDH_CONTROL_PARITY_ERROR_BIT 3
438#define CDH_TRIGGER_INFORMATION_UNAVAILABLE_BIT 4
439#define CDH_FEE_ERROR_BIT 5
440#define CDH_HLT_DECISION_BIT 6
441#define CDH_HLT_PAYLOAD_BIT 7
442#define CDH_HLT_DDG_PAYLOAD_BIT 8
443
444/* Please note how the above data structure has been
445 defined for LE systems. Code running on BE systems
446 must have all fields reverted to work correctly! */
447struct commonDataHeaderStruct {
448 unsigned cdhBlockLength : 32;
449 /* ------------------------------------- */
450 unsigned cdhEventId1 : 12;
451 unsigned cdhMBZ0 : 2;
452 unsigned cdhL1TriggerMessage : 10;
453 unsigned cdhVersion : 8;
454 /* ------------------------------------- */
455 unsigned cdhEventId2 : 24;
456 unsigned cdhMBZ1 : 8;
457 /* ------------------------------------- */
458 unsigned cdhParticipatingSubDetectors : 24;
459 unsigned cdhBlockAttributes : 8;
460 /* ------------------------------------- */
461 unsigned cdhMiniEventId : 12;
462 unsigned cdhStatusErrorBits : 16;
463 unsigned cdhMBZ2 : 4;
464 /* ------------------------------------- */
465 unsigned cdhTriggerClassesLow : 32;
466 /* ------------------------------------- */
467 unsigned cdhTriggerClassesHigh : 18;
468 unsigned cdhMBZ3 : 10;
469 unsigned cdhRoiLow : 4;
470 /* ------------------------------------- */
471 unsigned cdhRoiHigh : 32;
472};
473
474#endif