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

Last change on this file since 7764 was 7358, checked in by tbretz, 19 years ago
*** empty log message ***
File size: 2.6 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 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 Bool_t CheckEnv(MParContainer &c) const;
46 void PrintUntouchedEnv() const;
47 virtual Bool_t CheckEnvLocal() { return kTRUE; }
48
49 Bool_t WriteContainer(TCollection &list) const;
50 Bool_t ReadContainer(TCollection &list) const;
51 Bool_t WriteContainer(TCollection &cont, const char *name, const char *option="RECREATE", const int compr=2) const;
52
53public:
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 void SetPathData(const char *path=".");
61
62 void SetOverwrite(Bool_t b=kTRUE) { fOverwrite=b; }
63 Bool_t SetEnv(const char *env, const char *prefix=0);
64 void SetEnv(MEnv *env, const char *prefix=0);
65 void SetEnvDebug(Int_t d=2) { fEnvDebug=d; }
66
67 void SetMaxEvents(Int_t max) { fMaxEvents = max; }
68 void SetSequence(const MSequence &seq) { fSequence = seq; }
69
70 // Getter
71 TString GetPathOut() const { return fPathOut; }
72 TString GetPathIn() const { return fPathIn; }
73 TString GetPathData() const { return fPathData; }
74
75 // Others
76 MStatusDisplay *GetDisplay() { return fDisplay; }
77
78 static TString ExpandPath(TString fname);
79 static void SortArray(TArrayI &arr);
80
81 ClassDef(MJob, 0) // Bas class for Jobs
82};
83
84#endif
Note: See TracBrowser for help on using the repository browser.