![]() |
GRSISort "v4.0.0.5"
An extension of the ROOT analysis Framework
|
![]() |
MIDAS event.
C++ class representing one midas event.
Objects of this class are created by reading midas events from a file, by reading them from a midas shared memory buffer or by receiving them through the mserver
Contains the information within a Midas Event. This usually includes a header, midas information such as timestamp bank id, etc. And the bank data. The bank data is usually the information supplied by either a scaler or the experimental DAQ system.
Definition at line 35 of file TMidasEvent.h.
Classes | |
struct | TMidas_BANK |
struct | TMidas_BANK32 |
struct | TMidas_BANK_HEADER |
Public Member Functions | |
TMidasEvent () | |
TMidasEvent (const TMidasEvent &) | |
TMidasEvent (TMidasEvent &&) noexcept=default | |
~TMidasEvent () override | |
void | AllocateData () |
void | Clear (Option_t *opt="") override |
void | Copy (TObject &) const override |
int | FindBank (const char *name, int *bklen, int *bktype, void **pdata) const |
const char * | GetBankList () const |
char * | GetData () override |
uint32_t | GetDataSize () const override |
TMidas_EVENT_HEADER * | GetEventHeader () |
uint16_t | GetEventId () const |
uint32_t | GetSerialNumber () const |
uint32_t | GetTimeStamp () const override |
uint16_t | GetTriggerMask () const |
virtual int | GoodFrags () |
virtual void | IncrementGoodFrags () |
bool | IsBank32 () const |
bool | IsGoodSize () const |
int | IterateBank (TMidas_BANK **, char **pdata) const |
int | IterateBank32 (TMidas_BANK32 **, char **pdata) const |
int | LocateBank (const void *unused, const char *name, void **pdata) const |
TMidasEvent & | operator= (const TMidasEvent &) |
TMidasEvent & | operator= (TMidasEvent &&) noexcept=default |
void | Print (const char *option="") const override |
int | SetBankList () |
void | SetData (uint32_t size, char *data) |
int | SwapBytes (bool) override |
void | SwapBytesEventHeader () |
Private Attributes | |
bool | fAllocatedByUs |
char * | fBankList |
int | fBanksN |
char * | fData |
TMidas_EVENT_HEADER | fEventHeader |
int | fGoodFrags {0} |
TMidasEvent::TMidasEvent | ( | ) |
default constructor
Definition at line 19 of file TMidasEvent.cxx.
References TMidas_EVENT_HEADER::fDataSize, fEventHeader, TMidas_EVENT_HEADER::fEventId, TMidas_EVENT_HEADER::fSerialNumber, TMidas_EVENT_HEADER::fTimeStamp, and TMidas_EVENT_HEADER::fTriggerMask.
TMidasEvent::TMidasEvent | ( | const TMidasEvent & | rhs | ) |
|
defaultnoexcept |
|
override |
void TMidasEvent::AllocateData | ( | ) |
allocate data buffer using the existing event header
Definition at line 331 of file TMidasEvent.cxx.
References fAllocatedByUs, fData, TMidas_EVENT_HEADER::fDataSize, fEventHeader, and IsGoodSize().
Referenced by GetData().
|
override |
clear event for reuse
Definition at line 67 of file TMidasEvent.cxx.
References TRawEvent::Clear(), fAllocatedByUs, fBankList, fBanksN, fData, TMidas_EVENT_HEADER::fDataSize, fEventHeader, TMidas_EVENT_HEADER::fEventId, TMidas_EVENT_HEADER::fSerialNumber, TMidas_EVENT_HEADER::fTimeStamp, and TMidas_EVENT_HEADER::fTriggerMask.
Referenced by ~TMidasEvent(), operator=(), and TMidasFile::Skip().
|
override |
copy helper
Definition at line 30 of file TMidasEvent.cxx.
References fAllocatedByUs, fBankList, fBanksN, fData, TMidas_EVENT_HEADER::fDataSize, and fEventHeader.
Referenced by TMidasEvent(), and operator=().
int TMidasEvent::FindBank | ( | const char * | name, |
int * | bklen, | ||
int * | bktype, | ||
void ** | pdata ) const |
Find a data bank.
[in] | name | Name of the data bank to look for. |
[out] | bklen | Number of array elements in this bank. |
[out] | bktype | Bank data type (MIDAS TID_xxx). |
[out] | pdata | Pointer to bank data, Returns nullptr if bank not found. |
Definition at line 176 of file TMidasEvent.cxx.
References fData, TMidasEvent::TMidas_BANK32::fDataSize, TMidasEvent::TMidas_BANK::fDataSize, TMidasEvent::TMidas_BANK32::fName, TMidasEvent::TMidas_BANK::fName, TMidasEvent::TMidas_BANK32::fType, TMidasEvent::TMidas_BANK::fType, and IterateBank32().
Referenced by LocateBank(), and Print().
const char * TMidasEvent::GetBankList | ( | ) | const |
|
overridevirtual |
return pointer to the data buffer
Reimplemented from TRawEvent.
Definition at line 127 of file TMidasEvent.cxx.
References AllocateData(), and fData.
|
overridevirtual |
return the event size
Reimplemented from TRawEvent.
Definition at line 122 of file TMidasEvent.cxx.
References TMidas_EVENT_HEADER::fDataSize, and fEventHeader.
Referenced by TMidasFile::Skip().
TMidas_EVENT_HEADER * TMidasEvent::GetEventHeader | ( | ) |
return pointer to the event header
Definition at line 137 of file TMidasEvent.cxx.
References fEventHeader.
Referenced by TMidasFile::Skip().
uint16_t TMidasEvent::GetEventId | ( | ) | const |
return the event id
Definition at line 102 of file TMidasEvent.cxx.
References fEventHeader, and TMidas_EVENT_HEADER::fEventId.
uint32_t TMidasEvent::GetSerialNumber | ( | ) | const |
return the serial number
Definition at line 112 of file TMidasEvent.cxx.
References fEventHeader, and TMidas_EVENT_HEADER::fSerialNumber.
|
overridevirtual |
return the time stamp (unix time in seconds)
Reimplemented from TRawEvent.
Definition at line 117 of file TMidasEvent.cxx.
References fEventHeader, and TMidas_EVENT_HEADER::fTimeStamp.
uint16_t TMidasEvent::GetTriggerMask | ( | ) | const |
return the triger mask
Definition at line 107 of file TMidasEvent.cxx.
References fEventHeader, and TMidas_EVENT_HEADER::fTriggerMask.
|
inlinevirtualinherited |
returns number of good fragments parsed
Definition at line 47 of file TRawEvent.h.
References TRawEvent::fGoodFrags.
|
inlinevirtualinherited |
increments the number of good fragments parsed
Definition at line 48 of file TRawEvent.h.
References TRawEvent::fGoodFrags.
bool TMidasEvent::IsBank32 | ( | ) | const |
returns "true" if event uses 32-bit banks
Definition at line 147 of file TMidasEvent.cxx.
References fData.
Referenced by SetBankList(), and SwapBytes().
bool TMidasEvent::IsGoodSize | ( | ) | const |
validate the event length
Definition at line 142 of file TMidasEvent.cxx.
References TMidas_EVENT_HEADER::fDataSize, and fEventHeader.
Referenced by AllocateData(), SetData(), and TMidasFile::Skip().
int TMidasEvent::IterateBank | ( | TMidas_BANK ** | pbk, |
char ** | pdata ) const |
iterate through 16-bit data banks
Iterates through banks inside an event. The function can be used to enumerate all banks of an event.
[in] | pbk | Pointer to the bank header, must be nullptr for the first call to this function. Returns nullptr if no more banks |
[in] | pdata | Pointer to data area of bank. Returns nullptr if no more banks |
Definition at line 394 of file TMidasEvent.cxx.
References fData, and TMidasEvent::TMidas_BANK_HEADER::fDataSize.
Referenced by SetBankList().
int TMidasEvent::IterateBank32 | ( | TMidas_BANK32 ** | pbk, |
char ** | pdata ) const |
iterate through 32-bit data banks
See IterateBank()
Definition at line 423 of file TMidasEvent.cxx.
References fData, and TMidasEvent::TMidas_BANK32::fDataSize.
Referenced by FindBank(), and SetBankList().
int TMidasEvent::LocateBank | ( | const void * | unused, |
const char * | name, | ||
void ** | pdata ) const |
TMidasEvent & TMidasEvent::operator= | ( | const TMidasEvent & | rhs | ) |
|
defaultnoexcept |
|
override |
show all event information
Print data held in this class.
[in] | option | If 'a' (for "all") then the raw data will be printed out too. |
Definition at line 230 of file TMidasEvent.cxx.
References fBankList, fBanksN, fData, TMidas_EVENT_HEADER::fDataSize, fEventHeader, TMidas_EVENT_HEADER::fEventId, FindBank(), TMidas_EVENT_HEADER::fSerialNumber, TMidas_EVENT_HEADER::fTimeStamp, TMidas_EVENT_HEADER::fTriggerMask, hex(), and RESET_COLOR.
int TMidasEvent::SetBankList | ( | ) |
create the list of data banks, return number of banks
Definition at line 346 of file TMidasEvent.cxx.
References fBankList, fBanksN, fEventHeader, TMidas_EVENT_HEADER::fEventId, TMidasEvent::TMidas_BANK32::fName, TMidasEvent::TMidas_BANK::fName, IsBank32(), IterateBank(), and IterateBank32().
void TMidasEvent::SetData | ( | uint32_t | size, |
char * | data ) |
set an externally allocated data buffer
Definition at line 90 of file TMidasEvent.cxx.
References fAllocatedByUs, fData, TMidas_EVENT_HEADER::fDataSize, fEventHeader, IsGoodSize(), and SwapBytes().
|
overridevirtual |
convert event data between little-endian (Linux-x86) and big endian (MacOS-PPC)
Reimplemented from TRawEvent.
Definition at line 516 of file TMidasEvent.cxx.
References DWORD_SWAP, fData, TMidas_EVENT_HEADER::fDataSize, TMidasEvent::TMidas_BANK32::fDataSize, TMidasEvent::TMidas_BANK::fDataSize, TMidasEvent::TMidas_BANK_HEADER::fDataSize, fEventHeader, TMidasEvent::TMidas_BANK_HEADER::fFlags, TMidasEvent::TMidas_BANK32::fType, TMidasEvent::TMidas_BANK::fType, IsBank32(), QWORD_SWAP, and WORD_SWAP.
Referenced by SetData().
void TMidasEvent::SwapBytesEventHeader | ( | ) |
convert event header between little-endian (Linux-x86) and big endian (MacOS-PPC)
Definition at line 506 of file TMidasEvent.cxx.
References DWORD_SWAP, TMidas_EVENT_HEADER::fDataSize, fEventHeader, TMidas_EVENT_HEADER::fEventId, TMidas_EVENT_HEADER::fSerialNumber, TMidas_EVENT_HEADER::fTimeStamp, TMidas_EVENT_HEADER::fTriggerMask, and WORD_SWAP.
Referenced by TMidasFile::Skip().
|
private |
"true" if we own the data buffer
Definition at line 87 of file TMidasEvent.h.
Referenced by AllocateData(), Clear(), Copy(), and SetData().
|
private |
list of bank names in this event
Definition at line 86 of file TMidasEvent.h.
Referenced by Clear(), Copy(), GetBankList(), Print(), and SetBankList().
|
private |
number of banks in this event
Definition at line 85 of file TMidasEvent.h.
Referenced by Clear(), Copy(), Print(), and SetBankList().
|
private |
event data buffer
Definition at line 84 of file TMidasEvent.h.
Referenced by AllocateData(), Clear(), Copy(), FindBank(), GetData(), IsBank32(), IterateBank(), IterateBank32(), Print(), SetData(), and SwapBytes().
|
private |
event header
Definition at line 83 of file TMidasEvent.h.
Referenced by TMidasEvent(), AllocateData(), Clear(), Copy(), GetDataSize(), GetEventHeader(), GetEventId(), GetSerialNumber(), GetTimeStamp(), GetTriggerMask(), IsGoodSize(), Print(), SetBankList(), SetData(), SwapBytes(), and SwapBytesEventHeader().
|
privateinherited |
number of good fragments parsed
Definition at line 51 of file TRawEvent.h.
Referenced by TRawEvent::Clear(), TRawEvent::Copy(), TRawEvent::GoodFrags(), and TRawEvent::IncrementGoodFrags().