Rev 291 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 291 | Rev 299 | ||
---|---|---|---|
Line 112... | Line 112... | ||
112 | leg1->Draw(); |
112 | leg1->Draw(); |
113 | } |
113 | } |
114 | 114 | ||
115 | // ======================================================================================================= |
115 | // ======================================================================================================= |
116 | 116 | ||
117 | void plots2(char *fname="480", char *plopt="d", double fitcenter = 1190., double fitw = 70., double comhi_range_hi = 2100., int batch_q=0) |
117 | void plots2(char *fname="480", char *plopt="d", int chich=0, double fitcenter = 1190., double fitw = 70., double comhi_range_hi = 2100., int batch_q=0) |
118 | { |
118 | { |
119 | char sbuff[256]; |
119 | char sbuff[256]; |
120 | 120 | ||
121 | char *fitopt="crystal1"; |
121 | char *fitopt="crystal1"; |
122 | double inmin=-10; |
122 | double inmin=-10; |
Line 190... | Line 190... | ||
190 | 190 | ||
191 | //~ gStyle->SetOptStat(1111); |
191 | //~ gStyle->SetOptStat(1111); |
192 | gStyle->SetOptStat(0); |
192 | gStyle->SetOptStat(0); |
193 | gStyle->SetOptFit(0); |
193 | gStyle->SetOptFit(0); |
194 | 194 | ||
195 | c[++cc] = new TCanvas("a", "a", 0, 0, |
195 | c[++cc] = new TCanvas("a", "a", 0, 0, 1600, 900); |
196 | c[cc]->Divide(2,2); |
196 | c[cc]->Divide(2,2); |
197 | - | ||
198 | int draw_cuts = 1; |
- | |
199 | int rebin_tdcs = 0; |
- | |
200 | - | ||
201 | int ccccdi = 0; |
- | |
202 | int ich; |
- | |
203 | - | ||
204 | // -------------------------- qdc 0 ---------------------------------- |
- | |
205 | ich = 0; |
- | |
206 | (c[cc]->cd(++ccccdi))->SetLogy(1); |
- | |
207 | sprintf(hname, "hadc%d", ich); |
- | |
208 | hp1d = DrTH1F(dir, hname, ""); |
- | |
209 | hp1d->SetTitle("MPPC 1;Charge [200 fC/bin]"); |
- | |
210 | hp1d->GetXaxis()->SetRangeUser(0,2000); |
- | |
211 | //~ hp1d->GetYaxis()->SetRangeUser(0.9,hp1d->GetMaximum()*1.1); |
- | |
212 | hp1d->SetLineColor(kBlack); |
- | |
213 | hp1d->DrawClone(); |
- | |
214 | - | ||
215 | if(draw_cuts) { |
- | |
216 | sprintf(hname, "hadc_cut%d", ich); |
- | |
217 | hp1dcut = DrTH1F(dir, hname, ""); |
- | |
218 | hp1dcut->SetLineColor(kRed); |
- | |
219 | hp1dcut->DrawClone("SAME"); |
- | |
220 | - | ||
221 | //~ sprintf(hname, "hadc_cut_2%d", ich); |
- | |
222 | //~ hp1dcut = DrTH1F(dir, hname, ""); |
- | |
223 | //~ hp1dcut->SetLineColor(kGreen); |
- | |
224 | //~ hp1dcut->DrawClone("SAME"); |
- | |
225 | } |
- | |
226 | - | ||
227 | // -------------------------- TDC 0 ---------------------------------- |
- | |
228 | (c[cc]->cd(++ccccdi))->SetLogy(1); |
- | |
229 | sprintf(hname, "htdc%d", ich); |
- | |
230 | hp1d = DrTH1F(dir, hname, ""); |
- | |
231 | hp1d->SetTitle("MPPC 1;Time [ns]"); |
- | |
232 | if(rebin_tdcs) hp1d->Rebin(rebin_tdcs); |
- | |
233 | //~ hp1d->GetXaxis()->SetRangeUser(0,22); |
- | |
234 | hp1d->GetXaxis()->SetRangeUser(20,34); |
- | |
235 | //~ hp1d->GetYaxis()->SetRangeUser(0.9,hp1d->GetMaximum()*1.1); |
- | |
236 | hp1d->SetLineColor(kBlack); |
- | |
237 | hp1d->DrawClone(); |
- | |
238 | - | ||
239 | if(draw_cuts) { |
- | |
240 | sprintf(hname, "htdc_cut%d", ich); |
- | |
241 | hp1dcut = DrTH1F(dir, hname, ""); |
- | |
242 | if(rebin_tdcs) hp1dcut->Rebin(rebin_tdcs); |
- | |
243 | hp1dcut->SetLineColor(kRed); |
- | |
244 | hp1dcut->DrawClone("SAME"); |
- | |
245 | - | ||
246 | //~ sprintf(hname, "htdc_cut_2%d", ich); |
- | |
247 | //~ hp1dcut = DrTH1F(dir, hname, ""); |
- | |
248 | //~ if(rebin_tdcs) hp1dcut->Rebin(rebin_tdcs); |
- | |
249 | //~ hp1dcut->SetLineColor(kGreen); |
- | |
250 | //~ hp1dcut->DrawClone("SAME"); |
- | |
251 | } |
- | |
252 | - | ||
253 | // -------------------------- qdc 1 ---------------------------------- |
- | |
254 | ich = 1; |
- | |
255 | (c[cc]->cd(++ccccdi))->SetLogy(1); |
- | |
256 | sprintf(hname, "hadc%d", ich); |
- | |
257 | hp1d = DrTH1F(dir, hname, ""); |
- | |
258 | hp1d->SetTitle("MPPC 2;Charge [200 fC/bin]"); |
- | |
259 | hp1d->GetXaxis()->SetRangeUser(0,2000); |
- | |
260 | //~ hp1d->GetYaxis()->SetRangeUser(0.9,hp1d->GetMaximum()*1.1); |
- | |
261 | hp1d->SetLineColor(kBlack); |
- | |
262 | hp1d->DrawClone(); |
- | |
263 | - | ||
264 | if(draw_cuts) { |
- | |
265 | sprintf(hname, "hadc_cut%d", ich); |
- | |
266 | hp1dcut = DrTH1F(dir, hname, ""); |
- | |
267 | hp1dcut->SetLineColor(kRed); |
- | |
268 | hp1dcut->DrawClone("SAME"); |
- | |
269 | - | ||
270 | //~ sprintf(hname, "hadc_cut_2%d", ich); |
- | |
271 | //~ hp1dcut = DrTH1F(dir, hname, ""); |
- | |
272 | //~ hp1dcut->SetLineColor(kGreen); |
- | |
273 | //~ hp1dcut->DrawClone("SAME"); |
- | |
274 | } |
- | |
275 | - | ||
276 | // -------------------------- TDC 1 ---------------------------------- |
- | |
277 | (c[cc]->cd(++ccccdi))->SetLogy(1); |
- | |
278 | sprintf(hname, "htdc%d", ich); |
- | |
279 | hp1d = DrTH1F(dir, hname, ""); |
- | |
280 | hp1d->SetTitle("MPPC 2;Time [ns]"); |
- | |
281 | if(rebin_tdcs) hp1d->Rebin(rebin_tdcs); |
- | |
282 | //~ hp1d->GetXaxis()->SetRangeUser(0,22); |
- | |
283 | hp1d->GetXaxis()->SetRangeUser(20,34); |
- | |
284 | //~ hp1d->GetYaxis()->SetRangeUser(0.9,hp1d->GetMaximum()*1.1); |
- | |
285 | hp1d->SetLineColor(kBlack); |
- | |
286 | hp1d->DrawClone(); |
- | |
287 | - | ||
288 | if(draw_cuts) { |
- | |
289 | sprintf(hname, "htdc_cut%d", ich); |
- | |
290 | hp1dcut = DrTH1F(dir, hname, ""); |
- | |
291 | if(rebin_tdcs) hp1dcut->Rebin(rebin_tdcs); |
- | |
292 | hp1dcut->SetLineColor(kRed); |
- | |
293 | hp1dcut->DrawClone("SAME"); |
- | |
294 | - | ||
295 | //~ sprintf(hname, "htdc_cut_2%d", ich); |
- | |
296 | //~ hp1dcut = DrTH1F(dir, hname, ""); |
- | |
297 | //~ if(rebin_tdcs) hp1dcut->Rebin(rebin_tdcs); |
- | |
298 | //~ hp1dcut->SetLineColor(kGreen); |
- | |
299 | //~ hp1dcut->DrawClone("SAME"); |
- | |
300 | } |
- | |
301 | - | ||
302 | sprintf(fullname, "gif/a_%s.gif", fname); c[cc]->SaveAs(fullname); |
- | |
303 | } |
- | |
304 | - | ||
305 | // ------------------------------------------------------------------- |
- | |
306 | - | ||
307 | if( strchr(plopt, 'q') != NULL ) { |
- | |
308 | - | ||
309 | gStyle->SetOptStat(1111); |
- | |
310 | gStyle->SetOptFit(0); |
- | |
311 | - | ||
312 | c[++cc] = new TCanvas("q", "q", 0, 0, 1200, 700); |
- | |
313 | c[cc]->Divide(3,2); |
- | |
314 | - | ||
315 | int draw_cuts = 1; |
- | |
316 | int rebin_tdcs = 1; |
- | |
317 | - | ||
318 | int ccccdi = 0; |
- | |
319 | int ich; |
- | |
320 | /* |
- | |
321 | ich = 2; |
- | |
322 | // -------------------------- qdc ref ---------------------------------- |
- | |
323 | (c[cc]->cd(++ccccdi))->SetLogy(1); |
- | |
324 | sprintf(hname, "hadc%d", ich); |
- | |
325 | hp1d = DrTH1F(dir, hname, ""); |
- | |
326 | //~ hp1d->GetXaxis()->SetRangeUser(0,100); |
- | |
327 | hp1d->GetYaxis()->SetRangeUser(0.9,hp1d->GetMaximum()*1.1); |
- | |
328 | hp1d->DrawClone(); |
- | |
329 | |
- | |
330 | sprintf(hname, "hadc_cut%d", ich); |
- | |
331 | hp1dcut = DrTH1F(dir, hname, ""); |
- | |
332 | hp1dcut->SetLineColor(kRed); |
- | |
333 | hp1dcut->DrawClone("SAME"); |
- | |
334 | |
- | |
335 | sprintf(hname, "hadc_cut_2%d", ich); |
- | |
336 | hp1dcut = DrTH1F(dir, hname, ""); |
- | |
337 | hp1dcut->SetLineColor(kGreen); |
- | |
338 | hp1dcut->DrawClone("SAME"); |
- | |
339 | - | ||
340 | // -------------------------- TDC ref ---------------------------------- |
- | |
341 | (c[cc]->cd(++ccccdi))->SetLogy(1); |
- | |
342 | sprintf(hname, "htdc%d", ich); |
- | |
343 | hp1d = DrTH1F(dir, hname, ""); |
- | |
344 | hp1d->Rebin(8); |
- | |
345 | hp1d->GetXaxis()->SetRangeUser(5,105); |
- | |
346 | hp1d->GetYaxis()->SetRangeUser(0.9,hp1d->GetMaximum()*1.1); |
- | |
347 | hp1d->DrawClone(); |
- | |
348 | |
- | |
349 | sprintf(hname, "htdc_cut%d", ich); |
- | |
350 | hp1dcut = DrTH1F(dir, hname, ""); |
- | |
351 | hp1dcut->Rebin(8); |
- | |
352 | hp1dcut->SetLineColor(kRed); |
- | |
353 | hp1dcut->DrawClone("SAME"); |
- | |
354 | |
- | |
355 | sprintf(hname, "htdc_cut_2%d", ich); |
- | |
356 | hp1dcut = DrTH1F(dir, hname, ""); |
- | |
357 | hp1dcut->Rebin(8); |
- | |
358 | hp1dcut->SetLineColor(kGreen); |
- | |
359 | hp1dcut->DrawClone("SAME"); |
- | |
360 | */ |
- | |
361 | - | ||
362 | // -------------------------- TDC DIFF ---------------------------------- |
- | |
363 | (c[cc]->cd(++ccccdi))->SetLogy(0); |
- | |
364 | sprintf(hname, "htdcdiff"); |
- | |
365 | hp1d = DrTH1F(dir, hname, ""); |
- | |
366 | hp1d->Rebin(rebin_tdcs); |
- | |
367 | hp1d->GetXaxis()->SetRangeUser(-15,15); |
- | |
368 | //~ hp1d->GetYaxis()->SetRangeUser(0.9,hp1d->GetMaximum()*2); |
- | |
369 | hp1d->GetYaxis()->SetRangeUser(0.,hp1d->GetMaximum()*1.1); |
- | |
370 | hp1d->DrawClone(); |
- | |
371 | - | ||
372 | if(draw_cuts) { |
- | |
373 | sprintf(hname, "htdcdiff_cut"); |
- | |
374 | hp1dcut = DrTH1F(dir, hname, ""); |
- | |
375 | hp1dcut->Rebin(rebin_tdcs); |
- | |
376 | hp1dcut->SetLineColor(kRed); |
- | |
377 | hp1dcut->DrawClone("SAME"); |
- | |
378 | - | ||
379 | sprintf(hname, "htdcdiff_cut_2"); |
- | |
380 | hp1dcut = DrTH1F(dir, hname, ""); |
- | |
381 | hp1dcut->Rebin(rebin_tdcs); |
- | |
382 | hp1dcut->SetLineColor(kGreen); |
- | |
383 | hp1dcut->DrawClone("SAME"); |
- | |
384 | } |
- | |
385 | - | ||
386 | // -------------------------- qdc MPPC ---------------------------------- |
- | |
387 | ich = 0; |
- | |
388 | (c[cc]->cd(++ccccdi))->SetLogy(1); |
- | |
389 | sprintf(hname, "hadc%d", ich); |
- | |
390 | hp1d = DrTH1F(dir, hname, ""); |
- | |
391 | hp1d->GetXaxis()->SetRangeUser(0,1500); |
- | |
392 | //~ hp1d->GetYaxis()->SetRangeUser(0.9,hp1d->GetMaximum()*1.1); |
- | |
393 | hp1d->DrawClone(); |
- | |
394 | - | ||
395 | if(draw_cuts) { |
- | |
396 | sprintf(hname, "hadc_cut%d", ich); |
- | |
397 | hp1dcut = DrTH1F(dir, hname, ""); |
- | |
398 | hp1dcut->SetLineColor(kRed); |
- | |
399 | hp1dcut->DrawClone("SAME"); |
- | |
400 | - | ||
401 | sprintf(hname, "hadc_cut_2%d", ich); |
- | |
402 | hp1dcut = DrTH1F(dir, hname, ""); |
- | |
403 | hp1dcut->SetLineColor(kGreen); |
- | |
404 | hp1dcut->DrawClone("SAME"); |
- | |
405 | } |
- | |
406 | - | ||
407 | // -------------------------- TDC MPPC ---------------------------------- |
- | |
408 | (c[cc]->cd(++ccccdi))->SetLogy(1); |
- | |
409 | sprintf(hname, "htdc%d", ich); |
- | |
410 | hp1d = DrTH1F(dir, hname, ""); |
- | |
411 | hp1d->Rebin(rebin_tdcs); |
- | |
412 | hp1d->GetXaxis()->SetRangeUser(0,20); |
- | |
413 | hp1d->GetYaxis()->SetRangeUser(0.9,hp1d->GetMaximum()*1.1); |
- | |
414 | hp1d->DrawClone(); |
- | |
415 | - | ||
416 | if(draw_cuts) { |
- | |
417 | sprintf(hname, "htdc_cut%d", ich); |
- | |
418 | hp1dcut = DrTH1F(dir, hname, ""); |
- | |
419 | hp1dcut->Rebin(rebin_tdcs); |
- | |
420 | hp1dcut->SetLineColor(kRed); |
- | |
421 | hp1dcut->DrawClone("SAME"); |
- | |
422 | - | ||
423 | sprintf(hname, "htdc_cut_2%d", ich); |
- | |
424 | hp1dcut = DrTH1F(dir, hname, ""); |
- | |
425 | hp1dcut->Rebin(rebin_tdcs); |
- | |
426 | hp1dcut->SetLineColor(kGreen); |
- | |
427 | hp1dcut->DrawClone("SAME"); |
- | |
428 | } |
- | |
429 | - | ||
430 | // -------------------------- qdc MPPC ---------------------------------- |
- | |
431 | ich = 1; |
- | |
432 | ccccdi++; |
- | |
433 | (c[cc]->cd(++ccccdi))->SetLogy(1); |
- | |
434 | sprintf(hname, "hadc%d", ich); |
- | |
435 | hp1d = DrTH1F(dir, hname, ""); |
- | |
436 | hp1d->GetXaxis()->SetRangeUser(0,1500); |
- | |
437 | //~ hp1d->GetYaxis()->SetRangeUser(0.9,hp1d->GetMaximum()*1.1); |
- | |
438 | hp1d->DrawClone(); |
- | |
439 | - | ||
440 | if(draw_cuts) { |
- | |
441 | sprintf(hname, "hadc_cut%d", ich); |
- | |
442 | hp1dcut = DrTH1F(dir, hname, ""); |
- | |
443 | hp1dcut->SetLineColor(kRed); |
- | |
444 | hp1dcut->DrawClone("SAME"); |
- | |
445 | - | ||
446 | sprintf(hname, "hadc_cut_2%d", ich); |
- | |
447 | hp1dcut = DrTH1F(dir, hname, ""); |
- | |
448 | hp1dcut->SetLineColor(kGreen); |
- | |
449 | hp1dcut->DrawClone("SAME"); |
- | |
450 | } |
- | |
451 | - | ||
452 | // -------------------------- TDC MPPC ---------------------------------- |
- | |
453 | (c[cc]->cd(++ccccdi))->SetLogy(1); |
- | |
454 | sprintf(hname, "htdc%d", ich); |
- | |
455 | hp1d = DrTH1F(dir, hname, ""); |
- | |
456 | hp1d->Rebin(rebin_tdcs); |
- | |
457 | hp1d->GetXaxis()->SetRangeUser(0,20); |
- | |
458 | hp1d->GetYaxis()->SetRangeUser(0.9,hp1d->GetMaximum()*1.1); |
- | |
459 | hp1d->DrawClone(); |
- | |
460 | - | ||
461 | if(draw_cuts) { |
- | |
462 | sprintf(hname, "htdc_cut%d", ich); |
- | |
463 | hp1dcut = DrTH1F(dir, hname, ""); |
- | |
464 | hp1dcut->Rebin(rebin_tdcs); |
- | |
465 | hp1dcut->SetLineColor(kRed); |
- | |
466 | hp1dcut->DrawClone("SAME"); |
- | |
467 | - | ||
468 | sprintf(hname, "htdc_cut_2%d", ich); |
- | |
469 | hp1dcut = DrTH1F(dir, hname, ""); |
- | |
470 | hp1dcut->Rebin(rebin_tdcs); |
- | |
471 | hp1dcut->SetLineColor(kGreen); |
- | |
472 | hp1dcut->DrawClone("SAME"); |
- | |
473 | } |
- | |
474 | - | ||
475 | sprintf(fullname, "gif/q_%s.gif", fname); c[cc]->SaveAs(fullname); |
- | |
476 | //~ sprintf(fullname, "%s_j2.eps", fname); c[cc]->SaveAs(fullname); |
- | |
477 | - | ||
478 | if(batch_q) gSystem->Exit(1); |
- | |
479 | } |
- | |
480 | // ------------------------------------------------------------------- |
- | |
481 | - | ||
482 | if( strchr(plopt, 'n') != NULL ) { |
- | |
483 | - | ||
484 | gStyle->SetOptStat("e"); |
- | |
485 | //~ gStyle->SetOptFit(1); |
- | |
486 | - | ||
487 | c[++cc] = new TCanvas("d", "d", 0, 0, 900, 600); |
- | |
488 | //~ c[cc]->Divide(2,2); |
- | |
489 | - | ||
490 | int draw_cuts = 0; |
- | |
491 | int rebin_tdcs = 1; |
- | |
492 | - | ||
493 | double drawmin = -17; |
- | |
494 | double drawmax = +17; |
- | |
495 | double fitmin = -10; |
- | |
496 | double fitmax = 10; |
- | |
497 | double fitcenter = 0.0; |
- | |
498 | double HalfMax, MinHalfMax, MaxHalfMax, FWHM, FWHMc; |
- | |
499 | - | ||
500 | int ccccdi = 0; |
- | |
501 | int ich = 0; |
- | |
502 | - | ||
503 | TF1 *f_fit; |
- | |
504 | - | ||
505 | TF1 *fcg = new TF1("fcg", "pol0(0)+gaus(1)"); fcg->SetNpx(300); |
- | |
506 | fcg->SetParName(0,"Const"); fcg->SetParName(1,"G_Const"); |
- | |
507 | fcg->SetParName(2,"G_Mean" ); fcg->SetParName(3,"G_Sigma" ); |
- | |
508 | - | ||
509 | TF1 *fcgg = new TF1("fcgg", "pol0(0)+gaus(1)+gaus(4)"); fcgg->SetNpx(300); |
- | |
510 | fcgg->SetParName(0,"Const"); |
- | |
511 | fcgg->SetParName(1,"G1_Const"); fcgg->SetParName(2,"G1_Mean" ); fcgg->SetParName(3,"G1_Sigma" ); |
- | |
512 | fcgg->SetParName(4,"G2_Const"); fcgg->SetParName(5,"G2_Mean" ); fcgg->SetParName(6,"G2_Sigma" ); |
- | |
513 | - | ||
514 | (c[cc]->cd(++ccccdi))->SetLogy(0); |
- | |
515 | sprintf(hname, "htdcdiff"); |
- | |
516 | hp1d = DrTH1F(dir, hname, ""); |
- | |
517 | //~ hp1d->Rebin(rebin_tdcs); |
- | |
518 | hp1d->SetLineColor(kBlack); |
- | |
519 | hp1d->GetXaxis()->SetRangeUser(drawmin,drawmax); |
- | |
520 | hp1d->GetYaxis()->SetRangeUser(0.0,hp1d->GetMaximum()*1.1); |
- | |
521 | hp1d->SetTitle(";Coincidence Time [ns];Counts"); |
- | |
522 | - | ||
523 | - | ||
524 | f_fit = fcgg; |
- | |
525 | f_fit->SetParameters(hp1d->GetMaximum()*0.25, |
- | |
526 | hp1d->GetMaximum()*0.7, 0, 0.4, |
- | |
527 | hp1d->GetMaximum()*0.05, 0, 0.05); |
- | |
528 | f_fit->SetParLimits(0, 0, hp1d->GetMaximum()); |
- | |
529 | f_fit->SetParLimits(1, 0, hp1d->GetMaximum()); |
- | |
530 | f_fit->SetParLimits(2, fitmin,fitmax); |
- | |
531 | f_fit->SetParLimits(3, 0.2, 1); |
- | |
532 | f_fit->SetParLimits(4, 0, hp1d->GetMaximum()); |
- | |
533 | f_fit->SetParLimits(5, fitmin,fitmax); |
- | |
534 | f_fit->SetParLimits(6, 0.02, 0.3); |
- | |
535 | - | ||
536 | //~ f_fit = fcgg; |
- | |
537 | //~ f_fit->SetParameters(hp1d->GetMaximum()*0.1, |
- | |
538 | //~ hp1d->GetMaximum()*0.5, 0, 0.05, |
- | |
539 | //~ hp1d->GetMaximum()*0.4, 0, 0.5); |
- | |
540 | - | ||
541 | //~ f_fit = fcg; |
- | |
542 | //~ f_fit->SetParameters(hp1d->GetMaximum()*0.1, |
- | |
543 | //~ hp1d->GetMaximum()*0.9, 0, 0.05); |
- | |
544 | - | ||
545 | f_fit->SetRange(fitmin,fitmax); |
- | |
546 | f_fit->SetLineWidth(1); |
- | |
547 | hp1d->Fit(f_fit, "Q", "", fitmin,fitmax); |
- | |
548 | - | ||
549 | - | ||
550 | HalfMax = f_fit->GetMaximum(fitmin, fitmax)/2.0; |
- | |
551 | MinHalfMax = f_fit->GetX(HalfMax, fitmin, fitcenter); |
- | |
552 | MaxHalfMax = f_fit->GetX(HalfMax, fitcenter, fitmax); |
- | |
553 | FWHM = MaxHalfMax - MinHalfMax; |
- | |
554 | - | ||
555 | HalfMax = (f_fit->GetMaximum(fitmin, fitmax) + f_fit->GetParameter(0))/2.0; |
- | |
556 | MinHalfMax = f_fit->GetX(HalfMax, fitmin, fitcenter); |
- | |
557 | MaxHalfMax = f_fit->GetX(HalfMax, fitcenter, fitmax); |
- | |
558 | FWHMc = MaxHalfMax - MinHalfMax; |
- | |
559 | - | ||
560 | //~ printf("FWHM = %lf ns | FWHMc = %lf ns\n", FWHM, FWHMc); |
- | |
561 | printf("FWHM (peak only) = %.3lf ns\n", FWHMc); |
- | |
562 | - | ||
563 | - | ||
564 | leg[++legi] = new TLegend(0.122768, 0.740418, 0.420759, 0.878049); |
- | |
565 | leg[legi]->SetFillColor(0); leg[legi]->SetBorderSize(1); leg[legi]->SetTextSize(0.03); leg[legi]->SetTextAlign(22); |
- | |
566 | - | ||
567 | - | ||
568 | for(int i=0; i<6; i++) fgg->SetParameter(i, f_fit->GetParameter(i+1)); |
- | |
569 | //~ fgg->SetRange(drawmin, drawmax); fgg->SetNpx(300); fgg->SetLineColor(kBlue); fgg->SetLineWidth(1); fgg->DrawClone("LSAME"); |
- | |
570 | double Icherenkovs = fgg->Integral(drawmin, drawmax); |
- | |
571 | - | ||
572 | double Iall = f_fit->Integral(fitmin, fitmax); |
- | |
573 | double Rsn = Icherenkovs/(Iall-Icherenkovs); |
- | |
574 | - | ||
575 | double Ientr = hp1d->GetEntries()*hp1d->GetBinWidth(1); |
- | |
576 | double Rsne = Icherenkovs/(Ientr-Icherenkovs); |
- | |
577 | - | ||
578 | double Ihist = hp1d->Integral(1, hp1d->GetNbinsX()-1)*hp1d->GetBinWidth(1); |
- | |
579 | double Rsnh = Icherenkovs/(Ihist-Icherenkovs); |
- | |
580 | - | ||
581 | //~ printf("ICherenkov = %lf | IAll = %lf | Ientr = %lf | Ihist = %lf\n", Icherenkovs, Iall, Ientr, Ihist); |
- | |
582 | //~ printf("TF1 -> S/N = %lf || TH1F(e) -> S/N = %lf || TH1F(i) -> S/N = %lf\n", Rsn, Rsne, Rsnh); |
- | |
583 | printf("S/N (vs. All) = %lf\n", Rsnh); |
- | |
584 | - | ||
585 | if(draw_cuts) { |
- | |
586 | sprintf(hname, "htdcdiff_cut"); |
- | |
587 | hp1dcut = DrTH1F(dir, hname, ""); |
- | |
588 | hp1dcut->Rebin(rebin_tdcs); |
- | |
589 | hp1dcut->SetLineColor(kRed); |
- | |
590 | hp1dcut->DrawClone("SAME"); |
- | |
591 | - | ||
592 | sprintf(hname, "htdcdiff_cut_2"); |
- | |
593 | hp1dcut = DrTH1F(dir, hname, ""); |
- | |
594 | hp1dcut->Rebin(rebin_tdcs); |
- | |
595 | hp1dcut->SetLineColor(kGreen); |
- | |
596 | hp1dcut->DrawClone("SAME"); |
- | |
597 | } |
- | |
598 | - | ||
599 | //~ #define USE_NOISE_FILE |
- | |
600 | - | ||
601 | #ifdef USE_NOISE_FILE |
- | |
602 | //get ROOT file with histograms |
- | |
603 | char fnameroot[1024]; |
- | |
604 | TFile * rootfile2; |
- | |
605 | TDirectory *dir2; |
- | |
606 | - | ||
607 | sprintf(fname, "run054"); |
- | |
608 | sprintf(fnameroot, "root/%s.root", fname); |
- | |
609 | rootfile2 = (TFile *) gROOT->FindObject(fname); |
- | |
610 | if(rootfile2==NULL) rootfile2 = new TFile(fnameroot); |
- | |
611 | if(rootfile2==NULL) { |
- | |
612 | printf("Cannot open root file 2 %s!!!\n",fnameroot); |
- | |
613 | return; |
- | |
614 | } |
- | |
615 | dir2 = (TDirectory*) rootfile2; |
- | |
616 | - | ||
617 | sprintf(hname, "htdcdiff"); |
- | |
618 | hp1dcut = DrTH1F(dir2, hname, ""); |
- | |
619 | hp1dcut->SetLineColor(kMagenta); |
- | |
620 | hp1dcut->DrawClone("SAME"); |
- | |
621 | - | ||
622 | leg[legi]->AddEntry((TH1F*)hp1d->Clone(), "With source (30 min)", "L"); |
- | |
623 | leg[legi]->AddEntry((TH1F*)hp1dcut->Clone(), "W/o source (30 min)", "L"); |
- | |
624 | sprintf(fullname, "Fit FWHM = %.3lf ns", FWHMc); |
- | |
625 | leg[legi]->AddEntry((TF1*)f_fit->Clone(), fullname, "L"); |
- | |
626 | leg[legi]->Draw(); |
- | |
627 | #endif |
- | |
628 | - | ||
629 | sprintf(fullname, "gif/n_%s.gif", fname); c[cc]->SaveAs(fullname); |
- | |
630 | - | ||
631 | if(batch_q) gSystem->Exit(1); |
- | |
632 | } |
- | |
633 | // ------------------------------------------------------------------- |
- | |
634 | - | ||
635 | if( strchr(plopt, 'f') != NULL ) { |
- | |
636 | - | ||
637 | DrSetDrawStyle(0.05); |
- | |
638 | - | ||
639 | gStyle->SetOptStat("e"); |
- | |
640 | //~ gStyle->SetOptFit(1); |
- | |
641 | - | ||
642 | gStyle->SetPadRightMargin(0.03); |
- | |
643 | gStyle->SetPadTopMargin(0.05); |
- | |
644 | gStyle->SetPadBottomMargin(0.12); |
- | |
645 | gStyle->SetStatFontSize(0.05); |
- | |
646 | gStyle->SetStatX(0.97); |
- | |
647 | gStyle->SetStatY(0.95); |
- | |
648 | - | ||
649 | c[++cc] = new TCanvas("f", "f", 0, 460, 720, 400); |
- | |
650 | //~ c[cc]->Divide(2,2); |
- | |
651 | 197 | ||
652 | int draw_cuts = 0; |
198 | int draw_cuts = 0; |
653 | int rebin_tdcs = 1; |
- | |
654 | - | ||
655 | double drawmin = -10; |
- | |
656 | double drawmax = +10; |
- | |
657 | //~ double fitmin = inmin; |
- | |
658 | //~ double fitmax = inmax; |
- | |
659 | double fitmin = -10; |
- | |
660 | double fitmax = 10; |
- | |
661 | double fitcenter = 0.0; |
- | |
662 | double HalfMax, MinHalfMax, MaxHalfMax, FWHM, FWHMc; |
- | |
663 | - | ||
664 | int ccccdi = 0; |
- | |
665 | int ich = 0; |
- | |
666 | - | ||
667 | TF1 *f_fit; |
- | |
668 | TF1 *f_integrate; |
- | |
669 | - | ||
670 | TF1 *fc = new TF1("fc", "pol0(0)"); |
- | |
671 | - | ||
672 | TF1 *fcg = new TF1("fcg", "pol0(0)+gaus(1)"); fcg->SetNpx(300); |
- | |
673 | fcg->SetParName(0,"Const"); fcg->SetParName(1,"G_Const"); |
- | |
674 | fcg->SetParName(2,"G_Mean" ); fcg->SetParName(3,"G_Sigma" ); |
- | |
675 | - | ||
676 | TF1 *fcgg = new TF1("fcgg", "pol0(0)+gaus(1)+gaus(4)"); fcgg->SetNpx(300); |
- | |
677 | fcgg->SetParName(0,"Const"); |
- | |
678 | fcgg->SetParName(1,"G1_Const"); fcgg->SetParName(2,"G1_Mean" ); fcgg->SetParName(3,"G1_Sigma" ); |
- | |
679 | fcgg->SetParName(4,"G2_Const"); fcgg->SetParName(5,"G2_Mean" ); fcgg->SetParName(6,"G2_Sigma" ); |
- | |
680 | - | ||
681 | TF1 *fcggg = new TF1("fcggg", "pol0(0)+gaus(1)+gaus(4)+gaus(7)"); fcggg->SetNpx(300); |
- | |
682 | fcggg->SetParName(0,"Const"); |
- | |
683 | fcggg->SetParName(1,"G1_Const"); fcggg->SetParName(2,"G1_Mean" ); fcggg->SetParName(3,"G1_Sigma" ); |
- | |
684 | fcggg->SetParName(4,"G2_Const"); fcggg->SetParName(5,"G2_Mean" ); fcggg->SetParName(6,"G2_Sigma" ); |
- | |
685 | fcggg->SetParName(7,"G3_Const"); fcggg->SetParName(8,"G3_Mean" ); fcggg->SetParName(9,"G3_Sigma" ); |
- | |
686 | - | ||
687 | //~ TF1 *f_nocrystal = new TF1("f_nocrystal", "[0]*exp(-0.5*((x-[1])/(sqrt(2)*[2]))**2)+[3]*exp(-0.5*((x-[4])/(sqrt(2)*[5]))**2)+[6]*exp(-1*((x-[7])**2)/(2*(([2])**2+([5])**2)))+[8]*exp(-1*(((x-[9])**2)/(2*(([2])**2+([5])**2))))+[10]"); |
- | |
688 | TF1 *f_nocrystal = new TF1("f_nocrystal", "[0]*([1]**2*TMath::Gaus(x,[2],sqrt(2)*[3],1)+(1-[1])**2*TMath::Gaus(x,[4],sqrt(2)*[5],1)+[1]*(1-[1])*TMath::Gaus(x,[6],sqrt([3]**2+[5]**2),1)+[1]*(1-[1])*TMath::Gaus(x,[7],sqrt([3]**2+[5]**2),1))+[8]"); |
- | |
689 | f_nocrystal->SetParName(0, "const"); |
- | |
690 | f_nocrystal->SetParName(1, "ratio"); |
- | |
691 | f_nocrystal->SetParName(2, "WW_mean"); |
- | |
692 | f_nocrystal->SetParName(3, "Window_sigma"); |
- | |
693 | f_nocrystal->SetParName(4, "MM_mean"); |
- | |
694 | f_nocrystal->SetParName(5, "MCP_sigma"); |
- | |
695 | f_nocrystal->SetParName(6, "WM1_mean"); |
- | |
696 | f_nocrystal->SetParName(7, "WM2_mean"); |
- | |
697 | f_nocrystal->SetParName(8, "Constant"); |
- | |
698 | - | ||
699 | //~ TF1 *f_crystal = new TF1("f_crystal", "[0]+[1]*([2]**2*(TMath::Gaus(x,[3],sqrt(2)*[4],1))+([5])**2*(TMath::Gaus(x,[6],sqrt(2)*[7],1))+(4*[5]/6)**2*(TMath::Gaus(x,[8],sqrt(2)*[9],1))+[2]*[5]*(TMath::Gaus(x,[10],sqrt([2]**2+[5]**2),1))+[5]*[2]*(TMath::Gaus(x,[11],sqrt([2]**2+[5]**2),1))+[2]*(4/6*[5])*(TMath::Gaus(x,[12],sqrt([2]**2+(4/6*[5])**2),1))+[2]*(4/6*[5])*(TMath::Gaus(x,[13],sqrt([2]**2+(4/6*[5])**2),1))+[5]*(4/6*[5])*(TMath::Gaus(x,[14],sqrt([5]**2+(4/6*[5])**2),1))+[5]*(4/6*[5])*(TMath::Gaus(x,[15],sqrt([5]**2+(4/6*[5])**2),1)))"); |
- | |
700 | TF1 *f_crystal = new TF1("f_crystal", "[0]+[1]*([2]**2*(TMath::Gaus(x,[3],sqrt(2)*[4],1))+([5])**2*(TMath::Gaus(x,[6],sqrt(2)*[7],1))+(4*[5]/6)**2*(TMath::Gaus(x,[8],sqrt(2)*[9],1))+[2]*[5]*(TMath::Gaus(x,[10],sqrt([4]**2+[7]**2),1))+[5]*[2]*(TMath::Gaus(x,[11],sqrt([4]**2+[7]**2),1))+[2]*(4/6*[5])*(TMath::Gaus(x,[12],sqrt([4]**2+[9]**2),1))+[2]*(4/6*[5])*(TMath::Gaus(x,[13],sqrt([4]**2+[9]**2),1))+[5]*(4/6*[5])*(TMath::Gaus(x,[14],sqrt([7]**2+[9]**2),1))+[5]*(4/6*[5])*(TMath::Gaus(x,[15],sqrt([7]**2+[9]**2),1)))"); |
- | |
701 | f_crystal->SetParName(0, "dark"); |
- | |
702 | f_crystal->SetParName(1, "const"); |
- | |
703 | f_crystal->SetParName(2, "Prob_Crystal"); |
- | |
704 | f_crystal->SetParName(3, "CC_mean"); |
- | |
705 | f_crystal->SetParName(4, "Crystal_sigma"); |
- | |
706 | f_crystal->SetParName(5, "Prob_window"); |
- | |
707 | f_crystal->SetParName(6, "WW_mean"); |
- | |
708 | f_crystal->SetParName(7, "WW_sigma"); |
- | |
709 | f_crystal->SetParName(8, "MM_mean"); |
- | |
710 | f_crystal->SetParName(9, "MM_sigma"); |
- | |
711 | f_crystal->SetParName(10, "CW1_mean"); |
- | |
712 | f_crystal->SetParName(11, "CW2_mean"); |
- | |
713 | f_crystal->SetParName(12, "CM1_mean"); |
- | |
714 | f_crystal->SetParName(13, "CM2_mean"); |
- | |
715 | f_crystal->SetParName(14, "WM1_mean"); |
- | |
716 | f_crystal->SetParName(15, "WM2_mean"); |
- | |
717 | - | ||
718 | //~ TF1 *f_crystal1 = new TF1("f_crystal1", "[0]+[1]*([2]**2*TMath::Gaus(x,[3],sqrt(2)*[4],1)+(1.-5./3*[2])**2*TMath::Gaus(x,[5],sqrt(2)*[6],1)+(4.*[2]/6.)**2*TMath::Gaus(x,[7],sqrt(2)*[8],1)+[2]*(1.-(5./3)*[2])*TMath::Gaus(x,[9],sqrt([4]**2+[6]**2),1)+(1.-(5./3)*[2])*[2]*TMath::Gaus(x,[10],sqrt([4]**2+[6]**2),1)+[2]*4./6.*[2]*TMath::Gaus(x,[11],sqrt([4]**2+[8]**2),1)+[2]*4/6.*[2]*TMath::Gaus(x,[12],sqrt([4]**2+[8]**2),1)+4./6*[2]*(1.-5./3*[2])*TMath::Gaus(x,[13],sqrt([6]**2+[8]**2),1)+(1.-5./3*[2])*4./6*[2]*TMath::Gaus(x,[14],sqrt([8]**2+[6]**2),1))"); |
- | |
719 |
|
199 | int chmap[] = {0,1,2,31}; |
720 | f_crystal1->SetParName(0, "dark"); |
- | |
721 | f_crystal1->SetParName(1, "const"); |
- | |
722 | f_crystal1->SetParName(2, "Prob_Window"); |
- | |
723 | f_crystal1->SetParName(3, "WW_mean"); |
- | |
724 | f_crystal1->SetParName(4, "Window_sigma"); |
- | |
725 | f_crystal1->SetParName(5, "CC_mean"); |
- | |
726 | f_crystal1->SetParName(6, "Crystal_sigma"); |
- | |
727 | f_crystal1->SetParName(7, "MM_mean"); |
- | |
728 | f_crystal1->SetParName(8, "MCP_sigma"); |
- | |
729 | f_crystal1->SetParName(9, "CW1_mean"); |
- | |
730 | f_crystal1->SetParName(10, "CW2_mean"); |
- | |
731 | f_crystal1->SetParName(11, "WM1_mean"); |
- | |
732 | f_crystal1->SetParName(12, "WM2_mean"); |
- | |
733 | f_crystal1->SetParName(13, "CM1_mean"); |
- | |
734 | f_crystal1->SetParName(14, "CM2_mean"); |
- | |
735 | f_crystal1->SetParName(15, "ratio_mcp/window"); |
- | |
736 | f_crystal1->SetParName(16, "Sup._CW"); |
- | |
737 | - | ||
738 | double ratio_r=0; |
- | |
739 | 200 | ||
- | 201 | for(int ich = 0;ich<4;ich++) { |
|
740 | (c[cc]->cd(+ |
202 | (c[cc]->cd(ich+1))->SetLogy(1); |
741 | sprintf(hname, " |
203 | sprintf(hname, "hadc%d", chmap[ich]); |
742 | hp1d = DrTH1F(dir, hname, ""); |
204 | hp1d = DrTH1F(dir, hname, ""); |
743 |
|
205 | sprintf(htitle, "ADC%d;ADC;Count", chmap[ich]); hp1d->SetTitle(htitle); |
744 | hp1d->SetLineColor(kBlack); |
- | |
745 | hp1d |
206 | //~ hp1d->GetXaxis()->SetRangeUser(0,2000); |
746 | hp1d |
207 | //~ hp1d->GetYaxis()->SetRangeUser(0.9,hp1d->GetMaximum()*1.1); |
747 | sprintf(fullname, ";Coincidence Time [ns];Counts"); |
- | |
748 | hp1d->SetTitle(fullname); |
- | |
749 | - | ||
750 | if( strcmp(fitopt, "cgg")==0 ) { |
- | |
751 | f_fit = fcgg; |
- | |
752 | f_fit->SetParameters(hp1d->GetMaximum()*0.1, |
- | |
753 | hp1d->GetMaximum()*0.4, 0, 0.8, |
- | |
754 | hp1d->GetMaximum()*0.5, 0, 0.05); |
- | |
755 | f_fit->SetParLimits(0, 0, hp1d->GetMaximum()); |
- | |
756 | f_fit->SetParLimits(1, 0, hp1d->GetMaximum()); |
- | |
757 | f_fit->SetParLimits(2, fitmin,fitmax); |
- | |
758 | f_fit->SetParLimits(3, 0.05, 1); |
- | |
759 | f_fit->SetParLimits(4, 0, hp1d->GetMaximum()); |
- | |
760 | f_fit->SetParLimits(5, fitmin,fitmax); |
- | |
761 | f_fit->SetParLimits(6, 0.01, 1); |
- | |
762 | } else if(strcmp(fitopt, "cggg")==0) { |
- | |
763 | f_fit = fcggg; |
- | |
764 | f_fit->SetParameters(hp1d->GetMaximum()*0.1, |
- | |
765 | hp1d->GetMaximum()*0.4, 0, 0.4, |
- | |
766 | hp1d->GetMaximum()*0.4, 0, 0.2, |
- | |
767 | hp1d->GetMaximum()*0.1, 0, 0.05); |
- | |
768 | f_fit->SetParLimits(0, 0, hp1d->GetMaximum()); |
- | |
769 | f_fit->SetParLimits(1, 0, hp1d->GetMaximum()); |
- | |
770 | f_fit->SetParLimits(2, fitmin,fitmax); |
- | |
771 | f_fit->SetParLimits(3, 0.01, 1); |
- | |
772 | f_fit->SetParLimits(4, 0, hp1d->GetMaximum()); |
- | |
773 | f_fit->SetParLimits(5, fitmin,fitmax); |
- | |
774 | f_fit->SetParLimits(6, 0.05, 1); |
- | |
775 | f_fit->SetParLimits(7, 0, hp1d->GetMaximum()); |
- | |
776 | f_fit->SetParLimits(8, fitmin,fitmax); |
- | |
777 | f_fit->SetParLimits(9, 0.2, 1); |
- | |
778 | } else if(strcmp(fitopt, "nocrystal")==0) |
- | |
779 | { f_fit = f_nocrystal; |
- | |
780 | - | ||
781 | //~ f_fit->SetParameters(4000,0.87,0.03,0.03,0.28,0.1,200,200,0.01); |
- | |
782 | f_fit->SetParameters(200,0.8,0.0,0.03,0.0,0.1,-0.13,0.13,10.16); |
- | |
783 | f_fit->SetParLimits(0,0,10000); |
- | |
784 | f_fit->SetParLimits(1,0,1); |
- | |
785 | f_fit->SetParLimits(2,-0.02,0.02); |
- | |
786 | f_fit->SetParLimits(3,0.01,0.3); |
- | |
787 | f_fit->SetParLimits(4,-0.02,0.02); |
- | |
788 | f_fit->SetParLimits(5,0,0.8); |
- | |
789 | f_fit->SetParLimits(6,-0.5,0.0); |
- | |
790 | f_fit->SetParLimits(7,0.0,0.5); |
- | |
791 | f_fit->SetParLimits(8,0.00,9000.5); |
- | |
792 | //~ f_fit->FixParameter(6, 100); |
- | |
793 | //~ f_fit->FixParameter(7, 100); |
- | |
794 | //~ |
- | |
795 | - | ||
796 | } else if(strcmp(fitopt, "crystal")==0) |
- | |
797 | { |
- | |
798 | f_fit = f_crystal; |
- | |
799 | //~ f_fit->SetParameters(0.1,300,0.8,0,0.07,0.01,0,0.028,0,0.15,0,0,-0.2,0.2,-0.2,0.2); |
- | |
800 | f_fit->SetParameter(0, 0.1); |
- | |
801 | f_fit->SetParameter(1, 300); |
- | |
802 | f_fit->SetParameter(2, 0.8); |
- | |
803 | f_fit->SetParameter(3, 0.); |
- | |
804 | f_fit->SetParameter(4, 0.07); |
- | |
805 | f_fit->SetParameter(5, 0.01); |
- | |
806 | f_fit->SetParameter(6, 0.0); |
- | |
807 | f_fit->SetParameter(7, 0.028); |
- | |
808 | f_fit->SetParameter(8, 0.0); |
- | |
809 | f_fit->SetParameter(9, 0.15); |
- | |
810 | f_fit->SetParameter(10, 0.0); |
- | |
811 | f_fit->SetParameter(11, 0.0); |
- | |
812 | f_fit->SetParameter(12, -0.2); |
- | |
813 | f_fit->SetParameter(13, 0.2); |
- | |
814 | f_fit->SetParameter(14, -0.2); |
- | |
815 | f_fit->SetParameter(15, 0.2); |
- | |
816 | f_fit->SetParameter(15, 0.2); |
- | |
817 | - | ||
818 | f_fit->SetParLimits(0, 0, 10); |
- | |
819 | f_fit->SetParLimits(1, 0, 1000); |
- | |
820 | f_fit->SetParLimits(2, 0, 1); |
- | |
821 | f_fit->SetParLimits(3, -0.02, 0.02); f_fit->SetParLimits(4, 0, 0.3); |
- | |
822 | f_fit->SetParLimits(5, 0, 1); f_fit->SetParLimits(6, -0.02, 0.02); |
- | |
823 | f_fit->SetParLimits(7, 0, 0.035); |
- | |
824 | f_fit->SetParLimits(8, -0.02, 0.02); |
- | |
825 | f_fit->SetParLimits(9, 0, 0.2); |
- | |
826 | f_fit->SetParLimits(10, -0.02, 0.02); |
- | |
827 | f_fit->SetParLimits(11, -0.02, 0.02); |
- | |
828 | f_fit->SetParLimits(12, -0.04, 0); |
- | |
829 | f_fit->SetParLimits(13, 0, 0.04); |
- | |
830 | f_fit->SetParLimits(14, -0.04, 0); |
- | |
831 | f_fit->SetParLimits(15, 0, 0.04); |
- | |
832 | - | ||
833 | } else if(strcmp(fitopt, "crystal1")==0) |
- | |
834 | { |
- | |
835 | f_fit = f_crystal1; |
- | |
836 | //~ f_fit->SetParameters(0.1,300,0.8,0,0.07,0.01,0,0.028,0,0.15,0,0,-0.2,0.2,-0.2,0.2); |
- | |
837 | f_fit->SetParameter(0, 100.1); |
- | |
838 | f_fit->SetParameter(1, 1); |
- | |
839 | f_fit->SetParameter(2, 0.2); //prob. window |
- | |
840 | f_fit->SetParameter(3, 0.0); |
- | |
841 | f_fit->SetParameter(4, 0.02); // window sigma |
- | |
842 | f_fit->SetParameter(5, 0.0); |
- | |
843 | f_fit->SetParameter(6, 120/3.3/1000); //crystal sigma |
- | |
844 | f_fit->SetParameter(7, 0.0); |
- | |
845 | f_fit->SetParameter(8, 0.15); // mcp sigma |
- | |
846 | f_fit->SetParameter(9, -0.1825); //cw |
- | |
847 | f_fit->SetParameter(10, 0.1825); |
- | |
848 | f_fit->SetParameter(11, -0.2); //wm |
- | |
849 | f_fit->SetParameter(12, 0.2); |
- | |
850 | f_fit->SetParameter(13, -0.3); //cm |
- | |
851 | f_fit->SetParameter(14, 0.3); |
- | |
852 | f_fit->SetParameter(15, 1/0.6795 -1.); |
- | |
853 | f_fit->SetParameter(16, 0.1); |
- | |
854 | f_fit->SetParameter(1, hp1d->GetMaximum()/(f_fit->Eval(0)-f_fit->GetParameter(0))); |
- | |
855 | - | ||
856 | - | ||
857 | f_fit->SetParLimits(0, 0, 400); |
- | |
858 | f_fit->SetParLimits(1, 0, 100000); |
- | |
859 | f_fit->SetParLimits(2, 0, 1.); |
- | |
860 | f_fit->SetParLimits(3, -0.025, 0.025); |
- | |
861 | f_fit->SetParLimits(4, 0.02, 0.08); |
- | |
862 | f_fit->SetParLimits(5, -0.025, 0.025); |
- | |
863 | f_fit->SetParLimits(6, 0.01, 0.2); |
- | |
864 | f_fit->SetParLimits(7, -0.025, 0.025); |
- | |
865 | f_fit->SetParLimits(8, 0, 0.5); |
- | |
866 | f_fit->SetParLimits(9, -0.6, 0.02); |
- | |
867 | f_fit->SetParLimits(10, -0.02, 0.6); |
- | |
868 | f_fit->SetParLimits(11, -0.3, -0.1); |
- | |
869 | f_fit->SetParLimits(12, 0.1, 0.3); |
- | |
870 | f_fit->SetParLimits(13, -0.7, -0.1); |
- | |
871 | f_fit->SetParLimits(14, 0.1, 0.7); |
- | |
872 | f_fit->SetParLimits(15, 0, 0.999); |
- | |
873 | f_fit->SetParLimits(16, 0, 1); |
- | |
874 | f_fit->FixParameter(4,0.02668); |
- | |
875 | //~ f_fit->FixParameter(6,0.048); |
- | |
876 | f_fit->FixParameter(8,0.0877); |
- | |
877 | f_fit->FixParameter(11,-0.19); |
- | |
878 | f_fit->FixParameter(12,0.19); |
- | |
879 | //~ |
- | |
880 | ratio_r = 1/0.6795 -1.; |
- | |
881 | //~ ratio_r = 1/0.8089 -1.; |
- | |
882 | f_fit->FixParameter(15,ratio_r); |
- | |
883 | //~ f_fit->FixParameter(16,1); |
- | |
884 | //~ f_fit->FixParameter(2,0.52); |
- | |
885 | //~ f_fit->FixParameter(6,170/3.3/1000); |
- | |
886 | //~ f_fit->FixParameter(3,0); |
- | |
887 | //~ f_fit->FixParameter(5,0); |
- | |
888 | //~ f_fit->FixParameter(7,0); |
- | |
889 | - | ||
890 | //~ cout<<"hogeeeeeeeeeeee "<<f_fit->GetParameter(1)*((1.-5./3.*(f_fit->GetParameter(2)))*(4./6.*(f_fit->GetParameter(2))))<<endl; |
- | |
891 | } |
- | |
892 | //~ f_fit->SetRange(fitmin,fitmax); |
- | |
893 | f_fit->SetRange(-10,10); |
- | |
894 | f_fit->SetLineWidth(1); f_fit->SetLineStyle(2); |
- | |
895 | f_fit->SetNpx(300); |
- | |
896 | //~ hp1d->Fit(f_fit, "QWW", "", fitmin,fitmax); |
- | |
897 | //~ hp1d->Fit(f_fit, "ILM+", "", -0.4,0.4); |
- | |
898 | //~ |
- | |
899 | hp1d->Fit(f_fit, "LM+", "", -.5,.5); |
- | |
900 | //~ hp1d->Draw(); |
- | |
901 | //~ f_fit->Draw("same"); //f_fit->SetLineColor(6); |
- | |
902 | - | ||
903 | f_fit->SetLineColor(1); |
- | |
904 | hp1d->GetXaxis()->SetRangeUser(-1.5,2); |
- | |
905 | - | ||
906 | gStyle->SetOptFit(1111); |
- | |
907 | double wmsigma = sqrt(f_fit->GetParameter(3)**2 + f_fit->GetParameter(5)**2); |
- | |
908 | - | ||
909 | double cm1sigma = sqrt(f_fit->GetParameter(6)**2 + f_fit->GetParameter(8)**2); |
- | |
910 | double wm1sigma = sqrt(f_fit->GetParameter(4)**2 + f_fit->GetParameter(8)**2); |
- | |
911 | double cw1sigma = sqrt(f_fit->GetParameter(6)**2 + f_fit->GetParameter(4)**2); |
- | |
912 | - | ||
913 | - | ||
914 | //kobayashi |
- | |
915 | TPaveStats* st1 = (TPaveStats*) hp1d->FindObject("stats"); |
- | |
916 | st1->SetX1NDC(0.63); st1->SetX2NDC(0.99); |
- | |
917 | st1->SetY1NDC(0.24); st1->SetY2NDC(0.99); |
- | |
918 | - | ||
919 | double pw = f_fit->GetParameter(2); |
- | |
920 | double pm = f_fit->GetParameter(15)*f_fit->GetParameter(2); |
- | |
921 | double pc = 1-pw - pm; |
- | |
922 | - | ||
923 | double rate = pw**2 + pm**2 + 2*pw*pm; |
- | |
924 | double sumrate = pw**2+pm**2+pc**2+2*pw*pm+2*pm*pc+2*pc*pw*f_fit->GetParameter(16)**2; |
- | |
925 | - | ||
926 | cout<<"pw = "<<pw<<" pm = "<<pm<<" pc = "<<pc<<endl; |
- | |
927 | cout<<"rate = "<<rate<<" sumrate = "<<sumrate<<" rate/sumrate = "<<rate/sumrate<<endl; |
- | |
928 | cout<<" FWHM_sim = "<<f_fit->GetParameter(6)*sqrt(2)*2.35<<endl; |
- | |
929 | - | ||
930 | if(strcmp(fitopt, "nocrystal")==0) |
- | |
931 | { |
- | |
932 | //~ TF1 *fg_WW = new TF1("fg_WW","[0]*exp(-(x-[1])**2/2/([3]**2))/sqrt(2*3.141592*[2]*[2])"); |
- | |
933 | //~ TF1 *fg_MM = new TF1("fg_MM","[0]*exp(-(x-[1])**2/2/([3]**2))/sqrt(2*3.141592*[2]*[2])"); |
- | |
934 | //~ TF1 *fg_WM1 = new TF1("fg_WM1","[0]*exp(-(x-[1])**2/2/([3]**2))/sqrt(2*3.141592*[2]*[2])"); |
- | |
935 | //~ TF1 *fg_WM2 = new TF1("fg_WM2","[0]*exp(-(x-[1])**2/2/([3]**2))/sqrt(2*3.141592*[2]*[2])"); |
- | |
936 | TF1 *fg_WW = new TF1("fg_WW","[0]*TMath::Gaus(x,[1],[2],1)");fg_WW->SetNpx(300); |
- | |
937 | TF1 *fg_MM = new TF1("fg_MM","[0]*TMath::Gaus(x,[1],[2],1)");fg_MM->SetNpx(300); |
- | |
938 | TF1 *fg_WM1 = new TF1("fg_WM1","[0]*TMath::Gaus(x,[1],[2],1)"); fg_WM1->SetNpx(300); |
- | |
939 | TF1 *fg_WM2 = new TF1("fg_WM2","[0]*TMath::Gaus(x,[1],[2],1)"); fg_WM2->SetNpx(300); |
- | |
940 | fg_WW -> SetParameters(f_fit->GetParameter(1)**2*f_fit->GetParameter(0),f_fit->GetParameter(2),sqrt(2)*f_fit->GetParameter(3)); |
- | |
941 | fg_MM -> SetParameters((1-f_fit->GetParameter(1))**2*f_fit->GetParameter(0),f_fit->GetParameter(4),sqrt(2)*f_fit->GetParameter(5)); |
- | |
942 | fg_WM1 -> SetParameters(f_fit->GetParameter(0)*(1-f_fit->GetParameter(1))*f_fit->GetParameter(1),f_fit->GetParameter(6),wmsigma); |
- | |
943 | fg_WM2 -> SetParameters(f_fit->GetParameter(0)*(1-f_fit->GetParameter(1))*f_fit->GetParameter(1),f_fit->GetParameter(7),wmsigma); |
- | |
944 | - | ||
945 | fg_WW->Draw("sames"); fg_WW->SetLineColor(kYellow+1); fg_WW->SetRange(-10,10); |
- | |
946 | fg_MM->Draw("sames"); fg_MM->SetLineColor(kMagenta-7); fg_MM->SetRange(-10,10); |
- | |
947 | fg_WM1->Draw("sames"); fg_WM1->SetLineColor(kRed-4); fg_WM1->SetRange(-10,10); |
- | |
948 | fg_WM2->Draw("sames"); fg_WM2->SetLineColor(kRed-4); fg_WM2->SetRange(-10,10); |
- | |
949 | - | ||
950 | double integ_WW, integ_MM, integ_WM1, integ_WM2; |
- | |
951 | integ_WW = fg_WW->Integral(-4,4); |
- | |
952 | } |
- | |
953 | if(strcmp(fitopt, "crystal1")==0) |
- | |
954 | { |
- | |
955 | TF1 *fg_CC = new TF1("fg_CC","[0]*TMath::Gaus(x,[1],[2],1)"); fg_CC->SetNpx(300); |
- | |
956 | TF1 *fg_WW = new TF1("fg_WW","[0]*TMath::Gaus(x,[1],[2],1)"); fg_WW->SetNpx(300); |
- | |
957 | TF1 *fg_MM = new TF1("fg_MM","[0]*TMath::Gaus(x,[1],[2],1)"); fg_MM->SetNpx(300); |
- | |
958 | TF1 *fg_WM1 = new TF1("fg_WM1","[0]*TMath::Gaus(x,[1],[2],1)"); fg_WM1->SetNpx(300); |
- | |
959 | TF1 *fg_WM2 = new TF1("fg_WM2","[0]*TMath::Gaus(x,[1],[2],1)"); fg_WM2->SetNpx(300); |
- | |
960 | TF1 *fg_CW1 = new TF1("fg_CW1","[0]*TMath::Gaus(x,[1],[2],1)"); fg_CW1->SetNpx(300); |
- | |
961 | TF1 *fg_CW2 = new TF1("fg_CW2","[0]*TMath::Gaus(x,[1],[2],1)"); fg_CW2->SetNpx(300); |
- | |
962 | TF1 *fg_CM1 = new TF1("fg_CM1","[0]*TMath::Gaus(x,[1],[2],1)"); fg_CM1->SetNpx(300); |
- | |
963 | TF1 *fg_CM2 = new TF1("fg_CM2","[0]*TMath::Gaus(x,[1],[2],1)"); fg_CM2->SetNpx(300); |
- | |
964 | - | ||
965 | - | ||
966 | // normalize |
- | |
967 | fg_CC -> SetParameters((1.-(1+f_fit->GetParameter(15))*f_fit->GetParameter(2))**2*f_fit->GetParameter(1),f_fit->GetParameter(5),sqrt(2)*f_fit->GetParameter(6)); |
- | |
968 | fg_WW -> SetParameters(f_fit->GetParameter(2)**2*f_fit->GetParameter(1),f_fit->GetParameter(3),sqrt(2)*f_fit->GetParameter(4)); |
- | |
969 | fg_MM -> SetParameters((f_fit->GetParameter(15)*f_fit->GetParameter(2))**2*f_fit->GetParameter(1),f_fit->GetParameter(7),sqrt(2)*f_fit->GetParameter(8)); |
- | |
970 | fg_WM1 -> SetParameters(f_fit->GetParameter(1)*(f_fit->GetParameter(15)*f_fit->GetParameter(2))*f_fit->GetParameter(2),f_fit->GetParameter(11),wm1sigma); |
- | |
971 | fg_WM2 -> SetParameters(f_fit->GetParameter(1)*(f_fit->GetParameter(15)*f_fit->GetParameter(2))*f_fit->GetParameter(2),f_fit->GetParameter(12),wm1sigma); |
- | |
972 | fg_CW1 -> SetParameters(f_fit->GetParameter(1)*f_fit->GetParameter(16)*(1.-(1+f_fit->GetParameter(15))*f_fit->GetParameter(2))*f_fit->GetParameter(2),f_fit->GetParameter(9),cw1sigma); |
- | |
973 | fg_CW2 -> SetParameters(f_fit->GetParameter(1)*f_fit->GetParameter(16)*(1.-(1+f_fit->GetParameter(15))*f_fit->GetParameter(2))*f_fit->GetParameter(2),f_fit->GetParameter(10),cw1sigma); |
- | |
974 | fg_CM1 -> SetParameters(f_fit->GetParameter(1)*(ratio_r*f_fit->GetParameter(2))*(1.-(1+f_fit->GetParameter(15))*f_fit->GetParameter(2)),f_fit->GetParameter(13),cm1sigma); |
- | |
975 | fg_CM2 -> SetParameters(f_fit->GetParameter(1)*(ratio_r*f_fit->GetParameter(2))*(1.-(1+f_fit->GetParameter(15))*f_fit->GetParameter(2)),f_fit->GetParameter(14),cm1sigma); |
- | |
976 | - | ||
977 | //non normalize |
- | |
978 | //~ fg_CC -> SetParameters((1.-5./3.*f_fit->GetParameter(2))**2*f_fit->GetParameter(1),f_fit->GetParameter(5),sqrt(2)*f_fit->GetParameter(6)); |
- | |
979 | //~ fg_WW -> SetParameters(f_fit->GetParameter(2)**2*f_fit->GetParameter(1),f_fit->GetParameter(3),sqrt(2)*f_fit->GetParameter(4)); |
- | |
980 | //~ fg_MM -> SetParameters((4./6.*f_fit->GetParameter(2))**2*f_fit->GetParameter(1),f_fit->GetParameter(7),sqrt(2)*f_fit->GetParameter(8)); |
- | |
981 | //~ fg_WM1 -> SetParameters(f_fit->GetParameter(1)*(4./6.*f_fit->GetParameter(2))*f_fit->GetParameter(2),f_fit->GetParameter(11),wm1sigma); |
- | |
982 | //~ fg_WM2 -> SetParameters(f_fit->GetParameter(1)*(4./6.*f_fit->GetParameter(2))*f_fit->GetParameter(2),f_fit->GetParameter(12),wm1sigma); |
- | |
983 | //~ fg_CW1 -> SetParameters(f_fit->GetParameter(1)*(1.-5./3*f_fit->GetParameter(2))*f_fit->GetParameter(2),f_fit->GetParameter(9),cw1sigma); |
- | |
984 | //~ fg_CW2 -> SetParameters(f_fit->GetParameter(1)*(1.-5./3*f_fit->GetParameter(2))*f_fit->GetParameter(2),f_fit->GetParameter(10),cw1sigma); |
- | |
985 | //~ fg_CM1 -> SetParameters(f_fit->GetParameter(1)*(4./6.*f_fit->GetParameter(2))*(1.-5./3*f_fit->GetParameter(2)),f_fit->GetParameter(13),cm1sigma); |
- | |
986 | //~ fg_CM2 -> SetParameters(f_fit->GetParameter(1)*(4./6.*f_fit->GetParameter(2))*(1.-5./3*f_fit->GetParameter(2)),f_fit->GetParameter(14),cm1sigma); |
- | |
987 | - | ||
988 | - | ||
989 | fg_CC->Draw("sames"); fg_CC->SetLineColor(kCyan-5); fg_CC->SetRange(-10,10); |
- | |
990 | fg_WW->Draw("sames"); fg_WW->SetLineColor(kYellow+1); fg_WW->SetRange(-10,10); |
- | |
991 | fg_MM->Draw("sames"); fg_MM->SetLineColor(kMagenta-7); fg_MM->SetRange(-10,10); |
- | |
992 | fg_CW1->Draw("sames"); fg_CW1->SetLineColor(kGreen+2); fg_CW1->SetRange(-10,10); |
- | |
993 | fg_CW2->Draw("sames"); fg_CW2->SetLineColor(kGreen+2); fg_CW2->SetRange(-10,10); |
- | |
994 | fg_WM1->Draw("sames"); fg_WM1->SetLineColor(kRed-4); fg_WM1->SetRange(-10,10); |
- | |
995 | fg_WM2->Draw("sames"); fg_WM2->SetLineColor(kRed-4); fg_WM2->SetRange(-10,10); |
- | |
996 | fg_CM1->Draw("sames"); fg_CM1->SetLineColor(kBlue+2); fg_CM1->SetRange(-10,10); |
- | |
997 | fg_CM2->Draw("sames"); fg_CM2->SetLineColor(kBlue+2); fg_CM2->SetRange(-10,10); |
- | |
998 | } |
- | |
999 | - | ||
1000 | HalfMax = f_fit->GetMaximum(fitmin, fitmax)/2.0; |
- | |
1001 | MinHalfMax = f_fit->GetX(HalfMax, fitmin, fitcenter); |
- | |
1002 | MaxHalfMax = f_fit->GetX(HalfMax, fitcenter, fitmax); |
- | |
1003 | FWHM = MaxHalfMax - MinHalfMax; |
- | |
1004 | - | ||
1005 | HalfMax = (f_fit->GetMaximum(fitmin, fitmax) + f_fit->GetParameter(0))/2.0; |
- | |
1006 | MinHalfMax = f_fit->GetX(HalfMax, fitmin, f_fit->GetMaximumX(fitmin, fitmax)); |
- | |
1007 | MaxHalfMax = f_fit->GetX(HalfMax, f_fit->GetMaximumX(fitmin, fitmax), fitmax); |
- | |
1008 | FWHMc = MaxHalfMax - MinHalfMax; |
- | |
1009 | - | ||
1010 | printf("(f) HalfMax = %.3lf ns | MinHalfMax = %.3lf ns | MaxHalfMax = %.3lf ns\n", HalfMax, MinHalfMax, MaxHalfMax); |
- | |
1011 | printf("(f) FWHM (peak only) = %.3lf ns\n", FWHMc); |
- | |
1012 | - | ||
1013 | f_integrate = fgg; |
- | |
1014 | for(int i=0; i<6; i++) f_integrate->SetParameter(i, f_fit->GetParameter(i+1)); |
- | |
1015 | //~ for(int i=0; i<9; i++) f_integrate->SetParameter(i, f_fit->GetParameter(i+1)); |
- | |
1016 | //~ fgg->SetRange(drawmin, drawmax); fgg->SetNpx(300); fgg->SetLineColor(kBlue); fgg->SetLineWidth(1); fgg->DrawClone("LSAME"); |
- | |
1017 | double Icherenkovs = f_integrate->Integral(drawmin, drawmax)/hp1d->GetBinWidth(1); |
- | |
1018 | - | ||
1019 | double Iall = f_fit->Integral(fitmin, fitmax)/hp1d->GetBinWidth(1); |
- | |
1020 | double Rsn = Icherenkovs/(Iall-Icherenkovs); |
- | |
1021 | - | ||
1022 | //~ double Ientr = hp1d->GetEntries()*hp1d->GetBinWidth(1); |
- | |
1023 | double Ientr = hp1d->GetEntries(); |
- | |
1024 | double Rsne = Icherenkovs/(Ientr-Icherenkovs); |
- | |
1025 | - | ||
1026 | //~ double Ihist = hp1d->Integral(1, hp1d->GetNbinsX()-1)*hp1d->GetBinWidth(1); |
- | |
1027 | double Ihist = hp1d->Integral(1, hp1d->GetNbinsX()-1); |
- | |
1028 | double Rsnh = Icherenkovs/(Ihist-Icherenkovs); |
- | |
1029 | - | ||
1030 | double Icherenkovs_10ns = f_integrate->Integral(-10, 10)/hp1d->GetBinWidth(1); |
- | |
1031 | fc->SetParameter(0, f_fit->GetParameter(0)); |
- | |
1032 | double Inoise_10ns = fc->Integral(-10, 10)/hp1d->GetBinWidth(1); |
- | |
1033 | double R10ns = Icherenkovs_10ns/Inoise_10ns; |
- | |
1034 | - | ||
1035 | double Icherenkovs_4ns = f_integrate->Integral(-4, 4)/hp1d->GetBinWidth(1); |
- | |
1036 | fc->SetParameter(0, f_fit->GetParameter(0)); |
- | |
1037 | double Inoise_4ns = fc->Integral(-4, 4)/hp1d->GetBinWidth(1); |
- | |
1038 | double R4ns = Icherenkovs_4ns/Inoise_4ns; |
- | |
1039 | - | ||
1040 | double Icherenkovs_2ns = f_integrate->Integral(-2, 2)/hp1d->GetBinWidth(1); |
- | |
1041 | fc->SetParameter(0, f_fit->GetParameter(0)); |
- | |
1042 | double Inoise_2ns = fc->Integral(-2, 2)/hp1d->GetBinWidth(1); |
- | |
1043 | double R2ns = Icherenkovs_2ns/Inoise_2ns; |
- | |
1044 | - | ||
1045 | //~ printf("ICherenkov = %lf | IAll = %lf | Ientr = %lf | Ihist = %lf\n", Icherenkovs, Iall, Ientr, Ihist); |
- | |
1046 | printf("Icherenkovs_4ns = %.0lf\n", Icherenkovs_4ns); |
- | |
1047 | //~ printf("TF1 -> S/N = %lf || TH1F(e) -> S/N = %lf || TH1F(i) -> S/N = %lf\n", Rsn, Rsne, Rsnh); |
- | |
1048 | //~ printf("S/N (All) = %lf\n", Rsnh); |
- | |
1049 | printf("S/N (10ns) = %.2lf\n", R10ns); |
- | |
1050 | printf("S/N (4 ns) = %.2lf\n", R4ns); |
- | |
1051 | printf("S/N (2 ns) = %.2lf\n", R2ns); |
- | |
1052 | - | ||
1053 | leg[++legi] = new TLegend(0.12,0.4,0.43,0.925); |
- | |
1054 | leg[legi]->SetFillColor(0); leg[legi]->SetBorderSize(1); leg[legi]->SetTextSize(0.05); leg[legi]->SetTextAlign(12); |
- | |
1055 | - | ||
1056 | sprintf(fullname, "FWHM_fit = %.0lf ps", 1000*FWHMc); |
- | |
1057 | //~ leg[legi]->AddEntry((TF1*)f_fit->Clone(), fullname, "L"); |
- | |
1058 | leg[legi]->AddEntry((TF1*)f_fit->Clone(), fullname, ""); |
- | |
1059 | - | ||
1060 | sprintf(fullname, "FWHM_c = %.0lf ps", 1000*f_fit->GetParameter(6)*2.35*sqrt(2)); |
- | |
1061 | leg[legi]->AddEntry((TF1*)f_fit->Clone(), fullname, ""); |
- | |
1062 | - | ||
1063 | //~ sprintf(fullname, "S/N (#pm10ns) = %.1lf", R10ns); |
- | |
1064 | //~ leg[legi]->AddEntry((TF1*)f_fit->Clone(), fullname, ""); |
- | |
1065 | //~ sprintf(fullname, "S/N (#pm 4ns) = %.1lf", R4ns); |
- | |
1066 | //~ leg[legi]->AddEntry((TF1*)f_fit->Clone(), fullname, ""); |
- | |
1067 | //~ sprintf(fullname, "S/N (#pm 2ns) = %.1lf", R2ns); |
- | |
1068 | //~ leg[legi]->AddEntry((TF1*)f_fit->Clone(), fullname, ""); |
- | |
1069 | - | ||
1070 | //kobayashi |
- | |
1071 | sprintf(fullname, "R_w = %.2f" , pw); |
- | |
1072 | leg[legi]->AddEntry((TF1*)f_fit->Clone(), fullname, ""); |
- | |
1073 | sprintf(fullname, "R_m = %.2f" , pm); |
- | |
1074 | leg[legi]->AddEntry((TF1*)f_fit->Clone(), fullname, ""); |
- | |
1075 | sprintf(fullname, "R_c = %.2f" , pc); |
- | |
1076 | leg[legi]->AddEntry((TF1*)f_fit->Clone(), fullname, ""); |
- | |
1077 | sprintf(fullname, "R_w&m = %.2f" , rate); |
- | |
1078 | leg[legi]->AddEntry((TF1*)f_fit->Clone(), fullname, ""); |
- | |
1079 | sprintf(fullname, "R_sum = %.2f" , sumrate); |
- | |
1080 | leg[legi]->AddEntry((TF1*)f_fit->Clone(), fullname, ""); |
- | |
1081 | sprintf(fullname, "R_w&m/sum = %.2f" , rate/sumrate); |
- | |
1082 | leg[legi]->AddEntry((TF1*)f_fit->Clone(), fullname, ""); |
- | |
1083 | - | ||
1084 | - | ||
1085 | leg[legi]->Draw(); |
- | |
1086 | - | ||
1087 | if(draw_cuts) { |
- | |
1088 | sprintf(hname, "htdcdiff_cut"); |
- | |
1089 | hp1dcut = DrTH1F(dir, hname, ""); |
- | |
1090 | hp1dcut->Rebin(rebin_tdcs); |
- | |
1091 | hp1dcut->SetLineColor(kRed); |
- | |
1092 | hp1dcut->DrawClone("SAME"); |
- | |
1093 | - | ||
1094 | sprintf(hname, "htdcdiff_cut_2"); |
- | |
1095 | hp1dcut = DrTH1F(dir, hname, ""); |
- | |
1096 | hp1dcut->Rebin(rebin_tdcs); |
- | |
1097 | hp1dcut->SetLineColor(kGreen); |
- | |
1098 | hp1dcut->DrawClone("SAME"); |
- | |
1099 | } |
- | |
1100 | - | ||
1101 | sprintf(fullname, "gif/f_%s.gif", fname); c[cc]->SaveAs(fullname); |
- | |
1102 | sprintf(fullname, "eps/f_%s.eps", fname); c[cc]->SaveAs(fullname); |
- | |
1103 | cout<< "maximum x value = " << hp1d->GetXaxis()->GetBinCenter( hp1d->GetMaximumBin())<<endl; |
- | |
1104 | if(batch_q) gSystem->Exit(1); |
- | |
1105 | } |
- | |
1106 | - | ||
1107 | // ------------------------------------------------------------------- |
- | |
1108 | - | ||
1109 | if( strchr(plopt, 'd') != NULL ) { |
- | |
1110 | - | ||
1111 | DrSetDrawStyle(0.05); |
- | |
1112 | - | ||
1113 | gStyle->SetOptStat("e"); |
- | |
1114 | //~ gStyle->SetOptStat(0); |
- | |
1115 | gStyle->SetOptFit(1); |
- | |
1116 | //~ gStyle->SetOptFit(0); |
- | |
1117 | - | ||
1118 | gStyle->SetPadRightMargin(0.03); |
- | |
1119 | gStyle->SetPadTopMargin(0.05); |
- | |
1120 | gStyle->SetPadBottomMargin(0.12); |
- | |
1121 | gStyle->SetStatFontSize(0.05); |
- | |
1122 | gStyle->SetStatX(0.97); |
- | |
1123 | gStyle->SetStatY(0.95); |
- | |
1124 | - | ||
1125 | c[++cc] = new TCanvas("d", "d", 0, 0, 720, 400); |
- | |
1126 | //~ c[cc]->Divide(2,2); |
- | |
1127 | - | ||
1128 | int draw_cuts = 0; |
- | |
1129 | int rebin_tdcs = 1; |
- | |
1130 | - | ||
1131 | double drawmin = -10; |
- | |
1132 | double drawmax = +10; |
- | |
1133 | //~ double fitmin = inmin; |
- | |
1134 | //~ double fitmax = inmax; |
- | |
1135 | double fitmin = -10; |
- | |
1136 | double fitmax = 10; |
- | |
1137 | double fitcenter = 0.0; |
- | |
1138 | double HalfMax, MinHalfMax, MaxHalfMax, FWHM, FWHMc; |
- | |
1139 | - | ||
1140 | int ccccdi = 0; |
- | |
1141 | int ich = 0; |
- | |
1142 | - | ||
1143 | TF1 *f_fit; |
- | |
1144 | TF1 *f_integrate; |
- | |
1145 | - | ||
1146 | TF1 *fc = new TF1("fc", "pol0(0)"); |
- | |
1147 | - | ||
1148 | TF1 *fcg = new TF1("fcg", "pol0(0)+gaus(1)"); fcg->SetNpx(300); |
- | |
1149 | fcg->SetParName(0,"Const"); fcg->SetParName(1,"G_Const"); |
- | |
1150 | fcg->SetParName(2,"G_Mean" ); fcg->SetParName(3,"G_Sigma" ); |
- | |
1151 | - | ||
1152 | TF1 *fcgg = new TF1("fcgg", "pol0(0)+gaus(1)+gaus(4)"); fcgg->SetNpx(300); |
- | |
1153 | fcgg->SetParName(0,"Const"); |
- | |
1154 | fcgg->SetParName(1,"G1_Const"); fcgg->SetParName(2,"G1_Mean" ); fcgg->SetParName(3,"G1_Sigma" ); |
- | |
1155 | fcgg->SetParName(4,"G2_Const"); fcgg->SetParName(5,"G2_Mean" ); fcgg->SetParName(6,"G2_Sigma" ); |
- | |
1156 | - | ||
1157 | TF1 *fcggg = new TF1("fcggg", "pol0(0)+gaus(1)+gaus(4)+gaus(7)"); fcggg->SetNpx(300); |
- | |
1158 | fcggg->SetParName(0,"Const"); |
- | |
1159 | fcggg->SetParName(1,"G1_Const"); fcggg->SetParName(2,"G1_Mean" ); fcggg->SetParName(3,"G1_Sigma" ); |
- | |
1160 | fcggg->SetParName(4,"G2_Const"); fcggg->SetParName(5,"G2_Mean" ); fcggg->SetParName(6,"G2_Sigma" ); |
- | |
1161 | fcggg->SetParName(7,"G3_Const"); fcggg->SetParName(8,"G3_Mean" ); fcggg->SetParName(9,"G3_Sigma" ); |
- | |
1162 | - | ||
1163 | (c[cc]->cd(++ccccdi))->SetLogy(0); |
- | |
1164 | //~ sprintf(hname, "htdcdiff"); |
- | |
1165 | sprintf(hname, "htdcdiff_cut"); |
- | |
1166 | hp1d = DrTH1F(dir, hname, ""); |
- | |
1167 | //~ hp1d->Rebin(rebin_tdcs); |
- | |
1168 | hp1d->SetLineColor(kBlack); |
208 | hp1d->SetLineColor(kBlack); |
1169 | hp1d->GetXaxis()->SetRangeUser(drawmin,drawmax); |
- | |
1170 | hp1d->GetYaxis()->SetRangeUser(0.0,hp1d->GetMaximum()*1.1); |
- | |
1171 | //~ hp1d->GetYaxis()->SetRangeUser(0.0,hp1d->GetMaximum()*2); |
- | |
1172 | sprintf(fullname, ";Coincidence Time [ns];Counts"); |
- | |
1173 | hp1d->SetTitle(fullname); |
- | |
1174 | - | ||
1175 | //kobayashi |
- | |
1176 | //~ fitmin = hp1d->GetXaxis()->GetBinCenter(hp1d->GetMaximumBin()) - hp1d->GetRMS()/15; |
- | |
1177 | //~ fitmax = hp1d->GetXaxis()->GetBinCenter(hp1d->GetMaximumBin()) + hp1d->GetRMS()/15; |
- | |
1178 | - | ||
1179 | //~ if( strcmp(fname, "run000")==0 ) { |
- | |
1180 | //~ f_fit = fcg; |
- | |
1181 | //~ f_fit->SetParameters(hp1d->GetMaximum()*0.1, |
- | |
1182 | //~ hp1d->GetMaximum()*0.9, 0, 0.05); |
- | |
1183 | //~ } else if( strcmp(fname, "run061")==0 || |
- | |
1184 | //~ strcmp(fname, "run062")==0 || |
- | |
1185 | //~ strcmp(fname, "run063")==0 || |
- | |
1186 | //~ strcmp(fname, "run064")==0 || |
- | |
1187 | //~ strcmp(fname, "run065")==0) { |
- | |
1188 | //~ f_fit = fcgg; |
- | |
1189 | //~ f_fit->SetParameters(hp1d->GetMaximum()*0.1, |
- | |
1190 | //~ hp1d->GetMaximum()*0.5, 0, 0.05, |
- | |
1191 | //~ hp1d->GetMaximum()*0.4, 0, 0.5); |
- | |
1192 | //~ } else { |
- | |
1193 | //~ f_fit = fcgg; |
- | |
1194 | //~ f_fit->SetParameters(hp1d->GetMaximum()*0.25, |
- | |
1195 | //~ hp1d->GetMaximum()*0.7, 0, 0.4, |
- | |
1196 | //~ hp1d->GetMaximum()*0.05, 0, 0.05); |
- | |
1197 | //~ f_fit->SetParLimits(0, 0, hp1d->GetMaximum()); |
- | |
1198 | //~ f_fit->SetParLimits(1, 0, hp1d->GetMaximum()); |
- | |
1199 | //~ f_fit->SetParLimits(2, fitmin,fitmax); |
- | |
1200 | //~ f_fit->SetParLimits(3, 0.2, 1); |
- | |
1201 | //~ f_fit->SetParLimits(4, 0, hp1d->GetMaximum()); |
- | |
1202 | //~ f_fit->SetParLimits(5, fitmin,fitmax); |
- | |
1203 | //~ if( strcmp(fname, "run059")==0 || |
- | |
1204 | //~ strcmp(fname, "run060")==0) |
- | |
1205 | //~ f_fit->SetParLimits(6, 0.02, 0.3); |
- | |
1206 | //~ else |
- | |
1207 | //~ f_fit->SetParLimits(6, 0.02, 0.2); |
- | |
1208 | //~ |
- | |
1209 | //~ } |
- | |
1210 | - | ||
1211 | if( strcmp(fitopt, "cgg")==0 ) { |
- | |
1212 | f_fit = fcgg; |
- | |
1213 | f_fit->SetParameters(hp1d->GetMaximum()*0.1, |
- | |
1214 | hp1d->GetMaximum()*0.4, 0, 0.9, |
- | |
1215 | hp1d->GetMaximum()*0.5, 0, 0.05); |
- | |
1216 | f_fit->SetParLimits(0, 0, hp1d->GetMaximum()); |
- | |
1217 | f_fit->SetParLimits(1, hp1d->GetMaximum()*0.01, hp1d->GetMaximum()); |
- | |
1218 | f_fit->SetParLimits(2, fitmin,fitmax); |
- | |
1219 | f_fit->SetParLimits(3, 0.05, 1); |
- | |
1220 | f_fit->SetParLimits(4, hp1d->GetMaximum()*0.01, hp1d->GetMaximum()); |
- | |
1221 | f_fit->SetParLimits(5, fitmin,fitmax); |
- | |
1222 | f_fit->SetParLimits(6, 0.01, 1); |
- | |
1223 | } else if(strcmp(fitopt, "cggg")==0) { |
- | |
1224 | f_fit = fcggg; |
- | |
1225 | //original |
- | |
1226 | //~ f_fit->SetParameters(hp1d->GetMaximum()*0.01, |
- | |
1227 | //~ hp1d->GetMaximum()*0.4, 0, 0.4, |
- | |
1228 | //~ hp1d->GetMaximum()*0.4, 0, 0.2, |
- | |
1229 | //~ hp1d->GetMaximum()*0.1, 0, 0.05); |
- | |
1230 | //kobayashi |
- | |
1231 | double init_mean = hp1d->GetXaxis()->GetBinCenter(hp1d->GetMaximumBin()); |
- | |
1232 | f_fit->SetParameters(hp1d->GetMaximum()*0.0001, |
- | |
1233 | hp1d->GetMaximum()*0.01, init_mean , 0.04, |
- | |
1234 | hp1d->GetMaximum()*0.01, init_mean + 0.2, 0.03, |
- | |
1235 | hp1d->GetMaximum()*0.01, init_mean - 0.2, 0.03); |
- | |
1236 | f_fit->SetParLimits(0, 0, hp1d->GetMaximum()); |
- | |
1237 | f_fit->SetParLimits(1, 0, hp1d->GetMaximum()); |
- | |
1238 | f_fit->SetParLimits(2, fitmin,fitmax); |
- | |
1239 | f_fit->SetParLimits(3, 0.001, 1); |
- | |
1240 | f_fit->SetParLimits(4, hp1d->GetMaximum()*0.1, hp1d->GetMaximum()); |
- | |
1241 | f_fit->SetParLimits(5, fitmin,fitmax); |
- | |
1242 | f_fit->SetParLimits(6, 0.005, 3); |
- | |
1243 | f_fit->SetParLimits(7, hp1d->GetMaximum()*0.1, hp1d->GetMaximum()); |
- | |
1244 | f_fit->SetParLimits(8, fitmin,fitmax); |
- | |
1245 | f_fit->SetParLimits(9, 0.02, 5); |
- | |
1246 | } else if(strcmp(fitopt, "gg")==0) { |
- | |
1247 | f_fit = fgg; |
- | |
1248 | f_fit->SetParameters(hp1d->GetMaximum()*0.4, 0, 0.9, |
- | |
1249 | hp1d->GetMaximum()*0.5, 0, 0.05); |
- | |
1250 | f_fit->SetParLimits(0, hp1d->GetMaximum()*0.01, hp1d->GetMaximum()); |
- | |
1251 | f_fit->SetParLimits(1, fitmin,fitmax); |
- | |
1252 | f_fit->SetParLimits(2, 0.05, 1); |
- | |
1253 | f_fit->SetParLimits(3, hp1d->GetMaximum()*0.01, hp1d->GetMaximum()); |
- | |
1254 | f_fit->SetParLimits(4, fitmin,fitmax); |
- | |
1255 | f_fit->SetParLimits(5, 0.01, 1); |
- | |
1256 | } |
- | |
1257 | - | ||
1258 | f_fit->SetRange(fitmin,fitmax); |
- | |
1259 | f_fit->SetLineWidth(1); f_fit->SetLineStyle(9); |
- | |
1260 | hp1d->Fit(f_fit, "QWW", "", fitmin,fitmax); |
- | |
1261 | //~ hp1d->Fit(f_fit, "QWW", "", -0.5,+0.5); |
- | |
1262 | - | ||
1263 | //~ fg->SetRange(fitmin,fitmax); fg->SetLineWidth(1.0); |
- | |
1264 | //~ fg->SetParameters(f_fit->GetParameter(0+1), f_fit->GetParameter(1+1), f_fit->GetParameter(2+1)); fg->SetLineColor(kMagenta); fg->DrawCopy("LSAME"); |
- | |
1265 | //~ fg->SetParameters(f_fit->GetParameter(0+4), f_fit->GetParameter(1+4), f_fit->GetParameter(2+4)); fg->SetLineColor(kGreen); fg->DrawCopy("LSAME"); |
- | |
1266 | //~ fg->SetParameters(f_fit->GetParameter(0+7), f_fit->GetParameter(1+7), f_fit->GetParameter(2+7)); fg->SetLineColor(kYellow); fg->DrawCopy("LSAME"); |
- | |
1267 | - | ||
1268 | - | ||
1269 | HalfMax = f_fit->GetMaximum(fitmin, fitmax)/2.0; |
- | |
1270 | MinHalfMax = f_fit->GetX(HalfMax, fitmin, fitcenter); |
- | |
1271 | MaxHalfMax = f_fit->GetX(HalfMax, fitcenter, fitmax); |
- | |
1272 | FWHM = MaxHalfMax - MinHalfMax; |
- | |
1273 | - | ||
1274 | HalfMax = (f_fit->GetMaximum(fitmin, fitmax) + f_fit->GetParameter(0))/2.0; |
- | |
1275 | MinHalfMax = f_fit->GetX(HalfMax, fitmin, f_fit->GetMaximumX(fitmin, fitmax)); |
- | |
1276 | MaxHalfMax = f_fit->GetX(HalfMax, f_fit->GetMaximumX(fitmin, fitmax), fitmax); |
- | |
1277 | FWHMc = MaxHalfMax - MinHalfMax; |
- | |
1278 | - | ||
1279 | //~ printf("FWHM = %lf ns | FWHMc = %lf ns\n", FWHM, FWHMc); |
- | |
1280 | printf("(d) FWHM (peak only) = %.3lf ns\n", FWHMc); |
- | |
1281 | - | ||
1282 | f_integrate = fgg; |
- | |
1283 | for(int i=0; i<6; i++) f_integrate->SetParameter(i, f_fit->GetParameter(i+1)); |
- | |
1284 | //~ for(int i=0; i<9; i++) f_integrate->SetParameter(i, f_fit->GetParameter(i+1)); |
- | |
1285 | //~ fgg->SetRange(drawmin, drawmax); fgg->SetNpx(300); fgg->SetLineColor(kBlue); fgg->SetLineWidth(1); fgg->DrawClone("LSAME"); |
- | |
1286 | double Icherenkovs = f_integrate->Integral(drawmin, drawmax)/hp1d->GetBinWidth(1); |
- | |
1287 | - | ||
1288 | double Iall = f_fit->Integral(fitmin, fitmax)/hp1d->GetBinWidth(1); |
- | |
1289 | double Rsn = Icherenkovs/(Iall-Icherenkovs); |
- | |
1290 | - | ||
1291 | //~ double Ientr = hp1d->GetEntries()*hp1d->GetBinWidth(1); |
- | |
1292 | double Ientr = hp1d->GetEntries(); |
- | |
1293 | double Rsne = Icherenkovs/(Ientr-Icherenkovs); |
- | |
1294 | - | ||
1295 | //~ double Ihist = hp1d->Integral(1, hp1d->GetNbinsX()-1)*hp1d->GetBinWidth(1); |
- | |
1296 | double Ihist = hp1d->Integral(1, hp1d->GetNbinsX()-1); |
- | |
1297 | double Rsnh = Icherenkovs/(Ihist-Icherenkovs); |
- | |
1298 | - | ||
1299 | double Icherenkovs_10ns = f_integrate->Integral(-10, 10)/hp1d->GetBinWidth(1); |
- | |
1300 | fc->SetParameter(0, f_fit->GetParameter(0)); |
- | |
1301 | double Inoise_10ns = fc->Integral(-10, 10)/hp1d->GetBinWidth(1); |
- | |
1302 | double R10ns = Icherenkovs_10ns/Inoise_10ns; |
- | |
1303 | - | ||
1304 | double Icherenkovs_4ns = f_integrate->Integral(-4, 4)/hp1d->GetBinWidth(1); |
- | |
1305 | fc->SetParameter(0, f_fit->GetParameter(0)); |
- | |
1306 | double Inoise_4ns = fc->Integral(-4, 4)/hp1d->GetBinWidth(1); |
- | |
1307 | double R4ns = Icherenkovs_4ns/Inoise_4ns; |
- | |
1308 | - | ||
1309 | double Icherenkovs_2ns = f_integrate->Integral(-2, 2)/hp1d->GetBinWidth(1); |
- | |
1310 | fc->SetParameter(0, f_fit->GetParameter(0)); |
- | |
1311 | double Inoise_2ns = fc->Integral(-2, 2)/hp1d->GetBinWidth(1); |
- | |
1312 | double R2ns = Icherenkovs_2ns/Inoise_2ns; |
- | |
1313 | - | ||
1314 | //~ printf("ICherenkov = %lf | IAll = %lf | Ientr = %lf | Ihist = %lf\n", Icherenkovs, Iall, Ientr, Ihist); |
- | |
1315 | printf("Icherenkovs_4ns = %.0lf\n", Icherenkovs_4ns); |
- | |
1316 | //~ printf("TF1 -> S/N = %lf || TH1F(e) -> S/N = %lf || TH1F(i) -> S/N = %lf\n", Rsn, Rsne, Rsnh); |
- | |
1317 | //~ printf("S/N (All) = %lf\n", Rsnh); |
- | |
1318 | printf("S/N (10ns) = %.2lf\n", R10ns); |
- | |
1319 | printf("S/N (4 ns) = %.2lf\n", R4ns); |
- | |
1320 | printf("S/N (2 ns) = %.2lf\n", R2ns); |
- | |
1321 | - | ||
1322 | //~ #define USE_NOISE_FILE |
- | |
1323 | - | ||
1324 | #ifdef USE_NOISE_FILE |
- | |
1325 | //get ROOT file with histograms |
- | |
1326 | char fnameroot[1024]; |
- | |
1327 | TFile * rootfile2; |
- | |
1328 | TDirectory *dir2; |
- | |
1329 | - | ||
1330 | //~ sprintf(fname, "run054"); |
- | |
1331 | sprintf(fname, "run_309"); |
- | |
1332 | sprintf(fnameroot, "root/%s.root", fname); |
- | |
1333 | rootfile2 = (TFile *) gROOT->FindObject(fname); |
- | |
1334 | if(rootfile2==NULL) rootfile2 = new TFile(fnameroot); |
- | |
1335 | if(rootfile2==NULL) { |
- | |
1336 | printf("Cannot open root file 2 %s!!!\n",fnameroot); |
- | |
1337 | return; |
- | |
1338 | } |
- | |
1339 | dir2 = (TDirectory*) rootfile2; |
- | |
1340 | - | ||
1341 | sprintf(hname, "htdcdiff"); |
- | |
1342 | hp1dcut = DrTH1F(dir2, hname, ""); |
- | |
1343 | hp1dcut->SetLineColor(40); |
- | |
1344 | hp1dcut->SetLineStyle(2); |
- | |
1345 |
|
209 | hp1d->DrawClone(); |
1346 | - | ||
1347 | leg[++legi] = new TLegend(0.125,0.5,0.425,0.925); |
- | |
1348 | leg[legi]->SetFillColor(0); leg[legi]->SetBorderSize(1); leg[legi]->SetTextSize(0.05); leg[legi]->SetTextAlign(12); |
- | |
1349 | - | ||
1350 | leg[legi]->AddEntry((TH1F*)hp1d->Clone(), "With source", "L"); |
- | |
1351 | leg[legi]->AddEntry((TH1F*)hp1dcut->Clone(), "W/o source", "L"); |
- | |
1352 | #else |
- | |
1353 | leg[++legi] = new TLegend(0.125,0.625,0.425,0.925); |
- | |
1354 | leg[legi]->SetFillColor(0); leg[legi]->SetBorderSize(1); leg[legi]->SetTextSize(0.05); leg[legi]->SetTextAlign(12); |
- | |
1355 | #endif |
- | |
1356 | - | ||
1357 | sprintf(fullname, "FWHM = %.0lf ps", 1000*FWHMc); |
- | |
1358 | leg[legi]->AddEntry((TF1*)f_fit->Clone(), fullname, "L"); |
- | |
1359 | sprintf(fullname, "S/N (#pm10ns) = %.1lf", R10ns); |
- | |
1360 | leg[legi]->AddEntry((TF1*)f_fit->Clone(), fullname, ""); |
- | |
1361 | sprintf(fullname, "S/N (#pm 4ns) = %.1lf", R4ns); |
- | |
1362 | leg[legi]->AddEntry((TF1*)f_fit->Clone(), fullname, ""); |
- | |
1363 | sprintf(fullname, "S/N (#pm 2ns) = %.1lf", R2ns); |
- | |
1364 | leg[legi]->AddEntry((TF1*)f_fit->Clone(), fullname, ""); |
- | |
1365 | leg[legi]->Draw(); |
- | |
1366 | 210 | ||
1367 | if(draw_cuts) { |
211 | if(draw_cuts) { |
1368 | sprintf(hname, " |
212 | sprintf(hname, "hadc_cut%d", chmap[ich]); |
1369 | hp1dcut = DrTH1F(dir, hname, ""); |
213 | hp1dcut = DrTH1F(dir, hname, ""); |
1370 | hp1dcut->Rebin(rebin_tdcs); |
- | |
1371 | hp1dcut->SetLineColor(kRed); |
214 | hp1dcut->SetLineColor(kRed); |
1372 | hp1dcut->DrawClone("SAME"); |
- | |
1373 | - | ||
1374 | sprintf(hname, "htdcdiff_cut_2"); |
- | |
1375 | hp1dcut = DrTH1F(dir, hname, ""); |
- | |
1376 | hp1dcut->Rebin(rebin_tdcs); |
- | |
1377 | hp1dcut->SetLineColor(kGreen); |
- | |
1378 | hp1dcut->DrawClone("SAME"); |
215 | hp1dcut->DrawClone("SAME"); |
1379 | } |
216 | } |
1380 | 217 | } |
|
1381 |
|
218 | |
1382 | sprintf(fullname, " |
219 | sprintf(fullname, "gif/%s_a.gif", fname); c[cc]->SaveAs(fullname); |
1383 | - | ||
1384 | if(batch_q) gSystem->Exit(1); |
- | |
1385 | } |
220 | } |
1386 | 221 | ||
1387 | // ------------------------------------------------------------------- |
- | |
1388 | - | ||
1389 | if( strchr(plopt, 'c') != NULL ) { |
- | |
1390 | - | ||
1391 | //~ gStyle->SetOptStat(1111); |
- | |
1392 | //~ gStyle->SetOptFit(0); |
- | |
1393 | - | ||
1394 | c[++cc] = new TCanvas("c", "c", 0, 0, 900, 700); |
- | |
1395 | //~ c[cc]->Divide(2,2); |
- | |
1396 | - | ||
1397 | int ccccdi = 0; |
- | |
1398 | - | ||
1399 | (c[cc]->cd(++ccccdi))->SetLogz(1); |
- | |
1400 | sprintf(hname, "htdccor"); |
- | |
1401 | hp2d = DrTH2F(dir, hname, ""); |
- | |
1402 | //~ hp2d->GetYaxis()->SetRangeUser(0,1500); |
- | |
1403 | //~ sprintf(fullname, "%s;QDC Reference 1275 keV; QDC Reference Coincidence", fname); |
- | |
1404 | //~ hp2d->SetTitle(fullname); |
- | |
1405 | hp2d->DrawClone("COLZ"); |
- | |
1406 | - | ||
1407 | //~ (c[cc]->cd(++ccccdi))->SetLogz(1); |
- | |
1408 | //~ sprintf(hname, "hcor%d",0); |
- | |
1409 | //~ hp2d = DrTH2F(dir, hname, ""); |
- | |
1410 | //~ hp2d->DrawClone("COLZ"); |
- | |
1411 | //~ |
- | |
1412 | //~ (c[cc]->cd(++ccccdi))->SetLogz(1); |
- | |
1413 | //~ sprintf(hname, "hcor%d",1); |
- | |
1414 | //~ hp2d = DrTH2F(dir, hname, ""); |
- | |
1415 | //~ hp2d->DrawClone("COLZ"); |
- | |
1416 | //~ |
- | |
1417 | //~ |
- | |
1418 | //~ (c[cc]->cd(++ccccdi))->SetLogz(1); |
- | |
1419 | //~ sprintf(hname, "hdiffcor_%d_%d",0,1); |
- | |
1420 | //~ hp2d = DrTH2F(dir, hname, ""); |
- | |
1421 | //~ hp2d->DrawClone("COLZ"); |
- | |
1422 | //~ |
- | |
1423 | //~ (c[cc]->cd(++ccccdi))->SetLogz(1); |
- | |
1424 | //~ sprintf(hname, "hdiffcor_%d_%d",1,0); |
- | |
1425 | //~ hp2d = DrTH2F(dir, hname, ""); |
- | |
1426 | //~ hp2d->DrawClone("COLZ"); |
- | |
1427 | - | ||
1428 | sprintf(fullname, "gif/c_%s.gif", fname); c[cc]->SaveAs(fullname); |
- | |
1429 | } |
- | |
1430 | - | ||
1431 | // ------------------------------------------------------------------------------- |
- | |
1432 | // ------------------------------------------------------------------- |
222 | // ------------------------------------------------------------------- |
1433 | 223 | ||
1434 | if( strchr(plopt, 't') != NULL ) { |
224 | if( strchr(plopt, 't') != NULL ) { |
1435 | 225 | ||
1436 | gStyle->SetOptStat(1111); |
226 | gStyle->SetOptStat(1111); |
1437 | //~ gStyle-> |
227 | //~ gStyle->SetOptStat(0); |
- | 228 | gStyle->SetOptFit(0); |
|
1438 | 229 | ||
1439 | c[++cc] = new TCanvas(" |
230 | c[++cc] = new TCanvas("t", "t", 0, 0, 1600, 900); |
1440 |
|
231 | c[cc]->Divide(2,2); |
1441 | 232 | ||
1442 | double drawmin = -1; |
- | |
1443 |
|
233 | int draw_cuts = 0; |
1444 |
|
234 | int chmap[] = {0,1,2,31}; |
1445 | double fitmax = 0.75; |
- | |
1446 | double fitcenter = 0.0; |
- | |
1447 | double HalfMax, MinHalfMax, MaxHalfMax, FWHM; |
- | |
1448 | 235 | ||
1449 |
|
236 | for(int ich = 0;ich<4;ich++) { |
1450 | - | ||
1451 |
|
237 | (c[cc]->cd(ich+1))->SetLogy(1); |
1452 | sprintf(hname, " |
238 | sprintf(hname, "htdc%d", chmap[ich]); |
1453 | hp1d = DrTH1F(dir, hname, ""); |
239 | hp1d = DrTH1F(dir, hname, ""); |
1454 | hp1d->SetTitle( |
240 | sprintf(htitle, "TDC%d - TRIGGER;Time [ns];Count", chmap[ich]); hp1d->SetTitle(htitle); |
1455 | hp1d->GetXaxis()->SetRangeUser( |
241 | hp1d->GetXaxis()->SetRangeUser(-50,50); |
1456 | - | ||
1457 | f_fit = fgg; |
- | |
1458 | f_fit->SetParameters(hp1d->GetMaximum()*0.9, 0, 0.1, |
- | |
1459 | hp1d->GetMaximum()*0.1, 0, 0.5); |
- | |
1460 | //~ |
242 | //~ hp1d->GetYaxis()->SetRangeUser(0.9,hp1d->GetMaximum()*1.1); |
1461 | //~ f_fit->SetParLimits(2, fitmin,fitmax); |
- | |
1462 |
|
243 | hp1d->SetLineColor(kBlack); |
1463 | //~ f_fit->SetParLimits(4, 0, hp1d->GetMaximum()); |
- | |
1464 |
|
244 | hp1d->DrawClone(); |
1465 | - | ||
1466 |
|
245 | |
1467 |
|
246 | if(draw_cuts) { |
1468 |
|
247 | sprintf(hname, "htdc_cut%d", chmap[ich]); |
1469 | - | ||
1470 | - | ||
1471 |
|
248 | hp1dcut = DrTH1F(dir, hname, ""); |
1472 | MinHalfMax = f_fit->GetX(HalfMax, fitmin, fitcenter); |
- | |
1473 | MaxHalfMax = f_fit->GetX(HalfMax, fitcenter, fitmax); |
- | |
1474 |
|
249 | hp1dcut->SetLineColor(kRed); |
1475 |
|
250 | hp1dcut->DrawClone("SAME"); |
1476 | 251 | } |
|
1477 | fg->SetRange(-2,5); fg->SetLineWidth(1.0); |
- | |
1478 | fg->SetParameters(f_fit->GetParameter(0), f_fit->GetParameter(1), f_fit->GetParameter(2)); |
- | |
1479 | fg->SetLineColor(kGreen); fg->DrawClone("LSAME"); |
- | |
1480 | fg->SetParameters(f_fit->GetParameter(0+3), f_fit->GetParameter(1+3), f_fit->GetParameter(2+3)); |
- | |
1481 | fg->SetLineColor(kMagenta); fg->DrawClone("LSAME"); |
- | |
- | 252 | } |
|
1482 | 253 | ||
1483 | sprintf(fullname, "gif/ |
254 | sprintf(fullname, "gif/%s_t.gif", fname); c[cc]->SaveAs(fullname); |
1484 | sprintf(fullname, "eps/t_%s.eps", fname); c[cc]->SaveAs(fullname); |
- | |
1485 | } |
255 | } |
1486 | 256 | ||
1487 | // ------------------------------------------------------------------------------- |
- | |
1488 | // ------------------------------------------------------------------- |
257 | // ------------------------------------------------------------------- |
1489 | 258 | ||
1490 | if( strchr(plopt, |
259 | if( strchr(plopt, 'f') != NULL ) { |
1491 | - | ||
1492 | - | ||
1493 | DrSetDrawStyle(0.05); |
- | |
1494 | - | ||
1495 | gStyle->SetOptStat("e"); |
- | |
1496 | gStyle->SetOptFit(0); |
- | |
1497 | - | ||
1498 | gStyle->SetPadRightMargin(0.03); |
- | |
1499 | gStyle->SetPadTopMargin(0.05); |
- | |
1500 | gStyle->SetPadBottomMargin(0.12); |
- | |
1501 | gStyle->SetStatFontSize(0.05); |
- | |
1502 | gStyle->SetStatX(0.97); |
- | |
1503 | gStyle->SetStatY(0.95); |
- | |
1504 | - | ||
1505 | c[++cc] = new TCanvas("e_ref", "e_ref", 0, 0, 720, 400); |
- | |
1506 | - | ||
1507 | - | ||
1508 | int spectra_rebin = 0; |
- | |
1509 | int yaxis_max = 0; |
- | |
1510 | //~ int yaxis_max = 1200; |
- | |
1511 | //~ int xaxis_max = 2500; |
- | |
1512 | int xaxis_max = 3000; |
- | |
1513 | - | ||
1514 | //~ double fitcenter = 1190.; |
- | |
1515 | //~ double fitw = 70.; |
- | |
1516 | //~ double Cher_min = 10; |
- | |
1517 | //~ double Cher_max = 16; |
- | |
1518 | double Cher_min = -120; |
- | |
1519 | double Cher_max = -110; |
- | |
1520 | //~ double const_min = 20; |
- | |
1521 | //~ double const_max = 80; |
- | |
1522 | double const_min = -250; |
- | |
1523 | double const_max = -200; |
- | |
1524 | int ccccdi = 0; |
- | |
1525 | - | ||
1526 | if( strcmp(fname, "eff003")==0) {fitcenter=760.; fitw=100.;} |
- | |
1527 | if( strcmp(fname, "eff004")==0) {fitcenter=1220.; fitw=150.; spectra_rebin=8; yaxis_max=3300;} |
- | |
1528 | if( strcmp(fname, "eff005")==0) {fitcenter=1140.; fitw=60.;} |
- | |
1529 | if( strcmp(fname, "eff006")==0) {fitcenter=2050.; fitw=60.; xaxis_max=4000;} |
- | |
1530 | - | ||
1531 | if( strcmp(fname, "eff012")==0) {Cher_min=13; Cher_max=15;} |
- | |
1532 | if( strcmp(fname, "eff013")==0) {Cher_min=12; Cher_max=14;} |
- | |
1533 | if( strcmp(fname, "eff014")==0) {Cher_min=12; Cher_max=14;} |
- | |
1534 | if( strcmp(fname, "eff015")==0) {Cher_min=12; Cher_max=14;} |
- | |
1535 | if( strcmp(fname, "eff016")==0) {Cher_min=12; Cher_max=14;} |
- | |
1536 | if( strcmp(fname, "eff017")==0) {Cher_min=12; Cher_max=14;} |
- | |
1537 | if( strcmp(fname, "eff018")==0) {Cher_min=12; Cher_max=14;} |
- | |
1538 | - | ||
1539 | sprintf(hname, "hadc%d", 0); |
- | |
1540 | hp1d = DrTH1F(dir, hname, ""); |
- | |
1541 | hp1d->SetTitle("; Charge [200 fC/bin];Counts"); |
- | |
1542 | if(spectra_rebin) hp1d->Rebin(spectra_rebin); |
- | |
1543 | hp1d->SetLineColor(kBlack); |
- | |
1544 | hp1d->GetXaxis()->SetRangeUser(0,xaxis_max); |
- | |
1545 | if(yaxis_max) hp1d->GetYaxis()->SetRangeUser(0,yaxis_max); |
- | |
1546 | hp1d->Draw(); |
- | |
1547 | - | ||
1548 | //~ printf("Photofraction ~ %lf\n", hp1d->Integral(1300,1700)/hp1d->Integral(0,1300)); |
- | |
1549 | - | ||
1550 | f_fit = fg; |
- | |
1551 | f_fit->SetParameters(hp1d->GetMaximum()*0.1, fitcenter, fitw); |
- | |
1552 | - | ||
1553 | f_fit->SetRange(fitcenter-fitw, fitcenter+fitw); |
- | |
1554 | f_fit->SetLineWidth(3); |
- | |
1555 | hp1d->Fit(f_fit, "0Q", "", fitcenter-fitw, fitcenter+fitw); |
- | |
1556 | f_fit->DrawClone("LSAME"); |
- | |
1557 | - | ||
1558 | double PP_1sigma_min = f_fit->GetParameter(1)-f_fit->GetParameter(2); |
- | |
1559 | double PP_1sigma_max = f_fit->GetParameter(1)+f_fit->GetParameter(2); |
- | |
1560 | printf("PPcenter, PPwidth = %.0lf, %.0lf\n", f_fit->GetParameter(1), f_fit->GetParameter(2)); |
- | |
1561 | printf("PP+/-1sigma = [%.0lf, %.0lf]\n", PP_1sigma_min, PP_1sigma_max); |
- | |
1562 | printf("PP resolution = %.1lf\%% (FWHM = %.1lf\%%)\n", 100*f_fit->GetParameter(2)/f_fit->GetParameter(1), 235*f_fit->GetParameter(2)/f_fit->GetParameter(1)); |
- | |
1563 | - | ||
1564 | // -------- 1275keV Compton estimation -------- |
- | |
1565 | - | ||
1566 | // COMPTON EDGE |
- | |
1567 | //~ TF1 *fcompt = new TF1("fcompt", "[2]*(1 - ConstantStep(((x-[0])/[1]) - (1275.*(2*1275./511./(1+2*1275./511.)))))*(2 + (((x-[0])/[1])/1275.)^2/((1275./511.)^2*(1 - (((x-[0])/[1])/1275.))^2) + (((x-[0])/[1])/1275.)*((((x-[0])/[1])/1275.) - 2/(1275./511.))/(1 - (((x-[0])/[1])/1275.)))/(1275./511.)^2"); |
- | |
1568 | //~ TF1 *fcomhi = new TF1("fcomhi", "gaus(0)+fcompt"); |
- | |
1569 | //~ fcomhi->SetNpx(500); fcomhi->SetLineWidth(1); fcomhi->SetLineColor(6); |
- | |
1570 | //~ double comhi_range_low = 1670.; |
- | |
1571 | //~ //double comhi_range_hi = 2130.; |
- | |
1572 | //~ double comhi_range_hi = 2070.; |
- | |
1573 | //~ fcomhi->SetParameters(2000., 1710., 50., 100, 2, 200); |
- | |
1574 | //~ fcomhi->SetRange(comhi_range_low, comhi_range_hi); |
- | |
1575 | //~ hp1d->Fit(fcomhi, "0QR"); |
- | |
1576 | //~ //fcomhi->DrawClone("LSAME"); |
- | |
1577 | //~ |
- | |
1578 | //~ fcompt->SetNpx(300); fcompt->SetLineWidth(1); fcompt->SetLineColor(kBlue); fcompt->SetLineStyle(9); |
- | |
1579 | //~ fcompt->SetParameter(0, fcomhi->GetParameter(3)); |
- | |
1580 | //~ fcompt->SetParameter(1, fcomhi->GetParameter(4)); |
- | |
1581 | //~ fcompt->SetParameter(2, fcomhi->GetParameter(5)); |
- | |
1582 | //~ fcompt->SetRange(0, comhi_range_hi); |
- | |
1583 | //~ fcompt->DrawClone("LSAME"); |
- | |
1584 | //~ |
- | |
1585 | //~ double IComHi = fcompt->Integral(PP_1sigma_min, PP_1sigma_max)/hp1d->GetBinWidth(1); |
- | |
1586 | //~ printf("IComHi = %.0lf\n", IComHi); |
- | |
1587 | - | ||
1588 | // G LINEAR G |
- | |
1589 | //~ TF1 *fcomhi = new TF1("fcomhi", "gaus(0)+pol0(3)+gaus(4)"); |
- | |
1590 | //~ fcomhi->SetNpx(500); fcomhi->SetLineWidth(1); fcomhi->SetLineColor(kBlue); |
- | |
1591 | //~ double comhi_range_low = 1700.; |
- | |
1592 | //~ double comhi_range_hi = 2150.; |
- | |
1593 | //~ fcomhi->SetParameters(2000., 1710., 50., |
- | |
1594 | //~ 150., |
- | |
1595 | //~ 200., 2150., 100.); |
- | |
1596 | //~ fcomhi->SetRange(comhi_range_low, comhi_range_hi); |
- | |
1597 | //~ hp1d->Fit(fcomhi, "0QR"); |
- | |
1598 | //~ fcomhi->DrawClone("LSAME"); |
- | |
1599 | //~ |
- | |
1600 | //~ TF1 *fcom_lin = new TF1("fcom_lin", "pol0(0)"); |
- | |
1601 | //~ fcom_lin->SetNpx(300); fcom_lin->SetLineWidth(1); fcom_lin->SetLineColor(6); |
- | |
1602 | //~ fcom_lin->SetParameter(0, fcomhi->GetParameter(3)); |
- | |
1603 | //~ fcom_lin->SetRange(0, 4000); |
- | |
1604 | //~ fcom_lin->DrawClone("LSAME"); |
- | |
1605 | //~ |
- | |
1606 | //~ double IComHi = fcom_lin->Integral(PP_1sigma_min, PP_1sigma_max)/hp1d->GetBinWidth(1); |
- | |
1607 | // G LINEAR EXP |
- | |
1608 | TF1 *fcomhi = new TF1("fcomhi", "gaus(0) + [3] + [4]*TMath::Exp((x-[5])/[6])"); |
- | |
1609 | fcomhi->SetNpx(500); fcomhi->SetLineWidth(1); fcomhi->SetLineColor(6); |
- | |
1610 | //double comhi_range_low = 1250.; |
- | |
1611 | double comhi_range_low = fitcenter - 1.5*fitw; |
- | |
1612 | //double comhi_range_hi = 2100.; |
- | |
1613 | //~ fcomhi->SetParameters(2000., fitcenter, fitw, |
- | |
1614 | //~ 170., |
- | |
1615 | //~ 85., 2000., 100.); |
- | |
1616 | fcomhi->SetParameters(800., fitcenter, fitw, |
- | |
1617 | 40., |
- | |
1618 | 5., comhi_range_hi, 100.); |
- | |
1619 | - | ||
1620 | //~ fcomhi->SetParLimits(2, 50., 2000.); |
- | |
1621 | fcomhi->SetRange(comhi_range_low, comhi_range_hi); |
- | |
1622 | hp1d->Fit(fcomhi, "0QR"); |
- | |
1623 | //~ fcomhi->SetRange(0, 4000); |
- | |
1624 | fcomhi->DrawClone("LSAME"); |
- | |
1625 | - | ||
1626 | TF1 *fcompt = new TF1("fcompt", "[0] + [1]*TMath::Exp((x-[2])/[3])"); |
- | |
1627 | fcompt->SetNpx(300); fcompt->SetLineWidth(1); fcompt->SetLineColor(kBlue); fcompt->SetLineStyle(9); |
- | |
1628 | fcompt->SetParameter(0, fcomhi->GetParameter(3)); |
- | |
1629 | fcompt->SetParameter(1, fcomhi->GetParameter(4)); |
- | |
1630 | fcompt->SetParameter(2, fcomhi->GetParameter(5)); |
- | |
1631 | fcompt->SetParameter(3, fcomhi->GetParameter(6)); |
- | |
1632 | //~ fcompt->SetRange(1000, comhi_range_hi); |
- | |
1633 | fcompt->SetRange(400, comhi_range_hi); |
- | |
1634 | fcompt->DrawClone("LSAME"); |
- | |
1635 | //~ |
- | |
1636 | double IComHi = fcompt->Integral(PP_1sigma_min, PP_1sigma_max)/hp1d->GetBinWidth(1); |
- | |
1637 | printf("IComHi = %.0lf\n", IComHi); |
- | |
1638 | //~ |
- | |
1639 | //~ // EXP |
- | |
1640 | //~ TF1 *fcomhi = new TF1("fcomhi", "[0] + [1]*TMath::Exp((x-[2])/[3])"); |
- | |
1641 | //~ fcomhi->SetNpx(500); fcomhi->SetLineWidth(1); fcomhi->SetLineColor(6); |
- | |
1642 | //~ double comhi_range_low = 1800.; |
- | |
1643 | //~ double comhi_range_hi = 2000.; |
- | |
1644 | //~ fcomhi->SetParameters(150., 1., 2000.,1.); |
- | |
1645 | //~ fcomhi->SetRange(comhi_range_low, comhi_range_hi); |
- | |
1646 | //~ hp1d->Fit(fcomhi, "R"); |
- | |
1647 | //~ fcomhi->SetRange(0, 4000); |
- | |
1648 | //~ fcomhi->DrawClone("LSAME"); |
- | |
1649 | //~ |
- | |
1650 | //~ double IComHi = fcomhi->Integral(PP_1sigma_min, PP_1sigma_max)/hp1d->GetBinWidth(1); |
- | |
1651 | //~ printf("IComHi = %.0lf\n", IComHi); |
- | |
1652 | // LIN |
- | |
1653 | //~ TF1 *fcomhi = new TF1("fcomhi", "pol0"); |
- | |
1654 | //~ fcomhi->SetNpx(500); fcomhi->SetLineWidth(1); fcomhi->SetLineColor(6); |
- | |
1655 | //~ double comhi_range_low = 1800.; |
- | |
1656 | //~ double comhi_range_hi = 1900.; |
- | |
1657 | //~ fcomhi->SetParameter(0,150); |
- | |
1658 | //~ fcomhi->SetRange(comhi_range_low, comhi_range_hi); |
- | |
1659 | //~ hp1d->Fit(fcomhi, "QR"); |
- | |
1660 | //~ fcomhi->SetRange(0, 4000); |
- | |
1661 | //~ fcomhi->DrawClone("LSAME"); |
- | |
1662 | //~ |
- | |
1663 | //~ double IComHi = fcomhi->Integral(PP_1sigma_min, PP_1sigma_max)/hp1d->GetBinWidth(1); |
- | |
1664 | //~ printf("IComHi = %.0lf\n", IComHi); |
- | |
1665 | - | ||
1666 | // -------- 1275keV Compton estimation -------- |
- | |
1667 | - | ||
1668 | sprintf(hname, "hadc_cut%d", 0); |
- | |
1669 | hp1dcut = DrTH1F(dir, hname, ""); |
- | |
1670 | if(spectra_rebin) hp1dcut->Rebin(spectra_rebin); |
- | |
1671 | hp1dcut->SetLineColor(kRed); |
- | |
1672 | - | ||
1673 | hp1dcut->SetLineColor(40); |
- | |
1674 | hp1dcut->SetLineStyle(2); |
- | |
1675 | hp1dcut->DrawClone("SAME"); |
- | |
1676 | double N511 = hp1dcut->GetEntries(); |
- | |
1677 | //~ double N511 = hp1dcut->Integral(PP_1sigma_min-10, PP_1sigma_max+10); |
- | |
1678 | - | ||
1679 | leg[++legi] = new TLegend(0.124302, 0.65, 0.6, 0.925134); |
- | |
1680 | leg[legi]->SetFillColor(0); leg[legi]->SetBorderSize(1); leg[legi]->SetTextSize(0.05); leg[legi]->SetTextAlign(22); |
- | |
1681 | leg[legi]->AddEntry((TH1F*)hp1d->Clone(), "Measurement", "L"); |
- | |
1682 | leg[legi]->AddEntry((TH1F*)hp1dcut->Clone(), "#pm1 #sigma Photopeak Cut", "L"); |
- | |
1683 | leg[legi]->AddEntry((TF1*)fcompt->Clone(), "1275 keV Compton Estimate", "L"); |
- | |
1684 | - | ||
1685 | //~ leg[legi]->Draw(); |
- | |
1686 | - | ||
1687 | //~ sprintf(hname, "hadc_cut_2%d", 0); |
- | |
1688 | //~ hp1d = DrTH1F(dir, hname, ""); |
- | |
1689 | //~ hp1d->SetLineColor(kGreen); |
- | |
1690 | //~ hp1d->DrawClone("SAME"); |
- | |
1691 | - | ||
1692 | - | ||
1693 | sprintf(fullname, "gif/e_%s.gif", fname); c[cc]->SaveAs(fullname); |
- | |
1694 | sprintf(fullname, "eps/e_%s.eps", fname); c[cc]->SaveAs(fullname); |
- | |
1695 | - | ||
1696 | - | ||
1697 | - | ||
1698 | c[++cc] = new TCanvas("e_sipm", "e_sipm", 0, 470, 720, 300); |
- | |
1699 | int ch_Sprttype = 8; |
- | |
1700 | - | ||
1701 | (c[cc]->cd(1))->SetLogy(1); |
- | |
1702 | sprintf(hname, "htdc%d", ch_Sprttype); |
- | |
1703 | hp1d = DrTH1F(dir, hname, ""); |
- | |
1704 | hp1d->SetTitle("; Time [ns];Counts"); |
- | |
1705 | //~ hp1d->Rebin(4); |
- | |
1706 | hp1d->SetLineColor(kBlack); |
- | |
1707 | //~ hp1d->GetXaxis()->SetRangeUser(0,80);//original |
- | |
1708 | hp1d->GetXaxis()->SetRangeUser(-400,50); |
- | |
1709 | hp1d->GetYaxis()->SetRangeUser(0.1,hp1d->GetMaximum()*2); |
- | |
1710 | hp1d->DrawClone(); |
- | |
1711 | - | ||
1712 | sprintf(hname, "htdc_cut%d", ch_Sprttype); |
- | |
1713 | hp1d = DrTH1F(dir, hname, ""); |
- | |
1714 | //~ hp1d->Rebin(4); |
- | |
1715 | hp1d->SetLineColor(kRed); |
- | |
1716 | - | ||
1717 | TF1 *fc = new TF1("fc", "pol0"); fc->SetNpx(300); |
- | |
1718 | fc->SetParameter(0,1); |
- | |
1719 | //~ fc->SetParameter(1,-0.1); |
- | |
1720 | fc->SetRange(const_min,const_max); |
- | |
1721 | hp1d->Fit(fc, "0QWWR"); |
- | |
1722 | - | ||
1723 | hp1d->DrawClone("SAME"); |
- | |
1724 | fc->SetLineColor(kBlue); |
- | |
1725 | fc->DrawClone("LSAME"); |
- | |
1726 | - | ||
1727 | double Ntdc = hp1d->Integral(hp1d->FindBin(Cher_min), hp1d->FindBin(Cher_max)); |
- | |
1728 | double Nbckg = fc->Integral(Cher_min,Cher_max)/hp1d->GetBinWidth(1); |
- | |
1729 | printf("fc par(0) = %lf | Nbckg = %.0lf\n", fc->GetParameter(0), Nbckg); |
- | |
1730 | - | ||
1731 | - | ||
1732 | //~ sprintf(hname, "htdc_cut_2%d", 1); |
- | |
1733 | //~ hp1d = DrTH1F(dir, hname, ""); |
- | |
1734 | //~ hp1d->SetLineColor(kGreen); |
- | |
1735 | //~ hp1d->DrawClone("SAME"); |
- | |
1736 | - | ||
1737 | printf("N511 = %.0lf | Ntdc = %.0lf | R = %.2lf \%% | R_1 = %.2lf \%% | R_2 = %.2lf \%%\n", N511, Ntdc, 100*Ntdc/N511, 100*(Ntdc-Nbckg)/N511, 100*(Ntdc-Nbckg)/(N511-IComHi)); |
- | |
1738 | - | ||
1739 | sprintf(fullname, "gif/e2_%s.gif", fname); c[cc]->SaveAs(fullname); |
- | |
1740 | sprintf(fullname, "eps/e2_%s.eps", fname); c[cc]->SaveAs(fullname); |
- | |
1741 | - | ||
1742 | int kobayashi =1; |
- | |
1743 | if(kobayashi){ |
- | |
1744 | double Nnohit = hp1d->Integral(hp1d->FindBin(-715), hp1d->FindBin(-685)); |
- | |
1745 | - | ||
1746 | printf("N511 = %.0lf | Nnohit = %.0lf | R = %.2lf \%% | R_1 = %.2lf \%% | R_2 = %.2lf \%%\n", N511, Nnohit, 100*(N511-Nnohit)/N511, 100*((N511-Nnohit)-Nbckg)/N511, 100*((N511-Nnohit)-Nbckg)/(N511-IComHi)); |
- | |
1747 | 260 | ||
1748 | } |
- | |
- | 261 | gStyle->SetOptStat(1111); |
|
- | 262 | //~ gStyle->SetOptStat(0); |
|
- | 263 | gStyle->SetOptFit(0); |
|
1749 | 264 | ||
1750 | //~ (c[cc]->cd(++ccccdi))->SetLogy(1); |
- | |
1751 | //~ sprintf(hname, "hadc%d", 1); |
- | |
1752 | //~ hp1d = DrTH1F(dir, hname, ""); |
- | |
1753 | //~ hp1d->SetLineColor(kBlack); |
- | |
1754 | //~ hp1d->GetXaxis()->SetRangeUser(0,2000); |
- | |
1755 | //~ hp1d->DrawClone(); |
- | |
1756 | //~ |
- | |
1757 | //~ sprintf(hname, "hadc_cut%d", 1); |
- | |
1758 | //~ hp1d = DrTH1F(dir, hname, ""); |
- | |
1759 | //~ hp1d->SetLineColor(kRed); |
- | |
1760 | //~ hp1d->DrawClone("SAME"); |
- | |
1761 | //~ |
- | |
1762 | //~ sprintf(hname, "hadc_cut_2%d", 1); |
- | |
1763 | //~ hp1d = DrTH1F(dir, hname, ""); |
- | |
1764 | //~ hp1d->SetLineColor(kGreen); |
- | |
1765 | //~ hp1d->DrawClone("SAME"); |
- | |
1766 | - | ||
1767 | //~ sprintf(fullname, "gif/e_%s.gif", fname); c[cc]->SaveAs(fullname); |
- | |
1768 | //~ sprintf(fullname, "eps/e_%s.eps", fname); c[cc]->SaveAs(fullname); |
- | |
1769 | } |
- | |
1770 | // ------------------------------------------------------------------- |
- | |
1771 | - | ||
1772 | if( strchr(plopt, 'r') != NULL ) { |
- | |
1773 | - | ||
1774 | //~ gStyle->SetOptStat(1111); |
- | |
1775 | gStyle->SetOptStat(0); |
- | |
1776 | gStyle->SetOptFit(0); |
- | |
1777 | - | ||
1778 | c[++cc] = new TCanvas("e", "e", 0, 0, 1200, 450); |
- | |
1779 | c[cc]->Divide(3,1); |
- | |
1780 | - | ||
1781 | int spectra_rebin = 0; |
- | |
1782 | int yaxis_max = 0; |
- | |
1783 | int xaxis_max = 3000; |
- | |
1784 | - | ||
1785 | double fitcenter = 700.; |
- | |
1786 | double fitw = 60.; |
- | |
1787 | double Cher_min = 4; |
- | |
1788 | double Cher_max = 16; |
- | |
1789 | double const_min = Cher_max; |
- | |
1790 | double const_max = 80; |
- | |
1791 | int ccccdi = 0; |
- | |
1792 | - | ||
1793 | if( strcmp(fname, "eff003")==0) {fitcenter=760.; fitw=100.;} |
- | |
1794 | if( strcmp(fname, "eff004")==0) {fitcenter=1220.; fitw=150.; spectra_rebin=8; yaxis_max=3300;} |
- | |
1795 | if( strcmp(fname, "eff005")==0) {fitcenter=1140.; fitw=60.;} |
- | |
1796 | if( strcmp(fname, "eff006")==0) {fitcenter=2050.; fitw=60.; xaxis_max=4000;} |
- | |
1797 | if( strcmp(fname, "eff007")==0) {fitcenter=710.; fitw=50.;} |
- | |
1798 | if( strcmp(fname, "eff009")==0) {fitcenter=900.; fitw=60.; xaxis_max=2000;} |
- | |
1799 | - | ||
1800 | (c[cc]->cd(++ccccdi))->SetLogy(1); |
- | |
1801 | sprintf(hname, "hadc%d", 0); |
- | |
1802 | hp1d = DrTH1F(dir, hname, ""); |
- | |
1803 | hp1d->SetTitle("Reference Coincidence; Charge [200 fC/bin];"); |
- | |
1804 | if(spectra_rebin) hp1d->Rebin(spectra_rebin); |
- | |
1805 | hp1d->SetLineColor(kBlack); |
- | |
1806 | hp1d->GetXaxis()->SetRangeUser(0,xaxis_max); |
- | |
1807 | if(yaxis_max) hp1d->GetYaxis()->SetRangeUser(0.5,yaxis_max); |
- | |
1808 | - | ||
1809 | f_fit = fg; |
- | |
1810 | f_fit->SetParameters(hp1d->GetMaximum()*0.1, fitcenter, fitw); |
- | |
1811 | - | ||
1812 | f_fit->SetRange(fitcenter-fitw, fitcenter+fitw); |
- | |
1813 | f_fit->SetLineWidth(1); |
- | |
1814 | hp1d->Fit(f_fit, "Q", "", fitcenter-fitw, fitcenter+fitw); |
- | |
1815 | - | ||
1816 | printf("PP+/-1sigma = [%.0lf, %.0lf]\n", f_fit->GetParameter(1)-f_fit->GetParameter(2), f_fit->GetParameter(1)+f_fit->GetParameter(2)); |
- | |
1817 | printf("PP resolution = %.1lf\%% (FWHM = %.1lf\%%)\n", 100*f_fit->GetParameter(2)/f_fit->GetParameter(1), 235*f_fit->GetParameter(2)/f_fit->GetParameter(1)); |
- | |
1818 | - | ||
1819 | sprintf(hname, "hadc_cut%d", 0); |
- | |
1820 | hp1d = DrTH1F(dir, hname, ""); |
- | |
1821 | if(spectra_rebin) hp1d->Rebin(spectra_rebin); |
- | |
1822 | hp1d->SetLineColor(kRed); |
- | |
1823 | hp1d->DrawClone("SAME"); |
- | |
1824 | double N511 = hp1d->GetEntries(); |
- | |
1825 | - | ||
1826 | sprintf(hname, "hadc_cut_2%d", 0); |
- | |
1827 | hp1d = DrTH1F(dir, hname, ""); |
- | |
1828 | hp1d->SetLineColor(kGreen); |
- | |
1829 | hp1d->DrawClone("SAME"); |
- | |
1830 | - | ||
1831 | //----------------------------------------------------------------------- |
- | |
1832 | - | ||
1833 | (c[cc]->cd(++ccccdi))->SetLogy(1); |
- | |
1834 | sprintf(hname, "hadc%d", 2); |
- | |
1835 | hp1d = DrTH1F(dir, hname, ""); |
- | |
1836 | hp1d->SetTitle("Reference 1275 keV; Charge [200 fC/bin];"); |
- | |
1837 | //~ if(spectra_rebin) hp1d->Rebin(spectra_rebin); |
- | |
1838 | hp1d->SetLineColor(kBlack); |
- | |
1839 | //~ hp1d->GetXaxis()->SetRangeUser(0,xaxis_max); |
- | |
1840 | //~ if(yaxis_max) hp1d->GetYaxis()->SetRangeUser(0,yaxis_max); |
- | |
1841 | hp1d->DrawClone(); |
- | |
1842 | - | ||
1843 | sprintf(hname, "hadc_cut%d", 2); |
- | |
1844 | hp1d = DrTH1F(dir, hname, ""); |
- | |
1845 | if(spectra_rebin) hp1d->Rebin(spectra_rebin); |
- | |
1846 | hp1d->SetLineColor(kRed); |
- | |
1847 | hp1d->DrawClone("SAME"); |
- | |
1848 | - | ||
1849 | sprintf(hname, "hadc_cut_2%d", 2); |
- | |
1850 | hp1d = DrTH1F(dir, hname, ""); |
- | |
1851 | hp1d->SetLineColor(kGreen); |
- | |
1852 | hp1d->DrawClone("SAME"); |
- | |
1853 | - | ||
1854 | //----------------------------------------------------------------------- |
- | |
1855 | - | ||
1856 | (c[cc]->cd(++ccccdi))->SetLogy(1); |
- | |
1857 | sprintf(hname, "htdc%d", 1); |
- | |
1858 | hp1d = DrTH1F(dir, hname, ""); |
- | |
1859 | hp1d->SetTitle("MPPC Cherenkov; Time [ns];"); |
- | |
1860 | //~ hp1d->Rebin(4); |
- | |
1861 | hp1d->SetLineColor(kBlack); |
- | |
1862 | hp1d->GetXaxis()->SetRangeUser(0,80); |
- | |
1863 | hp1d->GetYaxis()->SetRangeUser(0.1,hp1d->GetMaximum()*2); |
- | |
1864 | hp1d->DrawClone(); |
- | |
1865 | - | ||
1866 | sprintf(hname, "htdc_cut%d", 1); |
- | |
1867 | hp1d = DrTH1F(dir, hname, ""); |
- | |
1868 | //~ hp1d->Rebin(4); |
- | |
1869 | hp1d->SetLineColor(kRed); |
- | |
1870 | - | ||
1871 | TF1 *fc = new TF1("fc", "pol0"); fc->SetNpx(300); |
- | |
1872 | fc->SetParameter(0,1); |
- | |
1873 | fc->SetRange(const_min,const_max); |
- | |
1874 | hp1d->Fit(fc, "0QWWR"); |
- | |
1875 | - | ||
1876 | hp1d->DrawClone("SAME"); |
- | |
1877 | fc->SetLineColor(kBlue); |
- | |
1878 | fc->DrawClone("LSAME"); |
- | |
1879 | - | ||
1880 | double Ntdc = hp1d->Integral(hp1d->FindBin(Cher_min), hp1d->FindBin(Cher_max)); |
- | |
1881 | double Nbckg = fc->Integral(Cher_min,Cher_max)/hp1d->GetBinWidth(1); |
- | |
1882 | printf("fc par(0) = %lf | Nbckg = %.0lf\n", fc->GetParameter(0), Nbckg); |
- | |
1883 | - | ||
1884 | - | ||
1885 | sprintf(hname, "htdc_cut_2%d", 1); |
- | |
1886 | hp1d = DrTH1F(dir, hname, ""); |
- | |
1887 | hp1d->SetLineColor(kGreen); |
- | |
1888 | hp1d->DrawClone("SAME"); |
- | |
1889 | - | ||
1890 | printf("N511 = %.0lf | Ntdc = %.0lf | R = %lf\n", N511, Ntdc, Ntdc/N511); |
- | |
1891 | - | ||
1892 | printf("R_1 = %lf\n", (Ntdc-Nbckg)/N511); |
- | |
1893 | - | ||
1894 | //~ (c[cc]->cd(++ccccdi))->SetLogy(1); |
- | |
1895 | //~ sprintf(hname, "hadc%d", 1); |
- | |
1896 | //~ hp1d = DrTH1F(dir, hname, ""); |
- | |
1897 | //~ hp1d->SetLineColor(kBlack); |
- | |
1898 | //~ hp1d->GetXaxis()->SetRangeUser(0,2000); |
- | |
1899 | //~ hp1d->DrawClone(); |
- | |
1900 | //~ |
- | |
1901 | //~ sprintf(hname, "hadc_cut%d", 1); |
- | |
1902 | //~ hp1d = DrTH1F(dir, hname, ""); |
- | |
1903 | //~ hp1d->SetLineColor(kRed); |
- | |
1904 | //~ hp1d->DrawClone("SAME"); |
- | |
1905 | //~ |
- | |
1906 | //~ sprintf(hname, "hadc_cut_2%d", 1); |
- | |
1907 | //~ hp1d = DrTH1F(dir, hname, ""); |
- | |
1908 | //~ hp1d->SetLineColor(kGreen); |
- | |
1909 | //~ hp1d->DrawClone("SAME"); |
- | |
1910 | - | ||
1911 | sprintf(fullname, "gif/e_%s.gif", fname); c[cc]->SaveAs(fullname); |
- | |
1912 | sprintf(fullname, "eps/e_%s.eps", fname); c[cc]->SaveAs(fullname); |
- | |
1913 | } |
- | |
1914 | - | ||
1915 | // ------------------------------------------------------------------------------- |
- | |
1916 | // ------------------------------------------------------------------- |
- | |
1917 | - | ||
1918 | if( strchr(plopt, 'p') != NULL ) { |
- | |
1919 | - | ||
1920 | - | ||
1921 | DrSetDrawStyle(0.05); |
- | |
1922 | - | ||
1923 | gStyle->SetOptStat("e"); |
- | |
1924 | gStyle->SetOptFit(0); |
- | |
1925 | - | ||
1926 | gStyle->SetPadRightMargin(0.03); |
- | |
1927 | gStyle->SetPadTopMargin(0.05); |
- | |
1928 | gStyle->SetPadBottomMargin(0.12); |
- | |
1929 | gStyle->SetStatFontSize(0.05); |
- | |
1930 | gStyle->SetStatX(0.97); |
- | |
1931 | gStyle->SetStatY(0.95); |
- | |
1932 | - | ||
1933 | c[++cc] = new TCanvas("Print", "Print", 0, 0, 720, 400); |
- | |
1934 | - | ||
1935 | - | ||
1936 | int spectra_rebin = 0; |
- | |
1937 | int yaxis_max = 1000; |
- | |
1938 | int xaxis_max = 1200; |
- | |
1939 | - | ||
1940 | - | ||
1941 | double Cher_min = 10; |
- | |
1942 | double Cher_max = 16; |
- | |
1943 | double const_min = 20; |
- | |
1944 | double const_max = 80; |
- | |
1945 | int ccccdi = 0; |
- | |
1946 | - | ||
1947 | sprintf(hname, "hadc%d", 0); |
- | |
1948 | hp1d = DrTH1F(dir, hname, ""); |
- | |
1949 | hp1d->SetTitle("; Charge [200 fC/bin];Counts"); |
- | |
1950 | if(spectra_rebin) hp1d->Rebin(spectra_rebin); |
- | |
1951 | hp1d->SetLineColor(kBlack); |
- | |
1952 | hp1d->GetXaxis()->SetRangeUser(0,xaxis_max); |
- | |
1953 | if(yaxis_max) hp1d->GetYaxis()->SetRangeUser(0,yaxis_max); |
- | |
1954 | hp1d->Draw(); |
- | |
1955 | - | ||
1956 | sprintf(hname, "hadc_cut%d", 0); |
- | |
1957 | hp1dcut = DrTH1F(dir, hname, ""); |
- | |
1958 | if(spectra_rebin) hp1dcut->Rebin(spectra_rebin); |
- | |
1959 | hp1dcut->SetLineColor(kRed); |
- | |
1960 | hp1dcut->Draw("SAME"); |
- | |
1961 | - | ||
1962 | sprintf(fullname, "gif/p_%s.gif", fname); c[cc]->SaveAs(fullname); |
- | |
1963 | sprintf(fullname, "eps/p_%s.eps", fname); c[cc]->SaveAs(fullname); |
- | |
1964 | } |
- | |
1965 | - | ||
1966 | // ------------------------------------------------------------------- |
- | |
1967 | - | ||
1968 | if( strchr(plopt, 'b') != NULL ) { |
- | |
1969 | gStyle->SetOptStat(0); |
- | |
1970 | gStyle->SetOptFit(0); |
- | |
1971 | - | ||
1972 | c[++cc] = new TCanvas(" |
265 | c[++cc] = new TCanvas("f", "f", 0, 0, 1600, 900); |
1973 | c[cc]->Divide(2,2); |
266 | c[cc]->Divide(2,2); |
1974 | 267 | ||
1975 | int |
268 | int draw_cuts = 0; |
1976 | int ich; |
- | |
1977 | /* |
- | |
1978 | // ------------------------------------------------------------ |
- | |
1979 | ich = 0; |
- | |
1980 | (c[cc]->cd(++ccccdi))->SetLogy(1); |
- | |
1981 | sprintf(hname, "htdc%d", ich); |
- | |
1982 | hp1d = DrTH1F(dir, hname, ""); |
- | |
1983 | hp1d->SetTitle(hname); |
- | |
1984 | //~ hp1d->GetXaxis()->SetRangeUser(0,2000); |
- | |
1985 | //~ hp1d->GetYaxis()->SetRangeUser(0.9,hp1d->GetMaximum()*1.1); |
- | |
1986 | hp1d->SetLineColor(kBlack); |
- | |
1987 | hp1d->DrawClone(); |
- | |
1988 | |
- | |
1989 | // ------------------------------------------------------------ |
- | |
1990 | ich = 1; |
- | |
1991 | (c[cc]->cd(++ccccdi))->SetLogy(1); |
- | |
1992 | sprintf(hname, "htdc%d", ich); |
- | |
1993 | hp1d = DrTH1F(dir, hname, ""); |
- | |
1994 | hp1d->SetTitle(hname); |
- | |
1995 | //~ hp1d->GetXaxis()->SetRangeUser(0,2000); |
- | |
1996 | //~ hp1d->GetYaxis()->SetRangeUser(0.9,hp1d->GetMaximum()*1.1); |
- | |
1997 | hp1d->SetLineColor(kBlack); |
- | |
1998 | hp1d->DrawClone(); |
- | |
1999 | */ |
- | |
2000 | // -------------------------- qdc 0 ---------------------------------- |
- | |
2001 | ich = 0; |
- | |
2002 | (c[cc]->cd(++ccccdi))->SetLogy(1); |
- | |
2003 | /* |
- | |
2004 | sprintf(hname, "hadc%d", ich); |
- | |
2005 | hp1d = DrTH1F(dir, hname, ""); |
- | |
2006 | hp1d->SetTitle("SiPM;Charge [200 fC/bin]"); |
- | |
2007 | hp1d->GetXaxis()->SetRangeUser(0,1000); |
- | |
2008 | //~ hp1d->GetYaxis()->SetRangeUser(0.9,hp1d->GetMaximum()*1.1); |
- | |
2009 | hp1d->SetLineColor(kBlack); |
- | |
2010 | hp1d->DrawClone(); |
- | |
2011 | */ |
- | |
2012 | - | ||
2013 | TLegend *leg0 = new TLegend(0.57,0.66,0.88,0.88); |
- | |
2014 | leg0->SetFillColor(0); |
- | |
2015 | leg0->SetBorderSize(1); |
- | |
2016 | leg0->SetTextSize(0.05); |
- | |
2017 | leg0->SetTextAlign(22); |
- | |
2018 | - | ||
2019 | sprintf(hname, "hadc%d", ich); |
- | |
2020 | TH1F* hADC = DrTH1F(dir, hname, ""); |
- | |
2021 | - | ||
2022 | hADC->SetTitle("SiPM;Charge [200 fC/bin]"); |
- | |
2023 | hADC->GetXaxis()->SetRangeUser(0,1000); |
- | |
2024 | hADC->SetLineColor(kBlack); |
- | |
2025 | hADC->DrawClone(); |
- | |
2026 | - | ||
2027 | int dbgprint=1; |
- | |
2028 | const int nPeaks=3; |
- | |
2029 | double pSigma=10; |
- | |
2030 | double pThr=0.005; |
- | |
2031 | - | ||
2032 | TSpectrum *sADC = new TSpectrum(nPeaks,0.3); |
- | |
2033 | sADC->Search(hADC, pSigma,"",pThr); |
- | |
2034 | int foundNPeaks = sADC->GetNPeaks(); |
- | |
2035 | float *foundPeakX = sADC->GetPositionX(); |
- | |
2036 | float *foundPeakY = sADC->GetPositionY(); |
- | |
2037 | - | ||
2038 | if(1 < foundNPeaks) { |
- | |
2039 | //void Sort(Int_t n1, const Float_t *a, Int_t *index, Bool_t down) |
- | |
2040 |
|
269 | int chmap[] = {0,1,2,31}; |
2041 | TMath::Sort(foundNPeaks, foundPeakX, sortedPeakIndex, 0); |
- | |
2042 | if(dbgprint) { |
- | |
2043 | printf("foundNPeaks = %d\n",foundNPeaks); |
- | |
2044 | for(int i=0; i<foundNPeaks; i++) printf("Peak[%d] = %f\n",i, foundPeakX[sortedPeakIndex[i]]); |
- | |
2045 | } |
- | |
2046 | float peakMidpointX[nPeaks+1]; |
- | |
2047 | float peakMidpointY[nPeaks+1]; |
- | |
2048 | - | ||
2049 | peakMidpointX[0] = 0; peakMidpointY[0] = 1; |
- | |
2050 | for(int i=1; i<foundNPeaks; i++) { |
- | |
2051 | peakMidpointX[i] = (foundPeakX[sortedPeakIndex[i]] + foundPeakX[sortedPeakIndex[i-1]])/2.0; |
- | |
2052 | peakMidpointY[i] = 1; |
- | |
2053 | - | ||
2054 | if(dbgprint) printf("peakMidpointX[%d] = %f\n",i, peakMidpointX[i]); |
- | |
2055 | - | ||
2056 | } |
- | |
2057 | peakMidpointX[foundNPeaks] = 1120; peakMidpointY[foundNPeaks] = 1; |
- | |
2058 | - | ||
2059 | if(dbgprint) printf("peakMidpointX[%d] = %f\n",foundNPeaks, peakMidpointX[foundNPeaks]); |
- | |
2060 | - | ||
2061 | TPolyMarker *pmMidpoints = new TPolyMarker(nPeaks+1, peakMidpointX, peakMidpointY); |
- | |
2062 | pmMidpoints->SetMarkerStyle(33); pmMidpoints->SetMarkerColor(9); pmMidpoints->SetMarkerSize(2); |
- | |
2063 | pmMidpoints->Draw("SAME"); |
- | |
2064 | - | ||
2065 | //~ fprintf(fp,"peakEvents:\n"); |
- | |
2066 | - | ||
2067 | double peakEvents[nPeaks]; |
- | |
2068 | for(int i=0; i<foundNPeaks-1; i++) { |
- | |
2069 | peakEvents[i] = hADC->Integral(hADC->FindBin(peakMidpointX[i]), hADC->FindBin(peakMidpointX[i+1])); |
- | |
2070 | - | ||
2071 | if(dbgprint) printf("I(%.1f, %.1f) = %.1lf\n", peakMidpointX[i], peakMidpointX[i+1], peakEvents[i]); |
- | |
2072 | //~ fprintf(fp,"%lf\n", peakEvents[i]); |
- | |
2073 | - | ||
2074 | } |
- | |
2075 | peakEvents[foundNPeaks-1] = hADC->Integral(hADC->FindBin(peakMidpointX[foundNPeaks-1]), hADC->FindBin(1130.)); |
- | |
2076 | - | ||
2077 | if(dbgprint) printf("I(%.1f, %.1f) = %.1lf\n", peakMidpointX[foundNPeaks-1], 1130., peakEvents[foundNPeaks-1]); |
- | |
2078 | //~ fprintf(fp,"%lf\n", peakEvents[foundNPeaks-1]); |
- | |
2079 | - | ||
2080 | double N0all = -TMath::Log(peakEvents[0]/hADC->GetEntries()); |
- | |
2081 | double N01 = peakEvents[1]/peakEvents[0]; |
- | |
2082 | double N02 = 2*peakEvents[2]/peakEvents[1]; |
- | |
2083 | - | ||
2084 | if(dbgprint) printf("Poisson <N>: N0all -> %.3lf | N01 -> %.3lf | N12 -> %.3lf\n", N0all, N01, N02); |
- | |
2085 | - | ||
2086 | - | ||
2087 | - | ||
2088 | sprintf(sbuff, "<N> = %.3lf", N0all); |
- | |
2089 | leg0->AddEntry((TH1F*)hADC->Clone(),sbuff, ""); |
- | |
2090 | sprintf(sbuff, "1 CPH = %.0lf", foundPeakX[sortedPeakIndex[1]]); |
- | |
2091 | leg0->AddEntry((TH1F*)hADC->Clone(),sbuff, ""); |
- | |
2092 | leg0->Draw(); |
- | |
2093 | } |
- | |
2094 | 270 | ||
2095 | double N_adc_integral = hADC->Integral(hADC->FindBin(peakMidpointX[1]), hADC->FindBin(1000.)); |
- | |
2096 | double N_poisson = (1 - TMath::Exp(-N0all))*hADC->GetEntries(); |
- | |
2097 | printf("hADC->GetEntries() = %.0lf\n", hADC->GetEntries()); |
- | |
2098 | printf("N_adc_integral = %.0lf | N_poisson = %.0lf\n", N_adc_integral, N_poisson); |
- | |
2099 | - | ||
2100 |
|
271 | for(int ich = 0;ich<4;ich++) { |
2101 | hp1d = DrTH1F(dir, hname, ""); |
- | |
2102 | hp1d->SetLineColor(kRed); |
- | |
2103 | hp1d->DrawClone("SAME"); |
- | |
2104 | - | ||
2105 | // -------------------------- TDC 0 ---------------------------------- |
- | |
2106 | (c[cc]->cd(+ |
272 | (c[cc]->cd(ich+1))->SetLogy(1); |
2107 | sprintf(hname, " |
273 | sprintf(hname, "hctdc%d", chmap[ich]); |
2108 | hp1d = DrTH1F(dir, hname, ""); |
274 | hp1d = DrTH1F(dir, hname, ""); |
2109 | hp1d->SetTitle( |
275 | sprintf(htitle, "corTDC%d - TRIGGER;Time [ns];Count", chmap[ich]); hp1d->SetTitle(htitle); |
2110 | hp1d->GetXaxis()->SetRangeUser(- |
276 | hp1d->GetXaxis()->SetRangeUser(-30,30); |
2111 | //~ hp1d->GetYaxis()->SetRangeUser(0.9,hp1d->GetMaximum()*1.1); |
277 | //~ hp1d->GetYaxis()->SetRangeUser(0.9,hp1d->GetMaximum()*1.1); |
2112 | hp1d->SetLineColor(kBlack); |
278 | hp1d->SetLineColor(kBlack); |
2113 | hp1d->DrawClone(); |
279 | hp1d->DrawClone(); |
2114 | 280 | ||
2115 | printf("hTDC->GetEntries() = %.0lf\n", hp1d->GetEntries()); |
- | |
2116 | double N_tdc_integral = hp1d->Integral(hp1d->FindBin(-10), hp1d->FindBin(10)); |
- | |
2117 | printf("N_tdc_integral = %.0lf\n", N_tdc_integral); |
- | |
2118 | - | ||
2119 | // ----------------------------------------------------------- |
- | |
2120 | - | ||
2121 | (c[cc]->cd(++ccccdi))->SetLogy(0); |
- | |
2122 | sprintf(hname, "hcor%d", ich); |
- | |
2123 | hp2d = DrTH2F(dir, hname, ""); |
- | |
2124 | hp2d->SetTitle(";Charge [200 fC/bin];cTime [ns]"); |
- | |
2125 | //~ hp1d->GetXaxis()->SetRangeUser(0,2000); |
- | |
2126 | //~ hp1d->GetYaxis()->SetRangeUser(0.9,hp1d->GetMaximum()*1.1); |
- | |
2127 | //~ hp1d->SetLineColor(kBlack); |
- | |
2128 |
|
281 | if(draw_cuts) { |
2129 | - | ||
2130 | // -------------------------- cTDC 0 ---------------------------------- |
- | |
2131 | (c[cc]->cd(++ccccdi))->SetLogy(0); |
- | |
2132 | sprintf |
282 | sprintf(hname, "hctdc_cut%d", chmap[ich]); |
2133 |
|
283 | hp1dcut = DrTH1F(dir, hname, ""); |
2134 | //~ hp1d->SetTitle("SiPM;cTime [ns]"); |
- | |
2135 | //~ hp1d->GetXaxis()->SetRangeUser(-5,5); |
- | |
2136 | //~ //hp1d->GetYaxis()->SetRangeUser(0.9,hp1d->GetMaximum()*1.1); |
- | |
2137 |
|
284 | hp1dcut->SetLineColor(kRed); |
2138 |
|
285 | hp1dcut->DrawClone("SAME"); |
2139 | - | ||
2140 | plotCorTDC(hp1d, "SiPM;cTime [ns]", -0.5, 0.45, -1., 2); |
- | |
2141 | - | ||
2142 | printf("hcTDC->GetEntries() = %.0lf\n", hp1d->GetEntries()); |
- | |
2143 | double N_ctdc_integral = hp1d->Integral(hp1d->FindBin(-2), hp1d->FindBin(2)); |
- | |
2144 | printf("N_ctdc_integral = %.0lf\n", N_ctdc_integral); |
- | |
2145 | 286 | } |
|
2146 | printf("N_ctdc_integral/N_poisson = %.3lf\n", N_ctdc_integral/N_poisson); |
- | |
2147 | printf("N_adc_integral/N_poisson = %.3lf\n", N_adc_integral/N_poisson); |
- | |
2148 | printf("N_ctdc_integral/N_adc_integral = %.3lf\n", N_ctdc_integral/N_adc_integral); |
- | |
2149 | 287 | } |
|
2150 | //~ sprintf(hname, "htdc_cut%d", ich); |
- | |
2151 | //~ hp1d = DrTH1F(dir, hname, ""); |
- | |
2152 | //~ hp1d->SetLineColor(kRed); |
- | |
2153 | //~ hp1d->DrawClone("SAME"); |
- | |
2154 | 288 | ||
2155 | sprintf(fullname, "gif/ |
289 | sprintf(fullname, "gif/%s_f.gif", fname); c[cc]->SaveAs(fullname); |
2156 | } |
290 | } |
2157 | 291 | ||
2158 | - | ||
2159 | // ------------------------------------------------------------------- |
292 | // ------------------------------------------------------------------- |
2160 | 293 | ||
2161 | if( strchr(plopt, |
294 | if( strchr(plopt, 'c') != NULL ) { |
- | 295 | ||
- | 296 | //gStyle->SetOptStat(1111); |
|
2162 | gStyle->SetOptStat(0); |
297 | gStyle->SetOptStat(0); |
2163 | gStyle->SetOptFit(0); |
298 | gStyle->SetOptFit(0); |
- | 299 | ||
- | 300 | c[++cc] = new TCanvas("c", "c", 0, 0, 1600, 900); |
|
- | 301 | c[cc]->Divide(2,2); |
|
- | 302 | ||
- | 303 | int draw_cuts = 0; |
|
- | 304 | int chmap[] = {0,1,2,31}; |
|
2164 | 305 | ||
- | 306 | for(int ich = 0;ich<4;ich++) { |
|
- | 307 | (c[cc]->cd(ich+1))->SetLogz(1); |
|
2165 |
|
308 | sprintf(hname, "hcor%d", chmap[ich]); |
- | 309 | hp2d = DrTH2F(dir, hname, ""); |
|
- | 310 | sprintf(htitle, "TDC%d - TRIGGER;ADC;Time [ns];Count", chmap[ich]); hp2d->SetTitle(htitle); |
|
- | 311 | hp2d->GetXaxis()->SetRangeUser(0,2048); |
|
- | 312 | hp2d->DrawClone("COLZ"); |
|
- | 313 | } |
|
- | 314 | ||
- | 315 | sprintf(fullname, "gif/%s_c.gif", fname); c[cc]->SaveAs(fullname); |
|
- | 316 | } |
|
- | 317 | //~ // ------------------------------------------------------------------- |
|
- | 318 | ||
- | 319 | //~ if( strchr(plopt, 'c') != NULL ) { |
|
2166 | 320 | ||
- | 321 | gStyle->SetOptStat(1111); |
|
2167 |
|
322 | //~ gStyle->SetOptStat(0); |
2168 |
|
323 | //~ gStyle->SetOptFit(0); |
2169 | 324 | ||
- | 325 | //~ c[++cc] = new TCanvas("c", "c", 0, 0, 1600, 900); |
|
- | 326 | ||
- | 327 | //~ int draw_cuts = 0; |
|
- | 328 | ||
- | 329 | //~ int ich = chich; |
|
2170 |
|
330 | //~ (c[cc]->cd(1))->SetLogz(1); |
2171 |
|
331 | //~ sprintf(hname, "hcor%d", ich); |
2172 |
|
332 | //~ hp2d = DrTH2F(dir, hname, ""); |
2173 | //~ |
333 | //~ sprintf(htitle, "TDC%d - TRIGGER;ADC;Time [ns];Count", ich); hp2d->SetTitle(htitle); |
2174 | //~ |
334 | //~ hp2d->GetXaxis()->SetRangeUser(512,2048); |
2175 | //~ |
335 | //~ hp2d->GetYaxis()->SetRangeUser(-10,20); |
2176 | hp1d->SetLineColor(kBlack); |
- | |
2177 | - | ||
2178 | //~ |
336 | //~ hp2d->DrawClone("COLZ"); |
2179 | 337 | ||
2180 | sprintf(hname, "Trigger(ch.%d)-Trigger(ch.31);Time [ns]", ich); |
- | |
2181 | plotCorTDC(hp1d, hname, -0.25, 0.25, -0.5, 0.5); |
- | |
2182 | 338 | ||
2183 |
|
339 | //~ sprintf(fullname, "gif/%s_c.gif", fname); c[cc]->SaveAs(fullname); |
- | 340 | //~ } |
|
2184 |
|
341 | |
2185 | // ------------------------------------------------------------------- |
342 | // ------------------------------------------------------------------- |
2186 | } |
343 | } |