1 #ifndef HADAQ_DEFINESS_H
2 #define HADAQ_DEFINESS_H
99 HADAQ_TIMEOFFSET = 1200000000
103 EvtId_data = 0x00000001,
104 EvtId_DABC = 0x00003001,
105 EvtId_runStart = 0x00010002,
106 EvtId_runStop = 0x00010003
110 EvtDecoding_default = 1,
111 EvtDecoding_AloneSubevt = 0x8,
112 EvtDecoding_64bitAligned = (0x03 << 16) | 0x0001
115 #define HADAQ_SWAP4(value) (((value & 0xFF) << 24) | ((value & 0xFF00) << 8) | ((value & 0xFF0000) >> 8) | ((value & 0xFF000000) >> 24))
141 inline uint32_t
Value(
const uint32_t *member)
const
145 return IsSwapped() ? HADAQ_SWAP4(*member) : *member;
154 inline void SetValue(uint32_t *member, uint32_t val)
156 *member =
IsSwapped() ? HADAQ_SWAP4(val) : val;
177 uint32_t rest = hedsize % 8;
178 return (rest==0) ? hedsize : (hedsize + 8 - rest);
356 void Init(uint32_t evnt, uint32_t run=0, uint32_t
id=EvtId_DABC)
431 void Init(uint32_t trigger = 0)
447 case 4:
return datasize /
sizeof(uint32_t);
448 case 2:
return datasize /
sizeof(uint16_t);
450 return datasize /
sizeof(uint8_t);
454 uint32_t
Data(
unsigned idx)
const
460 return Value((uint32_t *) my + idx);
463 uint16_t tmp = ((uint16_t *) my)[idx];
465 if (
IsSwapped()) tmp = ((tmp >> 8) & 0xff) | ((tmp << 8) & 0xff00);
471 return ((uint8_t*) my)[idx];
481 return SetValue((uint32_t *) my + idx, value);
484 if (
IsSwapped()) value = ((value & 0xff00) >> 8) | ((value & 0xff) << 8);
486 ((uint16_t *) my)[idx] = value & 0xffff;
501 while (datalen-- > 0) {
502 *((uint32_t*) buf) =
Data(indx++);
503 buf = ((uint32_t*) buf) + 1;
510 void Dump(
bool print_raw_data =
false);
Intermediate hierarchy class as common base for event and subevent.
Definition: definess.h:193
bool GetDataError() const
get data error
Definition: definess.h:211
void SetId(uint32_t id)
set id
Definition: definess.h:208
uint32_t GetId() const
get id
Definition: definess.h:205
void SetDataError(bool on)
set data error
Definition: definess.h:214
uint32_t tuId
id
Definition: definess.h:195
HadTuId()
constructor
Definition: definess.h:200
~HadTuId()
destructor
Definition: definess.h:202
HADES transport unit header used as base for event and subevent also common envelope for trd network ...
Definition: definess.h:125
uint32_t tuSize
size
Definition: definess.h:127
void SetValue(uint32_t *member, uint32_t val)
swap-save method to set value stolen from hadtu.h
Definition: definess.h:154
uint32_t tuDecoding
decoding
Definition: definess.h:128
uint32_t GetDecoding() const
get decoding
Definition: definess.h:168
HadTu()
constructor
Definition: definess.h:133
~HadTu()
destructor
Definition: definess.h:135
uint32_t GetSize() const
get size
Definition: definess.h:171
void SetDecoding(uint32_t decod)
set decoding
Definition: definess.h:185
uint32_t GetPaddedSize() const
get padded size
Definition: definess.h:174
void SetSize(uint32_t bytes)
set size
Definition: definess.h:182
uint32_t Value(const uint32_t *member) const
access value
Definition: definess.h:141
bool IsSwapped() const
msb of decode word is always non zero...?
Definition: definess.h:138
HADES raw event.
Definition: definess.h:315
uint32_t evtSeqNr
event sequence number
Definition: definess.h:318
void SetRunNr(uint32_t n)
set run nr
Definition: definess.h:343
void SetDate(uint32_t d)
set date
Definition: definess.h:348
void InitHeader(uint32_t evid)
Method to set initial header value like decoding and date/time.
Definition: definess.cxx:19
int32_t GetTime() const
get time
Definition: definess.h:351
void SetTime(uint32_t t)
set time
Definition: definess.h:353
void Init(uint32_t evnt, uint32_t run=0, uint32_t id=EvtId_DABC)
initialize subevent
Definition: definess.h:356
~RawEvent()
destructor
Definition: definess.h:333
RawEvent()
constructor
Definition: definess.h:331
void Dump()
dump raw event
Definition: definess.cxx:10
uint32_t evtRunNr
event run number
Definition: definess.h:321
int32_t GetRunNr() const
get run nr
Definition: definess.h:341
int32_t GetDate() const
get date
Definition: definess.h:346
uint32_t evtPad
event padding
Definition: definess.h:322
void SetSeqNr(uint32_t n)
set seq nr
Definition: definess.h:338
uint32_t evtTime
event time
Definition: definess.h:320
uint32_t evtDate
event date
Definition: definess.h:319
uint32_t GetSeqNr() const
get seq nr
Definition: definess.h:336
Raw hades subevent.
Definition: definess.h:408
unsigned GetNrOfDataWords() const
returns number of payload data words, not maximum index!
Definition: definess.h:443
uint32_t * GetDataPtr(unsigned indx) const
Return pointer on data by index - user should care itself about swapping.
Definition: definess.h:437
void SetData(unsigned idx, uint32_t value)
set data
Definition: definess.h:475
uint8_t GetTrigTypeTrb3() const
for trb3: each subevent contains trigger type in decoding word
Definition: definess.h:428
void CopyDataTo(void *buf, unsigned indx, unsigned datalen)
copy data to provided buffer
Definition: definess.h:498
void SetTrigNr(uint32_t trigger)
set trigger number
Definition: definess.h:425
uint32_t GetTrigNr() const
get trigger number
Definition: definess.h:423
uint32_t GetErrBits()
get error bits
Definition: definess.h:492
void Init(uint32_t trigger=0)
init header
Definition: definess.h:431
uint32_t Data(unsigned idx) const
swap-save access to any data.
Definition: definess.h:454
unsigned Alignment() const
get alignment
Definition: definess.h:420
uint32_t subEvtTrigNr
subevent trigger number
Definition: definess.h:412
void * RawData(unsigned ix=0) const
Return pointer where raw data should starts.
Definition: definess.h:508
void Dump(bool print_raw_data=false)
dump subevent
Definition: definess.cxx:41