Main Page | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

TMidasEvent Class Reference

#include <TMidasEvent.h>

Collaboration diagram for TMidasEvent:

[legend]
List of all members.

Detailed Description

MIDAS-event class.

For reading each event from a MIDAS .mid data file sequentially.

Author:
JEP, J. Chuma.
Version:
1.2.
Date:
August 2003.

Definition at line 12 of file TMidasEvent.h.

Public Types

enum  EEventId { kEV_BOR = 0x8000, kEV_EOR = 0x8001, kEV_MESS = 0x8002 }

Public Member Functions

 TMidasEvent ()
 TMidasEvent (const TMidasEvent &)
 ~TMidasEvent ()
TMidasEventoperator= (const TMidasEvent &)
void Clear (const Char_t *="")
void Print (const Char_t *="") const
Int_t FindBank (const Char_t *, ULong_t *, ULong_t *, void **) const
Int_t LocateBank (const Char_t *, void *) const
Int_t SwapBytes (Bool_t)
Char_t * GetData () const
const Char_t * GetBankList (UShort_t &) const
Short_t GetEventId () const
Short_t GetTriggerMask () const
ULong_t GetSerialNumber () const
ULong_t GetTimeStamp () const
ULong_t GetDataSize () const
EventHeader_tGetEventHeader ()
void AllocateData ()
void Set (Char_t *)
void SetData (Char_t *)
void SetEventId (Short_t)
void SetTriggerMask (Short_t)
void SetSerialNumber (ULong_t)
void SetTimeStamp (ULong_t)
void SetDataSize (ULong_t)
Bool_t IsGoodSize () const
Bool_t IsTriggerMask (Short_t) const
void SwapBytesEventHeader ()

Private Member Functions

Int_t IterateBank (void *, Bank_t **, void *) const
Int_t IterateBank32 (void *, Bank32_t **, void *) const

Private Attributes

const Int_t fBankListMax
const Int_t fStringBankListMax
Char_t * fData
Bool_t fAllocated
EventHeader_t fEventHeader


Member Enumeration Documentation

enum EEventId
 

Enumeration of MIDAS-specific events.

Enumeration values:
kEV_BOR 
kEV_EOR 
kEV_MESS 

Definition at line 45 of file TMidasEvent.h.


Constructor & Destructor Documentation

TMidasEvent  ) 
 

Default constructor.

Definition at line 25 of file TMidasEvent.cxx.

References EventHeader_t::fDataSize, fEventHeader, EventHeader_t::fEventId, EventHeader_t::fSerialNumber, EventHeader_t::fTimeStamp, and EventHeader_t::fTriggerMask.

TMidasEvent const TMidasEvent rhs  ) 
 

Copy constructor. This is needed as some of the DragonRoot classes deal with pointers.

Parameters:
[in] rhs The TMidasEvent to be copied.

Definition at line 38 of file TMidasEvent.cxx.

References fAllocated, fData, EventHeader_t::fDataSize, fEventHeader, EventHeader_t::fEventId, EventHeader_t::fSerialNumber, EventHeader_t::fTimeStamp, and EventHeader_t::fTriggerMask.

~TMidasEvent  ) 
 

Default destructor.

Definition at line 62 of file TMidasEvent.cxx.

References Clear().

Here is the call graph for this function:


Member Function Documentation

TMidasEvent & operator= const TMidasEvent rhs  ) 
 

Assignment operator overload. This is needed as some of the DragonRoot classes deal with pointers.

Parameters:
[in] rhs The TMidasEvent to be copied.

Definition at line 69 of file TMidasEvent.cxx.

References Clear(), fAllocated, fData, EventHeader_t::fDataSize, fEventHeader, EventHeader_t::fEventId, EventHeader_t::fSerialNumber, EventHeader_t::fTimeStamp, and EventHeader_t::fTriggerMask.

Here is the call graph for this function:

void Clear const Char_t *  option = ""  ) 
 

Method to clear all the data held in the TMidasEvent. This should be called after each TMidasEvent has been sorted to avoid a catastrophic memory leak.

Parameters:
[in] option The option is currently unimplemented.

Definition at line 96 of file TMidasEvent.cxx.

References fData, EventHeader_t::fDataSize, fEventHeader, EventHeader_t::fEventId, EventHeader_t::fSerialNumber, EventHeader_t::fTimeStamp, and EventHeader_t::fTriggerMask.

void Print const Char_t *  option = ""  )  const
 

Print data held in this class.

Parameters:
[in] option If 'b' a list of banks will be printed. If 'a' (for "all") then the raw data from the banks will be printed out too.

Definition at line 334 of file TMidasEvent.cxx.

References EventHeader_t::fDataSize, fEventHeader, EventHeader_t::fEventId, FindBank(), EventHeader_t::fSerialNumber, EventHeader_t::fTimeStamp, EventHeader_t::fTriggerMask, and GetBankList().

Here is the call graph for this function:

Int_t FindBank const Char_t *  name,
ULong_t *  bklen,
ULong_t *  bktype,
void **  pdata
const
 

Finds a bank of given name inside an event.

Parameters:
[in] name Bank name to look for.
[out] bklen Number of elemtents in bank.
[out] bktype Bank type.
[in] pdata Pointer to data area of bank, NULL if bank not found.
Returns:
1 if bank found, 0 otherwise.

Definition at line 176 of file TMidasEvent.cxx.

References DWORD, Bank_t::fDataSize, BankHeader_t::fDataSize, Bank32_t::fDataSize, Bank_t::fName, Bank32_t::fName, Bank_t::fType, and Bank32_t::fType.

Int_t LocateBank const Char_t *  name,
void *  pdata
const
 

Locates a bank of given name inside an event.

Parameters:
[in] name Bank name to look for.
[out] pdata Pointer to data area of bank, NULL if bank not found.
Returns:
Number of values inside the bank.

Definition at line 129 of file TMidasEvent.cxx.

References DWORD, Bank_t::fDataSize, Bank32_t::fDataSize, Bank_t::fName, Bank32_t::fName, Bank_t::fType, and Bank32_t::fType.

Int_t SwapBytes Bool_t  force  ) 
 

Swaps bytes from little endian to big endian or vice versa for a whole event. An event contains a flag which is set by bk_init() to identify the endian format of an event. If force is FALSE, this flag is evaluated and the event is only swapped if it is in the "wrong" format for this system. An event can be swapped to the "wrong" format on purpose for example by a front-end which wants to produce events in a "right" format for a back-end analyzer which has different byte ordering.

Parameters:
[in] force If true, the event is always swapped, if false, the event is only swapped if it is in the wrong format.
Returns:
1==event has been swap, 0==event has not been swapped.

Definition at line 235 of file TMidasEvent.cxx.

References DWORD, DWORD_SWAP, Bank_t::fDataSize, Bank32_t::fDataSize, BankHeader_t::fDataSize, BankHeader_t::fFlags, Bank_t::fType, Bank32_t::fType, QWORD_SWAP, WORD, and WORD_SWAP.

Char_t * GetData  )  const [inline]
 

Get the event data.

Returns:
A pointer to the data.

Definition at line 161 of file TMidasEvent.h.

const Char_t * GetBankList UShort_t &  banksN  )  const
 

Set the bank list. param [out] banksN The number of banks in the event.

Returns:
A list of banks in the event, if any. This returned string must be deleted by the caller.

Definition at line 438 of file TMidasEvent.cxx.

References fBankListMax, fEventHeader, EventHeader_t::fEventId, Bank_t::fName, Bank32_t::fName, IterateBank(), and IterateBank32().

Here is the call graph for this function:

Short_t GetEventId  )  const [inline]
 

Get the event identification number.

Returns:
The event identification number.

Definition at line 120 of file TMidasEvent.h.

References fEventHeader, and EventHeader_t::fEventId.

Short_t GetTriggerMask  )  const [inline]
 

Get the event trigger mask.

Returns:
The event trigger mask.

Definition at line 128 of file TMidasEvent.h.

References fEventHeader, and EventHeader_t::fTriggerMask.

ULong_t GetSerialNumber  )  const [inline]
 

Get the event serial number (incremented separately for each type of event).

Returns:
The event serial number.

Definition at line 136 of file TMidasEvent.h.

References fEventHeader, and EventHeader_t::fSerialNumber.

ULong_t GetTimeStamp  )  const [inline]
 

Get the event time stamp.

Returns:
The event time stamp.

Definition at line 145 of file TMidasEvent.h.

References fEventHeader, and EventHeader_t::fTimeStamp.

ULong_t GetDataSize  )  const [inline]
 

Get the event data-size.

Returns:
The event data-size in bytes.

Definition at line 153 of file TMidasEvent.h.

References EventHeader_t::fDataSize, and fEventHeader.

EventHeader_t * GetEventHeader  )  [inline]
 

Get the event header (usually to fill in the fields).

Returns:
The event header.

Definition at line 169 of file TMidasEvent.h.

void AllocateData  ) 
 

Dynamically allocate space for the event data.

Definition at line 424 of file TMidasEvent.cxx.

References fAllocated, fData, EventHeader_t::fDataSize, and fEventHeader.

void Set Char_t *  eventData  ) 
 

Set the MIDAS header and data area. The data is not copied, just the internal pointer set to point to the correct area. param [in] eventData The buffer containing the entire MIDAS event.

Definition at line 112 of file TMidasEvent.cxx.

References fData, EventHeader_t::fDataSize, fEventHeader, EventHeader_t::fEventId, EventHeader_t::fSerialNumber, EventHeader_t::fTimeStamp, and EventHeader_t::fTriggerMask.

void SetData Char_t *  data  )  [inline]
 

Set the event data - useful for online sorting when the data does not need to be copied into the class.

Parameters:
[in] data A pointer to the event data.

Definition at line 110 of file TMidasEvent.h.

References fAllocated, and fData.

void SetEventId Short_t  eventId  )  [inline]
 

Set the event identification-number.

Parameters:
[in] eventId The event identification number.

Definition at line 70 of file TMidasEvent.h.

References fEventHeader, and EventHeader_t::fEventId.

void SetTriggerMask Short_t  triggerMask  )  [inline]
 

Set the event trigger-mask.

Parameters:
[in] triggerMask The event trigger mask.

Definition at line 78 of file TMidasEvent.h.

References fEventHeader, and EventHeader_t::fTriggerMask.

void SetSerialNumber ULong_t  serialNumber  )  [inline]
 

Set the event serial-number.

Parameters:
[in] serialNumber The event serial number.

Definition at line 86 of file TMidasEvent.h.

References fEventHeader, and EventHeader_t::fSerialNumber.

void SetTimeStamp ULong_t  timeStamp  )  [inline]
 

Set the event time-stamp.

Parameters:
[in] timeStamp The event time stamp.

Definition at line 94 of file TMidasEvent.h.

References fEventHeader, and EventHeader_t::fTimeStamp.

void SetDataSize ULong_t  dataSize  )  [inline]
 

Set the event data-size.

Parameters:
[in] dataSize The size of the event in bytes.

Definition at line 102 of file TMidasEvent.h.

References EventHeader_t::fDataSize, and fEventHeader.

Bool_t IsGoodSize  )  const [inline]
 

Check if the event is a good size.

Returns:
True if the data has a sensible size, false otherwise.

Definition at line 177 of file TMidasEvent.h.

References EventHeader_t::fDataSize, and fEventHeader.

Bool_t IsTriggerMask Short_t  triggerMask  )  const [inline]
 

Check to see if the trigger mask of the events is the same as that required.

Parameters:
[in] triggerMask The trigger mask to test for.
Returns:
True if the trigger mask is the same, false otherwise.

Definition at line 185 of file TMidasEvent.h.

References fEventHeader, and EventHeader_t::fTriggerMask.

void SwapBytesEventHeader  ) 
 

The event header may need byte-swapping.

Definition at line 544 of file TMidasEvent.cxx.

References DWORD_SWAP, EventHeader_t::fDataSize, fEventHeader, EventHeader_t::fEventId, EventHeader_t::fSerialNumber, EventHeader_t::fTimeStamp, EventHeader_t::fTriggerMask, and WORD_SWAP.

Int_t IterateBank void *  event,
Bank_t **  pbk,
void *  pdata
const [private]
 

Iterates through banks inside an event. The function can be used to enumerate all banks of an event.

Parameters:
[in] event Pointer to data area of event.
[in] pbk Pointer to the bank header, must be NULL for the first call to this function.
[in] pdata Pointer to data area of bank, NULL if bank not found.
Returns:
Size of bank in bytes.

Definition at line 491 of file TMidasEvent.cxx.

References Bank_t::fDataSize.

Int_t IterateBank32 void *  event,
Bank32_t **  pbk,
void *  pdata
const [private]
 

Iterates through banks inside an event. The function can be used to enumerate all banks of an event.

Parameters:
[in] event Pointer to data area of event.
[in] pbk Pointer to the bank header, must be NULL for the first call to this function.
[in] pdata Pointer to data area of bank, NULL if bank not found.
Returns:
Size of bank in bytes.

Definition at line 517 of file TMidasEvent.cxx.

References Bank32_t::fDataSize.


Member Data Documentation

const Int_t fBankListMax [private]
 

The maximum number of banks allowed in an event, currently 64.

Definition at line 53 of file TMidasEvent.h.

const Int_t fStringBankListMax [private]
 

The maximum bank string size allowed in an event.

Definition at line 56 of file TMidasEvent.h.

Char_t* fData [private]
 

A pointer to the event data.

Definition at line 59 of file TMidasEvent.h.

Bool_t fAllocated [private]
 

A boolean to test whether data has been copied into the event or set via a pointer (used to determine whether to delete data or not).

Definition at line 64 of file TMidasEvent.h.

EventHeader_t fEventHeader [private]
 

The event header.

Definition at line 67 of file TMidasEvent.h.


The documentation for this class was generated from the following files:
Generated on Mon Jan 8 11:54:36 2007 for DragonRoot by  doxygen 1.3.9.1