BrEventIO


class description - source file - inheritance tree

class BrEventIO : public BrIOModule

    private:
Bool_t InitializeRootSerialFile() Bool_t InitializeRootTreeFile() void ProcessRootSerialFile(BrEvent* event) void ProcessRootTreeFile(BrEvent* event) public:
BrEventIO BrEventIO(Char_t* filename) BrEventIO BrEventIO() BrEventIO BrEventIO(BrEventIO&) void ~BrEventIO() TClass* Class() virtual Bool_t Close() virtual void Event(BrEvent* event) virtual Int_t GetFileMode() virtual TClass* IsA() virtual Bool_t Open(Char_t* fname, Option_t* option) virtual void SetFileMode(Int_t mode) virtual void ShowMembers(TMemberInspector& insp, char* parent) virtual Bool_t SkipEvent(Int_t numevt) virtual void Streamer(TBuffer& b)

Data Members

private:
Char_t fFileName[256] ! File name for Digitized ROOT file TFile* fROOTFile TFile object TString fFileOption Regular TFile option parameter Int_t fFileMode Option to decide what type of file to write TList* fListOfKeys List of Keys in serial file TIter* fNextKey !Key to next event in serial file TTree* fTree Tree to write out TBranch* fBranch[50] Branch for that tree Int_t fBufsize Buffer size for tree Int_t fSplit Split mode? Int_t fNumBytesWritten Number of bytes written Int_t fNumBytesRead Number of bytes read Bool_t fCreateBranch To decide if to create branch or not Int_t fNumBranches Number of branches in the Tree Int_t fNumEntries Number of entries in tree; Int_t fEventNumber Event number we are on. Bool_t fWriteFile Specifies read or write mode Char_t fDateTimeCreated[32] Date and time file was created

Class Description

                                                                   
    BrEventIO                                                      
                                                                   
    Class to write/read GBRAHMS Event data in ROOT format          
                                                                   
    the class is derived from the BrIOModule class                 
                                                                   
    Description:                                                   
    This class is meant to simplify writing BRAHMS output in ROOT  
    format.  The user simply creates the object which has defaults 
    that work.  Several options are also provided in case they are 
    needed.                                                        
                                                                   
    Usage:                                                         
    The standard usage is to create the object, open the           
    file and then use the Event(BrEvent* event) method for event   
    by event writing of event objects.  The file can be opened     
    either in READ mode for readonly operations or in RECREATE     
    mode for write operations.  The TFile APPEND option is not     
    currently supported.  The default file mode is a ROOT tree.    
    The mode can be manually selected using the SetFileMode(option)
    method.                                                        
                                                                   
    Example:                                                       
    BrEventIO *io = new BrEventIO("Digitized Output");             
    io->Open("digitized_output.root","RECREATE");                  
    .                                                              
    .                                                              
    .                                                              
    Event Loop                                                     
    .                                                              
    .                                                              
       Digitize data and create BrEvent *event                     
       io->Event(digitized_event)                                  
    .                                                              
    .                                                              
    End Event Loop                                                 
    io->Close();                                                   


BrEventIO()
 Default constructor

BrEventIO(Char_t *Name) : BrIOModule(Name, Name)
 Constructor.
 name becomes Name and Title for the Module.
 No data file is opened this has to be done in
 the Open() method.

 Option can by "READ" "RECREATE"


~BrEventIO()
  Destructor for BrEventIO. Close the file if open. Delete the TFile object


Bool_t Open(Char_t *fname,Option_t *option)
 Open the file with fname. Returns kFALSE
 if the file can't be opened.
 Otherwise the fFileName data member is set to the
 corresponding filepointer.

 Options: READ for readonly mode or RECREATE for write mode.

 RECREATE mode
 if option is RECREATE, a new file is created.  This object is written out
 to indicate the file mode (Tree or Serial).  If file mode is to be different
 than the default (Tree), the SetFileMode(mode) needs to be used before the Open
 method.

 READ mode
 if option is READ, existing file is opened.  This object is read in to get
 information on file mode.

Bool_t InitializeRootSerialFile()
Routine to Initialize ROOT serial file
This routine does nothing if in write mode.
If in read mode, a list of Keys is found from the event file and stored
in fListOfKeys.  The file header key is removed from the list of keys

Bool_t InitializeRootTreeFile()
Routine to initialize ROOT tree file (default writing mode)
if file opened in write mode:
Create the tree
Initialize some counters
Set up a single branch with fSplit=1.  Setting branches by hand is not yet supported.

if file opened in read mode.
Get the tree object from the file
Set counter of the number of entries in the file
Initialize some counters and flags

Bool_t Close()
 Close the file Opened by the object. Return
 kFALSE if no file was open.

Bool_t SkipEvent(Int_t numevt)
 Skip events on input only


void Event(BrEvent* event)
 Reads or writes one event depending on whether we are in read mode or write mode

void ProcessRootSerialFile(BrEvent *event)
Do Serial File specific actions to read or write the file depending on mode
if write mode, simply write the object and increment number of events written.
if read mode,
get the next key,
Create a dummy event using key->ReadObj();
Copy the dummy event into the event we are passing back.
increment number of events read

void ProcessRootTreeFile(BrEvent *event)
Do Tree File specific actions to read or write the file depending on mode
if Write mode, set the branch address to the event argument, then fTree->Fill();
if Read mode, set branch address to event argument, then fTree->GetEvent(fEventNumber);

void SetFileMode(Int_t mode)
Set file mode.
mode can be either tree or serial
mode must be set before opening the file.

void Streamer(TBuffer &R__b)
 Stream an object of class BrEventIO.



Inline Functions


              Int_t GetFileMode()
            TClass* Class()
            TClass* IsA()
               void ShowMembers(TMemberInspector& insp, char* parent)
          BrEventIO BrEventIO(BrEventIO&)


ROOT page - Class index - Top of the page

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.