Public Member Functions | Protected Member Functions | Private Attributes

TTrbSource Class Reference

#include <TTrbSource.h>

Collaboration diagram for TTrbSource:
Collaboration graph
[legend]

Public Member Functions

 TTrbSource ()
 TTrbSource (const char *name, const char *args, Int_t port)
 TTrbSource (TGo4UserSourceParameter *par)
virtual ~TTrbSource ()
virtual Int_t Open ()
virtual Int_t Close ()
virtual Bool_t CheckEventClass (TClass *cl)
virtual Bool_t BuildEvent (TGo4EventElement *dest)
const char * GetArgs () const
void SetArgs (const char *arg)
Int_t GetPort () const
void SetPort (Int_t val)

Protected Member Functions

Bool_t NextBuffer ()
Bool_t NextEvent (TGo4MbsEvent *target)
std::streamsize ReadFile (Char_t *dest, size_t len)

Private Attributes

Bool_t fbIsOpen
TString fxArgs
Int_t fiPort
std::ifstream * fxFile
TGo4SubEventHeader10 fxSubevHead
Char_t * fxBuffer
Trb_EventfxHadEvent
std::streamsize fxBufsize
Short_t * fxCursor
Short_t * fxBufEnd
Int_t fiEventLen

Detailed Description

Definition at line 323 of file TTrbSource.h.


Constructor & Destructor Documentation

TTrbSource::TTrbSource (  ) 

Definition at line 58 of file TTrbSource.cxx.

TTrbSource::TTrbSource ( const char *  name,
const char *  args,
Int_t  port 
)

Create source specifying values directly

Definition at line 16 of file TTrbSource.cxx.

References Open().

TTrbSource::TTrbSource ( TGo4UserSourceParameter *  par  ) 

Creat source from setup within usersource parameter object

Definition at line 33 of file TTrbSource.cxx.

References Open(), SetArgs(), and SetPort().

TTrbSource::~TTrbSource (  )  [virtual]

Definition at line 72 of file TTrbSource.cxx.

References Close().


Member Function Documentation

Bool_t TTrbSource::BuildEvent ( TGo4EventElement *  dest  )  [virtual]

This methods actually fills the target event class which is passed as pointer. Uses the latest event which is referenced by fxEvent or fxBuffer. Does _not_ fetch a new event from source, therefore one source event may be used to fill several TTrbEvent classes. To get a new event call NextEvent() before this method.

Definition at line 145 of file TTrbSource.cxx.

References NextBuffer(), and NextEvent().

Bool_t TTrbSource::CheckEventClass ( TClass *  cl  )  [virtual]

This method checks if event class is suited for the source

Definition at line 77 of file TTrbSource.cxx.

Int_t TTrbSource::Close (  )  [virtual]

Close the file or connection.

Closestatus of source

Definition at line 178 of file TTrbSource.cxx.

References fbIsOpen, fxBuffer, and fxFile.

Referenced by ~TTrbSource().

const char* TTrbSource::GetArgs (  )  const [inline]

Definition at line 353 of file TTrbSource.h.

References fxArgs.

Int_t TTrbSource::GetPort (  )  const [inline]

Definition at line 357 of file TTrbSource.h.

References fiPort.

Bool_t TTrbSource::NextBuffer (  )  [protected]

read next buffer from file into memory

Each buffer contains one full event: First read event header:

Then read rest of buffer from file

Account padding of events to 8 byte boundaries:

Definition at line 96 of file TTrbSource.cxx.

References fxBufEnd, fxBuffer, fxBufsize, fxHadEvent, Trb_Event::GetSize(), ReadFile(), and Trb_BUFSIZE.

Referenced by BuildEvent().

Bool_t TTrbSource::NextEvent ( TGo4MbsEvent *  target  )  [protected]

Fill next xsys event from buffer location into output structure

We fill complete hadaq event into one mbs subevent, not to lose header information decomposing hades subevents is left to the user analysis processor!

Definition at line 126 of file TTrbSource.cxx.

References fiEventLen, fxBuffer, fxBufsize, fxHadEvent, fxSubevHead, and Trb_Event::GetSeqNr().

Referenced by BuildEvent().

Int_t TTrbSource::Open (  )  [virtual]

Open the file or connection.

Open connection/file

Definition at line 158 of file TTrbSource.cxx.

References fbIsOpen, fxBuffer, and fxFile.

Referenced by TTrbSource().

std::streamsize TTrbSource::ReadFile ( Char_t *  dest,
size_t  len 
) [protected]

Read from input file and check

Definition at line 82 of file TTrbSource.cxx.

References fxFile.

Referenced by NextBuffer().

void TTrbSource::SetArgs ( const char *  arg  )  [inline]

Definition at line 355 of file TTrbSource.h.

References fxArgs.

Referenced by TTrbSource().

void TTrbSource::SetPort ( Int_t  val  )  [inline]

Definition at line 359 of file TTrbSource.h.

References fiPort.

Referenced by TTrbSource().


Field Documentation

Bool_t TTrbSource::fbIsOpen [private]

Definition at line 372 of file TTrbSource.h.

Referenced by Close(), and Open().

Int_t TTrbSource::fiEventLen [private]

Length of current event data in shorts

Definition at line 405 of file TTrbSource.h.

Referenced by NextEvent().

Int_t TTrbSource::fiPort [private]

Optional port number

Definition at line 378 of file TTrbSource.h.

Referenced by GetPort(), and SetPort().

TString TTrbSource::fxArgs [private]

Optional argument string

Definition at line 375 of file TTrbSource.h.

Referenced by GetArgs(), and SetArgs().

Short_t* TTrbSource::fxBufEnd [private]

points to end of buffer

Definition at line 402 of file TTrbSource.h.

Referenced by NextBuffer().

Char_t* TTrbSource::fxBuffer [private]

working buffer

Definition at line 390 of file TTrbSource.h.

Referenced by Close(), NextBuffer(), NextEvent(), and Open().

std::streamsize TTrbSource::fxBufsize [private]

actual size of bytes read into buffer most recently

Definition at line 396 of file TTrbSource.h.

Referenced by NextBuffer(), and NextEvent().

Short_t* TTrbSource::fxCursor [private]

cursor in buffer

Definition at line 399 of file TTrbSource.h.

std::ifstream* TTrbSource::fxFile [private]

file that contains the data in ascii format.

Definition at line 381 of file TTrbSource.h.

Referenced by Close(), Open(), and ReadFile().

points to current event header in buffer

Definition at line 393 of file TTrbSource.h.

Referenced by NextBuffer(), and NextEvent().

TGo4SubEventHeader10 TTrbSource::fxSubevHead [private]

true if next buffer needs to be read from file setup subevent ids for mbs container

Definition at line 387 of file TTrbSource.h.

Referenced by NextEvent().


The documentation for this class was generated from the following files: