source: trunk/MagicSoft/Mars/mjobs/MSequence.h@ 8339

Last change on this file since 8339 was 8256, checked in by tbretz, 18 years ago
*** empty log message ***
File size: 4.8 KB
Line 
1#ifndef MARS_MSequence
2#define MARS_MSequence
3
4#ifndef ROOT_TArrayI
5#include <TArrayI.h>
6#endif
7
8#ifndef ROOT_TExMap
9#include <TExMap.h>
10#endif
11
12#ifndef MARS_MTime
13#include "MTime.h"
14#endif
15
16class MDirIter;
17
18class MSequence : public MParContainer
19{
20public:
21 enum LightCondition_t { kNA, kNoMoon, kTwilight, kMoon, kDay };
22 enum FileType_t {
23 kRawDat, kRawPed, kRawCal, kRawAll,
24 kRootDat, kRootPed, kRootCal, kRootAll,
25 kCalibrated, kImages
26 };
27private:
28 TString fFileName;
29 TString fDataPath;
30
31 UInt_t fSequence;
32
33 MTime fStart;
34
35 UInt_t fLastRun;
36 UInt_t fNumEvents;
37
38 UInt_t fPeriod;
39 MTime fNight;
40
41 LightCondition_t fLightCondition;
42
43 TString fProject;
44 TString fSource;
45 TString fTriggerTable;
46 TString fHvSettings;
47
48 TArrayI fRuns;
49 TArrayI fCalRuns;
50 TArrayI fPedRuns;
51 TArrayI fDatRuns;
52
53 //TExMap fFileNames;
54
55 void Split(TString &runs, TArrayI &data) const;
56 //void GetFileNames(TEnv &env, const TArrayI &arr);
57 LightCondition_t ReadLightCondition(TEnv &env) const;
58
59 const char *GetFileName(UInt_t num);
60
61 //UInt_t SetupRuns(MDirIter &iter, const TArrayI &arr, const char *path, char *id, Bool_t raw=kFALSE) const;
62 UInt_t SetupRuns(MDirIter &iter, const TArrayI &arr, FileType_t type, const char *path=0) const;
63 UInt_t AddRuns(UInt_t first, UInt_t last, TArrayI *runs);
64
65public:
66 MSequence() : fSequence((UInt_t)-1), fLastRun((UInt_t)-1),
67 fNumEvents((UInt_t)-1), fPeriod((UInt_t)-1) { }
68 MSequence(const char *fname, const char *path="");
69 MSequence(const MSequence &s) : fSequence(s.fSequence), fStart(s.fStart),
70 fLastRun(s.fLastRun), fNumEvents(s.fNumEvents), fPeriod(s.fPeriod),
71 fNight(s.fNight), fProject(s.fProject), fSource(s.fSource),
72 fTriggerTable(s.fTriggerTable), fHvSettings(s.fHvSettings),
73 fRuns(s.fRuns), fCalRuns(s.fCalRuns), fPedRuns(s.fPedRuns),
74 fDatRuns(s.fDatRuns) { }
75 ~MSequence();
76
77 // TObject
78 void Print(Option_t *o="") const;
79
80 // Genaral interface
81 Bool_t IsValid() const { return fSequence!=(UInt_t)-1; }
82
83 UInt_t SetupPedRuns(MDirIter &iter, const char *path=0, Bool_t raw=kFALSE) const;
84 UInt_t SetupDatRuns(MDirIter &iter, const char *path=0, Bool_t raw=kFALSE) const;
85 UInt_t SetupAllRuns(MDirIter &iter, const char *path=0, Bool_t raw=kFALSE) const;
86 UInt_t SetupCalRuns(MDirIter &iter, const char *path=0, Bool_t raw=kFALSE) const;
87 UInt_t SetupDatRuns(MDirIter &iter, FileType_t type, const char *path=0) const;
88 /*
89 UInt_t SetupPedRuns(MDirIter &iter, FileType_t type, const char *path=0);
90 UInt_t SetupDatRuns(MDirIter &iter, FileType_t type, const char *path=0);
91 UInt_t SetupAllRuns(MDirIter &iter, FileType_t type, const char *path=0);
92 UInt_t SetupCalRuns(MDirIter &iter, FileType_t type, const char *path=0);
93 */
94 // Getter
95 UInt_t GetNumAllRuns() const { return fRuns.GetSize(); }
96 UInt_t GetNumDatRuns() const { return fDatRuns.GetSize(); }
97 UInt_t GetNumPedRuns() const { return fPedRuns.GetSize(); }
98 UInt_t GetNumCalRuns() const { return fCalRuns.GetSize(); }
99
100 UInt_t GetSequence() const { return fSequence; }
101 UInt_t GetLastRun() const { return fLastRun; }
102 UInt_t GetPeriod() const { return fPeriod; }
103 LightCondition_t GetLightCondition() const { return fLightCondition; }
104 Bool_t HasMoon() const { return fLightCondition==kMoon; }
105
106 const UInt_t GetFirstRun() const { return fRuns[0]; }
107 const UInt_t GetFirstCalRun() const { return fCalRuns[0]; }
108 const UInt_t GetLastCalRun() const { return fCalRuns[fCalRuns.GetSize()-1]; }
109 const TArrayI &GetPedRuns() const { return fPedRuns; }
110 const TArrayI &GetCalRuns() const { return fCalRuns; }
111 const TArrayI &GetDatRuns() const { return fDatRuns; }
112
113 const MTime &GetStart() const { return fStart; }
114 const MTime &GetNight() const { return fNight; }
115 const TString &GetSource() const { return fSource; }
116
117 const TString GetStandardPath() const { return "/magic/data/"; }
118
119 const TString &GetFileName() const { return fFileName; }
120 const TString &GetDataPath() const { return fDataPath; }
121
122 // Setter
123 void SetNight(const char*night);
124
125 UInt_t AddRuns(UInt_t first, UInt_t last) { return MSequence::AddRuns(first, last, 0); }
126 UInt_t AddCalRuns(UInt_t first, UInt_t last) { return MSequence::AddRuns(first, last, &fCalRuns); }
127 UInt_t AddPedRuns(UInt_t first, UInt_t last) { return MSequence::AddRuns(first, last, &fPedRuns); }
128 UInt_t AddDatRuns(UInt_t first, UInt_t last) { return MSequence::AddRuns(first, last, &fDatRuns); }
129
130 UInt_t AddRuns(UInt_t num) { return AddRuns(num, num); }
131 UInt_t AddCalRuns(UInt_t num) { return AddCalRuns(num, num); }
132 UInt_t AddPedRuns(UInt_t num) { return AddPedRuns(num, num); }
133 UInt_t AddDatRuns(UInt_t num) { return AddDatRuns(num, num); }
134
135 ClassDef(MSequence, 0)
136};
137
138#endif
Note: See TracBrowser for help on using the repository browser.