er  dev
ERNXyterTreeSource.h
1 /*
2  * ERNXyterTreeSource.h
3  *
4  * Created on: Apr 3, 2017
5  * Author: vratik
6  */
7 
8 #ifndef BEAMTIME_ERNXYTERTREESOURCE_H_
9 #define BEAMTIME_ERNXYTERTREESOURCE_H_
10 
11 #include "FairSource.h"
12 
13 #include "TFile.h"
14 #include "TTree.h"
15 #include "TRandom3.h"
16 
17 #include "cls_RootEvent.h"
18 #include "WCalEvent.h"
19 
20 #include <fstream>
21 
22 using std::cout;
23 using std::endl;
24 
25 class ERNXyterTreeSource: public FairSource {
26 public:
28  virtual ~ERNXyterTreeSource();
30 
31 
32  virtual Bool_t Init();
33 
34  virtual Int_t ReadEvent(UInt_t=0);
35 
36  virtual void Close();
37 
38  virtual void Reset();
39 
40  virtual Source_Type GetSourceType(){return kFILE;}
41  virtual void SetParUnpackers(){}
42  virtual Bool_t InitUnpackers(){return kTRUE;}
43  virtual Bool_t ReInitUnpackers(){return kTRUE;}
44 
45  void SetInFile(TString path, TString treeName, TString branchName);
46 
47  void SetCalParameters(const char* p_filename);
48  void SetNonLinGraphs(const char* graph_filename);
49  void PrintCalParameters();
50 
51 private:
52  void ImportCalParameters();
53  void ImportNonLinGraphs();
54 
55 
56 private:
57 
58  TString fPath;
59  TString fTreeName;
60  TString fBranchName;
61 
62  TString fCalParFileName;
63  TString fNonLinGraphsFileName;
64 
65  TFile* fFile;
66  TTree* fTree;
67 
68  cls_RootEvent* fInEvent;
69  WCalEvent *fOutEvent;
70 
71  Long64_t fEvent;
72 
73  Float_t fCalPar[64];
74  const Float_t f1ePosCorrection = 1.18;
75  Float_t fPedestalsCorrection[64];
76 
77  TRandom3 calRandom;
78 
79 };
80 
81 #endif /* BEAMTIME_ERNXYTERTREESOURCE_H_ */
ClassDef(ERNXyterTreeSource, 1) virtual Bool_t Init()