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

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