Rev 301 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 301 | Rev 316 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | #include "TFile.h" |
1 | #include "TFile.h" |
2 | #include "TH1.h" |
2 | #include "TH1.h" |
3 | #include "TH2.h" |
3 | #include "TH2.h" |
4 | #include "TFile.h" |
4 | #include "TFile.h" |
5 | #include "TGraph.h" |
5 | #include "TGraph.h" |
- | 6 | #include "TMultiGraph.h" |
|
6 | #include "TCanvas.h" |
7 | #include "TCanvas.h" |
7 | #include "TStyle.h" |
8 | #include "TStyle.h" |
8 | #include "TLegend.h" |
9 | #include "TLegend.h" |
9 | #include "TFile.h" |
10 | #include "TFile.h" |
10 | //#include "TROOT.h" |
11 | //#include "TROOT.h" |
Line 39... | Line 40... | ||
39 | TH2F *h2_pos; |
40 | TH2F *h2_pos; |
40 | TH1F *h1_qsumx; |
41 | TH1F *h1_qsumx; |
41 | TH1F *h1_qsumy; |
42 | TH1F *h1_qsumy; |
42 | TGraph *gr_wfm[NCH]; |
43 | TGraph *gr_wfm[NCH]; |
43 | TLegend *leg; |
44 | TLegend *leg; |
- | 45 | TMultiGraph *wfm; |
|
44 | 46 | ||
45 | int drs::histoinit( int nch, DrsChannel* d, int trgch, double ymin, double ymax){ |
47 | int drs::histoinit( int nch, DrsChannel* d, int trgch, double ymin, double ymax){ |
46 | char histname[128]; |
48 | char histname[128]; |
47 | c_wfm= new TCanvas("c_wfm","WFM",50,50,700,700); |
49 | c_wfm= new TCanvas("c_wfm","WFM",50,50,700,700); |
48 | 50 | ||
49 | c_wfm->Divide(1,1); |
51 | c_wfm->Divide(1,1); |
50 | c_wfm->cd(1); |
52 | c_wfm->cd(1); |
51 | const double maxt= |
53 | const double maxt=200; |
52 | leg = new TLegend(0.8, 0.8, 1, 1); |
54 | leg = new TLegend(0.8, 0.8, 1, 1); |
- | 55 | wfm = new TMultiGraph(); |
|
53 | for (int i=0; i<nch; i++) { |
56 | for (int i=0; i<nch; i++) { |
54 | sprintf(histname,"chmax_%02d",i); |
57 | sprintf(histname,"chmax_%02d",i); |
55 | h1_chmax[i]=new TH1F(histname, |
58 | h1_chmax[i]=new TH1F(histname,Form("%d"),1500,d[i].ymin,d[i].ymax); |
56 | sprintf(histname,"chmaxt_%02d",i); |
59 | sprintf(histname,"chmaxt_%02d",i); |
57 | h1_chmaxt[i]=new TH1F(histname,histname,DWIDTH,-0.1,maxt); |
60 | h1_chmaxt[i]=new TH1F(histname,histname,DWIDTH,-0.1,maxt); |
58 | sprintf(histname,"chmin_%02d",i); |
61 | sprintf(histname,"chmin_%02d",i); |
59 | h1_chmin[i]=new TH1F(histname,histname,1500,ymin, |
62 | h1_chmin[i]=new TH1F(histname,histname,1500,d[i].ymin,d[i].ymax); |
60 | sprintf(histname,"chmint_%02d",i); |
63 | sprintf(histname,"chmint_%02d",i); |
61 | h1_chmint[i]=new TH1F(histname,histname,DWIDTH,-0.1,maxt); |
64 | h1_chmint[i]=new TH1F(histname,histname,DWIDTH,-0.1,maxt); |
62 | sprintf(histname,"letime_%02d",i); |
65 | sprintf(histname,"letime_%02d",i); |
63 | h1_letime[i]=new TH1F(histname,histname,500,d[i].twin[0],d[i].twin[1]); |
66 | h1_letime[i]=new TH1F(histname,histname,500,d[i].twin[0],d[i].twin[1]); |
64 | sprintf(histname,"cftime_%02d",i); |
67 | sprintf(histname,"cftime_%02d",i); |
65 | h1_cftime[i]=new TH1F(histname,histname,500,d[i].twin[0],d[i].twin[1]); |
68 | h1_cftime[i]=new TH1F(histname,histname,500,d[i].twin[0],d[i].twin[1]); |
66 | sprintf(histname,"cftdif_%02d",i); |
69 | sprintf(histname,"cftdif_%02d",i); |
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); |
70 | 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); |
68 | sprintf(histname,"qdc_%02d",i); |
71 | sprintf(histname,"qdc_%02d",i); |
- | 72 | float dx = 7*(d[i].ymax - d[i].ymin); |
|
- | 73 | ||
- | 74 | double ymin, ymax; |
|
- | 75 | if(d[i].edge){ |
|
- | 76 | ymin=d[i].ymin*8; |
|
- | 77 | ymax=d[i].ymax*8; |
|
- | 78 | ||
- | 79 | } |
|
- | 80 | else{ |
|
- | 81 | ymin=-d[i].ymax*8; |
|
- | 82 | ymax=-d[i].ymin*8; |
|
- | 83 | ||
- | 84 | } |
|
- | 85 | ||
69 | h1_qdc[i] |
86 | h1_qdc[i]=new TH1F(histname,histname,800, ymin , ymax); |
70 | sprintf(histname,"dpo_%02d",i); |
87 | sprintf(histname,"dpo_%02d",i); |
71 | h2_dpo[i]=new TH2F(histname,histname,DWIDTH,-0.1,maxt,1500,ymin, |
88 | h2_dpo[i]=new TH2F(histname,histname,DWIDTH,-0.1,maxt,1500,d[i].ymin,d[i].ymax); |
72 | sprintf(histname,"tdcadc_%02d",i); |
89 | sprintf(histname,"tdcadc_%02d",i); |
73 | h2_tdcadc[i]=new TH2F(histname,histname,250,ymin, |
90 | h2_tdcadc[i]=new TH2F(histname,histname,250,d[i].ymin,d[i].ymax,400,d[i].twin[0]-d[trgch].twin[0],d[i].twin[1]-d[trgch].twin[0]); |
74 | sprintf(histname,"ctdcadc_%02d",i); |
91 | sprintf(histname,"ctdcadc_%02d",i); |
75 | h2_ctdcadc[i]=new TH2F(histname,histname,250,ymin, |
92 | h2_ctdcadc[i]=new TH2F(histname,histname,250,d[i].ymin,d[i].ymax,400,d[i].twin[0]-d[trgch].twin[0],d[i].twin[1]-d[trgch].twin[0]); |
76 | gr_wfm[i]=new TGraph(DWIDTH); |
93 | gr_wfm[i]=new TGraph(DWIDTH); |
77 | gr_wfm |
94 | //gr_wfm[i]->SetMinimum(d[i].ymin); |
78 | gr_wfm |
95 | //gr_wfm[i]->SetMaximum(d[i].ymax); |
79 | gr_wfm[i]->SetLineColor(i+1); |
96 | gr_wfm[i]->SetLineColor(i+1); |
80 | gr_wfm[i]->SetMarkerColor(i+1); |
97 | gr_wfm[i]->SetMarkerColor(i+1); |
81 | sprintf(histname,"ch %d",i); |
98 | sprintf(histname,"ch %d",i); |
82 | leg->AddEntry(gr_wfm[i], histname, "l"); |
99 | leg->AddEntry(gr_wfm[i], histname, "l"); |
- | 100 | wfm->Add(gr_wfm[i]); |
|
83 |
|
101 | //if (i) gr_wfm[i]->Draw("LP"); else gr_wfm[i]->Draw("ALP"); |
84 | gr_wfm |
102 | //gr_wfm[i]->GetHistogram()->SetTitle("WaveForms"); |
85 | gr_wfm |
103 | //gr_wfm[i]->GetHistogram()->SetDirectory(0); |
86 | } |
104 | } |
- | 105 | wfm->SetMinimum(ymin); |
|
- | 106 | wfm->SetMaximum(ymax); |
|
- | 107 | wfm->Draw("ALP"); |
|
87 | 108 | ||
- | 109 | //wfm->SetTitle("WaveForms"); |
|
- | 110 | //wfm->SetDirectory(0); |
|
88 | leg->Draw(); |
111 | leg->Draw(); |
89 | h2_ctalk=new TH2F("ctalk","ctalk",250,0.,0.5,250,0.,0.5); |
112 | 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); |
113 | h2_pos=new TH2F("cpos","cpos",40,-1,1,40,-1,1); |
91 | h1_qsumx=new TH1F("qsumx","qsumx",100,-1,6); |
114 | h1_qsumx=new TH1F("qsumx","qsumx",100,-1,6); |
92 | h1_qsumy=new TH1F("qsumy","qsumy",100,-1,6); |
115 | h1_qsumy=new TH1F("qsumy","qsumy",100,-1,6); |
Line 121... | Line 144... | ||
121 | 144 | ||
122 | short lwfm[NCH]; |
145 | short lwfm[NCH]; |
123 | int nwfm[NCH]; |
146 | int nwfm[NCH]; |
124 | int board; |
147 | int board; |
125 | int version; |
148 | int version; |
126 | 149 | ||
127 | 150 | ||
128 | unsigned short ichdat[NCH][DWIDTH]; |
151 | unsigned short ichdat[NCH][DWIDTH]; |
129 | float chdat[NCH][DWIDTH]; |
152 | float chdat[NCH][DWIDTH]; |
130 | float achdat[NCH][DWIDTH]; |
153 | float achdat[NCH][DWIDTH]; |
131 | float chmax[NCH][2]; |
154 | float chmax[NCH][2]; |
132 | float chmin[NCH][2]; |
155 | float chmin[NCH][2]; |
133 | float letime[NCH],cftime[NCH],qdc[NCH]; |
156 | float letime[NCH],cftime[NCH],qdc[NCH]; |
134 | 157 | ||
135 | 158 | ||
136 | // gROOT->Reset(); |
159 | // gROOT->Reset(); |
137 | 160 | ||
138 | gStyle->SetOptStat(1111111); |
161 | gStyle->SetOptStat(1111111); |
139 | // gStyle->SetPalette(52); |
162 | // gStyle->SetPalette(52); |
140 | 163 | ||
141 | histoinit(nch, d, trgch, ymin,ymax); |
164 | histoinit(nch, d, trgch, ymin,ymax); |
142 | char rootname[0xff]; |
165 | char rootname[0xff]; |
143 | sprintf(rootname, "%s_x%d_y%d.root", FileName, 0, 0); |
166 | sprintf(rootname, "%s_x%d_y%d.root", FileName, 0, 0); |
- | 167 | ||
144 | froot = new TFile(rootname,"RECREATE"); |
168 | froot = new TFile(rootname,"RECREATE"); |
145 | 169 | ||
146 | 170 | ||
147 | fin=fopen(FileName,"rb"); |
171 | fin=fopen(FileName,"rb"); |
148 | if (fin==NULL) { |
172 | if (fin==NULL) { |
149 | printf("Error opening file %s\n",FileName); |
173 | printf("Error opening file %s\n",FileName); |
150 | return; |
174 | return; |
Line 234... | Line 258... | ||
234 | default: |
258 | default: |
235 | printf("Unknown header! %s\n", recid); |
259 | printf("Unknown header! %s\n", recid); |
236 | break; |
260 | break; |
237 | } |
261 | } |
238 | if (iev<first) continue; |
262 | if (iev<first) continue; |
239 | - | ||
240 | if (recid[0] == 'E') { |
263 | if (recid[0] == 'E') { |
241 | for ( i=0; i<nch; i++) { |
264 | for ( i=0; i<nch; i++) { |
242 | if (!lwfm[i]) continue; |
265 | if (!lwfm[i]) continue; |
243 | double pulseheight = (d[i].edge)? chmax[i][0]: chmin[i][0]; |
266 | double pulseheight = (d[i].edge)? chmax[i][0]: chmin[i][0]; |
244 | 267 | ||
Line 262... | Line 285... | ||
262 | h1_qsumy->Fill(qsumy); |
285 | h1_qsumy->Fill(qsumy); |
263 | double ph0 = (d[0].edge)? chmax[0][0]: -chmin[0][0]; |
286 | double ph0 = (d[0].edge)? chmax[0][0]: -chmin[0][0]; |
264 | double ph1 = (d[1].edge)? chmax[1][0]: -chmin[1][0]; |
287 | double ph1 = (d[1].edge)? chmax[1][0]: -chmin[1][0]; |
265 | h2_ctalk->Fill(ph0,ph1); |
288 | h2_ctalk->Fill(ph0,ph1); |
266 | } |
289 | } |
- | 290 | ||
267 | if (event<1) continue; |
291 | if (event<1) continue; |
268 | if (recid[0]!='C') continue; |
292 | if (recid[0]!='C') continue; |
269 | if (ich>=nch) continue; |
293 | if (ich>=nch) continue; |
270 | 294 | ||
271 | lwfm[ich]=0; |
295 | lwfm[ich]=0; |
Line 273... | Line 297... | ||
273 | chmax[ich][0]=-1; chmax[ich][1]=-1; |
297 | chmax[ich][0]=-1; chmax[ich][1]=-1; |
274 | chmin[ich][0]=1; chmin[ich][1]=-1; |
298 | chmin[ich][0]=1; chmin[ich][1]=-1; |
275 | letime[ich]=-1.; letime[ich]=-1.; |
299 | letime[ich]=-1.; letime[ich]=-1.; |
276 | cftime[ich]=-1.; cftime[ich]=-1.; |
300 | cftime[ich]=-1.; cftime[ich]=-1.; |
277 | 301 | ||
278 | 302 | ||
279 | lwfm[ich]=1; |
303 | lwfm[ich]=1; |
280 | nwfm[ich]+=1; |
304 | nwfm[ich]+=1; |
281 | 305 | ||
282 | 306 | ||
283 | 307 | ||
Line 299... | Line 323... | ||
299 | if (version) y[i]+=evrec.rc/1000.; |
323 | if (version) y[i]+=evrec.rc/1000.; |
300 | h2_dpo[ich]->Fill(t[i],y[i]); |
324 | h2_dpo[ich]->Fill(t[i],y[i]); |
301 | gr_wfm[ich]->SetPoint(i,t[i],y[i]+0.05*(ich-1)); |
325 | gr_wfm[ich]->SetPoint(i,t[i],y[i]+0.05*(ich-1)); |
302 | } |
326 | } |
303 | 327 | ||
304 | 328 | ||
305 | for (i=0; i<DWIDTH; i++) { |
329 | for (i=0; i<DWIDTH; i++) { |
306 | // accumulated waveforms |
330 | // accumulated waveforms |
307 | ay[i]+=y[i]; |
331 | ay[i]+=y[i]; |
308 | 332 | ||
309 | // signal minumum |
333 | // signal minumum |
Line 322... | Line 346... | ||
322 | float t0n = t[i-1]; |
346 | float t0n = t[i-1]; |
323 | // charge in the range |
347 | // charge in the range |
324 | if ((t0>d[ich].adcgate[0])&&(t0<d[ich].adcgate[1])) { |
348 | if ((t0>d[ich].adcgate[0])&&(t0<d[ich].adcgate[1])) { |
325 | float sign = (d[ich].edge)? 1: -1; |
349 | float sign = (d[ich].edge)? 1: -1; |
326 | qdc[ich]+=sign*y[i]*(t0p-t0n)/2.; |
350 | qdc[ich]+=sign*y[i]*(t0p-t0n)/2.; |
327 | } |
351 | } |
328 | } |
352 | } |
329 | 353 | ||
330 | for (i=1; i<DWIDTH-1; i++) { |
354 | for (i=1; i<DWIDTH-1; i++) { |
331 | float t0 = t[i]; |
355 | float t0 = t[i]; |
332 | float t0p = t[i+1]; |
356 | float t0p = t[i+1]; |
Line 362... | Line 386... | ||
362 | } |
386 | } |
363 | h1_qdc[ich]->Fill(qdc[ich]); |
387 | h1_qdc[ich]->Fill(qdc[ich]); |
364 | h1_letime[ich]->Fill(letime[ich]); |
388 | h1_letime[ich]->Fill(letime[ich]); |
365 | h1_cftime[ich]->Fill(cftime[ich]); |
389 | h1_cftime[ich]->Fill(cftime[ich]); |
366 | time(&t0); |
390 | time(&t0); |
367 | - | ||
- | 391 | ||
368 | if ((t0!=told) || ((updfrq>0)&&(!(iev%updfrq) ) ) ) { |
392 | if ((t0!=told) || ((updfrq>0)&&(!(iev%updfrq) ) ) ) { |
369 | c_wfm->Update(); |
393 | c_wfm->Update(); |
370 | for (i=0; i<DWIDTH; i++) { |
394 | for (i=0; i<DWIDTH; i++) { |
371 | ay[i]/=nwfm[ich]; |
395 | ay[i]/=nwfm[ich]; |
372 | gr_wfm[ich]->SetPoint(i,t[i],ay[i]+0.00*(ich-1)); |
396 | gr_wfm[ich]->SetPoint(i,t[i],ay[i]+0.00*(ich-1)); |
Line 377... | Line 401... | ||
377 | } |
401 | } |
378 | 402 | ||
379 | printf("number of events: %d\n",iev); |
403 | printf("number of events: %d\n",iev); |
380 | fclose(fin); |
404 | fclose(fin); |
381 | TString pdfname = Form("%s.pdf",FileName); |
405 | TString pdfname = Form("%s.pdf",FileName); |
382 | gStyle->SetOptStat( |
406 | gStyle->SetOptStat(0); |
383 | TCanvas* c_dpo= new TCanvas("c_dpo","DPO",750,50,700,700); |
407 | TCanvas* c_dpo= new TCanvas("c_dpo","DPO",750,50,700,700); |
384 | c_dpo->Divide(2,2); |
408 | c_dpo->Divide(2,2); |
385 | 409 | ||
386 | for (i=0; i<nch; i++) {c_dpo->cd(i+1)->SetLogz(1); h2_dpo[i]->DrawCopy("colz");} |
410 | for (i=0; i<nch; i++) {c_dpo->cd(i+1)->SetLogz(1); h2_dpo[i]->DrawCopy("colz");} |
387 | - | ||
388 | 411 | ||
- | 412 | gStyle->SetOptStat(1111111); |
|
389 | TCanvas* c_cftdif= new TCanvas("c_cftdif"," |
413 | TCanvas* c_cftdif= new TCanvas("c_cftdif","Constant fraction time difference",750,50,700,700); |
390 | c_cftdif->Divide(2,2); |
414 | c_cftdif->Divide(2,2); |
391 | for (i=0; i<nch; i++) {c_cftdif->cd(i+1); h1_cftdif[i]->DrawCopy();} |
415 | for (i=0; i<nch; i++) {c_cftdif->cd(i+1); h1_cftdif[i]->DrawCopy();} |
392 | 416 | ||
- | 417 | /* |
|
393 | TCanvas* c_cftcorr= new TCanvas("c_cftcorr","pulseheight vs timing",750,50,700,700); |
418 | TCanvas* c_cftcorr= new TCanvas("c_cftcorr","pulseheight vs timing",750,50,700,700); |
394 | c_cftcorr->Divide(2,2); |
419 | c_cftcorr->Divide(2,2); |
395 | for (i=0; i<nch; i++) {c_cftcorr->cd(i+1); h2_tdcadc[i]->DrawCopy("colz");} |
420 | for (i=0; i<nch; i++) {c_cftcorr->cd(i+1); h2_tdcadc[i]->DrawCopy("colz");} |
396 | 421 | */ |
|
397 | TCanvas* c_adc= new TCanvas("c_adc","adc",750,50,700,700); |
422 | TCanvas* c_adc= new TCanvas("c_adc","adc",750,50,700,700); |
398 | c_adc->Divide(2,2); |
423 | c_adc->Divide(2,2); |
399 | for (i=0; i<nch; i++) {c_adc->cd(i+1); h1_qdc[i]->DrawCopy();} |
424 | for (i=0; i<nch; i++) {c_adc->cd(i+1); h1_qdc[i]->DrawCopy();} |
400 | 425 | ||
- | 426 | /* |
|
401 | TCanvas* c_qsum= new TCanvas("c_qsum","qsum",750,50,700,700); |
427 | TCanvas* c_qsum= new TCanvas("c_qsum","qsum",750,50,700,700); |
402 | c_qsum->Divide(1,2); |
428 | c_qsum->Divide(1,2); |
403 | c_qsum->cd(1); h1_qsumx->DrawCopy(); |
429 | c_qsum->cd(1); h1_qsumx->DrawCopy(); |
404 | c_qsum->cd(2); h1_qsumy->DrawCopy(); |
430 | c_qsum->cd(2); h1_qsumy->DrawCopy(); |
405 | 431 | ||
406 | gStyle->SetOptStat(0); |
432 | gStyle->SetOptStat(0); |
407 | TCanvas* c_pos= new TCanvas("c_pos","position",750,50,700,700); |
433 | TCanvas* c_pos= new TCanvas("c_pos","position",750,50,700,700); |
408 | 434 | ||
409 | c_pos->cd(); |
435 | c_pos->cd(); |
410 | h2_pos->DrawCopy("colz"); |
436 | h2_pos->DrawCopy("colz"); |
411 | 437 | */ |
|
412 | 438 | ||
413 | c_pos |
439 | //c_pos->Print(pdfname+"(","pdf"); |
414 | c_wfm |
440 | //c_wfm->Print(pdfname,"pdf"); |
415 | c_adc->Print(pdfname,"pdf"); |
441 | c_adc->Print(pdfname+"(","pdf"); |
416 | c_qsum |
442 | //c_qsum->Print(pdfname,"pdf"); |
417 | c_dpo->Print(pdfname,"pdf"); |
443 | c_dpo->Print(pdfname,"pdf"); |
418 | c_cftdif->Print(pdfname + ")","pdf"); |
444 | c_cftdif->Print(pdfname + ")","pdf"); |
419 | 445 | ||
- | 446 | c_dpo->Write(); |
|
- | 447 | c_adc->Write(); |
|
- | 448 | c_cftdif->Write(); |
|
420 | froot->Write(); |
449 | froot->Write(); |
421 | froot->Close(); |
450 | froot->Close(); |
422 | 451 | ||
423 | for (i=0; i<nch; i++) {c_cftdif->cd(i+1); h1_cftdif[i]->DrawCopy();} |
452 | for (i=0; i<nch; i++) {c_cftdif->cd(i+1); h1_cftdif[i]->DrawCopy();} |
424 | froot->Write(); |
453 | froot->Write(); |
425 | froot->Close(); |
454 | froot->Close(); |
426 | 455 | ||
427 | return; |
456 | return; |
428 | } |
457 | } |
429 | 458 | ||
430 | 459 | ||
431 | void drsana(int nev=1000, int updfrq=20, char *FileName="./data/x1.dat", int trgch=0){ |
460 | void drsana(int nev=1000, int updfrq=20, char *FileName="./data/x1.dat", int trgch=0){ |
432 | 461 | ||
433 | // float threshold[nch][2]={{0.,-0.02},{0.,0.},{0.,0.},{0.,-0.25}}; |
462 | // float threshold[nch][2]={{0.,-0.02},{0.,0.},{0.,0.},{0.,-0.25}}; |
434 | // float twin[nch][2]={{120.,130.},{100.,150.},{100.,150.},{70.,90.}}; |
463 | // float twin[nch][2]={{120.,130.},{100.,150.},{100.,150.},{70.,90.}}; |
435 | // float adcgate[nch][2]={{12nch.,136.},{120.,140.},{120.,140.},{70.,90.}}; |
464 | // float adcgate[nch][2]={{12nch.,136.},{120.,140.},{120.,140.},{70.,90.}}; |
436 | // float threshold[4][2]={{0.,-0.05},{0.,-0.05},{0.,-0.25},{0.,-0.25}}; |
465 | // float threshold[4][2]={{0.,-0.05},{0.,-0.05},{0.,-0.25},{0.,-0.25}}; |
437 | // float twin[4][2]={{80.,100.},{80.,100.},{90.,110.},{50.,70.}}; |
466 | // float twin[4][2]={{80.,100.},{80.,100.},{90.,110.},{50.,70.}}; |
Line 440... | Line 469... | ||
440 | float twin[4][2]={{100.,120.},{100.,120.},{110.,130.},{60.,80.}}; |
469 | float twin[4][2]={{100.,120.},{100.,120.},{110.,130.},{60.,80.}}; |
441 | float adcgate[4][2]={{105.,125.},{105.,125.},{110.,130.},{60.,80.}}; |
470 | float adcgate[4][2]={{105.,125.},{105.,125.},{110.,130.},{60.,80.}}; |
442 | double vcut[4][2]={{-0.49,-0.07},{-1,1},{-1,1},{-1,1}}; |
471 | double vcut[4][2]={{-0.49,-0.07},{-1,1},{-1,1},{-1,1}}; |
443 | int edge[4]={1,1,1,1};// 0 -- rising, 1 -- falling |
472 | int edge[4]={1,1,1,1};// 0 -- rising, 1 -- falling |
444 | float offset[4]={0.25,0.25,0.25,0.25};// |
473 | float offset[4]={0.25,0.25,0.25,0.25};// |
445 | 474 | ||
446 | DrsChannel c[2]; |
475 | DrsChannel c[2]; |
447 | 476 | ||
448 | c[0].cfrac = CFRAC; |
477 | c[0].cfrac = CFRAC; |
449 | c[0].threshold = threshold[0][0]; |
478 | c[0].threshold = threshold[0][0]; |
450 | c[0].twin[0] = twin[0][0]; |
479 | c[0].twin[0] = twin[0][0]; |
Line 464... | Line 493... | ||
464 | c[1].twin[0] = twin[1][0]; |
493 | c[1].twin[0] = twin[1][0]; |
465 | c[1].twin[1] = twin[1][1]; |
494 | c[1].twin[1] = twin[1][1]; |
466 | 495 | ||
467 | c[1].adcgate[0] = adcgate[1][0]; |
496 | c[1].adcgate[0] = adcgate[1][0]; |
468 | c[1].adcgate[1] = adcgate[1][1]; |
497 | c[1].adcgate[1] = adcgate[1][1]; |
469 | 498 | ||
470 | c[1].vcut[0] = vcut[1][0]; |
499 | c[1].vcut[0] = vcut[1][0]; |
471 | c[1].vcut[1] = vcut[1][1]; |
500 | c[1].vcut[1] = vcut[1][1]; |
472 | 501 | ||
473 | c[1].edge = edge[1]; |
502 | c[1].edge = edge[1]; |
474 | c[1].offset = offset[1]; |
503 | c[1].offset = offset[1]; |
475 | drs * d = new drs(FileName, 2, c, trgch, nev, updfrq, -0.55,0.55 ); |
504 | drs * d = new drs(FileName, 2, c, trgch, 0, nev, updfrq, -0.55,0.55 ); |
- | 505 | } |
|
- | 506 | ||
- | 507 | ||
- | 508 | ||
- | 509 | void sensl(int nev=1000, int updfrq=20, char *FileName="./data/x1.dat", int trgch=3){ |
|
- | 510 | // nev = -1 all events |
|
- | 511 | double threshold[4]={-0.005,-0.05,-0.005,-0.05}; // threshold for determination of timing |
|
- | 512 | float twin[4][2]={{20,40.},{980.,1150.},{100.,160.},{100.,160.}}; // window for calculation of the timing |
|
- | 513 | float adcgate[4][2]={{20.,30.}, {980.,1150.},{112.,123.},{150.,163.}}; //integration window |
|
- | 514 | double vcut[4][2]={{-1,1},{-1,1},{-1,1},{-1,1}}; // cut on the pulseheight for filling the timing histograms |
|
- | 515 | int edge[4]={1,0,1,0};// 1 -- rising edge, 0 -- falling edge |
|
- | 516 | double offset[4]={0.25,0.25, 0.025,0.25};// qdc offset |
|
- | 517 | double ymin[4]={-0.1,-0.5,-0.01,-0.6};// ymin offset |
|
- | 518 | double ymax[4]={0.5,0.5,0.07,0.1};// ymin offset |
|
- | 519 | DrsChannel c[NCH]; |
|
- | 520 | for (int k=0;k<NCH;k++){ |
|
- | 521 | c[k].cfrac = CFRAC; |
|
- | 522 | c[k].threshold = threshold[k]; |
|
- | 523 | for (int j=0;j<2;j++){ |
|
- | 524 | c[k].twin[j] = twin[k][j]; |
|
- | 525 | c[k].adcgate[j] = adcgate[k][j]; |
|
- | 526 | c[k].vcut[j] = vcut[k][j]; |
|
- | 527 | c[k].edge = edge[k]; |
|
- | 528 | c[k].offset = offset[k]; |
|
- | 529 | c[k].ymin = ymin[k]; |
|
- | 530 | c[k].ymax = ymax[k]; |
|
- | 531 | } |
|
- | 532 | } |
|
- | 533 | drs * d = new drs(FileName, NCH, c, trgch, 0, nev, updfrq , -1,1); |
|
476 | } |
534 | } |
477 | 535 | ||
478 | 536 | ||
479 | 537 | ||
480 | void |
538 | void ana(TString FileName="./data/x1.dat"){ |
- | 539 | int nev=-1; |
|
- | 540 | int updfrq=1000; |
|
- | 541 | int trgch=0; |
|
481 | // nev = -1 all events |
542 | // nev = -1 all events |
482 | double threshold[4]={-0.005,-0. |
543 | double threshold[4]={-0.005,-0.05,-0.005,-0.05}; // threshold for determination of timing |
483 | float twin[4][2]={{ |
544 | float twin[4][2]={{20,40.},{980.,1150.},{100.,160.},{100.,160.}}; // window for calculation of the timing |
484 | float adcgate[4][2]={{ |
545 | float adcgate[4][2]={{20.,30.}, {980.,1150.},{112.,123.},{150.,163.}}; //integration window |
485 | double vcut[4][2]={{-1,1},{-1,1},{-1,1},{-1,1}}; // cut on the pulseheight for filling the timing histograms |
546 | 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]={ |
547 | int edge[4]={1,0,1,0};// 1 -- rising edge, 0 -- falling edge |
487 |
|
548 | double offset[4]={0.25,0.25, 0.025,0.25};// qdc offset |
488 | - | ||
- | 549 | double ymin[4]={-0.1,-0.5,-0.01,-0.6};// ymin offset |
|
- | 550 | double ymax[4]={0.5,0.5,0.07,0.1};// ymin offset |
|
489 | DrsChannel c[NCH]; |
551 | DrsChannel c[NCH]; |
490 | for (int k=0;k<NCH;k++){ |
552 | for (int k=0;k<NCH;k++){ |
491 | c[k].cfrac = CFRAC; |
553 | c[k].cfrac = CFRAC; |
492 | c[k].threshold = threshold[k]; |
554 | c[k].threshold = threshold[k]; |
493 | for (int j=0;j<2;j++){ |
555 | for (int j=0;j<2;j++){ |
494 | c[k].twin[j] = twin[k][j]; |
556 | c[k].twin[j] = twin[k][j]; |
495 | c[k].adcgate[j] = adcgate[k][j]; |
557 | c[k].adcgate[j] = adcgate[k][j]; |
496 | c[k].vcut[j] = vcut[k][j]; |
558 | c[k].vcut[j] = vcut[k][j]; |
497 | c[k].edge = edge[k]; |
559 | c[k].edge = edge[k]; |
498 | c[k].offset = offset[k]; |
560 | c[k].offset = offset[k]; |
- | 561 | c[k].ymin = ymin[k]; |
|
- | 562 | c[k].ymax = ymax[k]; |
|
499 | } |
563 | } |
500 | } |
564 | } |
- | 565 | cout << "DRS4 " << FileName << endl; |
|
501 | drs * d = new drs(FileName |
566 | drs * d = new drs(FileName.Data(), NCH, c, trgch, 0, nev, updfrq , -0.5,0.5); |
502 | } |
567 | } |