1 | ////////////////////////////////////////////////////////// |
---|
2 | // This class has been automatically generated on |
---|
3 | // Thu Sep 16 02:25:20 2010 by ROOT version 5.18/00b |
---|
4 | // from TTree T/CRT Data Tree |
---|
5 | // found on file: ../../DataRoot/CRT_Sept2010/Run_4_LaserON_SinglePePulses_9_14_2010_USBWC.root |
---|
6 | ////////////////////////////////////////////////////////// |
---|
7 | |
---|
8 | #ifndef vis_h |
---|
9 | #define vis_h |
---|
10 | |
---|
11 | #include <TROOT.h> |
---|
12 | #include <TChain.h> |
---|
13 | #include <TFile.h> |
---|
14 | |
---|
15 | //C, C++ |
---|
16 | #include <stdio.h> |
---|
17 | #include <assert.h> |
---|
18 | #include <stdlib.h> |
---|
19 | #include <iostream> |
---|
20 | #include <fstream> |
---|
21 | #include <string> |
---|
22 | #include <iomanip> |
---|
23 | #include <math.h> |
---|
24 | |
---|
25 | class vis { |
---|
26 | public : |
---|
27 | TTree *fChain; //!pointer to the analyzed TTree or TChain |
---|
28 | Int_t fCurrent; //!current Tree number in a TChain |
---|
29 | |
---|
30 | // Declaration of leaf types |
---|
31 | Int_t eventID; |
---|
32 | Float_t SamplingPeriod; |
---|
33 | Int_t INLCorrection; |
---|
34 | Int_t FCR; |
---|
35 | Double_t UnixTime; |
---|
36 | Float_t ch[16][256]; |
---|
37 | Float_t Charge[16]; |
---|
38 | Float_t Time[16]; |
---|
39 | Float_t Amplitude[16]; |
---|
40 | |
---|
41 | // List of branches |
---|
42 | TBranch *b_eventID; //! |
---|
43 | TBranch *b_SamplingPeriod; //! |
---|
44 | TBranch *b_INLCorrection; //! |
---|
45 | TBranch *b_FCR; //! |
---|
46 | TBranch *b_UnixTime; //! |
---|
47 | TBranch *b_ch; //! |
---|
48 | TBranch *b_Charge; //! |
---|
49 | TBranch *b_Time; //! |
---|
50 | TBranch *b_Amplitude; //! |
---|
51 | |
---|
52 | |
---|
53 | vis(string name); |
---|
54 | virtual ~vis(); |
---|
55 | virtual Int_t Cut(Long64_t entry); |
---|
56 | virtual Int_t GetEntry(Long64_t entry); |
---|
57 | virtual Long64_t LoadTree(Long64_t entry); |
---|
58 | virtual void Init(TTree *tree); |
---|
59 | virtual void Loop(); |
---|
60 | virtual Bool_t Notify(); |
---|
61 | virtual void Show(Long64_t entry = -1); |
---|
62 | |
---|
63 | void DrawToCanvas(Long64_t entry[100], TString namePS); |
---|
64 | void Draw(Long64_t entry); |
---|
65 | |
---|
66 | void getTimeCFDW(); |
---|
67 | Double_t _timeW[16]; |
---|
68 | Double_t _amplW[16]; |
---|
69 | Int_t _timeWstatus[16]; |
---|
70 | Double_t _baselineAmp[16]; |
---|
71 | Int_t _ImaxVtime[16]; |
---|
72 | Int_t _IdAmpChangSignTime[16]; |
---|
73 | //Int_t _Ith_UpXingTime[16]; |
---|
74 | //Int_t _Ith_LowXingTime[16]; |
---|
75 | Double_t _amplCfd[16]; |
---|
76 | Int_t _wfID[16]; |
---|
77 | |
---|
78 | |
---|
79 | |
---|
80 | }; |
---|
81 | |
---|
82 | #endif |
---|
83 | |
---|
84 | #ifdef vis_cxx |
---|
85 | vis::vis(string name) |
---|
86 | { |
---|
87 | ifstream indata; |
---|
88 | string rootFileName; |
---|
89 | TChain *theChain = new TChain("T"); |
---|
90 | indata.open(name.c_str()); |
---|
91 | assert(indata.is_open()); |
---|
92 | while (indata >> rootFileName ){ |
---|
93 | if(indata.eof()){ |
---|
94 | std::cout<<"EOF"<<std::endl; |
---|
95 | break; |
---|
96 | } |
---|
97 | TFile *f = new TFile(rootFileName.c_str()); |
---|
98 | cout<<" adding "<<rootFileName<<endl; |
---|
99 | theChain->Add(rootFileName.c_str(),-1); |
---|
100 | } |
---|
101 | indata.close(); |
---|
102 | Init(theChain); |
---|
103 | Long64_t nentries = fChain->GetEntriesFast(); |
---|
104 | cout<<"======================="<<endl; |
---|
105 | cout<<" total number of event "<<nentries<<endl; |
---|
106 | cout<<"======================="<<endl; |
---|
107 | } |
---|
108 | |
---|
109 | vis::~vis() |
---|
110 | { |
---|
111 | if (!fChain) return; |
---|
112 | delete fChain->GetCurrentFile(); |
---|
113 | } |
---|
114 | |
---|
115 | Int_t vis::GetEntry(Long64_t entry) |
---|
116 | { |
---|
117 | // Read contents of entry. |
---|
118 | if (!fChain) return 0; |
---|
119 | return fChain->GetEntry(entry); |
---|
120 | } |
---|
121 | Long64_t vis::LoadTree(Long64_t entry) |
---|
122 | { |
---|
123 | // Set the environment to read one entry |
---|
124 | if (!fChain) return -5; |
---|
125 | Long64_t centry = fChain->LoadTree(entry); |
---|
126 | if (centry < 0) return centry; |
---|
127 | if (!fChain->InheritsFrom(TChain::Class())) return centry; |
---|
128 | TChain *chain = (TChain*)fChain; |
---|
129 | if (chain->GetTreeNumber() != fCurrent) { |
---|
130 | fCurrent = chain->GetTreeNumber(); |
---|
131 | Notify(); |
---|
132 | } |
---|
133 | return centry; |
---|
134 | } |
---|
135 | |
---|
136 | void vis::Init(TTree *tree) |
---|
137 | { |
---|
138 | // The Init() function is called when the selector needs to initialize |
---|
139 | // a new tree or chain. Typically here the branch addresses and branch |
---|
140 | // pointers of the tree will be set. |
---|
141 | // It is normally not necessary to make changes to the generated |
---|
142 | // code, but the routine can be extended by the user if needed. |
---|
143 | // Init() will be called many times when running on PROOF |
---|
144 | // (once per file to be processed). |
---|
145 | |
---|
146 | // Set branch addresses and branch pointers |
---|
147 | if (!tree) return; |
---|
148 | fChain = tree; |
---|
149 | fCurrent = -1; |
---|
150 | fChain->SetMakeClass(1); |
---|
151 | |
---|
152 | fChain->SetBranchAddress("eventID", &eventID, &b_eventID); |
---|
153 | fChain->SetBranchAddress("SamplingPeriod", &SamplingPeriod, &b_SamplingPeriod); |
---|
154 | fChain->SetBranchAddress("INLCorrection", &INLCorrection, &b_INLCorrection); |
---|
155 | fChain->SetBranchAddress("FCR", &FCR, &b_FCR); |
---|
156 | fChain->SetBranchAddress("UnixTime", &UnixTime, &b_UnixTime); |
---|
157 | fChain->SetBranchAddress("ch", ch, &b_ch); |
---|
158 | fChain->SetBranchAddress("Charge", Charge, &b_Charge); |
---|
159 | fChain->SetBranchAddress("Time", Time, &b_Time); |
---|
160 | fChain->SetBranchAddress("Amplitude", Amplitude, &b_Amplitude); |
---|
161 | Notify(); |
---|
162 | } |
---|
163 | |
---|
164 | Bool_t vis::Notify() |
---|
165 | { |
---|
166 | // The Notify() function is called when a new file is opened. This |
---|
167 | // can be either for a new TTree in a TChain or when when a new TTree |
---|
168 | // is started when using PROOF. It is normally not necessary to make changes |
---|
169 | // to the generated code, but the routine can be extended by the |
---|
170 | // user if needed. The return value is currently not used. |
---|
171 | |
---|
172 | return kTRUE; |
---|
173 | } |
---|
174 | |
---|
175 | void vis::Show(Long64_t entry) |
---|
176 | { |
---|
177 | // Print contents of entry. |
---|
178 | // If entry is not specified, print current entry |
---|
179 | if (!fChain) return; |
---|
180 | fChain->Show(entry); |
---|
181 | } |
---|
182 | Int_t vis::Cut(Long64_t entry) |
---|
183 | { |
---|
184 | // This function may be called from Loop. |
---|
185 | // returns 1 if entry is accepted. |
---|
186 | // returns -1 otherwise. |
---|
187 | return 1; |
---|
188 | } |
---|
189 | #endif // #ifdef vis_cxx |
---|