| 1 | #ifndef MARS_MTask
|
|---|
| 2 | #define MARS_MTask
|
|---|
| 3 |
|
|---|
| 4 | /////////////////////////////////////////////////////////////////////////////
|
|---|
| 5 | // //
|
|---|
| 6 | // MTask //
|
|---|
| 7 | // //
|
|---|
| 8 | // Abstract base class for a task //
|
|---|
| 9 | // //
|
|---|
| 10 | /////////////////////////////////////////////////////////////////////////////
|
|---|
| 11 |
|
|---|
| 12 | #ifndef MARS_MInputStreamID
|
|---|
| 13 | #include "MInputStreamID.h"
|
|---|
| 14 | #endif
|
|---|
| 15 |
|
|---|
| 16 | class TList;
|
|---|
| 17 |
|
|---|
| 18 | class MFilter;
|
|---|
| 19 | class MParList;
|
|---|
| 20 |
|
|---|
| 21 | class MTask : public MInputStreamID
|
|---|
| 22 | {
|
|---|
| 23 | private:
|
|---|
| 24 | TList *fListOfBranches; //! List of Branch names for auto enabeling scheme
|
|---|
| 25 |
|
|---|
| 26 | MFilter *fFilter; // Filter for conditional task execution
|
|---|
| 27 | Byte_t fSerialNumber; // Serial number having more than one detector of the same type
|
|---|
| 28 |
|
|---|
| 29 | Bool_t fIsPreprocessed; //! Indicates the success of the PreProcessing (set by MTaskList)
|
|---|
| 30 | UInt_t fNumExecutions; //! Number of Excutions
|
|---|
| 31 |
|
|---|
| 32 | virtual Int_t PreProcess(MParList *pList);
|
|---|
| 33 | virtual Int_t Process();
|
|---|
| 34 | virtual Int_t PostProcess();
|
|---|
| 35 |
|
|---|
| 36 | protected:
|
|---|
| 37 | void AddToBranchList(const char *b);
|
|---|
| 38 | void AddToBranchList(const TString &str);
|
|---|
| 39 | void AddToBranchList(const char *master, const char *sub, const UInt_t first, const UInt_t last)
|
|---|
| 40 | {
|
|---|
| 41 | if (first==0 && last==0)
|
|---|
| 42 | {
|
|---|
| 43 | AddToBranchList(sub);
|
|---|
| 44 | return;
|
|---|
| 45 | }
|
|---|
| 46 |
|
|---|
| 47 | for (unsigned int i=first; i<last+1; i++)
|
|---|
| 48 | AddToBranchList(Form("%s;%d.%s", master, i, sub));
|
|---|
| 49 | }
|
|---|
| 50 | void AddToBranchList(TString &master, TString &sub, const UInt_t first, const UInt_t last)
|
|---|
| 51 | {
|
|---|
| 52 | AddToBranchList((const char*)master, (const char*)sub, first, last);
|
|---|
| 53 | }
|
|---|
| 54 | void AddToBranchList(const char *master, const char *sub, const UInt_t num)
|
|---|
| 55 | {
|
|---|
| 56 | AddToBranchList(master, sub, 0, num);
|
|---|
| 57 | }
|
|---|
| 58 | void AddToBranchList(TString &master, TString &sub, const UInt_t num)
|
|---|
| 59 | {
|
|---|
| 60 | AddToBranchList(master, sub, 0, num);
|
|---|
| 61 | }
|
|---|
| 62 |
|
|---|
| 63 | public:
|
|---|
| 64 | MTask(const char *name=NULL, const char *title=NULL);
|
|---|
| 65 | MTask(MTask &t);
|
|---|
| 66 | virtual ~MTask();
|
|---|
| 67 |
|
|---|
| 68 | virtual void SetFilter(MFilter *filter) { fFilter=filter; }
|
|---|
| 69 | const MFilter *GetFilter() const { return fFilter; }
|
|---|
| 70 | MFilter *GetFilter() { return fFilter; } // for MContinue only
|
|---|
| 71 |
|
|---|
| 72 | void SetDisplay(MStatusDisplay *d);
|
|---|
| 73 | virtual void PrintStatistics(const Int_t lvl=0, Bool_t title=kFALSE) const;
|
|---|
| 74 |
|
|---|
| 75 | virtual void SetSerialNumber(Byte_t num) { fSerialNumber = num; }
|
|---|
| 76 | Byte_t GetSerialNumber() const { return fSerialNumber; }
|
|---|
| 77 | TString AddSerialNumber(const char *str) const { TString s(str); if (fSerialNumber==0) return s; s += ";"; s += fSerialNumber; return s; }
|
|---|
| 78 | TString AddSerialNumber(const TString &str) const { return AddSerialNumber((const char*)str); }
|
|---|
| 79 |
|
|---|
| 80 | const char *GetDescriptor() const;
|
|---|
| 81 |
|
|---|
| 82 | UInt_t GetNumExecutions() const { return fNumExecutions; }
|
|---|
| 83 |
|
|---|
| 84 | virtual Bool_t ReInit(MParList *pList);
|
|---|
| 85 |
|
|---|
| 86 | virtual Int_t CallPreProcess(MParList *plist);
|
|---|
| 87 | virtual Int_t CallProcess();
|
|---|
| 88 | virtual Int_t CallPostProcess();
|
|---|
| 89 |
|
|---|
| 90 | const TList *GetListOfBranches() const { return fListOfBranches; }
|
|---|
| 91 |
|
|---|
| 92 | Bool_t OverwritesProcess(TClass *cls=NULL) const;
|
|---|
| 93 |
|
|---|
| 94 | void SavePrimitive(ofstream &out, Option_t *o="");
|
|---|
| 95 |
|
|---|
| 96 | ClassDef(MTask, 2) //Abstract base class for a task
|
|---|
| 97 | };
|
|---|
| 98 |
|
|---|
| 99 | #endif
|
|---|