GRSISort
Created by P.C. Bender
Developement Team: P.C. Bender, R. Dunlop, V. Bildstein
An extension of the ROOT analysis Framework
TMidasEvent Class Reference

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 () 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_HEADERGetEventHeader ()
 
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
 
TMidasEventoperator= (const TMidasEvent &)
 
void Print (const char *option="") const override
 
int SetBankList ()
 
void SetData (uint32_t size, char *data)
 
int SwapBytes (bool) override
 
void SwapBytesEventHeader ()
 

Protected Attributes

bool fAllocatedByUs
 
char * fBankList
 
int fBanksN
 
char * fData
 
TMidas_EVENT_HEADER fEventHeader
 
int fGoodFrags {0}
 

#include <TMidasEvent.h>

+ Inheritance diagram for TMidasEvent:
+ Collaboration diagram for TMidasEvent:

Constructor & Destructor Documentation

◆ TMidasEvent() [1/2]

TMidasEvent::TMidasEvent ( )

default constructor

Definition at line 23 of file TMidasEvent.cxx.

◆ TMidasEvent() [2/2]

TMidasEvent::TMidasEvent ( const TMidasEvent rhs)

copy constructor

Definition at line 58 of file TMidasEvent.cxx.

References Copy().

◆ ~TMidasEvent()

TMidasEvent::~TMidasEvent ( )
override

destructor

Definition at line 64 of file TMidasEvent.cxx.

References Clear().

Member Function Documentation

◆ AllocateData()

void TMidasEvent::AllocateData ( )

allocate data buffer using the existing event header

Definition at line 366 of file TMidasEvent.cxx.

References fAllocatedByUs, fData, TMidas_EVENT_HEADER::fDataSize, fEventHeader, and IsGoodSize().

Referenced by GetData().

◆ Clear()

◆ Copy()

void TMidasEvent::Copy ( TObject &  rhs) const
override

copy helper

Definition at line 41 of file TMidasEvent.cxx.

References fAllocatedByUs, fBankList, fBanksN, fData, TMidas_EVENT_HEADER::fDataSize, and fEventHeader.

Referenced by operator=(), and TMidasEvent().

◆ FindBank()

int TMidasEvent::FindBank ( const char *  name,
int *  bklen,
int *  bktype,
void **  pdata 
) const

Find a data bank.

Parameters
[in]nameName of the data bank to look for.
[out]bklenNumber of array elements in this bank.
[out]bktypeBank data type (MIDAS TID_xxx).
[out]pdataPointer to bank data, Returns nullptr if bank not found.
Returns
1 if bank found, 0 otherwise.

Definition at line 192 of file TMidasEvent.cxx.

References fData, TMidasEvent::TMidas_BANK_HEADER::fDataSize, TMidasEvent::TMidas_BANK::fDataSize, TMidasEvent::TMidas_BANK32::fDataSize, TMidasEvent::TMidas_BANK_HEADER::fFlags, TMidasEvent::TMidas_BANK::fName, TMidasEvent::TMidas_BANK32::fName, TMidasEvent::TMidas_BANK::fType, TMidasEvent::TMidas_BANK32::fType, IterateBank32(), and TID_SIZE.

Referenced by LocateBank(), and Print().

◆ GetBankList()

const char * TMidasEvent::GetBankList ( ) const

return a list of data banks

Definition at line 376 of file TMidasEvent.cxx.

References fBankList.

◆ GetData()

char * TMidasEvent::GetData ( )
overridevirtual

return pointer to the data buffer

Reimplemented from TRawEvent.

Definition at line 141 of file TMidasEvent.cxx.

References AllocateData(), and fData.

◆ GetDataSize()

uint32_t TMidasEvent::GetDataSize ( ) const
overridevirtual

return the event size

Reimplemented from TRawEvent.

Definition at line 136 of file TMidasEvent.cxx.

References TMidas_EVENT_HEADER::fDataSize, and fEventHeader.

Referenced by TMidasFile::Skip().

◆ GetEventHeader()

TMidas_EVENT_HEADER * TMidasEvent::GetEventHeader ( )

return pointer to the event header

Definition at line 151 of file TMidasEvent.cxx.

References fEventHeader.

Referenced by TMidasFile::Skip().

◆ GetEventId()

uint16_t TMidasEvent::GetEventId ( ) const

return the event id

Definition at line 116 of file TMidasEvent.cxx.

References fEventHeader, and TMidas_EVENT_HEADER::fEventId.

◆ GetSerialNumber()

uint32_t TMidasEvent::GetSerialNumber ( ) const

return the serial number

Definition at line 126 of file TMidasEvent.cxx.

References fEventHeader, and TMidas_EVENT_HEADER::fSerialNumber.

◆ GetTimeStamp()

uint32_t TMidasEvent::GetTimeStamp ( ) const
overridevirtual

return the time stamp (unix time in seconds)

Reimplemented from TRawEvent.

Definition at line 131 of file TMidasEvent.cxx.

References fEventHeader, and TMidas_EVENT_HEADER::fTimeStamp.

◆ GetTriggerMask()

uint16_t TMidasEvent::GetTriggerMask ( ) const

return the triger mask

Definition at line 121 of file TMidasEvent.cxx.

References fEventHeader, and TMidas_EVENT_HEADER::fTriggerMask.

◆ GoodFrags()

virtual int TRawEvent::GoodFrags ( )
inlinevirtualinherited

returns number of good fragments parsed

Definition at line 48 of file TRawEvent.h.

References TRawEvent::fGoodFrags.

◆ IncrementGoodFrags()

virtual void TRawEvent::IncrementGoodFrags ( )
inlinevirtualinherited

increments the number of good fragments parsed

Definition at line 49 of file TRawEvent.h.

References TRawEvent::fGoodFrags.

◆ IsBank32()

bool TMidasEvent::IsBank32 ( ) const

returns "true" if event uses 32-bit banks

Definition at line 161 of file TMidasEvent.cxx.

References fData.

Referenced by SetBankList(), and SwapBytes().

◆ IsGoodSize()

bool TMidasEvent::IsGoodSize ( ) const

validate the event length

Definition at line 156 of file TMidasEvent.cxx.

References TMidas_EVENT_HEADER::fDataSize, and fEventHeader.

Referenced by AllocateData(), SetData(), and TMidasFile::Skip().

◆ IterateBank()

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.

Parameters
[in]pbkPointer to the bank header, must be nullptr for the first call to this function. Returns nullptr if no more banks
[in]pdataPointer to data area of bank. Returns nullptr if no more banks
Returns
Size of bank in bytes or 0 if no more banks.

Definition at line 429 of file TMidasEvent.cxx.

References fData, and TMidasEvent::TMidas_BANK::fDataSize.

Referenced by SetBankList().

◆ IterateBank32()

int TMidasEvent::IterateBank32 ( TMidas_BANK32 **  pbk,
char **  pdata 
) const

iterate through 32-bit data banks

See IterateBank()

Definition at line 458 of file TMidasEvent.cxx.

References fData, TMidasEvent::TMidas_BANK32::fDataSize, TMidasEvent::TMidas_BANK32::fType, and TID_MAX.

Referenced by FindBank(), and SetBankList().

◆ LocateBank()

int TMidasEvent::LocateBank ( const void *  unused,
const char *  name,
void **  pdata 
) const

See FindBank()

Definition at line 166 of file TMidasEvent.cxx.

References FindBank().

◆ operator=()

TMidasEvent & TMidasEvent::operator= ( const TMidasEvent rhs)

assignement operator

Definition at line 69 of file TMidasEvent.cxx.

References Clear(), and Copy().

◆ Print()

void TMidasEvent::Print ( const char *  option = "") const
override

show all event information

Print data held in this class.

Parameters
[in]optionIf 'a' (for "all") then the raw data will be printed out too.

Definition at line 265 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.

◆ SetBankList()

int TMidasEvent::SetBankList ( )

◆ SetData()

void TMidasEvent::SetData ( uint32_t  size,
char *  data 
)

set an externally allocated data buffer

Definition at line 104 of file TMidasEvent.cxx.

References fAllocatedByUs, fData, TMidas_EVENT_HEADER::fDataSize, fEventHeader, IsGoodSize(), and SwapBytes().

◆ SwapBytes()

int TMidasEvent::SwapBytes ( bool  force)
overridevirtual

◆ SwapBytesEventHeader()

void TMidasEvent::SwapBytesEventHeader ( )

convert event header between little-endian (Linux-x86) and big endian (MacOS-PPC)

Definition at line 539 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().

Member Data Documentation

◆ fAllocatedByUs

bool TMidasEvent::fAllocatedByUs
protected

"true" if we own the data buffer

Definition at line 86 of file TMidasEvent.h.

Referenced by AllocateData(), Clear(), Copy(), and SetData().

◆ fBankList

char* TMidasEvent::fBankList
protected

list of bank names in this event

Definition at line 85 of file TMidasEvent.h.

Referenced by Clear(), Copy(), GetBankList(), Print(), and SetBankList().

◆ fBanksN

int TMidasEvent::fBanksN
protected

number of banks in this event

Definition at line 84 of file TMidasEvent.h.

Referenced by Clear(), Copy(), Print(), and SetBankList().

◆ fData

char* TMidasEvent::fData
protected

event data buffer

Definition at line 83 of file TMidasEvent.h.

Referenced by AllocateData(), Clear(), Copy(), FindBank(), GetData(), IsBank32(), IterateBank(), IterateBank32(), Print(), SetData(), and SwapBytes().

◆ fEventHeader

◆ fGoodFrags

int TRawEvent::fGoodFrags {0}
protectedinherited

number of good fragments parsed

Definition at line 52 of file TRawEvent.h.

Referenced by Clear(), TRawEvent::GoodFrags(), and TRawEvent::IncrementGoodFrags().