1 | #define sigVis_cxx |
---|
2 | #include "sigVis.h" |
---|
3 | #include <TH2.h> |
---|
4 | #include <TStyle.h> |
---|
5 | #include <TCanvas.h> |
---|
6 | |
---|
7 | void sigVis::Loop(){ |
---|
8 | if (fChain == 0) return; |
---|
9 | Long64_t nentries = fChain->GetEntriesFast(); |
---|
10 | Long64_t nbytes = 0, nb = 0; |
---|
11 | for (Long64_t jentry=0; jentry<nentries;jentry++) { |
---|
12 | Long64_t ientry = LoadTree(jentry); |
---|
13 | if (ientry < 0) break; |
---|
14 | nb = fChain->GetEntry(jentry); nbytes += nb; |
---|
15 | } |
---|
16 | |
---|
17 | } |
---|
18 | |
---|
19 | void sigVis::DrawToCanvas(Long64_t entry[100], TString namePS){ |
---|
20 | |
---|
21 | Int_t i = 0; |
---|
22 | Int_t j = 0; |
---|
23 | |
---|
24 | TString nameO = namePS+"["; |
---|
25 | TString nameC = namePS+"]"; |
---|
26 | |
---|
27 | TGraph *wfGr[16]; |
---|
28 | TString nameG; |
---|
29 | TString titleG; |
---|
30 | |
---|
31 | TCanvas c11("c1"," wf ",10,10,1000,800); |
---|
32 | c11.Print(nameO.Data()); |
---|
33 | c11.Divide(2,4); |
---|
34 | |
---|
35 | for(Int_t k = 0;k<100;k++){ |
---|
36 | if(entry[k]>0){ |
---|
37 | GetEntry((entry[k])); |
---|
38 | |
---|
39 | cout<<"entry "<<entry[k]<<endl; |
---|
40 | cout<<"eventID_crt "<<eventID_crt<<endl; |
---|
41 | cout<<"eventID_usb "<<eventID_usb<<endl; |
---|
42 | |
---|
43 | for(i = 0;i<16;i++){ |
---|
44 | wfGr[i] = new TGraph(); |
---|
45 | nameG = "wfgr_"; |
---|
46 | nameG += i; |
---|
47 | nameG += "_"; |
---|
48 | nameG += eventID_usb; |
---|
49 | titleG = "wave form graph "; |
---|
50 | titleG += i; |
---|
51 | titleG += "_"; |
---|
52 | titleG += eventID_usb; |
---|
53 | wfGr[i]->SetNameTitle(nameG.Data(),titleG.Data()); |
---|
54 | } |
---|
55 | |
---|
56 | for(i = 0;i<16;i++){ |
---|
57 | for(j = 0;j<256;j++){ |
---|
58 | wfGr[i]->SetPoint(j,(j*SamplingPeriod_usb/1000.0),ch_usb[i][j]); |
---|
59 | } |
---|
60 | } |
---|
61 | |
---|
62 | for(i = 0;i<8;i++){ |
---|
63 | TMultiGraph *mg = new TMultiGraph("mg","mg"); |
---|
64 | c11.cd(i+1); |
---|
65 | mg->Add(wfGr[i]); |
---|
66 | wfGr[i]->SetMarkerSize(0.5); |
---|
67 | wfGr[i]->SetMarkerStyle(20); |
---|
68 | wfGr[i]->Draw("APL"); |
---|
69 | TLine *lnTime = new TLine(Time_usb[i],1.0,Time_usb[i],-1.0); |
---|
70 | TLine *lnAmpl = new TLine(0.0,Amplitude_usb[i],80,Amplitude_usb[i]); |
---|
71 | lnTime->SetLineColor(kRed); |
---|
72 | lnAmpl->SetLineColor(kRed); |
---|
73 | lnTime->Draw("same"); |
---|
74 | lnAmpl->Draw("same"); |
---|
75 | //wfGr_smooth[i]->Draw("APL"); |
---|
76 | //mg->Draw("APL"); |
---|
77 | } |
---|
78 | c11.Print(namePS.Data()); |
---|
79 | |
---|
80 | //TCanvas *c12 = new TCanvas("c2"," wf 8 - 15",20,20,1000,800); |
---|
81 | //c12->Divide(2,4); |
---|
82 | |
---|
83 | for(i = 0;i<8;i++){ |
---|
84 | TMultiGraph *mg = new TMultiGraph("mg","mg"); |
---|
85 | //c12->cd(i+1); |
---|
86 | c11.cd(i+1); |
---|
87 | mg->Add(wfGr[i+8]); |
---|
88 | wfGr[i+8]->SetMarkerSize(0.5); |
---|
89 | wfGr[i+8]->SetMarkerStyle(20); |
---|
90 | wfGr[i+8]->Draw("APL same"); |
---|
91 | TLine *lnTime = new TLine(Time_usb[i+8],1.0,Time_usb[i+8],-1.0); |
---|
92 | TLine *lnAmpl = new TLine(0.0,Amplitude_usb[i+8],80,Amplitude_usb[i+8]); |
---|
93 | lnTime->SetLineColor(kRed); |
---|
94 | lnAmpl->SetLineColor(kRed); |
---|
95 | lnTime->Draw("same"); |
---|
96 | lnAmpl->Draw("same"); |
---|
97 | //wfGr_smooth[i+8]->Draw("APL"); |
---|
98 | //mg->Draw("APL"); |
---|
99 | } |
---|
100 | //wfGr[0]->SaveAs("ss.C"); |
---|
101 | c11.Print(namePS.Data()); |
---|
102 | |
---|
103 | //for(i = 0;i<8;i++){ |
---|
104 | //delete wfGr[i]; |
---|
105 | //delete wfGr[i+8]; |
---|
106 | //} |
---|
107 | |
---|
108 | } |
---|
109 | else{ |
---|
110 | //cout<<"0"<<endl; |
---|
111 | } |
---|
112 | } |
---|
113 | c11.Print(nameC.Data()); |
---|
114 | |
---|
115 | } |
---|
116 | |
---|
117 | |
---|
118 | void sigVis::Draw(Long64_t entry){ |
---|
119 | |
---|
120 | Int_t i = 0; |
---|
121 | Int_t j = 0; |
---|
122 | |
---|
123 | TGraph *wfGr[16]; |
---|
124 | TString nameG; |
---|
125 | TString titleG; |
---|
126 | |
---|
127 | TCanvas *c11 = new TCanvas("c1"," wf ",10,10,1000,800); |
---|
128 | c11->Divide(2,4); |
---|
129 | |
---|
130 | GetEntry((entry)); |
---|
131 | |
---|
132 | cout<<"eventID_usb "<<eventID_usb<<endl; |
---|
133 | cout<<"entry "<<entry<<endl; |
---|
134 | |
---|
135 | for(i = 0;i<16;i++){ |
---|
136 | wfGr[i] = new TGraph(); |
---|
137 | nameG = "wfgr_"; |
---|
138 | nameG += i; |
---|
139 | nameG += "_"; |
---|
140 | nameG += entry; |
---|
141 | titleG = "wave form graph "; |
---|
142 | titleG += i; |
---|
143 | titleG += "_"; |
---|
144 | titleG += entry; |
---|
145 | wfGr[i]->SetNameTitle(nameG.Data(),titleG.Data()); |
---|
146 | } |
---|
147 | |
---|
148 | for(i = 0;i<16;i++){ |
---|
149 | for(j = 0;j<256;j++){ |
---|
150 | wfGr[i]->SetPoint(j,(j*SamplingPeriod_usb/1000.0),ch_usb[i][j]); |
---|
151 | } |
---|
152 | } |
---|
153 | |
---|
154 | Double_t maxAmpl; |
---|
155 | Double_t minAmpl; |
---|
156 | |
---|
157 | for(i = 0;i<8;i++){ |
---|
158 | TMultiGraph *mg = new TMultiGraph("mg","mg"); |
---|
159 | c11->cd(i+1); |
---|
160 | mg->Add(wfGr[i]); |
---|
161 | wfGr[i]->SetMarkerSize(0.5); |
---|
162 | wfGr[i]->SetMarkerStyle(20); |
---|
163 | wfGr[i]->Draw("APL"); |
---|
164 | // maxAmpl = wfGr[i]->GetMaximum(); |
---|
165 | //minAmpl = wfGr[i]->GetMinimum(); |
---|
166 | //TLine *lnTime = new TLine(Time_usb[i],1.0,Time_usb[i],-1.0); |
---|
167 | //TLine *lnAmpl = new TLine(0.0,Amplitude_usb[i],80,Amplitude_usb[i]); |
---|
168 | //lnTime->SetLineColor(kRed); |
---|
169 | //lnAmpl->SetLineColor(kRed); |
---|
170 | //lnTime->Draw("same"); |
---|
171 | //lnAmpl->Draw("same"); |
---|
172 | //wfGr_smooth[i]->Draw("APL"); |
---|
173 | //mg->Draw("APL"); |
---|
174 | } |
---|
175 | |
---|
176 | |
---|
177 | TCanvas *c12 = new TCanvas("c2"," wf 8 - 15",20,20,1000,800); |
---|
178 | c12->Divide(2,4); |
---|
179 | |
---|
180 | for(i = 0;i<8;i++){ |
---|
181 | TMultiGraph *mg = new TMultiGraph("mg","mg"); |
---|
182 | c12->cd(i+1); |
---|
183 | mg->Add(wfGr[i+8]); |
---|
184 | wfGr[i+8]->SetMarkerSize(0.5); |
---|
185 | wfGr[i+8]->SetMarkerStyle(20); |
---|
186 | wfGr[i+8]->Draw("APL same"); |
---|
187 | //TLine *lnTime = new TLine(Time_usb[i+8],1.0,Time_usb[i+8],-1.0); |
---|
188 | //TLine *lnAmpl = new TLine(0.0,Amplitude_usb[i+8],80,Amplitude_usb[i+8]); |
---|
189 | //lnTime->SetLineColor(kRed); |
---|
190 | //lnAmpl->SetLineColor(kRed); |
---|
191 | //lnTime->Draw("same"); |
---|
192 | //lnAmpl->Draw("same"); |
---|
193 | //wfGr_smooth[i+8]->Draw("APL"); |
---|
194 | //mg->Draw("APL"); |
---|
195 | } |
---|
196 | //wfGr[0]->SaveAs("ss.C"); |
---|
197 | |
---|
198 | |
---|
199 | //for(i = 0;i<8;i++){ |
---|
200 | //delete wfGr[i]; |
---|
201 | //delete wfGr[i+8]; |
---|
202 | //} |
---|
203 | |
---|
204 | |
---|
205 | } |
---|