| 1 | #ifndef MARS_MEvtLoop
|
|---|
| 2 | #define MARS_MEvtLoop
|
|---|
| 3 |
|
|---|
| 4 | /////////////////////////////////////////////////////////////////////////////
|
|---|
| 5 | // //
|
|---|
| 6 | // MEvtLoop //
|
|---|
| 7 | // //
|
|---|
| 8 | // Class to execute the tasks in a tasklist //
|
|---|
| 9 | // //
|
|---|
| 10 | /////////////////////////////////////////////////////////////////////////////
|
|---|
| 11 |
|
|---|
| 12 | #ifndef MARS_MParContainer
|
|---|
| 13 | #include "MParContainer.h"
|
|---|
| 14 | #endif
|
|---|
| 15 |
|
|---|
| 16 | class MTask;
|
|---|
| 17 | class MParList;
|
|---|
| 18 | class MTaskList;
|
|---|
| 19 | class TGProgressBar;
|
|---|
| 20 | #ifdef __MARS__
|
|---|
| 21 | class MProgressBar;
|
|---|
| 22 | #endif
|
|---|
| 23 |
|
|---|
| 24 | class MEvtLoop : public MParContainer
|
|---|
| 25 | {
|
|---|
| 26 | private:
|
|---|
| 27 | MParList *fParList;
|
|---|
| 28 | MTaskList *fTaskList; //!
|
|---|
| 29 |
|
|---|
| 30 | TGProgressBar *fProgress; //!
|
|---|
| 31 |
|
|---|
| 32 | ULong_t fNumEvents; //!
|
|---|
| 33 |
|
|---|
| 34 | enum { kIsOwner = BIT(14), kPrivateDisplay = BIT(15) };
|
|---|
| 35 |
|
|---|
| 36 | Bool_t HasDuplicateNames(const TString txt) const;
|
|---|
| 37 | Bool_t HasDuplicateNames(TObjArray &arr, const TString txt) const;
|
|---|
| 38 |
|
|---|
| 39 | void StreamPrimitive(std::ostream &out) const;
|
|---|
| 40 |
|
|---|
| 41 | Bool_t ProcessGuiEvents(Int_t num, Int_t rc);
|
|---|
| 42 |
|
|---|
| 43 | public:
|
|---|
| 44 | enum Statistics_t {
|
|---|
| 45 | kNoStatistics = 0,
|
|---|
| 46 | kStdStatistics = 1,
|
|---|
| 47 | kFullStatistics = 2
|
|---|
| 48 | };
|
|---|
| 49 |
|
|---|
| 50 | MEvtLoop(const char *name="Evtloop");
|
|---|
| 51 | virtual ~MEvtLoop();
|
|---|
| 52 |
|
|---|
| 53 | void SetParList(MParList *p);
|
|---|
| 54 | MParList *GetParList() const { return fParList; }
|
|---|
| 55 | MTaskList *GetTaskList() const { return fTaskList; }
|
|---|
| 56 |
|
|---|
| 57 | MTask *FindTask(const char *name) const;
|
|---|
| 58 | MTask *FindTask(const MTask *obj) const;
|
|---|
| 59 |
|
|---|
| 60 | MStatusDisplay *GetDisplay() { return fDisplay; }
|
|---|
| 61 | void SetDisplay(MStatusDisplay *d);
|
|---|
| 62 | void SetPrivateDisplay(Bool_t b=kTRUE) { b ? SetBit(kPrivateDisplay) : ResetBit(kPrivateDisplay); } // Prevent status display from being cascaded in PreProcess
|
|---|
| 63 |
|
|---|
| 64 | void SetOwner(Bool_t enable=kTRUE);
|
|---|
| 65 |
|
|---|
| 66 | void SetProgressBar(TGProgressBar *bar);
|
|---|
| 67 | #ifdef __MARS__
|
|---|
| 68 | void SetProgressBar(MProgressBar *bar);
|
|---|
| 69 | #endif
|
|---|
| 70 |
|
|---|
| 71 | Bool_t PreProcess();
|
|---|
| 72 | Int_t Process(UInt_t maxcnt);
|
|---|
| 73 | Bool_t PostProcess() const;
|
|---|
| 74 |
|
|---|
| 75 | Bool_t Eventloop(UInt_t maxcnt=0, Statistics_t printstat=kStdStatistics);
|
|---|
| 76 |
|
|---|
| 77 | void MakeMacro(const char *filename="evtloop.C");
|
|---|
| 78 |
|
|---|
| 79 | void SavePrimitive(std::ostream &out, Option_t *o="");
|
|---|
| 80 | void SavePrimitive(std::ofstream &out, Option_t *o="");
|
|---|
| 81 |
|
|---|
| 82 | Int_t Read(const char *name="Evtloop");
|
|---|
| 83 | Int_t Write(const char *name="Evtloop", Int_t option=0, Int_t bufsize=0) const;
|
|---|
| 84 | Int_t Write(const char *name="Evtloop", Int_t option=0, Int_t bufsize=0)
|
|---|
| 85 | {
|
|---|
| 86 | return const_cast<MEvtLoop*>(this)->Write(name, option, bufsize);
|
|---|
| 87 | }
|
|---|
| 88 |
|
|---|
| 89 | void Print(Option_t *opt="") const;
|
|---|
| 90 |
|
|---|
| 91 | Int_t ReadEnv(const TEnv &env, TString prefix="", Bool_t print=kFALSE);
|
|---|
| 92 | Bool_t WriteEnv(TEnv &env, TString prefix="", Bool_t print=kFALSE) const;
|
|---|
| 93 |
|
|---|
| 94 | Bool_t ReadEnv(const char *config, Bool_t print=kFALSE);
|
|---|
| 95 |
|
|---|
| 96 | void RecursiveRemove(TObject *obj);
|
|---|
| 97 |
|
|---|
| 98 | static UInt_t GetMemoryUsage();
|
|---|
| 99 |
|
|---|
| 100 | ClassDef(MEvtLoop, 1) // Class to execute the tasks in a tasklist
|
|---|
| 101 | };
|
|---|
| 102 |
|
|---|
| 103 | #endif
|
|---|