source: trunk/MagicSoft/Mars/mjobs/MJob.h@ 8405

Last change on this file since 8405 was 8245, checked in by tbretz, 18 years ago
*** empty log message ***
File size: 2.4 KB
Line 
1#ifndef MARS_MJob
2#define MARS_MJob
3
4#ifndef MARS_MSequence
5#include "MSequence.h"
6#endif
7
8class MEnv;
9class MEvtLoop;
10
11class MJob : public MParContainer
12{
13private:
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
23protected:
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
52public:
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
60 void SetOverwrite(Bool_t b=kTRUE) { fOverwrite=b; }
61 Bool_t SetEnv(const char *env, const char *prefix=0);
62 void SetEnv(MEnv *env, const char *prefix=0);
63 void SetEnvDebug(Int_t d=2) { fEnvDebug=d; }
64
65 void SetMaxEvents(Int_t max) { fMaxEvents = max; }
66 void SetSequence(const MSequence &seq) { fSequence = seq; }
67
68 // Getter
69 TString GetPathOut() const { return fPathOut; }
70 TString GetPathIn() const { return fPathIn; }
71
72 // Others
73 MStatusDisplay *GetDisplay() { return fDisplay; }
74
75 static TString ExpandPath(TString fname);
76 static void SortArray(TArrayI &arr);
77
78 ClassDef(MJob, 0) // Bas class for Jobs
79};
80
81#endif
Note: See TracBrowser for help on using the repository browser.