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 | enum DataType_t {
|
---|
21 | kIsUseRawData,
|
---|
22 | kIsUseRootData,
|
---|
23 | kIsUseMC
|
---|
24 | };
|
---|
25 |
|
---|
26 | protected:
|
---|
27 |
|
---|
28 | Byte_t fDataFlag; // Bit-field to store the data type
|
---|
29 | TString fPathOut; // Directory to write output file to (eg. calib*.root)
|
---|
30 | TString fPathIn; // Directory to read output from (eg. calib*.root)
|
---|
31 | TString fPathData; // Directory to read data files from (2004*.root)
|
---|
32 |
|
---|
33 | Bool_t fOverwrite; // Allow overwriting output files
|
---|
34 | Int_t fMaxEvents; // Maximum number of events
|
---|
35 |
|
---|
36 | MSequence fSequence; // Sequence
|
---|
37 |
|
---|
38 | Bool_t IsUseRawData() const { return TESTBIT(fDataFlag,kIsUseRawData); }
|
---|
39 | Bool_t IsUseRootData() const { return TESTBIT(fDataFlag,kIsUseRootData); }
|
---|
40 | Bool_t IsUseMC() const { return TESTBIT(fDataFlag,kIsUseMC); }
|
---|
41 |
|
---|
42 | void SetUseRawData ( const Bool_t b=kTRUE ) { b ? SETBIT(fDataFlag,kIsUseRawData) : CLRBIT(fDataFlag,kIsUseRawData); }
|
---|
43 | void SetUseRootData( const Bool_t b=kTRUE ) { b ? SETBIT(fDataFlag,kIsUseRootData) : CLRBIT(fDataFlag,kIsUseRootData); }
|
---|
44 | void SetUseMC ( const Bool_t b=kTRUE ) { b ? SETBIT(fDataFlag,kIsUseMC) : CLRBIT(fDataFlag,kIsUseMC); }
|
---|
45 |
|
---|
46 | const TEnv *GetEnv() const { return fEnv; }
|
---|
47 | const TString &GetEnvPrefix() const { return fEnvPrefix; }
|
---|
48 | Bool_t GetEnvDebug() const { return fEnvDebug; }
|
---|
49 |
|
---|
50 | Int_t GetEnv(const char *name, Int_t dflt) const;
|
---|
51 | Double_t GetEnv(const char *name, Double_t dflt) const;
|
---|
52 | const char *GetEnv(const char *name, const char *dflt) const;
|
---|
53 | Bool_t HasEnv(const char *name) const;
|
---|
54 |
|
---|
55 | Bool_t SetupEnv(MEvtLoop &loop) const;
|
---|
56 | Bool_t CheckEnv();
|
---|
57 | virtual Bool_t CheckEnvLocal() { return kTRUE; }
|
---|
58 |
|
---|
59 | Bool_t WriteContainer(TCollection &list) const;
|
---|
60 | Bool_t ReadContainer(TCollection &list) const;
|
---|
61 | Bool_t WriteContainer(TCollection &cont, const char *name, const char *option="RECREATE", const int compr=2) const;
|
---|
62 |
|
---|
63 | public:
|
---|
64 | MJob(const char *name=NULL, const char *title=NULL);
|
---|
65 | ~MJob();
|
---|
66 |
|
---|
67 | // Setter
|
---|
68 | void SetPathOut(const char *path=".");
|
---|
69 | void SetPathIn(const char *path=".");
|
---|
70 | void SetPathData(const char *path=".");
|
---|
71 |
|
---|
72 | void SetOverwrite(Bool_t b=kTRUE) { fOverwrite=b; }
|
---|
73 | Bool_t SetEnv(const char *env, const char *prefix=0);
|
---|
74 | void SetEnvDebug(Bool_t b=kTRUE) { fEnvDebug=b; }
|
---|
75 |
|
---|
76 | void SetMaxEvents(Int_t max) { fMaxEvents = max; }
|
---|
77 | void SetSequence(const MSequence &seq) { fSequence = seq; }
|
---|
78 |
|
---|
79 | // Getter
|
---|
80 | TString GetPathOut() const { return fPathOut; }
|
---|
81 | TString GetPathIn() const { return fPathIn; }
|
---|
82 | TString GetPathData() const { return fPathData; }
|
---|
83 |
|
---|
84 | // Others
|
---|
85 | MStatusDisplay *GetDisplay() { return fDisplay; }
|
---|
86 |
|
---|
87 | ClassDef(MJob, 0) // Bas class for Jobs
|
---|
88 | };
|
---|
89 |
|
---|
90 | #endif
|
---|