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