#ifndef MARS_MRawFileRead
#define MARS_MRawFileRead

#ifndef MARS_MRawRead
#include "MRawRead.h"
#endif

class TList;
class MTaskList;

class MRawFileRead : public MRawRead
{
private:
    TList     *fFileNames; // list of file names
    UInt_t     fNumFile;   //! number of next file
    UInt_t     fNumEvents; //! input stream (file to read from)

    ifstream  *fIn;        //! input stream (file to read from)

    MParList  *fParList;   //! tasklist to call ReInit from

    UInt_t     fInterleave;

    Bool_t OpenNextFile();

    Int_t PreProcess(MParList *pList);
    Int_t Process();
    Int_t PostProcess();

public:
    MRawFileRead(const char *filename, const char *name=NULL, const char *title=NULL);
    ~MRawFileRead();

    void SetInterleave(UInt_t i) { fInterleave = i; }

    const TString GetFileName() const;

    Int_t  AddFile(const char *fname, Int_t entries=-1);
    Bool_t Rewind();

    ClassDef(MRawFileRead, 0)	// Task to read the raw data binary file
};

#endif
