1 | #ifndef MARS_MJob
|
---|
2 | #define MARS_MJob
|
---|
3 |
|
---|
4 | #ifndef MARS_MSequence
|
---|
5 | #include "MSequence.h"
|
---|
6 | #endif
|
---|
7 |
|
---|
8 | class MEnv;
|
---|
9 | class MEvtLoop;
|
---|
10 |
|
---|
11 | class MJob : public MParContainer
|
---|
12 | {
|
---|
13 | private:
|
---|
14 | enum { kIsOwner = BIT(14) };
|
---|
15 |
|
---|
16 | void FixPath(TString &path) const;
|
---|
17 | void ClearEnv();
|
---|
18 |
|
---|
19 | const MEnv *fEnv; // Resource file
|
---|
20 | TString fEnvPrefix; // Prefix for resources
|
---|
21 | Int_t fEnvDebug; // Debug setup of resources
|
---|
22 |
|
---|
23 | protected:
|
---|
24 | TString fPathOut; // Directory to write output file to (eg. calib*.root)
|
---|
25 | TString fPathIn; // Directory to read output from (eg. calib*.root)
|
---|
26 |
|
---|
27 | Bool_t fOverwrite; // Allow overwriting output files
|
---|
28 | Int_t fMaxEvents; // Maximum number of events
|
---|
29 |
|
---|
30 | MSequence fSequence; // Sequence
|
---|
31 |
|
---|
32 | const TEnv *GetEnv() const;
|
---|
33 | const MEnv *GetMEnv() const { return fEnv; }
|
---|
34 | const TString &GetEnvPrefix() const { return fEnvPrefix; }
|
---|
35 | Int_t GetEnvDebug() const { return fEnvDebug; }
|
---|
36 |
|
---|
37 | Int_t GetEnv(const char *name, Int_t dflt) const;
|
---|
38 | Double_t GetEnv(const char *name, Double_t dflt) const;
|
---|
39 | const char *GetEnv(const char *name, const char *dflt) const;
|
---|
40 | Bool_t HasEnv(const char *name) const;
|
---|
41 |
|
---|
42 | Bool_t SetupEnv(MEvtLoop &loop) const;
|
---|
43 | Bool_t CheckEnv();
|
---|
44 | Bool_t CheckEnv(MParContainer &c) const;
|
---|
45 | void PrintUntouchedEnv() const;
|
---|
46 | virtual Bool_t CheckEnvLocal() { return kTRUE; }
|
---|
47 |
|
---|
48 | Bool_t WriteContainer(TCollection &list) const;
|
---|
49 | Bool_t ReadContainer(TCollection &list) const;
|
---|
50 | Bool_t WriteContainer(TCollection &cont, const char *name, const char *option="RECREATE", const int compr=2) const;
|
---|
51 | Bool_t WriteDisplay(const char *name, const char *option="RECREATE", const int comp=2) const;
|
---|
52 |
|
---|
53 | public:
|
---|
54 | MJob(const char *name=NULL, const char *title=NULL);
|
---|
55 | ~MJob();
|
---|
56 |
|
---|
57 | // Setter
|
---|
58 | void SetPathOut(const char *path=".");
|
---|
59 | void SetPathIn(const char *path=".");
|
---|
60 |
|
---|
61 | void SetOverwrite(Bool_t b=kTRUE) { fOverwrite=b; }
|
---|
62 | Bool_t SetEnv(const char *env, const char *prefix=0);
|
---|
63 | void SetEnv(MEnv *env, const char *prefix=0);
|
---|
64 | void SetEnvDebug(Int_t d=2) { fEnvDebug=d; }
|
---|
65 |
|
---|
66 | void SetMaxEvents(Int_t max) { fMaxEvents = max; }
|
---|
67 | void SetSequence(const MSequence &seq) { fSequence = seq; }
|
---|
68 |
|
---|
69 | // Getter
|
---|
70 | TString GetPathOut() const { return fPathOut; }
|
---|
71 | TString GetPathIn() const { return fPathIn; }
|
---|
72 |
|
---|
73 | // Others
|
---|
74 | MStatusDisplay *GetDisplay() { return fDisplay; }
|
---|
75 |
|
---|
76 | static TString ExpandPath(TString fname);
|
---|
77 | static void SortArray(TArrayI &arr);
|
---|
78 |
|
---|
79 | ClassDef(MJob, 0) // Bas class for Jobs
|
---|
80 | };
|
---|
81 |
|
---|
82 | #endif
|
---|