Rev 208 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 208 | Rev 301 | ||
---|---|---|---|
Line -... | Line 1... | ||
- | 1 | #include "TFile.h" |
|
1 | #include "TH1.h" |
2 | #include "TH1.h" |
2 | #include "TH2.h" |
3 | #include "TH2.h" |
- | 4 | #include "TFile.h" |
|
3 | #include "TGraph.h" |
5 | #include "TGraph.h" |
4 | #include "TCanvas.h" |
6 | #include "TCanvas.h" |
5 | #include "TStyle.h" |
7 | #include "TStyle.h" |
6 | #include "TLegend.h" |
8 | #include "TLegend.h" |
7 | #include "TFile.h" |
9 | #include "TFile.h" |
8 | //#include "TROOT.h" |
10 | //#include "TROOT.h" |
9 | 11 | ||
10 | #include <stdio.h> |
12 | #include <stdio.h> |
11 | #include <time.h> |
13 | #include <time.h> |
12 | 14 | ||
13 | #define DATA_PATH "./data/" |
15 | #define DATA_PATH "./data/" |
14 | #define CFRAC 0.4 |
16 | #define CFRAC 0.4 |
15 | #define DWIDTH 1024 |
17 | #define DWIDTH 1024 |
16 | #define NCH 4 |
18 | #define NCH 4 |
17 | #include "drs.h" |
19 | #include "drs.h" |
18 | 20 | ||
19 | ClassImp (drs) |
21 | ClassImp (drs) |
20 | 22 | ||
21 | 23 | ||
- | 24 | TCanvas *c_wfm; |
|
- | 25 | TFile *froot; |
|
- | 26 | ||
22 | TH1F *h1_chmax[NCH]; |
27 | TH1F *h1_chmax[NCH]; |
23 | TH1F *h1_chmaxt[NCH]; |
28 | TH1F *h1_chmaxt[NCH]; |
24 | TH1F *h1_chmin[NCH]; |
29 | TH1F *h1_chmin[NCH]; |
25 | TH1F *h1_chmint[NCH]; |
30 | TH1F *h1_chmint[NCH]; |
26 | TH1F *h1_letime[NCH]; |
31 | TH1F *h1_letime[NCH]; |
27 | TH1F *h1_cftime[NCH]; |
32 | TH1F *h1_cftime[NCH]; |
28 | TH1F *h1_cftdif[NCH]; |
33 | TH1F *h1_cftdif[NCH]; |
29 | TH1F *h1_qdc[NCH]; |
34 | TH1F *h1_qdc[NCH]; |
30 | TH2F *h2_dpo[NCH]; |
35 | TH2F *h2_dpo[NCH]; |
31 | TH2F *h2_tdcadc[NCH]; |
36 | TH2F *h2_tdcadc[NCH]; |
32 | TH2F *h2_ctdcadc[NCH]; |
37 | TH2F *h2_ctdcadc[NCH]; |
33 | TH2F *h2_ctalk; |
38 | TH2F *h2_ctalk; |
- | 39 | TH2F *h2_pos; |
|
- | 40 | TH1F *h1_qsumx; |
|
- | 41 | TH1F *h1_qsumy; |
|
34 | TGraph *gr_wfm[NCH]; |
42 | TGraph *gr_wfm[NCH]; |
35 | TLegend *leg; |
43 | TLegend *leg; |
36 | - | ||
37 | - | ||
38 | TFile *froot; |
- | |
39 | 44 | ||
40 | int drs::histoinit( int nch, DrsChannel* d, int trgch){ |
45 | int drs::histoinit( int nch, DrsChannel* d, int trgch, double ymin, double ymax){ |
41 | char histname[128]; |
46 | char histname[128]; |
- | 47 | c_wfm= new TCanvas("c_wfm","WFM",50,50,700,700); |
|
- | 48 | ||
- | 49 | c_wfm->Divide(1,1); |
|
- | 50 | c_wfm->cd(1); |
|
- | 51 | const double maxt=1800; |
|
42 | leg = new TLegend(0.8, 0.8, 1, 1); |
52 | leg = new TLegend(0.8, 0.8, 1, 1); |
43 | for (int i=0; i<nch; i++) { |
53 | for (int i=0; i<nch; i++) { |
44 | sprintf(histname,"chmax_%02d",i); |
54 | sprintf(histname,"chmax_%02d",i); |
45 | h1_chmax[i]=new TH1F(histname,histname, |
55 | h1_chmax[i]=new TH1F(histname,histname,1500,ymin,ymax); |
46 | sprintf(histname,"chmaxt_%02d",i); |
56 | sprintf(histname,"chmaxt_%02d",i); |
47 | h1_chmaxt[i]=new TH1F(histname,histname,DWIDTH,-0.1, |
57 | h1_chmaxt[i]=new TH1F(histname,histname,DWIDTH,-0.1,maxt); |
48 | sprintf(histname,"chmin_%02d",i); |
58 | sprintf(histname,"chmin_%02d",i); |
49 | h1_chmin[i]=new TH1F(histname,histname, |
59 | h1_chmin[i]=new TH1F(histname,histname,1500,ymin,ymax); |
50 | sprintf(histname,"chmint_%02d",i); |
60 | sprintf(histname,"chmint_%02d",i); |
51 | h1_chmint[i]=new TH1F(histname,histname,DWIDTH,-0.1, |
61 | h1_chmint[i]=new TH1F(histname,histname,DWIDTH,-0.1,maxt); |
52 | sprintf(histname,"letime_%02d",i); |
62 | sprintf(histname,"letime_%02d",i); |
53 | h1_letime[i]=new TH1F(histname,histname,500,d[i].twin[0],d[i].twin[1]); |
63 | h1_letime[i]=new TH1F(histname,histname,500,d[i].twin[0],d[i].twin[1]); |
54 | sprintf(histname,"cftime_%02d",i); |
64 | sprintf(histname,"cftime_%02d",i); |
55 | h1_cftime[i]=new TH1F(histname,histname,500,d[i].twin[0],d[i].twin[1]); |
65 | h1_cftime[i]=new TH1F(histname,histname,500,d[i].twin[0],d[i].twin[1]); |
56 | sprintf(histname,"cftdif_%02d",i); |
66 | sprintf(histname,"cftdif_%02d",i); |
57 | h1_cftdif[i]=new TH1F(histname,histname,2000,d[i].twin[0]-d[trgch].twin[0] |
67 | h1_cftdif[i]=new TH1F(histname,histname,2000,d[i].twin[0]-d[trgch].twin[0]-40,d[i].twin[1]-d[trgch].twin[0]+20); |
58 | sprintf(histname,"qdc_%02d",i); |
68 | sprintf(histname,"qdc_%02d",i); |
59 | h1_qdc[i]=new TH1F(histname,histname,500,- |
69 | h1_qdc[i]=new TH1F(histname,histname,500,-4.5,4.5); |
60 | sprintf(histname,"dpo_%02d",i); |
70 | sprintf(histname,"dpo_%02d",i); |
61 | h2_dpo[i]=new TH2F(histname,histname,DWIDTH,-0.1, |
71 | h2_dpo[i]=new TH2F(histname,histname,DWIDTH,-0.1,maxt,1500,ymin,ymax); |
62 | sprintf(histname,"tdcadc_%02d",i); |
72 | sprintf(histname,"tdcadc_%02d",i); |
63 | h2_tdcadc[i]=new TH2F(histname,histname,250, |
73 | h2_tdcadc[i]=new TH2F(histname,histname,250,ymin,ymax,400,d[i].twin[0]-d[trgch].twin[0],d[i].twin[1]-d[trgch].twin[0]); |
64 | sprintf(histname,"ctdcadc_%02d",i); |
74 | sprintf(histname,"ctdcadc_%02d",i); |
65 | h2_ctdcadc[i]=new TH2F(histname,histname,250, |
75 | h2_ctdcadc[i]=new TH2F(histname,histname,250,ymin,ymax,400,d[i].twin[0]-d[trgch].twin[0],d[i].twin[1]-d[trgch].twin[0]); |
66 | gr_wfm[i]=new TGraph(DWIDTH); |
76 | gr_wfm[i]=new TGraph(DWIDTH); |
67 | gr_wfm[i]->SetMinimum( |
77 | gr_wfm[i]->SetMinimum(ymin); |
68 | gr_wfm[i]->SetMaximum( |
78 | gr_wfm[i]->SetMaximum(ymax); |
69 | gr_wfm[i]->SetLineColor(i+1); |
79 | gr_wfm[i]->SetLineColor(i+1); |
70 | gr_wfm[i]->SetMarkerColor(i+1); |
80 | gr_wfm[i]->SetMarkerColor(i+1); |
71 | sprintf(histname,"ch %d",i); |
81 | sprintf(histname,"ch %d",i); |
72 | leg->AddEntry(gr_wfm[i], histname, "l"); |
82 | leg->AddEntry(gr_wfm[i], histname, "l"); |
73 | if (i) gr_wfm[i]->Draw("LP"); else gr_wfm[i]->Draw("ALP"); |
83 | if (i) gr_wfm[i]->Draw("LP"); else gr_wfm[i]->Draw("ALP"); |
74 | gr_wfm[i]->GetHistogram()->SetTitle("WaveForms"); |
84 | gr_wfm[i]->GetHistogram()->SetTitle("WaveForms"); |
- | 85 | gr_wfm[i]->GetHistogram()->SetDirectory(0); |
|
75 | } |
86 | } |
76 | 87 | ||
77 | 88 | leg->Draw(); |
|
78 | h2_ctalk=new TH2F("ctalk","ctalk",250,0.,0.5,250,0.,0.5); |
89 | h2_ctalk=new TH2F("ctalk","ctalk",250,0.,0.5,250,0.,0.5); |
- | 90 | h2_pos=new TH2F("cpos","cpos",40,-1,1,40,-1,1); |
|
- | 91 | h1_qsumx=new TH1F("qsumx","qsumx",100,-1,6); |
|
- | 92 | h1_qsumy=new TH1F("qsumy","qsumy",100,-1,6); |
|
79 | return 0; |
93 | return 0; |
80 | } |
94 | } |
81 | 95 | ||
82 | drs::drs( const char *FileName, int nch, DrsChannel* d, int trgch, |
96 | drs::drs( const char *FileName, int nch, DrsChannel* d, int trgch,int first, int neve, int updfrq,double ymin, double ymax) |
- | 97 | ||
83 | { |
98 | { |
84 | int debug=0; |
99 | int debug=0; |
85 | int i,ich,iev; |
100 | int i,ich,iev; |
86 | int stat; |
101 | int stat; |
87 | int nev = first + neve; |
102 | int nev = first + neve; |
88 | // char FileName[300]="./data/n2.dat"; |
103 | // char FileName[300]="./data/n2.dat"; |
89 | FILE *fin; |
104 | FILE *fin; |
90 | 105 | ||
91 | char recid[5]="SAMO"; |
106 | char recid[5]="SAMO"; |
92 | unsigned short *srecid = (unsigned short *) &recid[0]; |
107 | unsigned short *srecid = (unsigned short *) &recid[0]; |
93 | 108 | ||
94 | struct evrec { |
109 | struct evrec { |
95 | unsigned long evn; |
110 | unsigned long evn; |
Line 120... | Line 135... | ||
120 | 135 | ||
121 | // gROOT->Reset(); |
136 | // gROOT->Reset(); |
122 | 137 | ||
123 | gStyle->SetOptStat(1111111); |
138 | gStyle->SetOptStat(1111111); |
124 | // gStyle->SetPalette(52); |
139 | // gStyle->SetPalette(52); |
125 | - | ||
126 | char rootname[0xFF]; |
- | |
127 | sprintf(rootname, "%s_x%d_y%d.root", FileName, 0,0); |
- | |
128 | TFile *froot = new TFile(rootname,"RECREATE"); |
- | |
129 | histoinit(nch, d, trgch); |
- | |
130 | leg->Draw(); |
- | |
131 | TCanvas *c_wfm= new TCanvas("c_wfm","WFM",50,50,700,700); |
- | |
132 | 140 | ||
133 |
|
141 | histoinit(nch, d, trgch, ymin,ymax); |
134 |
|
142 | char rootname[0xff]; |
- | 143 | sprintf(rootname, "%s_x%d_y%d.root", FileName, 0, 0); |
|
- | 144 | froot = new TFile(rootname,"RECREATE"); |
|
- | 145 | ||
135 | 146 | ||
136 | - | ||
137 | - | ||
138 | fin=fopen(FileName,"rb"); |
147 | fin=fopen(FileName,"rb"); |
139 | if (fin==NULL) { |
148 | if (fin==NULL) { |
140 | printf("Error opening file %s\n",FileName); |
149 | printf("Error opening file %s\n",FileName); |
141 | return; |
150 | return; |
142 | } |
151 | } |
Line 156... | Line 165... | ||
156 | time_t t0,told; |
165 | time_t t0,told; |
157 | time(&t0); |
166 | time(&t0); |
158 | told=t0-1; |
167 | told=t0-1; |
159 | int posrec[9]; |
168 | int posrec[9]; |
160 | while(!feof(fin)) { |
169 | while(!feof(fin)) { |
161 | if (iev |
170 | if (iev==nev) break; |
162 | stat=fread(recid,1,4,fin); |
171 | stat=fread(recid,1,4,fin); |
163 | if (debug) { |
172 | if (debug) { |
164 | if (recid[1]=='#') printf("%c%c%u\n",recid[0],recid[1],srecid[1]); |
173 | if (recid[1]=='#') printf("%c%c%u\n",recid[0],recid[1],srecid[1]); |
165 | else printf("%s\n",recid ); |
174 | else printf("%s\n",recid ); |
166 | } |
175 | } |
Line 175... | Line 184... | ||
175 | if (iev>=first){ |
184 | if (iev>=first){ |
176 | froot->Write(); |
185 | froot->Write(); |
177 | froot->Close(); |
186 | froot->Close(); |
178 | sprintf(rootname, "%s_x%d_y%d.root", FileName, posrec[3], posrec[4]); |
187 | sprintf(rootname, "%s_x%d_y%d.root", FileName, posrec[3], posrec[4]); |
179 | froot = new TFile(rootname,"RECREATE"); |
188 | froot = new TFile(rootname,"RECREATE"); |
180 | histoinit(nch,d, trgch); |
189 | histoinit(nch,d, trgch, ymin,ymax); |
181 | } |
190 | } |
182 | printf("Position len=%d x=%d y=%d ix=%d iy=%d\n", len, posrec[0], posrec[1], posrec[3], posrec[4]); |
191 | printf("Position len=%d x=%d y=%d ix=%d iy=%d\n", len, posrec[0], posrec[1], posrec[3], posrec[4]); |
183 | } else |
192 | } else |
184 | printf("Position record buffer length %d\n", len); |
193 | printf("Position record buffer length %d\n", len); |
185 | } else { |
194 | } else { |
Line 223... | Line 232... | ||
223 | event=1; |
232 | event=1; |
224 | break; |
233 | break; |
225 | default: |
234 | default: |
226 | printf("Unknown header! %s\n", recid); |
235 | printf("Unknown header! %s\n", recid); |
227 | break; |
236 | break; |
228 | } |
237 | } |
229 | if (iev<first) continue; |
238 | if (iev<first) continue; |
230 | 239 | ||
231 | if (recid[0] == 'E') { |
240 | if (recid[0] == 'E') { |
232 | for ( i=0; i<nch; i++) { |
241 | for ( i=0; i<nch; i++) { |
233 | if (!lwfm[i]) continue; |
242 | if (!lwfm[i]) continue; |
Line 242... | Line 251... | ||
242 | h2_tdcadc[i] ->Fill(pulseheight,letime[i]-cftime[trgch]); |
251 | h2_tdcadc[i] ->Fill(pulseheight,letime[i]-cftime[trgch]); |
243 | h2_ctdcadc[i]->Fill(pulseheight,cftime[i]-cftime[trgch]); |
252 | h2_ctdcadc[i]->Fill(pulseheight,cftime[i]-cftime[trgch]); |
244 | 253 | ||
245 | //if (i==1) printf("ph=%f %f\n", pulseheight, letime[i]-cftime[trgch]); |
254 | //if (i==1) printf("ph=%f %f\n", pulseheight, letime[i]-cftime[trgch]); |
246 | } |
255 | } |
- | 256 | double qsumx=qdc[0]+qdc[1]; |
|
- | 257 | double qsumy=qdc[2]+qdc[3]; |
|
- | 258 | double x0=(qsumx)?(qdc[0]-qdc[1])/qsumx:-2; |
|
- | 259 | double x1=(qsumy)?(qdc[2]-qdc[3])/qsumy:-2; |
|
- | 260 | h2_pos->Fill(x0,x1); |
|
- | 261 | h1_qsumx->Fill(qsumx); |
|
- | 262 | h1_qsumy->Fill(qsumy); |
|
247 | double ph0 = (d[0].edge)? chmax[0][0]: -chmin[0][0]; |
263 | double ph0 = (d[0].edge)? chmax[0][0]: -chmin[0][0]; |
248 | double ph1 = (d[1].edge)? chmax[1][0]: -chmin[1][0]; |
264 | double ph1 = (d[1].edge)? chmax[1][0]: -chmin[1][0]; |
249 | h2_ctalk->Fill(ph0,ph1); |
265 | h2_ctalk->Fill(ph0,ph1); |
250 | } |
266 | } |
251 | if (event<1) continue; |
267 | if (event<1) continue; |
252 | if (recid[0]!='C') continue; |
268 | if (recid[0]!='C') continue; |
253 | if (ich>=nch) continue; |
269 | if (ich>=nch) continue; |
254 | 270 | ||
255 | lwfm[ich]=0; |
271 | lwfm[ich]=0; |
256 | qdc[ich]= |
272 | qdc[ich]=d[ich].offset; |
257 | chmax[ich][0]=-1; chmax[ich][1]=-1; |
273 | chmax[ich][0]=-1; chmax[ich][1]=-1; |
258 | chmin[ich][0]=1; chmin[ich][1]=-1; |
274 | chmin[ich][0]=1; chmin[ich][1]=-1; |
259 | letime[ich]=-1.; letime[ich]=-1.; |
275 | letime[ich]=-1.; letime[ich]=-1.; |
260 | cftime[ich]=-1.; cftime[ich]=-1.; |
276 | cftime[ich]=-1.; cftime[ich]=-1.; |
261 | 277 | ||
262 | 278 | ||
263 | lwfm[ich]=1; |
279 | lwfm[ich]=1; |
264 | nwfm[ich]+=1; |
280 | nwfm[ich]+=1; |
265 | 281 | ||
266 | 282 | ||
267 | 283 | ||
268 | t = &tcdata[ich][0]; |
284 | t = &tcdata[ich][0]; |
269 | y = &chdat[ich][0]; |
285 | y = &chdat[ich][0]; |
270 | ay = &achdat[ich][0]; |
286 | ay = &achdat[ich][0]; |
271 | 287 | ||
272 | float sum=0; |
288 | float sum=0; |
273 | for (i=0; i<DWIDTH; i++) { |
289 | for (i=0; i<DWIDTH; i++) { |
274 | sum+= dtdata[ich][(i+trgcell)%DWIDTH]; |
290 | sum+= dtdata[ich][(i+trgcell)%DWIDTH]; |
275 | if (version) t[i]=sum; |
291 | if (version) t[i]=sum; |
276 | else t[i]=dtdata[0][i]; // old format |
292 | else t[i]=dtdata[0][i]; // old format |
277 | } |
293 | } |
278 | tccalib[ich]=t[(DWIDTH-trgcell)%DWIDTH]; |
294 | tccalib[ich]=t[(DWIDTH-trgcell)%DWIDTH]; |
279 | 295 | ||
280 | for (i=0; i<DWIDTH; i++) { |
296 | for (i=0; i<DWIDTH; i++) { |
281 | if (version) t[i]-=(tccalib[ich]-tccalib[0]); // assume ich 0 is connected and always first in the data |
297 | if (version) t[i]-=(tccalib[ich]-tccalib[0]); // assume ich 0 is connected and always first in the data |
282 | y[i]=-0.5+(float)ichdat[ich][i]/0xFFFF; |
298 | y[i]=-0.5+(float)ichdat[ich][i]/0xFFFF; |
Line 360... | Line 376... | ||
360 | } |
376 | } |
361 | } |
377 | } |
362 | 378 | ||
363 | printf("number of events: %d\n",iev); |
379 | printf("number of events: %d\n",iev); |
364 | fclose(fin); |
380 | fclose(fin); |
365 | - | ||
- | 381 | TString pdfname = Form("%s.pdf",FileName); |
|
- | 382 | gStyle->SetOptStat(1111111); |
|
366 | TCanvas* c_dpo= new TCanvas("c_dpo","DPO",750,50,700,700); |
383 | TCanvas* c_dpo= new TCanvas("c_dpo","DPO",750,50,700,700); |
367 | c_dpo->Divide(2,2); |
384 | c_dpo->Divide(2,2); |
- | 385 | ||
368 | for (i=0; i<nch; i++) {c_dpo->cd(i+1); h2_dpo[i]->DrawCopy("colz");} |
386 | for (i=0; i<nch; i++) {c_dpo->cd(i+1)->SetLogz(1); h2_dpo[i]->DrawCopy("colz");} |
- | 387 | ||
369 | 388 | ||
370 | TCanvas* c_cftdif= new TCanvas("c_cftdif","DPO",750,50,700,700); |
389 | TCanvas* c_cftdif= new TCanvas("c_cftdif","DPO",750,50,700,700); |
371 | c_cftdif->Divide(2,2); |
390 | c_cftdif->Divide(2,2); |
- | 391 | for (i=0; i<nch; i++) {c_cftdif->cd(i+1); h1_cftdif[i]->DrawCopy();} |
|
- | 392 | ||
- | 393 | TCanvas* c_cftcorr= new TCanvas("c_cftcorr","pulseheight vs timing",750,50,700,700); |
|
- | 394 | c_cftcorr->Divide(2,2); |
|
- | 395 | for (i=0; i<nch; i++) {c_cftcorr->cd(i+1); h2_tdcadc[i]->DrawCopy("colz");} |
|
- | 396 | ||
- | 397 | TCanvas* c_adc= new TCanvas("c_adc","adc",750,50,700,700); |
|
- | 398 | c_adc->Divide(2,2); |
|
- | 399 | for (i=0; i<nch; i++) {c_adc->cd(i+1); h1_qdc[i]->DrawCopy();} |
|
- | 400 | ||
- | 401 | TCanvas* c_qsum= new TCanvas("c_qsum","qsum",750,50,700,700); |
|
- | 402 | c_qsum->Divide(1,2); |
|
- | 403 | c_qsum->cd(1); h1_qsumx->DrawCopy(); |
|
- | 404 | c_qsum->cd(2); h1_qsumy->DrawCopy(); |
|
- | 405 | ||
- | 406 | gStyle->SetOptStat(0); |
|
- | 407 | TCanvas* c_pos= new TCanvas("c_pos","position",750,50,700,700); |
|
- | 408 | ||
- | 409 | c_pos->cd(); |
|
- | 410 | h2_pos->DrawCopy("colz"); |
|
- | 411 | ||
- | 412 | ||
- | 413 | c_pos->Print(pdfname+"(","pdf"); |
|
- | 414 | c_wfm->Print(pdfname,"pdf"); |
|
- | 415 | c_adc->Print(pdfname,"pdf"); |
|
- | 416 | c_qsum->Print(pdfname,"pdf"); |
|
- | 417 | c_dpo->Print(pdfname,"pdf"); |
|
- | 418 | c_cftdif->Print(pdfname + ")","pdf"); |
|
- | 419 | ||
- | 420 | froot->Write(); |
|
- | 421 | froot->Close(); |
|
- | 422 | ||
372 | for (i=0; i<nch; i++) {c_cftdif->cd(i+1); h1_cftdif[i]->DrawCopy();} |
423 | for (i=0; i<nch; i++) {c_cftdif->cd(i+1); h1_cftdif[i]->DrawCopy();} |
373 | froot->Write(); |
424 | froot->Write(); |
374 | froot->Close(); |
425 | froot->Close(); |
- | 426 | ||
375 | return; |
427 | return; |
376 | } |
428 | } |
377 | 429 | ||
378 | 430 | ||
379 | void drsana(int nev=1000, int updfrq=20, char *FileName="./data/x1.dat", int trgch=0){ |
431 | void drsana(int nev=1000, int updfrq=20, char *FileName="./data/x1.dat", int trgch=0){ |
380 | 432 | ||
381 | // float threshold[nch][2]={{0.,-0.02},{0.,0.},{0.,0.},{0.,-0.25}}; |
433 | // float threshold[nch][2]={{0.,-0.02},{0.,0.},{0.,0.},{0.,-0.25}}; |
382 | // float twin[nch][2]={{120.,130.},{100.,150.},{100.,150.},{70.,90.}}; |
434 | // float twin[nch][2]={{120.,130.},{100.,150.},{100.,150.},{70.,90.}}; |
383 | // float adcgate[nch][2]={{12nch.,136.},{120.,140.},{120.,140.},{70.,90.}}; |
435 | // float adcgate[nch][2]={{12nch.,136.},{120.,140.},{120.,140.},{70.,90.}}; |
384 | // float threshold[4][2]={{0.,-0.05},{0.,-0.05},{0.,-0.25},{0.,-0.25}}; |
436 | // float threshold[4][2]={{0.,-0.05},{0.,-0.05},{0.,-0.25},{0.,-0.25}}; |
385 | // float twin[4][2]={{80.,100.},{80.,100.},{90.,110.},{50.,70.}}; |
437 | // float twin[4][2]={{80.,100.},{80.,100.},{90.,110.},{50.,70.}}; |
Line 387... | Line 439... | ||
387 | double threshold[4][2]={{0.,-0.05},{0.,-0.05},{0.,-0.25},{0.,-0.25}}; |
439 | double threshold[4][2]={{0.,-0.05},{0.,-0.05},{0.,-0.25},{0.,-0.25}}; |
388 | float twin[4][2]={{100.,120.},{100.,120.},{110.,130.},{60.,80.}}; |
440 | float twin[4][2]={{100.,120.},{100.,120.},{110.,130.},{60.,80.}}; |
389 | float adcgate[4][2]={{105.,125.},{105.,125.},{110.,130.},{60.,80.}}; |
441 | float adcgate[4][2]={{105.,125.},{105.,125.},{110.,130.},{60.,80.}}; |
390 | double vcut[4][2]={{-0.49,-0.07},{-1,1},{-1,1},{-1,1}}; |
442 | double vcut[4][2]={{-0.49,-0.07},{-1,1},{-1,1},{-1,1}}; |
391 | int edge[4]={1,1,1,1};// 0 -- rising, 1 -- falling |
443 | int edge[4]={1,1,1,1};// 0 -- rising, 1 -- falling |
- | 444 | float offset[4]={0.25,0.25,0.25,0.25};// |
|
392 | 445 | ||
393 | DrsChannel c[2]; |
446 | DrsChannel c[2]; |
394 | 447 | ||
395 | c[0].cfrac = CFRAC; |
448 | c[0].cfrac = CFRAC; |
396 | c[0].threshold = threshold[0][0]; |
449 | c[0].threshold = threshold[0][0]; |
397 | c[0].twin[0] = twin[0][0]; |
450 | c[0].twin[0] = twin[0][0]; |
Line 402... | Line 455... | ||
402 | 455 | ||
403 | c[0].vcut[0] = vcut[0][0]; |
456 | c[0].vcut[0] = vcut[0][0]; |
404 | c[0].vcut[1] = vcut[0][1]; |
457 | c[0].vcut[1] = vcut[0][1]; |
405 | 458 | ||
406 | c[0].edge = edge[0]; |
459 | c[0].edge = edge[0]; |
407 | - | ||
- | 460 | c[0].edge = offset[0]; |
|
408 | 461 | ||
409 | c[1].cfrac = CFRAC; |
462 | c[1].cfrac = CFRAC; |
410 | c[1].threshold = threshold[1][0]; |
463 | c[1].threshold = threshold[1][0]; |
411 | c[1].twin[0] = twin[1][0]; |
464 | c[1].twin[0] = twin[1][0]; |
412 | c[1].twin[1] = twin[1][1]; |
465 | c[1].twin[1] = twin[1][1]; |
Line 416... | Line 469... | ||
416 | 469 | ||
417 | c[1].vcut[0] = vcut[1][0]; |
470 | c[1].vcut[0] = vcut[1][0]; |
418 | c[1].vcut[1] = vcut[1][1]; |
471 | c[1].vcut[1] = vcut[1][1]; |
419 | 472 | ||
420 | c[1].edge = edge[1]; |
473 | c[1].edge = edge[1]; |
- | 474 | c[1].offset = offset[1]; |
|
421 | drs * d = new drs(FileName, 2, c, trgch, nev, updfrq ); |
475 | drs * d = new drs(FileName, 2, c, trgch, nev, updfrq, -0.55,0.55 ); |
- | 476 | } |
|
- | 477 | ||
- | 478 | ||
- | 479 | ||
- | 480 | void sensl(int nev=1000, int updfrq=20, char *FileName="./data/x1.dat", int trgch=0){ |
|
- | 481 | // nev = -1 all events |
|
- | 482 | double threshold[4]={-0.005,-0.005,-0.005,-0.005}; // threshold for determination of timing |
|
- | 483 | float twin[4][2]={{980.,1150.},{980.,1150.},{980.,1150.},{980,1150.}}; // window for calculation of the timing |
|
- | 484 | float adcgate[4][2]={{980.,1150.},{980.,1150.},{980.,1150.},{980.,1150.}}; //integration window |
|
- | 485 | double vcut[4][2]={{-1,1},{-1,1},{-1,1},{-1,1}}; // cut on the pulseheight for filling the timing histograms |
|
- | 486 | int edge[4]={0,0,0,0};// 1 -- rising edge, 0 -- falling edge |
|
- | 487 | float offset[4]={0.25,0.25,0.25,0.25};// qdc offset |
|
- | 488 | ||
- | 489 | DrsChannel c[NCH]; |
|
- | 490 | for (int k=0;k<NCH;k++){ |
|
- | 491 | c[k].cfrac = CFRAC; |
|
- | 492 | c[k].threshold = threshold[k]; |
|
- | 493 | for (int j=0;j<2;j++){ |
|
- | 494 | c[k].twin[j] = twin[k][j]; |
|
- | 495 | c[k].adcgate[j] = adcgate[k][j]; |
|
- | 496 | c[k].vcut[j] = vcut[k][j]; |
|
- | 497 | c[k].edge = edge[k]; |
|
- | 498 | c[k].offset = offset[k]; |
|
- | 499 | } |
|
- | 500 | } |
|
- | 501 | drs * d = new drs(FileName, NCH, c, trgch, nev, updfrq , -0.1,0.12); |
|
422 | } |
502 | } |