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

Last change on this file since 8898 was 8780, checked in by tbretz, 17 years ago
*** empty log message ***
File size: 5.9 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 TString fComment;
48
49 TArrayI fRuns;
50 TArrayI fCalRuns;
51 TArrayI fPedRuns;
52 TArrayI fDatRuns;
53
54 TArrayI fExclRuns;
55
56 Bool_t fMonteCarlo;
57
58 //TExMap fFileNames;
59
60 void Split(TString &runs, TArrayI &data) const;
61 //void GetFileNames(TEnv &env, const TArrayI &arr);
62
63 LightCondition_t ReadLightCondition(TEnv &env, const char *prefix) const;
64
65 const char *GetFileName(UInt_t num);
66
67 //UInt_t SetupRuns(MDirIter &iter, const TArrayI &arr, const char *path, char *id, Bool_t raw=kFALSE) const;
68 UInt_t SetupRuns(MDirIter &iter, const TArrayI &arr, FileType_t type, const char *path=0) const;
69 UInt_t AddRuns(UInt_t first, UInt_t last, TArrayI *runs);
70 void ExcludeRun(TArrayI &arr, UInt_t num);
71 Bool_t IsContained(const TArrayI &arr, UInt_t num) const;
72
73public:
74 MSequence() : fSequence((UInt_t)-1), fLastRun((UInt_t)-1),
75 fNumEvents((UInt_t)-1), fPeriod((UInt_t)-1), fMonteCarlo(kFALSE) { }
76 MSequence(const char *fname, const char *path="", UInt_t id=(UInt_t)-1);
77 MSequence(const MSequence &s) : fSequence(s.fSequence), fStart(s.fStart),
78 fLastRun(s.fLastRun), fNumEvents(s.fNumEvents), fPeriod(s.fPeriod),
79 fNight(s.fNight), fProject(s.fProject), fSource(s.fSource),
80 fTriggerTable(s.fTriggerTable), fHvSettings(s.fHvSettings),
81 fRuns(s.fRuns), fCalRuns(s.fCalRuns), fPedRuns(s.fPedRuns),
82 fDatRuns(s.fDatRuns), fMonteCarlo(s.fMonteCarlo) { }
83 ~MSequence();
84
85 // TObject
86 void Print(Option_t *o) const;
87 void Print() const { Print(); } //*MENU*
88
89 const char *GetName() const;
90 const char *GetRcName() const { return fName; }
91
92 // Genaral interface
93 Bool_t IsValid() const { return fSequence!=(UInt_t)-1; }
94 Bool_t IsMonteCarlo() const { return fMonteCarlo; }
95 Bool_t IsExcluded(UInt_t run) const { return IsContained(fExclRuns, run); }
96 Bool_t IsContained(UInt_t run) const { return IsContained(fCalRuns, run) || IsContained(fPedRuns, run) || IsContained(fDatRuns, run); }
97
98 void SetMonteCarlo(Bool_t ismc=kTRUE) { fMonteCarlo=ismc; }
99
100 UInt_t SetupPedRuns(MDirIter &iter, const char *path=0, Bool_t raw=kFALSE) const;
101 UInt_t SetupDatRuns(MDirIter &iter, const char *path=0, Bool_t raw=kFALSE) const;
102 UInt_t SetupAllRuns(MDirIter &iter, const char *path=0, Bool_t raw=kFALSE) const;
103 UInt_t SetupCalRuns(MDirIter &iter, const char *path=0, Bool_t raw=kFALSE) const;
104 UInt_t SetupDatRuns(MDirIter &iter, FileType_t type, const char *path=0) const;
105 /*
106 UInt_t SetupPedRuns(MDirIter &iter, FileType_t type, const char *path=0);
107 UInt_t SetupDatRuns(MDirIter &iter, FileType_t type, const char *path=0);
108 UInt_t SetupAllRuns(MDirIter &iter, FileType_t type, const char *path=0);
109 UInt_t SetupCalRuns(MDirIter &iter, FileType_t type, const char *path=0);
110 */
111
112 // Getter
113// UInt_t GetNumAllRuns() const { return fRuns.GetSize(); }
114// UInt_t GetNumDatRuns() const { return fDatRuns.GetSize(); }
115// UInt_t GetNumPedRuns() const { return fPedRuns.GetSize(); }
116// UInt_t GetNumCalRuns() const { return fCalRuns.GetSize(); }
117 UInt_t GetNumExclRuns() const { return fExclRuns.GetSize(); }
118
119 UInt_t GetSequence() const { return fSequence; }
120 UInt_t GetLastRun() const { return fLastRun; }
121 UInt_t GetPeriod() const { return fPeriod; }
122 LightCondition_t GetLightCondition() const { return fLightCondition; }
123 Bool_t HasMoon() const { return fLightCondition==kMoon; }
124
125 const UInt_t GetFirstRun() const { return fRuns[0]; }
126 const UInt_t GetFirstCalRun() const { return fCalRuns[0]; }
127 const UInt_t GetLastCalRun() const { return fCalRuns[fCalRuns.GetSize()-1]; }
128// const TArrayI &GetDatRuns() const { return fDatRuns; }
129// const TArrayI &GetPedRuns() const { return fPedRuns; }
130// const TArrayI &GetCalRuns() const { return fCalRuns; }
131 const TArrayI &GetExclRuns() const { return fExclRuns; }
132
133 const MTime &GetStart() const { return fStart; }
134 const MTime &GetNight() const { return fNight; }
135 const TString &GetSource() const { return fSource; }
136
137 const TString GetStandardPath() const { return fMonteCarlo?"/magic/montecarlo/":"/magic/data/"; }
138
139 const TString &GetFileName() const { return fFileName; }
140 const TString &GetDataPath() const { return fDataPath; }
141
142 const TString GetExcludedRuns() const;
143
144 // Setter
145 void SetNight(const char*night);
146
147 UInt_t AddRuns(UInt_t first, UInt_t last) { return MSequence::AddRuns(first, last, 0); }
148 UInt_t AddCalRuns(UInt_t first, UInt_t last) { return MSequence::AddRuns(first, last, &fCalRuns); }
149 UInt_t AddPedRuns(UInt_t first, UInt_t last) { return MSequence::AddRuns(first, last, &fPedRuns); }
150 UInt_t AddDatRuns(UInt_t first, UInt_t last) { return MSequence::AddRuns(first, last, &fDatRuns); }
151
152 UInt_t AddRuns(UInt_t num) { return AddRuns(num, num); }
153 UInt_t AddCalRuns(UInt_t num) { return AddCalRuns(num, num); }
154 UInt_t AddPedRuns(UInt_t num) { return AddPedRuns(num, num); }
155 UInt_t AddDatRuns(UInt_t num) { return AddDatRuns(num, num); }
156
157 void ExcludeRun(UInt_t num);
158 void ExcludeRuns(TString runs);
159
160 static Bool_t InflatePath(TString &seq, Bool_t ismc=kFALSE);
161
162 ClassDef(MSequence, 4)
163};
164
165#endif
Note: See TracBrowser for help on using the repository browser.