Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

ReadWriteModule.h

Go to the documentation of this file.
00001 
00002 
00003 
00004 
00005 
00006 
00007 #ifndef IO_IOMODULE_H
00008 #define IO_IOMODULE_H
00009 #ifndef STRING
00010 # include <string>
00011 # define STRING
00012 #endif
00013 #ifndef VECTOR
00014 # include <vector>
00015 # define VECTOR
00016 #endif
00017 #ifndef IO_EVENTHANDLE_H
00018 # include "IoModules/EventHandle.h"
00019 #endif
00020 #ifndef IO_FILTER_H
00021 # include "IoModules/Filter.h"
00022 #endif
00023 class TFile;
00024 
00025 namespace io {
00027   class ReadWriteModule {
00028   public:
00029     ReadWriteModule();
00030     virtual ~ReadWriteModule();
00031     
00032   public:
00033     int AddFile(const char* file_regexp);
00034     int RemoveFile(const char* file_regexp);
00035     int GoToFile(const char* file);
00036     int AdvanceFile(int n=1);
00037     int RewindFile(int n=1);
00038     
00039     virtual int GoTo(int run, int event);
00040     virtual int Advance(int n=1);
00041     virtual int Rewind(int n=1);
00042     virtual int Reload();
00043     
00044     void AdoptInputFilter(io::Filter* f);
00045     void AdoptOutputFilter(io::Filter* f);
00046     
00047     void SetOutputFileName(const char* n);
00048     
00049     void        Report()        const;
00050     const char* CurrentFile()   const;
00051     const char* FileName(int i) const;
00052     int         RunNumber()     const { return fRunNumber;   }
00053     int         EventNumber()   const { return fEventNumber; }
00054     
00055     bool              ReadOK();
00056     edm::EventHandle& GetEvent();
00057     int               WriteEvent();
00058     void              Close();
00059     void              SetOutSizeLimit(int mbLimit);
00060     
00061   private:
00062     virtual void UpdateEventNumbers();
00063     virtual int  SetupInputFile();
00064     int          SetupOutputFile();
00065     bool         CheckInFilters(edm::EventHandle& evt);
00066     bool         CheckOutFilters(edm::EventHandle& evt);
00067     
00068   protected:
00069     void SetReadOK(bool ok = true) { fReadOK = ok; }
00070     void SetEventHandle(io::EventHandle* handle);
00071     
00072   private:
00073     // Input stream data
00074     int                      fRunNumber;  
00075     int                      fEventNumber;
00076     bool                     fReadOK;     
00077     int                      fFileIndex;  
00078     TFile*                   fInFile;     
00079     io::EventHandle*         fEvtHandle;  
00080     bool                     fOwnHandle;  
00081     std::vector<std::string> fFileList;   
00082     
00083     // Output stream data
00084     TFile*   fOutFile;     
00085     int      fNwrite;      
00086     int      fFlushFreq;   
00087     Long64_t fOutSizeLimit;
00088     
00089     // Input/output filters
00090     std::vector<io::Filter*> fInFilterList; 
00091     std::vector<io::Filter*> fOutFilterList;
00092   };
00093 }
00094 #endif // IOINPUTMODULE_H
00095 

Generated on Thu Sep 4 02:05:28 2008 for NOvA Offline by doxygen 1.3.5