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 | TString fPathData; // Directory to read data files from (2004*.root)
|
---|
27 |
|
---|
28 | Bool_t fOverwrite; // Allow overwriting output files
|
---|
29 | Int_t fMaxEvents; // Maximum number of events
|
---|
30 |
|
---|
31 | MSequence fSequence; // Sequence
|
---|
32 |
|
---|
33 | const TEnv *GetEnv() const;
|
---|
34 | const MEnv *GetMEnv() const { return fEnv; }
|
---|
35 | const TString &GetEnvPrefix() const { return fEnvPrefix; }
|
---|
36 | Int_t GetEnvDebug() const { return fEnvDebug; }
|
---|
37 |
|
---|
38 | Int_t GetEnv(const char *name, Int_t dflt) const;
|
---|
39 | Double_t GetEnv(const char *name, Double_t dflt) const;
|
---|
40 | const char *GetEnv(const char *name, const char *dflt) const;
|
---|
41 | Bool_t HasEnv(const char *name) const;
|
---|
42 |
|
---|
43 | Bool_t SetupEnv(MEvtLoop &loop) const;
|
---|
44 | Bool_t CheckEnv();
|
---|
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 |
|
---|
52 | public:
|
---|
53 | MJob(const char *name=NULL, const char *title=NULL);
|
---|
54 | ~MJob();
|
---|
55 |
|
---|
56 | // Setter
|
---|
57 | void SetPathOut(const char *path=".");
|
---|
58 | void SetPathIn(const char *path=".");
|
---|
59 | void SetPathData(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 | TString GetPathData() const { return fPathData; }
|
---|
73 |
|
---|
74 | // Others
|
---|
75 | MStatusDisplay *GetDisplay() { return fDisplay; }
|
---|
76 |
|
---|
77 | static TString ExpandPath(TString fname);
|
---|
78 |
|
---|
79 | ClassDef(MJob, 0) // Bas class for Jobs
|
---|
80 | };
|
---|
81 |
|
---|
82 | #endif
|
---|