1 | #ifndef MARS_MDataSet
|
---|
2 | #define MARS_MDataSet
|
---|
3 |
|
---|
4 | #ifndef MARS_MParContainer
|
---|
5 | #include "MParContainer.h"
|
---|
6 | #endif
|
---|
7 |
|
---|
8 | #ifndef ROOT_TArrayI
|
---|
9 | #include <TArrayI.h>
|
---|
10 | #endif
|
---|
11 |
|
---|
12 | class TChain;
|
---|
13 |
|
---|
14 | class MRead;
|
---|
15 | class MDirIter;
|
---|
16 | class MPointingPos;
|
---|
17 |
|
---|
18 | class MDataSet : public MParContainer
|
---|
19 | {
|
---|
20 | private:
|
---|
21 | static const TString fgCatalog; //! Default Catalog path
|
---|
22 | static const TString fgPathDataFiles; //! Default path to data files
|
---|
23 | static const TString fgPathSequences; //! Default path to sequences
|
---|
24 |
|
---|
25 | UInt_t fNumAnalysis; // Analysis number (artificial)
|
---|
26 |
|
---|
27 | TArrayI fNumSequencesOn; // number of on-sequences
|
---|
28 | TArrayI fNumSequencesOff; // number of off-sequences
|
---|
29 |
|
---|
30 | TList fSequencesOn; // list of names and paths of on-sequences
|
---|
31 | TList fSequencesOff; // list of names and paths of off-sequences
|
---|
32 |
|
---|
33 | TString fNameSource; // Name of source from catalog
|
---|
34 | TString fCatalog; // edb catalog (magic_favourites.edb)
|
---|
35 |
|
---|
36 | TString fComment; // Comment from DS file
|
---|
37 |
|
---|
38 | Bool_t fIsWobbleMode; // Wobble Mode for this dataset?
|
---|
39 |
|
---|
40 | void Split(TString &runs, TArrayI &data) const;
|
---|
41 | void ResolveSequences(TEnv &env, const TArrayI &num, TList &list, const TString &sequences, const TString &data) const;
|
---|
42 | static void PrintFile(const TObject &obj);
|
---|
43 |
|
---|
44 | void ReplaceDir(TList &list, const TString &old, const TString &news) const;
|
---|
45 | void ReplaceFile(TList &list, const TString &old, const TString &news) const;
|
---|
46 |
|
---|
47 | void SetupDefaultPath(TString &path, const TString &def) const
|
---|
48 | {
|
---|
49 | if (path.IsNull())
|
---|
50 | path = def;
|
---|
51 | if (!path.EndsWith("/"))
|
---|
52 | path += "/";
|
---|
53 | }
|
---|
54 |
|
---|
55 | public:
|
---|
56 | MDataSet(Int_t num=(UInt_t)-1) : fNumAnalysis(num) { }
|
---|
57 | MDataSet(const char *fname, TString sequences="", TString data="");
|
---|
58 |
|
---|
59 | void Copy(TObject &obj) const
|
---|
60 | {
|
---|
61 | MDataSet &ds = (MDataSet&)obj;
|
---|
62 | ds.fNumAnalysis = fNumAnalysis;
|
---|
63 | ds.fNumSequencesOn = fNumSequencesOn;
|
---|
64 | ds.fNumSequencesOff = fNumSequencesOff;
|
---|
65 | ds.fNameSource = fNameSource;
|
---|
66 | ds.fCatalog = fCatalog;
|
---|
67 | ds.fComment = fComment;
|
---|
68 | ds.fIsWobbleMode = fIsWobbleMode;
|
---|
69 |
|
---|
70 | TObject *o=0;
|
---|
71 |
|
---|
72 | ds.fSequencesOn.Delete();
|
---|
73 | ds.fSequencesOff.Delete();
|
---|
74 |
|
---|
75 | TIter NextOn(&fSequencesOn);
|
---|
76 | while ((o=NextOn()))
|
---|
77 | ds.fSequencesOn.Add(o->Clone());
|
---|
78 |
|
---|
79 | TIter NextOff(&fSequencesOff);
|
---|
80 | while ((o=NextOff()))
|
---|
81 | ds.fSequencesOff.Add(o->Clone());
|
---|
82 | }
|
---|
83 |
|
---|
84 | // Getter
|
---|
85 | Bool_t IsValid() const { return fNumAnalysis!=(UInt_t)-1; }
|
---|
86 |
|
---|
87 | UInt_t GetNumSequencesOn() const { return fNumSequencesOn.GetSize(); }
|
---|
88 | UInt_t GetNumSequencesOff() const { return fNumSequencesOff.GetSize(); }
|
---|
89 |
|
---|
90 | Bool_t HasOffSequences() const { return GetNumSequencesOff()>0; }
|
---|
91 |
|
---|
92 | UInt_t GetNumAnalysis() const { return fNumAnalysis; }
|
---|
93 | void SetNumAnalysis(UInt_t num) { fNumAnalysis=num; }
|
---|
94 |
|
---|
95 | Bool_t HasSource() const { return !fNameSource.IsNull(); }
|
---|
96 | Bool_t GetSourcePos(MPointingPos &pos) const;
|
---|
97 |
|
---|
98 | Bool_t IsWobbleMode() const { return fIsWobbleMode; }
|
---|
99 |
|
---|
100 | // Setter
|
---|
101 | static Bool_t AddSequencesFromList(const TList &list, MDirIter &files);
|
---|
102 | static Int_t AddFilesToChain(MDirIter &files, TChain &chain);
|
---|
103 |
|
---|
104 | const TList &GetSequencesOn() const { return fSequencesOn; }
|
---|
105 | const TList &GetSequencesOff() const { return fSequencesOff; }
|
---|
106 |
|
---|
107 | Bool_t AddFiles(MRead &read) const;
|
---|
108 | Bool_t AddFilesOn(MRead &read) const;
|
---|
109 | Bool_t AddFilesOff(MRead &read) const;
|
---|
110 |
|
---|
111 | Bool_t AddFiles(TChain &read) const;
|
---|
112 | Bool_t AddFilesOn(TChain &read) const;
|
---|
113 | Bool_t AddFilesOff(TChain &read) const;
|
---|
114 |
|
---|
115 | void ReplaceDir(const TString &old, const TString &news)
|
---|
116 | {
|
---|
117 | ReplaceDir(fSequencesOn, old, news);
|
---|
118 | ReplaceDir(fSequencesOff, old, news);
|
---|
119 | }
|
---|
120 |
|
---|
121 | void ReplaceFile(const TString &old, const TString &news)
|
---|
122 | {
|
---|
123 | ReplaceFile(fSequencesOn, old, news);
|
---|
124 | ReplaceFile(fSequencesOff, old, news);
|
---|
125 | }
|
---|
126 |
|
---|
127 | // TObject
|
---|
128 | void Print(Option_t *o="") const;
|
---|
129 |
|
---|
130 | ClassDef(MDataSet, 0)
|
---|
131 | };
|
---|
132 |
|
---|
133 | #endif
|
---|