source: tags/Mars-V0.9.3/mjobs/MSequence.h

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