er  dev
ERRootSource.h
1 #ifndef ERRootSource_H
2 #define ERRootSource_H
3 
4 #include <vector>
5 
6 #include "TString.h"
7 #include "TFile.h"
8 #include "TTree.h"
9 
10 #include "FairSource.h"
11 
12 #include "ERRawEvent.h"
13 
14 class ERRootSource : public FairSource
15 {
16  public:
17  ERRootSource();
18  ERRootSource(const ERRootSource& source);
19  virtual ~ERRootSource();
20 
21  virtual Bool_t Init();
22 
23  virtual Int_t ReadEvent(UInt_t=0);
24 
25  virtual void Close();
26 
27  virtual void Reset();
28 
29  virtual Source_Type GetSourceType(){return kFILE;}
30 
31  virtual void SetParUnpackers(){}
32 
33  virtual Bool_t InitUnpackers(){return kTRUE;}
34 
35  virtual Bool_t ReInitUnpackers(){return kTRUE;}
36 
37  void SetFile(TString path, TString treeName, TString branchName);
38  void AddFile(TString path){fPath.push_back(path);}
39 
40  void AddEvent(ERRawEvent* event) {fRawEvents.push_back(event);}
41  private:
42  std::vector<TString> fPath;
43  Int_t fCurFile;
44  Int_t fOldEvents;
45  TString fTreeName;
46  TString fBranchName;
47  TFile* fFile;
48  TTree* fTree;
49  Int_t HE8Event_nevent;
50 
51  std::vector<ERRawEvent*> fRawEvents;
52 
53  Int_t OpenNextFile();
54  public:
55  ClassDef(ERRootSource, 1)
56 };
57 
58 
59 #endif