#ifndef MARS_MDataSet
#define MARS_MDataSet

#ifndef MARS_MParContainer
#include "MParContainer.h"
#endif

#ifndef ROOT_TArrayI
#include <TArrayI.h>
#endif

class MRead;
class MPointingPos;

class MDataSet : public MParContainer
{
private:
    UInt_t  fNumAnalysis;     // Analysis number (artificial)

    TArrayI fNumSequencesOn;  // number of on-sequences
    TArrayI fNumSequencesOff; // number of off-sequences

    TList   fSequencesOn;     // list of names and paths of on-sequences
    TList   fSequencesOff;    // list of names and paths of off-sequences

    TString fNameSource;      // Name of source from catalog
    TString fCatalog;         // edb catalog (magic_favourites.edb)

    Bool_t  fIsWobbleMode;    // Wobble Mode for this dataset?

    void Split(TString &runs, TArrayI &data) const;
    void ResolveSequences(TEnv &env, const TArrayI &num, TList &list) const;
    static void PrintFile(const TObject &obj);

public:
    MDataSet() : fNumAnalysis((UInt_t)-1) { }
    MDataSet(const char *fname);

    // Getter
    Bool_t IsValid() const { return fNumAnalysis!=(UInt_t)-1; }

    UInt_t GetNumSequencesOn() const  { return fNumSequencesOn.GetSize(); }
    UInt_t GetNumSequencesOff() const { return fNumSequencesOff.GetSize(); }

    Bool_t HasOffSequences() const { return GetNumSequencesOff()>0; }

    UInt_t GetNumAnalysis() const { return fNumAnalysis; }
    void   SetNumAnalysis(UInt_t num) { fNumAnalysis=num; }

    Bool_t HasSource() const { return !fNameSource.IsNull(); }
    Bool_t GetSourcePos(MPointingPos &pos) const;

    Bool_t IsWobbleMode() const { return fIsWobbleMode; }

    // Setter
    static Bool_t AddSequencesToList(const TList &list, MRead &read);

    Bool_t AddFiles(MRead &read) const;
    Bool_t AddFilesOn(MRead &read) const;
    Bool_t AddFilesOff(MRead &read) const;

    // TObject
    void Print(Option_t *o="") const;

    ClassDef(MDataSet, 0)
};

#endif
