322 bool existAr =
false;
324 float ptcutforerrors = 2;
331 float run,
evt, trk,
det, lay,
mod, stl, stw, brd, chp, fsid,
r,
dr,
t, rtrack, ttrack, drtrack,
t0, ephase,
theta,
phi,
pt,
d0, ToT, HT, qoverp, isArgonStraw;
337 map<int, CalHist *> histmap;
338 map<string, trackdata> trackmap;
340 int ntbins = 55, nrbins = 100, ntresbins = 100, nresbins = 100, nhistbins, maxvalue = 0;
342 double minr = 0, maxr = 2, mint = -5, maxt = 50, mintres = -10, maxtres = 10, minres = -0.6, maxres = 0.6;
350 nhistbins = ntbins * nrbins + 200;
354 std::vector<int> histdata(nhistbins, 0);
356 int nhits = 0,
nhists = 0;
357 int ntres = 0, nres = 0, nrt = 0;
358 int nhistsadd = 0, nbinsadd = 0, nhiststmp = 0;
360 int nfiles =
argc - 2;
361 cout <<
"PROCESSING " << nfiles <<
" FILE(S)" << endl
366 TH1F *residual_ref =
new TH1F(
"residual_-2_0_0_1",
"residual_-2_0_0_1", nresbins, minres, maxres);
367 TH1F *timeresidual_ref =
new TH1F(
"timeresidual_1_0_0_0_1",
"timeresidual_1_0_0_0_1", ntresbins, mintres, maxtres);
368 TH2F *rt_ref =
new TH2F(
"rt_-1_2",
"rt_-1_2", ntbins, mint, maxt, nrbins, minr, maxr);
369 TH2F *rt_ref2 =
new TH2F(
"rt_-1",
"rt_-1", ntbins, mint, maxt, nrbins, minr, maxr);
371 TH2F *reshist_trt =
new TH2F(
"residual_trt",
"residual_trt", ntbins, mint, maxt, 100, -0.4, 0.4);
372 TH2F *reshist_bar =
new TH2F(
"residual_bar",
"residual_bar", ntbins, mint, maxt, 100, -0.4, 0.4);
373 TH2F *reshist1 =
new TH2F(
"residual_1",
"residual_1", ntbins, mint, maxt, 100, -0.4, 0.4);
374 TH2F *reshist2 =
new TH2F(
"residual_-1",
"residual_-1", ntbins, mint, maxt, 100, -0.4, 0.4);
375 TH2F *reshist3 =
new TH2F(
"residual_2",
"residual_2", ntbins, mint, maxt, 100, -0.4, 0.4);
376 TH2F *reshist4 =
new TH2F(
"residual_-2",
"residual_-2", ntbins, mint, maxt, 100, -0.4, 0.4);
378 TH2F *treshist_trt =
new TH2F(
"timeresidual_trt",
"timeresidual_trt", 50, mintres, maxtres, nrbins, minr, maxr);
379 TH2F *treshist_bar =
new TH2F(
"timeresidual_bar",
"timeresidual_bar", 50, mintres, maxtres, nrbins, minr, maxr);
380 TH2F *treshist1 =
new TH2F(
"timeresidual_1",
"timeresidual_1", 50, mintres, maxtres, nrbins, minr, maxr);
381 TH2F *treshist2 =
new TH2F(
"timeresidual_-1",
"timeresidual_-1", 50, mintres, maxtres, nrbins, minr, maxr);
382 TH2F *treshist3 =
new TH2F(
"timeresidual_2",
"timeresidual_2", 50, mintres, maxtres, nrbins, minr, maxr);
383 TH2F *treshist4 =
new TH2F(
"timeresidual_-2",
"timeresidual_-2", 50, mintres, maxtres, nrbins, minr, maxr);
392 TH2F *pull_trt =
new TH2F(
"pull_trt",
"pull_TRT_allhits", 16, 0, 16, 200, -4, 4);
393 TH2F *pull_ba =
new TH2F(
"pull_ba",
"pull_BarrelA_allhits", 16, 0, 16, 200, -4, 4);
394 TH2F *pull_bc =
new TH2F(
"pull_bc",
"pull_BarrelC_allhits", 16, 0, 16, 200, -4, 4);
395 TH2F *pull_ea =
new TH2F(
"pull_ea",
"pull_EndcapA_allhits", 16, 0, 16, 200, -4, 4);
396 TH2F *pull_ec =
new TH2F(
"pull_ec",
"pull_EndcapC_allhits", 16, 0, 16, 200, -4, 4);
399 TH2F *residual_trt =
new TH2F(
"residual_allhits",
"residual_TRT_allhits", 16, 0, 16, 200, -2, 2);
400 TH2F *residual_ba =
new TH2F(
"residual_ba",
"residual_BarrelA_allhits", 16, 0, 16, 200, -2, 2);
401 TH2F *residual_bc =
new TH2F(
"residual_bc",
"residual_BarrelC_allhits", 16, 0, 16, 200, -2, 2);
402 TH2F *residual_ea =
new TH2F(
"residual_ea",
"residual_EndcapA_allhits", 16, 0, 16, 200, -2, 2);
403 TH2F *residual_ec =
new TH2F(
"residual_ec",
"residual_EndcapC_allhits", 16, 0, 16, 200, -2, 2);
406 TH2F *tresidual_trt =
new TH2F(
"tresidual_trt",
"tresidual_TRT_allhits", 16, 0, 16, 200, -20, 20);
407 TH2F *tresidual_ba =
new TH2F(
"tresidual_ba",
"tresidual_BarrelA_allhits", 16, 0, 16, 200, -20, 20);
408 TH2F *tresidual_bc =
new TH2F(
"tresidual_bc",
"tresidual_BarrelC_allhits", 16, 0, 16, 200, -20, 20);
409 TH2F *tresidual_ea =
new TH2F(
"tresidual_ea",
"tresidual_EndcapA_allhits", 16, 0, 16, 200, -20, 20);
410 TH2F *tresidual_ec =
new TH2F(
"tresidual_ec",
"tresidual_EndcapC_allhits", 16, 0, 16, 200, -20, 20);
413 TH2F *pull_trtP =
new TH2F(
"pull_trtP",
"pull_TRT_Phits", 16, 0, 16, 200, -4, 4);
414 TH2F *pull_baP =
new TH2F(
"pull_baP",
"pull_BarrelA_Phits", 16, 0, 16, 200, -4, 4);
415 TH2F *pull_bcP =
new TH2F(
"pull_bcP",
"pull_BarrelC_Phits", 16, 0, 16, 200, -4, 4);
416 TH2F *pull_eaP =
new TH2F(
"pull_eaP",
"pull_EndcapA_Phits", 16, 0, 16, 200, -4, 4);
417 TH2F *pull_ecP =
new TH2F(
"pull_ecP",
"pull_EndcapC_Phits", 16, 0, 16, 200, -4, 4);
419 TH2F *residual_trtP =
new TH2F(
"residual_trtP",
"residual_TRT_Phits", 16, 0, 16, 200, -2, 2);
420 TH2F *residual_baP =
new TH2F(
"residual_baP",
"residual_BarrelA_Phits", 16, 0, 16, 200, -2, 2);
421 TH2F *residual_bcP =
new TH2F(
"residual_bcP",
"residual_BarrelC_Phits", 16, 0, 16, 200, -2, 2);
422 TH2F *residual_eaP =
new TH2F(
"residual_eaP",
"residual_EndcapA_Phits", 16, 0, 16, 200, -2, 2);
423 TH2F *residual_ecP =
new TH2F(
"residual_ecP",
"residual_EndcapC_Phits", 16, 0, 16, 200, -2, 2);
425 TH2F *tresidual_trtP =
new TH2F(
"tresidual_trtP",
"residual_TRT_Phits", 16, 0, 16, 200, -20, 20);
426 TH2F *tresidual_baP =
new TH2F(
"tresidual_baP",
"residual_BarrelA_Phits", 16, 0, 16, 200, -20, 20);
427 TH2F *tresidual_bcP =
new TH2F(
"tresidual_bcP",
"residual_BarrelC_Phits", 16, 0, 16, 200, -20, 20);
428 TH2F *tresidual_eaP =
new TH2F(
"tresidual_eaP",
"residual_EndcapA_Phits", 16, 0, 16, 200, -20, 20);
429 TH2F *tresidual_ecP =
new TH2F(
"tresidual_ecP",
"residual_EndcapC_Phits", 16, 0, 16, 200, -20, 20);
431 TH2F *trackerrors_trtP =
new TH2F(
"trackerrors_trt",
"trackerrors_vs_pt_trt", 16, 0, 16, 200, 0, 0.2);
432 TH2F *trackerrors_baP =
new TH2F(
"trackerrors_ba",
"trackerrors_vs_pt_BarrelA", 16, 0, 16, 200, 0, .2);
433 TH2F *trackerrors_bcP =
new TH2F(
"trackerrors_bc",
"trackerrors_vs_pt_BarrelC", 16, 0, 16, 200, 0, .2);
434 TH2F *trackerrors_eaP =
new TH2F(
"trackerrors_ea",
"trackerrors_vs_pt_EndcapA", 16, 0, 16, 200, 0, .2);
435 TH2F *trackerrors_ecP =
new TH2F(
"trackerrors_ec",
"trackerrors_vs_pt_EndcapC", 16, 0, 16, 200, 0, .2);
446 TH2F *pull_vs_tb_trt =
new TH2F(
"pull_vs_tb_trt",
"pull_vs_timebin_trt", ntbins2, tmin, tmax, 200, -4, 4);
447 TH2F *pull_vs_tb_ba =
new TH2F(
"pull_vs_tb_ba",
"pull_vs_timebin_BarrelA", ntbins2, tmin, tmax, 200, -4, 4);
448 TH2F *pull_vs_tb_bc =
new TH2F(
"pull_vs_tb_bc",
"pull_vs_timebin_BarrelC", ntbins2, tmin, tmax, 200, -4, 4);
449 TH2F *pull_vs_tb_ea =
new TH2F(
"pull_vs_tb_ea",
"pull_vs_timebin_EndcapA", ntbins2, tmin, tmax, 200, -4, 4);
450 TH2F *pull_vs_tb_ec =
new TH2F(
"pull_vs_tb_ec",
"pull_vs_timebin_EndcapC", ntbins2, tmin, tmax, 200, -4, 4);
453 TH2F *errors_vs_tb_trt =
new TH2F(
"errors_vs_tb_trt",
"errors_vs_timebin_trt", ntbins2, tmin, tmax, 200, 0, 0.4);
454 TH2F *errors_vs_tb_ba =
new TH2F(
"errors_vs_tb_ba",
"errors_vs_timebin_BarrelA", ntbins2, tmin, tmax, 200, 0, 0.4);
455 TH2F *errors_vs_tb_bc =
new TH2F(
"errors_vs_tb_bc",
"errors_vs_timebin_BarrelC", ntbins2, tmin, tmax, 200, 0, 0.4);
456 TH2F *errors_vs_tb_ea =
new TH2F(
"errors_vs_tb_ea",
"errors_vs_timebin_EndcapA", ntbins2, tmin, tmax, 200, 0, 0.4);
457 TH2F *errors_vs_tb_ec =
new TH2F(
"errors_vs_tb_ec",
"errors_vs_timebin_EndcapC", ntbins2, tmin, tmax, 200, 0, 0.4);
460 TH2F *residual_vs_tb_trt =
new TH2F(
"residual_vs_tb_trt",
"residual_vs_timebin_trt", ntbins2, tmin, tmax, 200, -2, .2);
461 TH2F *residual_vs_tb_ba =
new TH2F(
"residual_vs_tb_ba",
"residual_vs_timebin_BarrelA", ntbins2, tmin, tmax, 200, -2, .2);
462 TH2F *residual_vs_tb_bc =
new TH2F(
"residual_vs_tb_bc",
"residual_vs_timebin_BarrelC", ntbins2, tmin, tmax, 200, -2, .2);
463 TH2F *residual_vs_tb_ea =
new TH2F(
"residual_vs_tb_ea",
"residual_vs_timebin_EndcapA", ntbins2, tmin, tmax, 200, -2, .2);
464 TH2F *residual_vs_tb_ec =
new TH2F(
"residual_vs_tb_ec",
"residual_vs_timebin_EndcapC", ntbins2, tmin, tmax, 200, -2, .2);
467 TH2F *trackerrors_vs_tb_trt =
new TH2F(
"trackerrors_vs_tb_trt",
"trackerrors_vs_timebin_trt", ntbins2, tmin, tmax, 200, 0, 0.2);
468 TH2F *trackerrors_vs_tb_ba =
new TH2F(
"trackerrors_vs_tb_ba",
"trackerrors_vs_timebin_BarrelA", ntbins2, tmin, tmax, 200, 0, .2);
469 TH2F *trackerrors_vs_tb_bc =
new TH2F(
"trackerrors_vs_tb_bc",
"trackerrors_vs_timebin_BarrelC", ntbins2, tmin, tmax, 200, 0, .2);
470 TH2F *trackerrors_vs_tb_ea =
new TH2F(
"trackerrors_vs_tb_ea",
"trackerrors_vs_timebin_EndcapA", ntbins2, tmin, tmax, 200, 0, .2);
471 TH2F *trackerrors_vs_tb_ec =
new TH2F(
"trackerrors_vs_tb_ec",
"trackerrors_vs_timebin_EndcapC", ntbins2, tmin, tmax, 200, 0, .2);
474 TH2F *tres_vs_ToT_trt =
new TH2F(
"tres_vs_ToT_trt",
"tres_vs_ToT_trt", 24, -0.5, 23.5, 200, -20, 20);
475 TH2F *tres_vs_ToT_ba =
new TH2F(
"tres_vs_ToT_ba",
"tres_vs_ToT_ba", 24, -0.5, 23.5, 200, -20, 20);
476 TH2F *tres_vs_ToT_bc =
new TH2F(
"tres_vs_ToT_bc",
"tres_vs_ToT_bc", 24, -0.5, 23.5, 200, -20, 20);
477 TH2F *tres_vs_ToT_ea =
new TH2F(
"tres_vs_ToT_ea",
"tres_vs_ToT_ea", 24, -0.5, 23.5, 200, -20, 20);
478 TH2F *tres_vs_ToT_ec =
new TH2F(
"tres_vs_ToT_ec",
"tres_vs_ToT_ec", 24, -0.5, 23.5, 200, -20, 20);
481 TH2F *res_vs_ToT_trt =
new TH2F(
"res_vs_ToT_trt",
"res_vs_ToT_trt", 24, -0.5, 23.5, 200, -2, 2);
482 TH2F *res_vs_ToT_ba =
new TH2F(
"res_vs_ToT_ba",
"res_vs_ToT_ba", 24, -0.5, 23.5, 200, -2, 2);
483 TH2F *res_vs_ToT_bc =
new TH2F(
"res_vs_ToT_bc",
"res_vs_ToT_bc", 24, -0.5, 23.5, 200, -2, 2);
484 TH2F *res_vs_ToT_ea =
new TH2F(
"res_vs_ToT_ea",
"res_vs_ToT_ea", 24, -0.5, 23.5, 200, -2, 2);
485 TH2F *res_vs_ToT_ec =
new TH2F(
"res_vs_ToT_ec",
"res_vs_ToT_ec", 24, -0.5, 23.5, 200, -2, 2);
488 TH2F *tres_vs_HT_trt =
new TH2F(
"tres_vs_HT_trt",
"tres_vs_HT_trt", 2, -0.5, 1.5, 200, -20, 20);
489 TH2F *tres_vs_HT_ba =
new TH2F(
"tres_vs_HT_ba",
"tres_vs_HT_ba", 2, -0.5, 1.5, 200, -20, 20);
490 TH2F *tres_vs_HT_bc =
new TH2F(
"tres_vs_HT_bc",
"tres_vs_HT_bc", 2, -0.5, 1.5, 200, -20, 20);
491 TH2F *tres_vs_HT_ea =
new TH2F(
"tres_vs_HT_ea",
"tres_vs_HT_ea", 2, -0.5, 1.5, 200, -20, 20);
492 TH2F *tres_vs_HT_ec =
new TH2F(
"tres_vs_HT_ec",
"tres_vs_HT_ec", 2, -0.5, 1.5, 200, -20, 20);
495 TH2F *res_vs_HT_trt =
new TH2F(
"res_vs_HT_trt",
"res_vs_HT_trt", 2, -0.5, 1.5, 200, -2, 2);
496 TH2F *res_vs_HT_ba =
new TH2F(
"res_vs_HT_ba",
"res_vs_HT_ba", 2, -0.5, 1.5, 200, -2, 2);
497 TH2F *res_vs_HT_bc =
new TH2F(
"res_vs_HT_bc",
"res_vs_HT_bc", 2, -0.5, 1.5, 200, -2, 2);
498 TH2F *res_vs_HT_ea =
new TH2F(
"res_vs_HT_ea",
"res_vs_HT_ea", 2, -0.5, 1.5, 200, -2, 2);
499 TH2F *res_vs_HT_ec =
new TH2F(
"res_vs_HT_ec",
"res_vs_HT_ec", 2, -0.5, 1.5, 200, -2, 2);
502 TH2F *tres_vs_SinOverP_trt =
new TH2F(
"tres_vs_SinOverP_trt",
"tres_vs_SinOverP_trt", 24, 0., 1., 200, -20., 20.);
503 TH2F *tres_vs_SinOverP_ba =
new TH2F(
"tres_vs_SinOverP_ba",
"tres_vs_SinOverP_ba", 24, 0., 1., 200, -20., 20.);
504 TH2F *tres_vs_SinOverP_bc =
new TH2F(
"tres_vs_SinOverP_bc",
"tres_vs_SinOverP_bc", 24, 0., 1., 200, -20., 20.);
505 TH2F *tres_vs_SinOverP_ea =
new TH2F(
"tres_vs_SinOverP_ea",
"tres_vs_SinOverP_ea", 24, 0., 1., 200, -20., 20.);
506 TH2F *tres_vs_SinOverP_ec =
new TH2F(
"tres_vs_SinOverP_ec",
"tres_vs_SinOverP_ec", 24, 0., 1., 200, -20., 20.);
509 TH2F *res_vs_SinOverP_trt =
new TH2F(
"res_vs_SinOverP_trt",
"res_vs_SinOverP_trt", 24, 0., 1., 200, -2., 2.);
510 TH2F *res_vs_SinOverP_ba =
new TH2F(
"res_vs_SinOverP_ba",
"res_vs_SinOverP_ba", 24, 0., 1., 200, -2., 2.);
511 TH2F *res_vs_SinOverP_bc =
new TH2F(
"res_vs_SinOverP_bc",
"res_vs_SinOverP_bc", 24, 0., 1., 200, -2., 2.);
512 TH2F *res_vs_SinOverP_ea =
new TH2F(
"res_vs_SinOverP_ea",
"res_vs_SinOverP_ea", 24, 0., 1., 200, -2., 2.);
513 TH2F *res_vs_SinOverP_ec =
new TH2F(
"res_vs_SinOverP_ec",
"res_vs_SinOverP_ec", 24, 0., 1., 200, -2., 2.);
516 TH2F *tres_vs_CosOverP_trt =
new TH2F(
"tres_vs_CosOverP_trt",
"tres_vs_CosOverP_trt", 24, 0., 1., 200, -20., 20.);
517 TH2F *tres_vs_CosOverP_ba =
new TH2F(
"tres_vs_CosOverP_ba",
"tres_vs_CosOverP_ba", 24, 0., 1., 200, -20., 20.);
518 TH2F *tres_vs_CosOverP_bc =
new TH2F(
"tres_vs_CosOverP_bc",
"tres_vs_CosOverP_bc", 24, 0., 1., 200, -20., 20.);
519 TH2F *tres_vs_CosOverP_ea =
new TH2F(
"tres_vs_CosOverP_ea",
"tres_vs_CosOverP_ea", 24, 0., 1., 200, -20., 20.);
520 TH2F *tres_vs_CosOverP_ec =
new TH2F(
"tres_vs_CosOverP_ec",
"tres_vs_CosOverP_ec", 24, 0., 1., 200, -20., 20.);
523 TH2F *res_vs_CosOverP_trt =
new TH2F(
"res_vs_CosOverP_trt",
"res_vs_CosOverP_trt", 24, 0., 1., 200, -2., 2.);
524 TH2F *res_vs_CosOverP_ba =
new TH2F(
"res_vs_CosOverP_ba",
"res_vs_CosOverP_ba", 24, 0., 1., 200, -2., 2.);
525 TH2F *res_vs_CosOverP_bc =
new TH2F(
"res_vs_CosOverP_bc",
"res_vs_CosOverP_bc", 24, 0., 1., 200, -2., 2.);
526 TH2F *res_vs_CosOverP_ea =
new TH2F(
"res_vs_CosOverP_ea",
"res_vs_CosOverP_ea", 24, 0., 1., 200, -2., 2.);
527 TH2F *res_vs_CosOverP_ec =
new TH2F(
"res_vs_CosOverP_ec",
"res_vs_CosOverP_ec", 24, 0., 1., 200, -2., 2.);
530 TH2F *resArhist_trt =
new TH2F(
"residualAr_trt",
"residualAr_trt", ntbins, mint, maxt, 100, -0.4, 0.4);
531 TH2F *resArhist_bar =
new TH2F(
"residualAr_bar",
"residualAr_bar", ntbins, mint, maxt, 100, -0.4, 0.4);
532 TH2F *resArhist1 =
new TH2F(
"residualAr_1",
"residualAr_1", ntbins, mint, maxt, 100, -0.4, 0.4);
533 TH2F *resArhist2 =
new TH2F(
"residualAr_-1",
"residualAr_-1", ntbins, mint, maxt, 100, -0.4, 0.4);
534 TH2F *resArhist3 =
new TH2F(
"residualAr_2",
"residualAr_2", ntbins, mint, maxt, 100, -0.4, 0.4);
535 TH2F *resArhist4 =
new TH2F(
"residualAr_-2",
"residualAr_-2", ntbins, mint, maxt, 100, -0.4, 0.4);
537 TH2F *tresArhist_trt =
new TH2F(
"timeresidualAr_trt",
"timeresidualAr_trt", 50, mintres, maxtres, nrbins, minr, maxr);
538 TH2F *tresArhist_bar =
new TH2F(
"timeresidualAr_bar",
"timeresidualAr_bar", 50, mintres, maxtres, nrbins, minr, maxr);
539 TH2F *tresArhist1 =
new TH2F(
"timeresidualAr_1",
"timeresidualAr_1", 50, mintres, maxtres, nrbins, minr, maxr);
540 TH2F *tresArhist2 =
new TH2F(
"timeresidualAr_-1",
"timeresidualAr_-1", 50, mintres, maxtres, nrbins, minr, maxr);
541 TH2F *tresArhist3 =
new TH2F(
"timeresidualAr_2",
"timeresidualAr_2", 50, mintres, maxtres, nrbins, minr, maxr);
542 TH2F *tresArhist4 =
new TH2F(
"timeresidualAr_-2",
"timeresidualAr_-2", 50, mintres, maxtres, nrbins, minr, maxr);
547 TH2F *pullAr_trt =
new TH2F(
"pullAr_trt",
"pullAr_TRT_allhits", 16, 0, 16, 200, -4, 4);
548 TH2F *pullAr_ba =
new TH2F(
"pullAr_ba",
"pullAr_BarrelA_allhits", 16, 0, 16, 200, -4, 4);
549 TH2F *pullAr_bc =
new TH2F(
"pullAr_bc",
"pullAr_BarrelC_allhits", 16, 0, 16, 200, -4, 4);
550 TH2F *pullAr_ea =
new TH2F(
"pullAr_ea",
"pullAr_EndcapA_allhits", 16, 0, 16, 200, -4, 4);
551 TH2F *pullAr_ec =
new TH2F(
"pullAr_ec",
"pullAr_EndcapC_allhits", 16, 0, 16, 200, -4, 4);
554 TH2F *residualAr_trt =
new TH2F(
"residualAr_allhits",
"residualAr_TRT_allhits", 16, 0, 16, 200, -2, 2);
555 TH2F *residualAr_ba =
new TH2F(
"residualAr_ba",
"residualAr_BarrelA_allhits", 16, 0, 16, 200, -2, 2);
556 TH2F *residualAr_bc =
new TH2F(
"residualAr_bc",
"residualAr_BarrelC_allhits", 16, 0, 16, 200, -2, 2);
557 TH2F *residualAr_ea =
new TH2F(
"residualAr_ea",
"residualAr_EndcapA_allhits", 16, 0, 16, 200, -2, 2);
558 TH2F *residualAr_ec =
new TH2F(
"residualAr_ec",
"residualAr_EndcapC_allhits", 16, 0, 16, 200, -2, 2);
561 TH2F *tresidualAr_trt =
new TH2F(
"tresidualAr_trt",
"tresidualAr_TRT_allhits", 16, 0, 16, 200, -20, 20);
562 TH2F *tresidualAr_ba =
new TH2F(
"tresidualAr_ba",
"tresidualAr_BarrelA_allhits", 16, 0, 16, 200, -20, 20);
563 TH2F *tresidualAr_bc =
new TH2F(
"tresidualAr_bc",
"tresidualAr_BarrelC_allhits", 16, 0, 16, 200, -20, 20);
564 TH2F *tresidualAr_ea =
new TH2F(
"tresidualAr_ea",
"tresidualAr_EndcapA_allhits", 16, 0, 16, 200, -20, 20);
565 TH2F *tresidualAr_ec =
new TH2F(
"tresidualAr_ec",
"tresidualAr_EndcapC_allhits", 16, 0, 16, 200, -20, 20);
568 TH2F *pullAr_trtP =
new TH2F(
"pullAr_trtP",
"pullAr_TRT_Phits", 16, 0, 16, 200, -4, 4);
569 TH2F *pullAr_baP =
new TH2F(
"pullAr_baP",
"pullAr_BarrelA_Phits", 16, 0, 16, 200, -4, 4);
570 TH2F *pullAr_bcP =
new TH2F(
"pullAr_bcP",
"pullAr_BarrelC_Phits", 16, 0, 16, 200, -4, 4);
571 TH2F *pullAr_eaP =
new TH2F(
"pullAr_eaP",
"pullAr_EndcapA_Phits", 16, 0, 16, 200, -4, 4);
572 TH2F *pullAr_ecP =
new TH2F(
"pullAr_ecP",
"pullAr_EndcapC_Phits", 16, 0, 16, 200, -4, 4);
574 TH2F *residualAr_trtP =
new TH2F(
"residualAr_trtP",
"residualAr_TRT_Phits", 16, 0, 16, 200, -2, 2);
575 TH2F *residualAr_baP =
new TH2F(
"residualAr_baP",
"residualAr_BarrelA_Phits", 16, 0, 16, 200, -2, 2);
576 TH2F *residualAr_bcP =
new TH2F(
"residualAr_bcP",
"residualAr_BarrelC_Phits", 16, 0, 16, 200, -2, 2);
577 TH2F *residualAr_eaP =
new TH2F(
"residualAr_eaP",
"residualAr_EndcapA_Phits", 16, 0, 16, 200, -2, 2);
578 TH2F *residualAr_ecP =
new TH2F(
"residualAr_ecP",
"residualAr_EndcapC_Phits", 16, 0, 16, 200, -2, 2);
580 TH2F *tresidualAr_trtP =
new TH2F(
"tresidualAr_trtP",
"residualAr_TRT_Phits", 16, 0, 16, 200, -20, 20);
581 TH2F *tresidualAr_baP =
new TH2F(
"tresidualAr_baP",
"residualAr_BarrelA_Phits", 16, 0, 16, 200, -20, 20);
582 TH2F *tresidualAr_bcP =
new TH2F(
"tresidualAr_bcP",
"residualAr_BarrelC_Phits", 16, 0, 16, 200, -20, 20);
583 TH2F *tresidualAr_eaP =
new TH2F(
"tresidualAr_eaP",
"residualAr_EndcapA_Phits", 16, 0, 16, 200, -20, 20);
584 TH2F *tresidualAr_ecP =
new TH2F(
"tresidualAr_ecP",
"residualAr_EndcapC_Phits", 16, 0, 16, 200, -20, 20);
586 TH2F *trackerrorsAr_trtP =
new TH2F(
"trackerrorsAr_trt",
"trackerrorsAr_vs_pt_trt", 16, 0, 16, 200, 0, 0.2);
587 TH2F *trackerrorsAr_baP =
new TH2F(
"trackerrorsAr_ba",
"trackerrorsAr_vs_pt_BarrelA", 16, 0, 16, 200, 0, .2);
588 TH2F *trackerrorsAr_bcP =
new TH2F(
"trackerrorsAr_bc",
"trackerrorsAr_vs_pt_BarrelC", 16, 0, 16, 200, 0, .2);
589 TH2F *trackerrorsAr_eaP =
new TH2F(
"trackerrorsAr_ea",
"trackerrorsAr_vs_pt_EndcapA", 16, 0, 16, 200, 0, .2);
590 TH2F *trackerrorsAr_ecP =
new TH2F(
"trackerrorsAr_ec",
"trackerrorsAr_vs_pt_EndcapC", 16, 0, 16, 200, 0, .2);
595 TH2F *pullAr_vs_tb_trt =
new TH2F(
"pullAr_vs_tb_trt",
"pullAr_vs_timebin_trt", ntbins2, tmin, tmax, 200, -4, 4);
596 TH2F *pullAr_vs_tb_ba =
new TH2F(
"pullAr_vs_tb_ba",
"pullAr_vs_timebin_BarrelA", ntbins2, tmin, tmax, 200, -4, 4);
597 TH2F *pullAr_vs_tb_bc =
new TH2F(
"pullAr_vs_tb_bc",
"pullAr_vs_timebin_BarrelC", ntbins2, tmin, tmax, 200, -4, 4);
598 TH2F *pullAr_vs_tb_ea =
new TH2F(
"pullAr_vs_tb_ea",
"pullAr_vs_timebin_EndcapA", ntbins2, tmin, tmax, 200, -4, 4);
599 TH2F *pullAr_vs_tb_ec =
new TH2F(
"pullAr_vs_tb_ec",
"pullAr_vs_timebin_EndcapC", ntbins2, tmin, tmax, 200, -4, 4);
602 TH2F *errorsAr_vs_tb_trt =
new TH2F(
"errorsAr_vs_tb_trt",
"errorsAr_vs_timebin_trt", ntbins2, tmin, tmax, 200, 0, 0.4);
603 TH2F *errorsAr_vs_tb_ba =
new TH2F(
"errorsAr_vs_tb_ba",
"errorsAr_vs_timebin_BarrelA", ntbins2, tmin, tmax, 200, 0, 0.4);
604 TH2F *errorsAr_vs_tb_bc =
new TH2F(
"errorsAr_vs_tb_bc",
"errorsAr_vs_timebin_BarrelC", ntbins2, tmin, tmax, 200, 0, 0.4);
605 TH2F *errorsAr_vs_tb_ea =
new TH2F(
"errorsAr_vs_tb_ea",
"errorsAr_vs_timebin_EndcapA", ntbins2, tmin, tmax, 200, 0, 0.4);
606 TH2F *errorsAr_vs_tb_ec =
new TH2F(
"errorsAr_vs_tb_ec",
"errorsAr_vs_timebin_EndcapC", ntbins2, tmin, tmax, 200, 0, 0.4);
609 TH2F *residualAr_vs_tb_trt =
new TH2F(
"residualAr_vs_tb_trt",
"residualAr_vs_timebin_trt", ntbins2, tmin, tmax, 200, -2, .2);
610 TH2F *residualAr_vs_tb_ba =
new TH2F(
"residualAr_vs_tb_ba",
"residualAr_vs_timebin_BarrelA", ntbins2, tmin, tmax, 200, -2, .2);
611 TH2F *residualAr_vs_tb_bc =
new TH2F(
"residualAr_vs_tb_bc",
"residualAr_vs_timebin_BarrelC", ntbins2, tmin, tmax, 200, -2, .2);
612 TH2F *residualAr_vs_tb_ea =
new TH2F(
"residualAr_vs_tb_ea",
"residualAr_vs_timebin_EndcapA", ntbins2, tmin, tmax, 200, -2, .2);
613 TH2F *residualAr_vs_tb_ec =
new TH2F(
"residualAr_vs_tb_ec",
"residualAr_vs_timebin_EndcapC", ntbins2, tmin, tmax, 200, -2, .2);
616 TH2F *trackerrorsAr_vs_tb_trt =
new TH2F(
"trackerrorsAr_vs_tb_trt",
"trackerrorsAr_vs_timebin_trt", ntbins2, tmin, tmax, 200, 0, 0.2);
617 TH2F *trackerrorsAr_vs_tb_ba =
new TH2F(
"trackerrorsAr_vs_tb_ba",
"trackerrorsAr_vs_timebin_BarrelA", ntbins2, tmin, tmax, 200, 0, .2);
618 TH2F *trackerrorsAr_vs_tb_bc =
new TH2F(
"trackerrorsAr_vs_tb_bc",
"trackerrorsAr_vs_timebin_BarrelC", ntbins2, tmin, tmax, 200, 0, .2);
619 TH2F *trackerrorsAr_vs_tb_ea =
new TH2F(
"trackerrorsAr_vs_tb_ea",
"trackerrorsAr_vs_timebin_EndcapA", ntbins2, tmin, tmax, 200, 0, .2);
620 TH2F *trackerrorsAr_vs_tb_ec =
new TH2F(
"trackerrorsAr_vs_tb_ec",
"trackerrorsAr_vs_timebin_EndcapC", ntbins2, tmin, tmax, 200, 0, .2);
623 TH2F *tresAr_vs_ToT_trt =
new TH2F(
"tresAr_vs_ToT_trt",
"tresAr_vs_ToT_trt", 24, -0.5, 23.5, 200, -20, 20);
624 TH2F *tresAr_vs_ToT_ba =
new TH2F(
"tresAr_vs_ToT_ba",
"tresAr_vs_ToT_ba", 24, -0.5, 23.5, 200, -20, 20);
625 TH2F *tresAr_vs_ToT_bc =
new TH2F(
"tresAr_vs_ToT_bc",
"tresAr_vs_ToT_bc", 24, -0.5, 23.5, 200, -20, 20);
626 TH2F *tresAr_vs_ToT_ea =
new TH2F(
"tresAr_vs_ToT_ea",
"tresAr_vs_ToT_ea", 24, -0.5, 23.5, 200, -20, 20);
627 TH2F *tresAr_vs_ToT_ec =
new TH2F(
"tresAr_vs_ToT_ec",
"tresAr_vs_ToT_ec", 24, -0.5, 23.5, 200, -20, 20);
630 TH2F *resAr_vs_ToT_trt =
new TH2F(
"resAr_vs_ToT_trt",
"resAr_vs_ToT_trt", 24, -0.5, 23.5, 200, -2, 2);
631 TH2F *resAr_vs_ToT_ba =
new TH2F(
"resAr_vs_ToT_ba",
"resAr_vs_ToT_ba", 24, -0.5, 23.5, 200, -2, 2);
632 TH2F *resAr_vs_ToT_bc =
new TH2F(
"resAr_vs_ToT_bc",
"resAr_vs_ToT_bc", 24, -0.5, 23.5, 200, -2, 2);
633 TH2F *resAr_vs_ToT_ea =
new TH2F(
"resAr_vs_ToT_ea",
"resAr_vs_ToT_ea", 24, -0.5, 23.5, 200, -2, 2);
634 TH2F *resAr_vs_ToT_ec =
new TH2F(
"resAr_vs_ToT_ec",
"resAr_vs_ToT_ec", 24, -0.5, 23.5, 200, -2, 2);
637 TH2F *tresAr_vs_HT_trt =
new TH2F(
"tresAr_vs_HT_trt",
"tresAr_vs_HT_trt", 2, -0.5, 1.5, 200, -20, 20);
638 TH2F *tresAr_vs_HT_ba =
new TH2F(
"tresAr_vs_HT_ba",
"tresAr_vs_HT_ba", 2, -0.5, 1.5, 200, -20, 20);
639 TH2F *tresAr_vs_HT_bc =
new TH2F(
"tresAr_vs_HT_bc",
"tresAr_vs_HT_bc", 2, -0.5, 1.5, 200, -20, 20);
640 TH2F *tresAr_vs_HT_ea =
new TH2F(
"tresAr_vs_HT_ea",
"tresAr_vs_HT_ea", 2, -0.5, 1.5, 200, -20, 20);
641 TH2F *tresAr_vs_HT_ec =
new TH2F(
"tresAr_vs_HT_ec",
"tresAr_vs_HT_ec", 2, -0.5, 1.5, 200, -20, 20);
644 TH2F *resAr_vs_HT_trt =
new TH2F(
"resAr_vs_HT_trt",
"resAr_vs_HT_trt", 2, -0.5, 1.5, 200, -2, 2);
645 TH2F *resAr_vs_HT_ba =
new TH2F(
"resAr_vs_HT_ba",
"resAr_vs_HT_ba", 2, -0.5, 1.5, 200, -2, 2);
646 TH2F *resAr_vs_HT_bc =
new TH2F(
"resAr_vs_HT_bc",
"resAr_vs_HT_bc", 2, -0.5, 1.5, 200, -2, 2);
647 TH2F *resAr_vs_HT_ea =
new TH2F(
"resAr_vs_HT_ea",
"resAr_vs_HT_ea", 2, -0.5, 1.5, 200, -2, 2);
648 TH2F *resAr_vs_HT_ec =
new TH2F(
"resAr_vs_HT_ec",
"resAr_vs_HT_ec", 2, -0.5, 1.5, 200, -2, 2);
651 TH2F *tresAr_vs_SinOverP_trt =
new TH2F(
"tresAr_vs_SinOverP_trt",
"tresAr_vs_SinOverP_trt", 24, 0., 1., 200, -20., 20.);
652 TH2F *tresAr_vs_SinOverP_ba =
new TH2F(
"tresAr_vs_SinOverP_ba",
"tresAr_vs_SinOverP_ba", 24, 0., 1., 200, -20., 20.);
653 TH2F *tresAr_vs_SinOverP_bc =
new TH2F(
"tresAr_vs_SinOverP_bc",
"tresAr_vs_SinOverP_bc", 24, 0., 1., 200, -20., 20.);
654 TH2F *tresAr_vs_SinOverP_ea =
new TH2F(
"tresAr_vs_SinOverP_ea",
"tresAr_vs_SinOverP_ea", 24, 0., 1., 200, -20., 20.);
655 TH2F *tresAr_vs_SinOverP_ec =
new TH2F(
"tresAr_vs_SinOverP_ec",
"tresAr_vs_SinOverP_ec", 24, 0., 1., 200, -20., 20.);
658 TH2F *resAr_vs_SinOverP_trt =
new TH2F(
"resAr_vs_SinOverP_trt",
"resAr_vs_SinOverP_trt", 24, 0., 1., 200, -2., 2.);
659 TH2F *resAr_vs_SinOverP_ba =
new TH2F(
"resAr_vs_SinOverP_ba",
"resAr_vs_SinOverP_ba", 24, 0., 1., 200, -2., 2.);
660 TH2F *resAr_vs_SinOverP_bc =
new TH2F(
"resAr_vs_SinOverP_bc",
"resAr_vs_SinOverP_bc", 24, 0., 1., 200, -2., 2.);
661 TH2F *resAr_vs_SinOverP_ea =
new TH2F(
"resAr_vs_SinOverP_ea",
"resAr_vs_SinOverP_ea", 24, 0., 1., 200, -2., 2.);
662 TH2F *resAr_vs_SinOverP_ec =
new TH2F(
"resAr_vs_SinOverP_ec",
"resAr_vs_SinOverP_ec", 24, 0., 1., 200, -2., 2.);
665 TH2F *tresAr_vs_CosOverP_trt =
new TH2F(
"tresAr_vs_CosOverP_trt",
"tresAr_vs_CosOverP_trt", 24, 0., 1., 200, -20., 20.);
666 TH2F *tresAr_vs_CosOverP_ba =
new TH2F(
"tresAr_vs_CosOverP_ba",
"tresAr_vs_CosOverP_ba", 24, 0., 1., 200, -20., 20.);
667 TH2F *tresAr_vs_CosOverP_bc =
new TH2F(
"tresAr_vs_CosOverP_bc",
"tresAr_vs_CosOverP_bc", 24, 0., 1., 200, -20., 20.);
668 TH2F *tresAr_vs_CosOverP_ea =
new TH2F(
"tresAr_vs_CosOverP_ea",
"tresAr_vs_CosOverP_ea", 24, 0., 1., 200, -20., 20.);
669 TH2F *tresAr_vs_CosOverP_ec =
new TH2F(
"tresAr_vs_CosOverP_ec",
"tresAr_vs_CosOverP_ec", 24, 0., 1., 200, -20., 20.);
672 TH2F *resAr_vs_CosOverP_trt =
new TH2F(
"resAr_vs_CosOverP_trt",
"resAr_vs_CosOverP_trt", 24, 0., 1., 200, -2., 2.);
673 TH2F *resAr_vs_CosOverP_ba =
new TH2F(
"resAr_vs_CosOverP_ba",
"resAr_vs_CosOverP_ba", 24, 0., 1., 200, -2., 2.);
674 TH2F *resAr_vs_CosOverP_bc =
new TH2F(
"resAr_vs_CosOverP_bc",
"resAr_vs_CosOverP_bc", 24, 0., 1., 200, -2., 2.);
675 TH2F *resAr_vs_CosOverP_ea =
new TH2F(
"resAr_vs_CosOverP_ea",
"resAr_vs_CosOverP_ea", 24, 0., 1., 200, -2., 2.);
676 TH2F *resAr_vs_CosOverP_ec =
new TH2F(
"resAr_vs_CosOverP_ec",
"resAr_vs_CosOverP_ec", 24, 0., 1., 200, -2., 2.);
684 for (
int ifiles = 0; ifiles < nfiles; ifiles++)
688 bool isntuple =
false;
690 ifstream
myFile(
argv[ifiles + 2], ios::in | ios::binary);
693 myFile.read((
char *)filetype, 4);
695 if (strcmp(filetype,
"root") == 0)
702 std::cerr <<
"WRONG INPUT FILE!\n";
714 TFile *ntfile =
new TFile(
argv[ifiles + 2]);
715 TNtuple *hittuple = (TNtuple *)ntfile->Get(
"ntuple");
717 hittuple->SetBranchAddress(
"run", &
run);
718 hittuple->SetBranchAddress(
"evt", &
evt);
719 hittuple->SetBranchAddress(
"trk", &trk);
720 hittuple->SetBranchAddress(
"det", &
det);
721 hittuple->SetBranchAddress(
"lay", &lay);
722 hittuple->SetBranchAddress(
"mod", &
mod);
723 hittuple->SetBranchAddress(
"brd", &brd);
724 hittuple->SetBranchAddress(
"chp", &chp);
725 hittuple->SetBranchAddress(
"sid", &fsid);
726 hittuple->SetBranchAddress(
"stl", &stl);
727 hittuple->SetBranchAddress(
"stw", &stw);
728 hittuple->SetBranchAddress(
"r", &
r);
729 hittuple->SetBranchAddress(
"dr", &
dr);
730 hittuple->SetBranchAddress(
"dr", &
dr);
731 hittuple->SetBranchAddress(
"t", &
t);
732 hittuple->SetBranchAddress(
"t0", &
t0);
735 hittuple->SetBranchAddress(
"rtrackunbias", &rtrack);
736 hittuple->SetBranchAddress(
"drrtrackunbias", &drtrack);
737 hittuple->SetBranchAddress(
"ttrackunbias", &ttrack);
738 hittuple->SetBranchAddress(
"ephase", &ephase);
740 if (hittuple->GetListOfBranches()->FindObject(
"theta"))
742 hittuple->SetBranchAddress(
"theta", &
theta);
744 if (hittuple->GetListOfBranches()->FindObject(
"phi"))
746 hittuple->SetBranchAddress(
"phi", &
phi);
748 if (hittuple->GetListOfBranches()->FindObject(
"d0"))
750 hittuple->SetBranchAddress(
"d0", &
d0);
752 if (hittuple->GetListOfBranches()->FindObject(
"pt"))
754 hittuple->SetBranchAddress(
"pt", &
pt);
756 if (hittuple->GetListOfBranches()->FindObject(
"ToT"))
758 hittuple->SetBranchAddress(
"ToT", &ToT);
762 if (hittuple->GetListOfBranches()->FindObject(
"HT"))
764 hittuple->SetBranchAddress(
"HT", &HT);
768 if (hittuple->GetListOfBranches()->FindObject(
"qoverp"))
770 hittuple->SetBranchAddress(
"qoverp", &qoverp);
775 if (hittuple->GetListOfBranches()->FindObject(
"isArgonStraw"))
777 hittuple->SetBranchAddress(
"isArgonStraw", &isArgonStraw);
785 nevents = hittuple->GetEntries();
787 cout <<
"SCANNING ROOT FILE " <<
argv[ifiles + 2] <<
" (" <<
nevents <<
" HITS)" << endl;
791 for (
int ievt = 0; ievt <
nevents; ievt++)
798 hittuple->GetEntry(ievt);
806 string trkkey = string(Form(
"_%i_%i_%i", (
int)
run, (
int)
evt, (
int)trk));
808 string pt0key = string(Form(
"_%i_%i_%i_%i_%i", (
int)
det, (
int)lay, (
int)
mod, (
int)stl, (
int)stw));
809 if (pt0map.find(pt0key) != pt0map.end())
811 diffpt0 += fabs(
t0 - pt0map[
string(Form(
"_%i_%i_%i_%i_%i", (
int)
det, (
int)lay, (
int)
mod, (
int)stl, (
int)stw))].
t0);
812 t0 = pt0map[string(Form(
"_%i_%i_%i_%i_%i", (
int)
det, (
int)lay, (
int)
mod, (
int)stl, (
int)stw))].t0;
817 if (trackmap.find(trkkey) == trackmap.end())
819 trackmap[trkkey].run =
run;
820 trackmap[trkkey].event =
evt;
821 trackmap[trkkey].track = trk;
822 trackmap[trkkey].epnew = (
t + ephase) -
t0 - ttrack;
823 trackmap[trkkey].epold = ephase;
824 trackmap[trkkey].nhits = 1.0;
825 trackmap[trkkey].t =
t;
826 trackmap[trkkey].ttrack = ttrack;
827 trackmap[trkkey].t0 =
t0;
828 trackmap[trkkey].theta =
theta;
829 trackmap[trkkey].phi =
phi;
830 trackmap[trkkey].d0 =
d0;
831 trackmap[trkkey].pt =
pt;
832 trackmap[trkkey].trackres = (
r - rtrack) * (
r - rtrack);
833 trackmap[trkkey].trackresMean = (
r - rtrack);
837 trackmap[trkkey].epnew += (
t + ephase) -
t0 - ttrack;
838 trackmap[trkkey].t +=
t;
839 trackmap[trkkey].ttrack += ttrack;
840 trackmap[trkkey].t0 +=
t0;
841 trackmap[trkkey].nhits++;
842 trackmap[trkkey].trackres += (
r - rtrack) * (
r - rtrack);
843 trackmap[trkkey].trackresMean += (
r - rtrack);
847 short tresbin =
Simple1dHist(mintres, maxtres, ntresbins,
t - ttrack -
t0 + ephase);
848 short rresbin =
Simple1dHist(minres, maxres, nresbins,
r - rtrack);
849 short trbin =
Simple2dHist(mint, maxt, ntbins, minr, maxr, nrbins,
t -
t0 + ephase, fabs(rtrack));
851 if ((
int)
det == -2 && (
int)lay == 0 && (
int)
mod == 0 && (
int)brd == 1)
852 residual_ref->Fill(
r - rtrack);
853 if ((
int)
det == 1 && (
int)lay == 0 && (
int)
mod == 0 && (
int)brd == 0 && (
int)chp == 1)
854 timeresidual_ref->Fill(
t - ttrack -
t0 + ephase);
855 if ((
int)
det == -1 && (
int)lay == 2)
856 rt_ref->Fill(
t -
t0 + ephase, fabs(rtrack));
858 rt_ref2->Fill(
t -
t0 + ephase, fabs(rtrack));
860 if (histmap.find(sid) == histmap.end())
868 nbinsadd += histmap[sid]->IncreaseBin(tresbin, 1);
873 nbinsadd += histmap[sid]->IncreaseBin(rresbin + 100, 1);
878 nbinsadd += histmap[sid]->IncreaseBin(trbin + 200, 1);
882 if (histmap[sid]->maxvalue > maxvalue)
883 maxvalue = histmap[sid]->maxvalue;
885 if ((nhits % 1000000 == 0) | (ievt ==
nevents - 1))
889 printf(
"%8i HITS READ, %8i HISTOGRAMS (%8lu ADDED), %8i BINS ADDED, MAXVALUE: %3i, VM: %8.0f, RSS: %8.0f\n", nhits,
nhists, histmap.size() - nhiststmp, nbinsadd, maxvalue, vm, rss);
890 nhiststmp = histmap.size();
895 if (nhits % 20000000 == 0)
909 if (isArgonStraw == 0)
911 reshist_trt->Fill(
t -
t0, fabs(
r) - fabs(rtrack));
913 reshist1->Fill(
t -
t0 + ephase, fabs(
r) - fabs(rtrack));
915 reshist2->Fill(
t -
t0 + ephase, fabs(
r) - fabs(rtrack));
917 reshist3->Fill(
t -
t0 + ephase, fabs(
r) - fabs(rtrack));
919 reshist4->Fill(
t -
t0 + ephase, fabs(
r) - fabs(rtrack));
920 if (abs((
int)
det) == 1)
921 reshist_bar->Fill(
t -
t0 + ephase, fabs(
r) - fabs(rtrack));
923 treshist_trt->Fill(
t -
t0 - ttrack, fabs(rtrack));
925 treshist1->Fill(
t -
t0 - ttrack + ephase, fabs(rtrack));
927 treshist2->Fill(
t -
t0 - ttrack + ephase, fabs(rtrack));
929 treshist3->Fill(
t -
t0 - ttrack + ephase, fabs(rtrack));
931 treshist4->Fill(
t -
t0 - ttrack + ephase, fabs(rtrack));
932 if (abs((
int)
det) == 1)
933 treshist_bar->Fill(
t -
t0 - ttrack + ephase, fabs(rtrack));
938 float pull = (
r - rtrack) / TMath::Sqrt(
dr *
dr + drtrack * drtrack);
939 float tresidual =
t -
t0 - ttrack + ephase;
943 float sinoverp = 0.0;
944 float cosoverp = 0.0;
951 float ppt =
pt / 1000.;
955 tres_vs_ToT_trt->Fill(ToT, tresidual);
956 res_vs_ToT_trt->Fill(ToT,
residual);
957 tres_vs_HT_trt->Fill(HT, tresidual);
959 tres_vs_SinOverP_trt->Fill(sinoverp, tresidual);
960 res_vs_SinOverP_trt->Fill(sinoverp,
residual);
961 tres_vs_CosOverP_trt->Fill(cosoverp, tresidual);
962 res_vs_CosOverP_trt->Fill(cosoverp,
residual);
964 pull_trtP->Fill(ppt,
pull);
966 tresidual_trtP->Fill(ppt, tresidual);
967 trackerrors_trtP->Fill(ppt, drtrack);
968 if (ppt > ptcutforerrors)
970 if (ppt > ptcutforerrors)
971 errors_vs_tb_trt->Fill(
time,
dr);
972 if (ppt > ptcutforerrors)
973 trackerrors_vs_tb_trt->Fill(
time, drtrack);
974 if (ppt > ptcutforerrors)
979 tres_vs_ToT_ea->Fill(ToT, tresidual);
981 tres_vs_HT_ea->Fill(HT, tresidual);
983 tres_vs_SinOverP_ea->Fill(sinoverp, tresidual);
984 res_vs_SinOverP_ea->Fill(sinoverp,
residual);
985 tres_vs_CosOverP_ea->Fill(cosoverp, tresidual);
986 res_vs_CosOverP_ea->Fill(cosoverp,
residual);
988 pull_eaP->Fill(ppt,
pull);
990 tresidual_eaP->Fill(ppt, tresidual);
991 trackerrors_eaP->Fill(ppt, drtrack);
992 if (ppt > ptcutforerrors)
994 if (ppt > ptcutforerrors)
995 errors_vs_tb_ea->Fill(
time,
dr);
996 if (ppt > ptcutforerrors)
997 trackerrors_vs_tb_ea->Fill(
time, drtrack);
998 if (ppt > ptcutforerrors)
1003 tres_vs_ToT_ec->Fill(ToT, tresidual);
1004 res_vs_ToT_ec->Fill(ToT,
residual);
1005 tres_vs_HT_ec->Fill(HT, tresidual);
1007 tres_vs_SinOverP_ec->Fill(sinoverp, tresidual);
1008 res_vs_SinOverP_ec->Fill(sinoverp,
residual);
1009 tres_vs_CosOverP_ec->Fill(cosoverp, tresidual);
1010 res_vs_CosOverP_ec->Fill(cosoverp,
residual);
1012 pull_ecP->Fill(ppt,
pull);
1014 tresidual_ecP->Fill(ppt, tresidual);
1015 trackerrors_ecP->Fill(ppt, drtrack);
1016 if (ppt > ptcutforerrors)
1018 if (ppt > ptcutforerrors)
1019 errors_vs_tb_ec->Fill(
time,
dr);
1020 if (ppt > ptcutforerrors)
1021 trackerrors_vs_tb_ec->Fill(
time, drtrack);
1022 if (ppt > ptcutforerrors)
1027 tres_vs_ToT_ba->Fill(ToT, tresidual);
1028 res_vs_ToT_ba->Fill(ToT,
residual);
1029 tres_vs_HT_ba->Fill(HT, tresidual);
1031 tres_vs_SinOverP_ba->Fill(sinoverp, tresidual);
1032 res_vs_SinOverP_ba->Fill(sinoverp,
residual);
1033 tres_vs_CosOverP_ba->Fill(cosoverp, tresidual);
1034 res_vs_CosOverP_ba->Fill(cosoverp,
residual);
1036 pull_baP->Fill(ppt,
pull);
1038 tresidual_baP->Fill(ppt, tresidual);
1039 trackerrors_baP->Fill(ppt, drtrack);
1040 if (ppt > ptcutforerrors)
1042 if (ppt > ptcutforerrors)
1043 errors_vs_tb_ba->Fill(
time,
dr);
1044 if (ppt > ptcutforerrors)
1045 trackerrors_vs_tb_ba->Fill(
time, drtrack);
1046 if (ppt > ptcutforerrors)
1051 tres_vs_ToT_bc->Fill(ToT, tresidual);
1052 res_vs_ToT_bc->Fill(ToT,
residual);
1053 tres_vs_HT_bc->Fill(HT, tresidual);
1055 tres_vs_SinOverP_bc->Fill(sinoverp, tresidual);
1056 res_vs_SinOverP_bc->Fill(sinoverp,
residual);
1057 tres_vs_CosOverP_bc->Fill(cosoverp, tresidual);
1058 res_vs_CosOverP_bc->Fill(cosoverp,
residual);
1060 pull_bcP->Fill(ppt,
pull);
1062 tresidual_bcP->Fill(ppt, tresidual);
1063 trackerrors_bcP->Fill(ppt, drtrack);
1064 if (ppt > ptcutforerrors)
1066 if (ppt > ptcutforerrors)
1067 errors_vs_tb_bc->Fill(
time,
dr);
1068 if (ppt > ptcutforerrors)
1069 trackerrors_vs_tb_bc->Fill(
time, drtrack);
1070 if (ppt > ptcutforerrors)
1079 resArhist_trt->Fill(
t -
t0, fabs(
r) - fabs(rtrack));
1081 resArhist1->Fill(
t -
t0 + ephase, fabs(
r) - fabs(rtrack));
1083 resArhist2->Fill(
t -
t0 + ephase, fabs(
r) - fabs(rtrack));
1085 resArhist3->Fill(
t -
t0 + ephase, fabs(
r) - fabs(rtrack));
1087 resArhist4->Fill(
t -
t0 + ephase, fabs(
r) - fabs(rtrack));
1088 if (abs((
int)
det) == 1)
1089 resArhist_bar->Fill(
t -
t0 + ephase, fabs(
r) - fabs(rtrack));
1091 tresArhist_trt->Fill(
t -
t0 - ttrack, fabs(rtrack));
1093 tresArhist1->Fill(
t -
t0 - ttrack + ephase, fabs(rtrack));
1095 tresArhist2->Fill(
t -
t0 - ttrack + ephase, fabs(rtrack));
1097 tresArhist3->Fill(
t -
t0 - ttrack + ephase, fabs(rtrack));
1099 tresArhist4->Fill(
t -
t0 - ttrack + ephase, fabs(rtrack));
1100 if (abs((
int)
det) == 1)
1101 tresArhist_bar->Fill(
t -
t0 - ttrack + ephase, fabs(rtrack));
1106 float pull = (
r - rtrack) / TMath::Sqrt(
dr *
dr + drtrack * drtrack);
1107 float tresidual =
t -
t0 - ttrack + ephase;
1110 float sinoverp = 0.0;
1111 float cosoverp = 0.0;
1117 float ppt =
pt / 1000.;
1121 tresAr_vs_ToT_trt->Fill(ToT, tresidual);
1122 resAr_vs_ToT_trt->Fill(ToT,
residual);
1123 tresAr_vs_HT_trt->Fill(HT, tresidual);
1124 resAr_vs_HT_trt->Fill(HT,
residual);
1125 tresAr_vs_SinOverP_trt->Fill(sinoverp, tresidual);
1126 resAr_vs_SinOverP_trt->Fill(sinoverp,
residual);
1127 tresAr_vs_CosOverP_trt->Fill(cosoverp, tresidual);
1128 resAr_vs_CosOverP_trt->Fill(cosoverp,
residual);
1130 pullAr_trtP->Fill(ppt,
pull);
1131 residualAr_trtP->Fill(ppt,
residual);
1132 tresidualAr_trtP->Fill(ppt, tresidual);
1133 trackerrorsAr_trtP->Fill(ppt, drtrack);
1134 if (ppt > ptcutforerrors)
1135 pullAr_vs_tb_trt->Fill(
time,
pull);
1136 if (ppt > ptcutforerrors)
1137 errors_vs_tb_trt->Fill(
time,
dr);
1138 if (ppt > ptcutforerrors)
1139 trackerrors_vs_tb_trt->Fill(
time, drtrack);
1140 if (ppt > ptcutforerrors)
1145 tresAr_vs_ToT_ea->Fill(ToT, tresidual);
1146 resAr_vs_ToT_ea->Fill(ToT,
residual);
1147 tresAr_vs_HT_ea->Fill(HT, tresidual);
1148 resAr_vs_HT_ea->Fill(HT,
residual);
1149 tresAr_vs_SinOverP_ea->Fill(sinoverp, tresidual);
1150 resAr_vs_SinOverP_ea->Fill(sinoverp,
residual);
1151 tresAr_vs_CosOverP_ea->Fill(cosoverp, tresidual);
1152 resAr_vs_CosOverP_ea->Fill(cosoverp,
residual);
1154 pullAr_eaP->Fill(ppt,
pull);
1155 residualAr_eaP->Fill(ppt,
residual);
1156 tresidualAr_eaP->Fill(ppt, tresidual);
1157 trackerrorsAr_eaP->Fill(ppt, drtrack);
1158 if (ppt > ptcutforerrors)
1160 if (ppt > ptcutforerrors)
1161 errorsAr_vs_tb_ea->Fill(
time,
dr);
1162 if (ppt > ptcutforerrors)
1163 trackerrorsAr_vs_tb_ea->Fill(
time, drtrack);
1164 if (ppt > ptcutforerrors)
1167 else if ((
int)
det == -2)
1169 tresAr_vs_ToT_ec->Fill(ToT, tresidual);
1170 resAr_vs_ToT_ec->Fill(ToT,
residual);
1171 tresAr_vs_HT_ec->Fill(HT, tresidual);
1172 resAr_vs_HT_ec->Fill(HT,
residual);
1173 tresAr_vs_SinOverP_ec->Fill(sinoverp, tresidual);
1174 resAr_vs_SinOverP_ec->Fill(sinoverp,
residual);
1175 tresAr_vs_CosOverP_ec->Fill(cosoverp, tresidual);
1176 resAr_vs_CosOverP_ec->Fill(cosoverp,
residual);
1178 pullAr_ecP->Fill(ppt,
pull);
1179 residualAr_ecP->Fill(ppt,
residual);
1180 tresidualAr_ecP->Fill(ppt, tresidual);
1181 trackerrorsAr_ecP->Fill(ppt, drtrack);
1182 if (ppt > ptcutforerrors)
1184 if (ppt > ptcutforerrors)
1185 errorsAr_vs_tb_ec->Fill(
time,
dr);
1186 if (ppt > ptcutforerrors)
1187 trackerrorsAr_vs_tb_ec->Fill(
time, drtrack);
1188 if (ppt > ptcutforerrors)
1191 else if ((
int)
det == 1)
1193 tresAr_vs_ToT_ba->Fill(ToT, tresidual);
1194 resAr_vs_ToT_ba->Fill(ToT,
residual);
1195 tresAr_vs_HT_ba->Fill(HT, tresidual);
1196 resAr_vs_HT_ba->Fill(HT,
residual);
1197 tresAr_vs_SinOverP_ba->Fill(sinoverp, tresidual);
1198 resAr_vs_SinOverP_ba->Fill(sinoverp,
residual);
1199 tresAr_vs_CosOverP_ba->Fill(cosoverp, tresidual);
1200 resAr_vs_CosOverP_ba->Fill(cosoverp,
residual);
1202 pullAr_baP->Fill(ppt,
pull);
1203 residualAr_baP->Fill(ppt,
residual);
1204 tresidualAr_baP->Fill(ppt, tresidual);
1205 trackerrorsAr_baP->Fill(ppt, drtrack);
1206 if (ppt > ptcutforerrors)
1208 if (ppt > ptcutforerrors)
1209 errorsAr_vs_tb_ba->Fill(
time,
dr);
1210 if (ppt > ptcutforerrors)
1211 trackerrorsAr_vs_tb_ba->Fill(
time, drtrack);
1212 if (ppt > ptcutforerrors)
1215 else if ((
int)
det == -1)
1217 tresAr_vs_ToT_bc->Fill(ToT, tresidual);
1218 resAr_vs_ToT_bc->Fill(ToT,
residual);
1219 tresAr_vs_HT_bc->Fill(HT, tresidual);
1220 resAr_vs_HT_bc->Fill(HT,
residual);
1221 tresAr_vs_SinOverP_bc->Fill(sinoverp, tresidual);
1222 resAr_vs_SinOverP_bc->Fill(sinoverp,
residual);
1223 tresAr_vs_CosOverP_bc->Fill(cosoverp, tresidual);
1224 resAr_vs_CosOverP_bc->Fill(cosoverp,
residual);
1226 pullAr_bcP->Fill(ppt,
pull);
1227 residualAr_bcP->Fill(ppt,
residual);
1228 tresidualAr_bcP->Fill(ppt, tresidual);
1229 trackerrorsAr_bcP->Fill(ppt, drtrack);
1230 if (ppt > ptcutforerrors)
1232 if (ppt > ptcutforerrors)
1233 errorsAr_vs_tb_bc->Fill(
time,
dr);
1234 if (ppt > ptcutforerrors)
1235 trackerrorsAr_vs_tb_bc->Fill(
time, drtrack);
1236 if (ppt > ptcutforerrors)
1243 float ppt =
pt / 1000.;
1247 float tresidual =
t -
t0 - ttrack + ephase;
1248 float pull = (
r - rtrack) / TMath::Sqrt(
dr *
dr + drtrack * drtrack);
1250 if (isArgonStraw == 0)
1252 pull_trt->Fill(ppt,
pull);
1254 tresidual_trt->Fill(ppt,
residual);
1257 pull_ea->Fill(ppt,
pull);
1258 tresidual_ea->Fill(ppt, tresidual);
1262 pull_ec->Fill(ppt,
pull);
1264 tresidual_ec->Fill(ppt, tresidual);
1268 pull_ba->Fill(ppt,
pull);
1270 tresidual_ba->Fill(ppt, tresidual);
1274 pull_bc->Fill(ppt,
pull);
1276 tresidual_bc->Fill(ppt, tresidual);
1281 pullAr_trt->Fill(ppt,
pull);
1282 residualAr_trt->Fill(ppt,
residual);
1283 tresidualAr_trt->Fill(ppt,
residual);
1286 pullAr_ea->Fill(ppt,
pull);
1287 tresidualAr_ea->Fill(ppt, tresidual);
1291 pullAr_ec->Fill(ppt,
pull);
1292 residualAr_ec->Fill(ppt,
residual);
1293 tresidualAr_ec->Fill(ppt, tresidual);
1297 pullAr_ba->Fill(ppt,
pull);
1298 residualAr_ba->Fill(ppt,
residual);
1299 tresidualAr_ba->Fill(ppt, tresidual);
1303 pullAr_bc->Fill(ppt,
pull);
1304 residualAr_bc->Fill(ppt,
residual);
1305 tresidualAr_bc->Fill(ppt, tresidual);
1311 printf(
"REPLACED %d T0S WITH PRECISION VALUES (MEAN DIFF=%f)\n", npt0, diffpt0 /
float(npt0));
1313 printf(
"ERROR!! npt0 is zero!");
1316 if (ifiles == nfiles - 1)
1319 TFile *ttfile =
new TFile(
"tracktuple.root",
"RECREATE");
1321 TDirectory *trtdir = ttfile->mkdir(
"TRT_all");
1322 TDirectory *binhist = trtdir->mkdir(
"reshists");
1323 TDirectory *detdir1 = trtdir->mkdir(
"Detector_-2");
1324 TDirectory *binhist1 = detdir1->mkdir(
"reshists1");
1325 TDirectory *detdir2 = trtdir->mkdir(
"Detector_-1");
1326 TDirectory *binhist2 = detdir2->mkdir(
"reshists2");
1327 TDirectory *detdir3 = trtdir->mkdir(
"Detector_1");
1328 TDirectory *binhist3 = detdir3->mkdir(
"reshists3");
1329 TDirectory *detdir4 = trtdir->mkdir(
"Detector_2");
1330 TDirectory *binhist4 = detdir4->mkdir(
"reshists4");
1331 TDirectory *detdir5 = trtdir->mkdir(
"WholeBarrel_1");
1332 TDirectory *binhist5 = detdir5->mkdir(
"reshists5");
1334 TDirectory *errordir = ttfile->mkdir(
"Errors");
1335 TDirectory *corrdir = ttfile->mkdir(
"Correction");
1337 int npointsX = reshist1->GetNbinsX();
1338 int npointsY = treshist1->GetNbinsY();
1339 TH1D **hslizesX =
new TH1D *[npointsX];
1340 TH1D **hslizesY =
new TH1D *[npointsY];
1342 TVectorD tbins(npointsX);
1343 TVectorD rbins(npointsY);
1346 for (
int i = 0;
i < npointsX;
i++)
1349 tbins(
i) = reshist1->GetXaxis()->GetBinCenter(
i + 1);
1352 chname = string(Form(
"res_tbin%i_trt",
i));
1353 hslizesX[
i] = reshist_trt->ProjectionY(chname.data(),
i + 1,
i + 1);
1355 chname = string(Form(
"res_tbin%i_-2",
i));
1356 hslizesX[
i] = reshist1->ProjectionY(chname.data(),
i + 1,
i + 1);
1358 chname = string(Form(
"res_tbin%i_-1",
i));
1359 hslizesX[
i] = reshist2->ProjectionY(chname.data(),
i + 1,
i + 1);
1361 chname = string(Form(
"res_tbin%i_1",
i));
1362 hslizesX[
i] = reshist3->ProjectionY(chname.data(),
i + 1,
i + 1);
1364 chname = string(Form(
"res_tbin%i_2",
i));
1365 hslizesX[
i] = reshist4->ProjectionY(chname.data(),
i + 1,
i + 1);
1367 chname = string(Form(
"res_tbin%i_bar",
i));
1368 hslizesX[
i] = reshist_bar->ProjectionY(chname.data(),
i + 1,
i + 1);
1371 for (
int i = 0;
i < npointsY;
i++)
1374 rbins(
i) = treshist1->GetYaxis()->GetBinCenter(
i + 1);
1377 chname = string(Form(
"tres_rbin%i_trt",
i));
1378 hslizesY[
i] = treshist_trt->ProjectionX(chname.data(),
i + 1,
i + 1);
1380 chname = string(Form(
"tres_rbin%i_-2",
i));
1381 hslizesY[
i] = treshist1->ProjectionX(chname.data(),
i + 1,
i + 1);
1383 chname = string(Form(
"tres_rbin%i_-1",
i));
1384 hslizesY[
i] = treshist1->ProjectionX(chname.data(),
i + 1,
i + 1);
1386 chname = string(Form(
"tres_rbin%i_1",
i));
1387 hslizesY[
i] = treshist3->ProjectionX(chname.data(),
i + 1,
i + 1);
1389 chname = string(Form(
"tres_rbin%i_2",
i));
1390 hslizesY[
i] = treshist4->ProjectionX(chname.data(),
i + 1,
i + 1);
1392 chname = string(Form(
"tres_rbin%i_bar",
i));
1393 hslizesY[
i] = treshist_bar->ProjectionX(chname.data(),
i + 1,
i + 1);
1397 tbins.Write(
"tbins");
1398 rbins.Write(
"rbins");
1401 residual_ref->Write();
1402 timeresidual_ref->Write();
1407 reshist_trt->Write();
1409 reshist_bar->Write();
1419 treshist_trt->Write();
1421 treshist_bar->Write();
1440 residual_trt->Write();
1441 residual_ba->Write();
1442 residual_bc->Write();
1443 residual_ea->Write();
1444 residual_ec->Write();
1446 tresidual_trt->Write();
1447 tresidual_ba->Write();
1448 tresidual_bc->Write();
1449 tresidual_ea->Write();
1450 tresidual_ec->Write();
1458 residual_trtP->Write();
1459 residual_baP->Write();
1460 residual_bcP->Write();
1461 residual_eaP->Write();
1462 residual_ecP->Write();
1464 tresidual_trtP->Write();
1465 tresidual_baP->Write();
1466 tresidual_bcP->Write();
1467 tresidual_eaP->Write();
1468 tresidual_ecP->Write();
1470 pull_vs_tb_trt->Write();
1471 pull_vs_tb_trt->Write();
1472 pull_vs_tb_ba->Write();
1473 pull_vs_tb_bc->Write();
1474 pull_vs_tb_ea->Write();
1475 pull_vs_tb_ec->Write();
1477 errors_vs_tb_trt->Write();
1478 errors_vs_tb_ba->Write();
1479 errors_vs_tb_bc->Write();
1480 errors_vs_tb_ea->Write();
1481 errors_vs_tb_ec->Write();
1483 residual_vs_tb_trt->Write();
1484 residual_vs_tb_ba->Write();
1485 residual_vs_tb_bc->Write();
1486 residual_vs_tb_ea->Write();
1487 residual_vs_tb_ec->Write();
1489 trackerrors_trtP->Write();
1490 trackerrors_baP->Write();
1491 trackerrors_bcP->Write();
1492 trackerrors_eaP->Write();
1493 trackerrors_ecP->Write();
1495 trackerrors_vs_tb_trt->Write();
1496 trackerrors_vs_tb_ba->Write();
1497 trackerrors_vs_tb_bc->Write();
1498 trackerrors_vs_tb_ea->Write();
1499 trackerrors_vs_tb_ec->Write();
1504 tres_vs_ToT_trt->Write();
1505 tres_vs_ToT_ba->Write();
1506 tres_vs_ToT_bc->Write();
1507 tres_vs_ToT_ea->Write();
1508 tres_vs_ToT_ec->Write();
1510 res_vs_ToT_trt->Write();
1511 res_vs_ToT_ba->Write();
1512 res_vs_ToT_bc->Write();
1513 res_vs_ToT_ea->Write();
1514 res_vs_ToT_ec->Write();
1516 tres_vs_HT_trt->Write();
1517 tres_vs_HT_ba->Write();
1518 tres_vs_HT_bc->Write();
1519 tres_vs_HT_ea->Write();
1520 tres_vs_HT_ec->Write();
1522 res_vs_HT_trt->Write();
1523 res_vs_HT_ba->Write();
1524 res_vs_HT_bc->Write();
1525 res_vs_HT_ea->Write();
1526 res_vs_HT_ec->Write();
1528 tres_vs_SinOverP_trt->Write();
1529 tres_vs_SinOverP_ba->Write();
1530 tres_vs_SinOverP_bc->Write();
1531 tres_vs_SinOverP_ea->Write();
1532 tres_vs_SinOverP_ec->Write();
1534 res_vs_SinOverP_trt->Write();
1535 res_vs_SinOverP_ba->Write();
1536 res_vs_SinOverP_bc->Write();
1537 res_vs_SinOverP_ea->Write();
1538 res_vs_SinOverP_ec->Write();
1540 tres_vs_CosOverP_trt->Write();
1541 tres_vs_CosOverP_ba->Write();
1542 tres_vs_CosOverP_bc->Write();
1543 tres_vs_CosOverP_ea->Write();
1544 tres_vs_CosOverP_ec->Write();
1546 res_vs_CosOverP_trt->Write();
1547 res_vs_CosOverP_ba->Write();
1548 res_vs_CosOverP_bc->Write();
1549 res_vs_CosOverP_ea->Write();
1550 res_vs_CosOverP_ec->Write();
1556 TDirectory *trtArdir = ttfile->mkdir(
"TRT_Ar_all");
1557 TDirectory *binArhist = trtArdir->mkdir(
"reshists_Ar");
1558 TDirectory *detArdir1 = trtArdir->mkdir(
"Detector_Ar_-2");
1559 TDirectory *binArhist1 = detArdir1->mkdir(
"reshists_Ar1");
1560 TDirectory *detArdir2 = trtArdir->mkdir(
"Detector_Ar_-1");
1561 TDirectory *binArhist2 = detArdir2->mkdir(
"reshists_Ar2");
1562 TDirectory *detArdir3 = trtArdir->mkdir(
"Detector_Ar_1");
1563 TDirectory *binArhist3 = detArdir3->mkdir(
"reshists_Ar3");
1564 TDirectory *detArdir4 = trtArdir->mkdir(
"Detector_Ar_2");
1565 TDirectory *binArhist4 = detArdir4->mkdir(
"reshists_Ar4");
1566 TDirectory *detArdir5 = trtArdir->mkdir(
"WholeBarrel_Ar_1");
1567 TDirectory *binArhist5 = detArdir5->mkdir(
"reshists_Ar5");
1569 TDirectory *errordirAr = ttfile->mkdir(
"ErrorsAr");
1570 TDirectory *corrdirAr = ttfile->mkdir(
"CorrectionAr");
1574 resArhist_trt->Write();
1576 resArhist_bar->Write();
1578 resArhist1->Write();
1580 resArhist2->Write();
1582 resArhist3->Write();
1584 resArhist4->Write();
1586 tresArhist_trt->Write();
1588 tresArhist_bar->Write();
1590 tresArhist1->Write();
1592 tresArhist2->Write();
1594 tresArhist3->Write();
1596 tresArhist4->Write();
1598 TH1D **hslizesArX =
new TH1D *[npointsX];
1599 TH1D **hslizesArY =
new TH1D *[npointsY];
1600 TVectorD tbinsAr(npointsX);
1601 TVectorD rbinsAr(npointsY);
1602 for (
int i = 0;
i < npointsX;
i++)
1604 tbinsAr(
i) = resArhist1->GetXaxis()->GetBinCenter(
i + 1);
1606 chname = string(Form(
"res_tbin%i_trt",
i));
1607 hslizesArX[
i] = resArhist_trt->ProjectionY(chname.data(),
i + 1,
i + 1);
1609 chname = string(Form(
"res_tbin%i_-2",
i));
1610 hslizesArX[
i] = resArhist1->ProjectionY(chname.data(),
i + 1,
i + 1);
1612 chname = string(Form(
"res_tbin%i_-1",
i));
1613 hslizesArX[
i] = resArhist2->ProjectionY(chname.data(),
i + 1,
i + 1);
1615 chname = string(Form(
"res_tbin%i_1",
i));
1616 hslizesArX[
i] = resArhist3->ProjectionY(chname.data(),
i + 1,
i + 1);
1618 chname = string(Form(
"res_tbin%i_2",
i));
1619 hslizesArX[
i] = resArhist4->ProjectionY(chname.data(),
i + 1,
i + 1);
1621 chname = string(Form(
"res_tbin%i_bar",
i));
1622 hslizesArX[
i] = resArhist_bar->ProjectionY(chname.data(),
i + 1,
i + 1);
1625 for (
int i = 0;
i < npointsY;
i++)
1627 rbinsAr(
i) = tresArhist1->GetYaxis()->GetBinCenter(
i + 1);
1629 chname = string(Form(
"tres_rbin%i_trt",
i));
1630 hslizesArY[
i] = tresArhist_trt->ProjectionX(chname.data(),
i + 1,
i + 1);
1632 chname = string(Form(
"tres_rbin%i_-2",
i));
1633 hslizesArY[
i] = tresArhist1->ProjectionX(chname.data(),
i + 1,
i + 1);
1635 chname = string(Form(
"tres_rbin%i_-1",
i));
1636 hslizesArY[
i] = tresArhist1->ProjectionX(chname.data(),
i + 1,
i + 1);
1638 chname = string(Form(
"tres_rbin%i_1",
i));
1639 hslizesArY[
i] = tresArhist3->ProjectionX(chname.data(),
i + 1,
i + 1);
1641 chname = string(Form(
"tres_rbin%i_2",
i));
1642 hslizesArY[
i] = tresArhist4->ProjectionX(chname.data(),
i + 1,
i + 1);
1644 chname = string(Form(
"tres_rbin%i_bar",
i));
1645 hslizesArY[
i] = tresArhist_bar->ProjectionX(chname.data(),
i + 1,
i + 1);
1651 pullAr_trt->Write();
1657 residualAr_trt->Write();
1658 residualAr_ba->Write();
1659 residualAr_bc->Write();
1660 residualAr_ea->Write();
1661 residualAr_ec->Write();
1663 tresidualAr_trt->Write();
1664 tresidualAr_ba->Write();
1665 tresidualAr_bc->Write();
1666 tresidualAr_ea->Write();
1667 tresidualAr_ec->Write();
1669 pullAr_trtP->Write();
1670 pullAr_baP->Write();
1671 pullAr_bcP->Write();
1672 pullAr_eaP->Write();
1673 pullAr_ecP->Write();
1675 residualAr_trtP->Write();
1676 residualAr_baP->Write();
1677 residualAr_bcP->Write();
1678 residualAr_eaP->Write();
1679 residualAr_ecP->Write();
1681 tresidualAr_trtP->Write();
1682 tresidualAr_baP->Write();
1683 tresidualAr_bcP->Write();
1684 tresidualAr_eaP->Write();
1685 tresidualAr_ecP->Write();
1687 pullAr_vs_tb_trt->Write();
1688 pullAr_vs_tb_trt->Write();
1689 pullAr_vs_tb_ba->Write();
1690 pullAr_vs_tb_bc->Write();
1691 pullAr_vs_tb_ea->Write();
1692 pullAr_vs_tb_ec->Write();
1694 errorsAr_vs_tb_trt->Write();
1695 errorsAr_vs_tb_ba->Write();
1696 errorsAr_vs_tb_bc->Write();
1697 errorsAr_vs_tb_ea->Write();
1698 errorsAr_vs_tb_ec->Write();
1700 residualAr_vs_tb_trt->Write();
1701 residualAr_vs_tb_ba->Write();
1702 residualAr_vs_tb_bc->Write();
1703 residualAr_vs_tb_ea->Write();
1704 residualAr_vs_tb_ec->Write();
1706 trackerrorsAr_trtP->Write();
1707 trackerrorsAr_baP->Write();
1708 trackerrorsAr_bcP->Write();
1709 trackerrorsAr_eaP->Write();
1710 trackerrorsAr_ecP->Write();
1712 trackerrorsAr_vs_tb_trt->Write();
1713 trackerrorsAr_vs_tb_ba->Write();
1714 trackerrorsAr_vs_tb_bc->Write();
1715 trackerrorsAr_vs_tb_ea->Write();
1716 trackerrorsAr_vs_tb_ec->Write();
1721 tresAr_vs_ToT_trt->Write();
1722 tresAr_vs_ToT_ba->Write();
1723 tresAr_vs_ToT_bc->Write();
1724 tresAr_vs_ToT_ea->Write();
1725 tresAr_vs_ToT_ec->Write();
1727 resAr_vs_ToT_trt->Write();
1728 resAr_vs_ToT_ba->Write();
1729 resAr_vs_ToT_bc->Write();
1730 resAr_vs_ToT_ea->Write();
1731 resAr_vs_ToT_ec->Write();
1733 tresAr_vs_HT_trt->Write();
1734 tresAr_vs_HT_ba->Write();
1735 tresAr_vs_HT_bc->Write();
1736 tresAr_vs_HT_ea->Write();
1737 tresAr_vs_HT_ec->Write();
1739 resAr_vs_HT_trt->Write();
1740 resAr_vs_HT_ba->Write();
1741 resAr_vs_HT_bc->Write();
1742 resAr_vs_HT_ea->Write();
1743 resAr_vs_HT_ec->Write();
1745 tresAr_vs_SinOverP_trt->Write();
1746 tresAr_vs_SinOverP_ba->Write();
1747 tresAr_vs_SinOverP_bc->Write();
1748 tresAr_vs_SinOverP_ea->Write();
1749 tresAr_vs_SinOverP_ec->Write();
1751 resAr_vs_SinOverP_trt->Write();
1752 resAr_vs_SinOverP_ba->Write();
1753 resAr_vs_SinOverP_bc->Write();
1754 resAr_vs_SinOverP_ea->Write();
1755 resAr_vs_SinOverP_ec->Write();
1757 tresAr_vs_CosOverP_trt->Write();
1758 tresAr_vs_CosOverP_ba->Write();
1759 tresAr_vs_CosOverP_bc->Write();
1760 tresAr_vs_CosOverP_ea->Write();
1761 tresAr_vs_CosOverP_ec->Write();
1763 resAr_vs_CosOverP_trt->Write();
1764 resAr_vs_CosOverP_ba->Write();
1765 resAr_vs_CosOverP_bc->Write();
1766 resAr_vs_CosOverP_ea->Write();
1767 resAr_vs_CosOverP_ec->Write();
1781 cout <<
"SCANNING BINARY HISTOGRAM FILE " <<
argv[ifiles + 2] << endl;
1786 ifstream *
ifile =
new ifstream(
argv[ifiles + 2], ios::in | ios::binary);
1793 ifile->read((
char *)&npop,
sizeof(
int));
1796 int *chist =
new int[(2 * npop)];
1798 ifile->read((
char *)chist,
sizeof(
int) * 2 * npop);
1799 ifile->read((
char *)&sid,
sizeof(
int));
1801 if (histmap.find(sid) == histmap.end())
1808 for (
int ipop = 0; ipop < 2 * npop; ipop = ipop + 2)
1810 histmap[sid]->IncreaseBin((
short)chist[ipop], (
unsigned short)chist[ipop + 1]);
1811 if (chist[ipop] < 100)
1813 ntres += chist[ipop + 1];
1815 else if (chist[ipop] >= 100 && chist[ipop] < 200)
1816 nres += chist[ipop + 1];
1818 nrt += chist[ipop + 1];
1826 printf(
"%i HISTOGRAMS READ! %i HISTOGRAMS ADDED! %i BINS ADDED! MAXVALUE: %i VM: %0f RSS: %0f\n",
nhists, nhistsadd, nbinsadd, maxvalue, vm, rss);
1829 std::destroy_at(chist);
1831 if (
nhists % 1000000000 == 0)
1834 printf(
"%i HISTOGRAMS READ! %i HISTOGRAMS ADDED! %i BINS ADDED! MAXVALUE: %i VM: %0f RSS: %0f\n",
nhists, nhistsadd, nbinsadd, maxvalue, vm, rss);
1846 cout <<
nhists <<
" HISTOGRAMS SACNNED" << endl;
1847 cout << nhistsadd <<
" HISTOGRAMS ADDED" << endl;
1853 cout <<
"TOT HISTOGRAMS............. " <<
nhists << endl;
1855 cout <<
"TOT HITS IN TIMERES HIST .. " << ntres <<
" (" << 100 *
float(ntres) /
float(nhits) <<
"%)" << endl;
1856 cout <<
"TOT HITS IN RRES HIST ..... " << nres <<
" (" << 100 *
float(nres) /
float(nhits) <<
"%)" << endl;
1857 cout <<
"TOT HITS IN RT HIST ....... " << nrt <<
" (" << 100 *
float(nrt) /
float(nhits) <<
"%)" << endl;
1859 cout <<
"Number of hits was zero !!\n";
1863 ofilestat <<
"TRESHITS " << ntres << endl;