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