source: branches/Mars_McMismatchStudy/mbase/MRunIter.h@ 18725

Last change on this file since 18725 was 8907, checked in by tbretz, 16 years ago
*** empty log message ***
File size: 1.6 KB
Line 
1#ifndef MARS_MRunIter
2#define MARS_MRunIter
3
4#ifndef MARS_MDirIter
5#include "MDirIter.h"
6#endif
7
8#ifndef ROOT_TArrayI
9#include <TArrayI.h>
10#endif
11
12class MRunIter : public MDirIter
13{
14private:
15 TString fPath;
16 TArrayI fRuns;
17
18 Bool_t fIsRawFile;
19 Bool_t fIsStandardFile;
20
21 void AddRunNumber(UInt_t run)
22 {
23 fRuns.Set(fRuns.GetSize()+1);
24 fRuns[fRuns.GetSize()-1] = run;
25
26 SortRuns();
27
28 }
29
30 void SortRuns();
31
32public:
33 MRunIter(const char *path=0) : fPath(path), fIsRawFile(0), fIsStandardFile(kFALSE) { }
34
35 void SetRawFile(Bool_t filetype) { fIsRawFile = filetype; }
36 void SetStandardFile(Bool_t filetype) { fIsStandardFile = filetype; }
37
38 Int_t AddRun(UInt_t run, const char *path=0);
39 Int_t AddRuns(const char* runrange, const char *path=0);
40 Int_t AddRuns(UInt_t from, UInt_t to, const char *path=0)
41 {
42 Int_t n = 0;
43
44 for (UInt_t i=from; i<=to; i++)
45 AddRun(i, path);
46
47 return n;
48 }
49
50 UInt_t GetNumRuns() const { return fRuns.GetSize(); }
51 const TArrayI &GetRuns() const { return fRuns; }
52
53 TString GetRunsAsString() const {
54 TString txt;
55 for (int i=0; i<fRuns.GetSize(); i++)
56 {
57 txt += "#";
58 txt += fRuns[i];
59 if (i!=fRuns.GetSize()-1)
60 txt += " ";
61 }
62 return txt;
63 }
64 TString GetRunsAsFileName() const {
65 TString txt;
66 for (int i=0; i<fRuns.GetSize(); i++)
67 {
68 txt += fRuns[i];
69 if (i!=fRuns.GetSize()-1)
70 txt += "_";
71 }
72 return txt;
73 }
74
75 ClassDef(MRunIter, 1) // Iterator for runs
76};
77
78#endif
Note: See TracBrowser for help on using the repository browser.