#ifndef MARS_MJSimulation
#define MARS_MJSimulation

#ifndef MARS_MJob
#include "MJob.h"
#endif

class MHn;
class MArgs;
class MParList;
class MSequence;
class MWriteRootFile;

class MJSimulation : public MJob
{
public:
    enum Mode_t { kModeData, kModePed, kModeCal, kModePointRun };

private:
    Bool_t fForceMode;      // Force execution even if RUNE-section was not foundm

    Bool_t fCamera;         // Switch on/off camera (for fast reflector processing)
    Bool_t fForceTrigger;   // Force the use of the trigger "electronics"

    Int_t fOperationMode;   // Operation mode (data, ped, cal, pointrun)

    Bool_t WriteResult(const MParList &plist, const MSequence &seq);
    Bool_t CheckEnvLocal();

    void SetupHist(MHn &hist) const;
    void SetupCommonFileStructure(MWriteRootFile &write) const;

public:
    MJSimulation(const char *name=NULL, const char *title=NULL);

    void SetForceMode(Bool_t force=kTRUE) { fForceMode = force; }

    void SetMode(Int_t mode) { fOperationMode = mode; }

    // Process
    Bool_t Process(const MArgs &args, const MSequence &seq);

    ClassDef(MJSimulation, 0) // Job to run the simulation (ceres)
};

#endif
