#ifndef _BREVENTIO_H #define _BREVENTIO_H /////////////////////////////////////////////////////////////////////// // // // // // Author : K. Hagel // // Created : July 98 // // Version : 1.0 // // Changed : // // // /////////////////////////////////////////////////////////////////////// #include "stdio.h" #include "BrIOModule.h" #include "BrDataTable.h" #include "TObject.h" #include "TFile.h" #include "TTree.h" #include "TKey.h" #define ROOT_FILE_SERIAL 1 #define ROOT_FILE_TREE 2 #define MaxNumEventBranches 50 class BrEventIO : public BrIOModule { public: BrEventIO(); BrEventIO(Char_t *filename); virtual ~BrEventIO(); virtual Bool_t Open(Char_t *fname,Option_t *option); virtual Bool_t Close(); virtual void Event(BrEvent* event); virtual Bool_t SkipEvent(Int_t numevt); virtual Int_t GetFileMode() {return fFileMode;} virtual void SetFileMode(Int_t mode); private: Bool_t InitializeRootSerialFile(); //Do initialization for setting up flat file Bool_t InitializeRootTreeFile(); //Do initialization for setting up tree void ProcessRootSerialFile(BrEvent *event); //Read serial file void ProcessRootTreeFile(BrEvent *event); //Read tree file 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[MaxNumEventBranches]; //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 public: friend ostream& operator<< (ostream& os,BrEventIO* digio_p); friend ostream& operator<< (ostream& os,BrEventIO& digio_p); ClassDef(BrEventIO, 1) // Interface to STREAM files }; #endif