3543 TNtuple *Tracktuple = (TNtuple *)
file->Get(
"tracktuple");
3545 TH1F *resAr0 = (
TH1F *)
file->Get(
"TRT_Ar_all/Detector_Ar_-1/residual");
3546 TH1F *tresAr0 = (
TH1F *)
file->Get(
"TRT_Ar_all/Detector_Ar_-1/timeresidual");
3547 TH1F *resAr1 = (
TH1F *)
file->Get(
"TRT_Ar_all/Detector_Ar_-2/residual");
3548 TH1F *tresAr1 = (
TH1F *)
file->Get(
"TRT_Ar_all/Detector_Ar_-2/timeresidual");
3549 TH1F *resXe1 = (
TH1F *)
file->Get(
"TRT_all/Detector_-2/residual");
3550 TH1F *tresXe1 = (
TH1F *)
file->Get(
"TRT_all/Detector_-2/timeresidual");
3551 TH1F *resAr2 = (
TH1F *)
file->Get(
"TRT_Ar_all/Detector_Ar_1/residual");
3552 TH1F *tresAr2 = (
TH1F *)
file->Get(
"TRT_Ar_all/Detector_Ar_1/timeresidual");
3553 TH1F *resAr3 = (
TH1F *)
file->Get(
"TRT_Ar_all/Detector_Ar_2/residual");
3554 TH1F *tresAr3 = (
TH1F *)
file->Get(
"TRT_Ar_all/Detector_Ar_2/timeresidual");
3555 TH1F *resXe3 = (
TH1F *)
file->Get(
"TRT_all/Detector_2/residual");
3556 TH1F *tresXe3 = (
TH1F *)
file->Get(
"TRT_all/Detector_2/timeresidual");
3558 TDatime *
dt =
new TDatime();
3560 TPaveText *
pt =
new TPaveText(.1, .2, .9, .9);
3563 throw(
string(
"tracktuple not found!"));
3565 cout <<
" tracktuple found " << endl;
3572 cout <<
" writing to header. iteration number " <<
iter << endl;
3573 pt->AddText(Form(
"Iteration number: %i",
iter));
3574 cout <<
" writing to header. month " <<
dt->GetMonth() << endl;
3575 pt->AddText(Form(
"Time: %02i/%02i/%i %02i:%02i",
dt->GetDay(),
dt->GetMonth(),
dt->GetYear(),
dt->GetHour(),
dt->GetMinute()));
3576 Tracktuple->SetBranchAddress(
"run", &
runnumber);
3577 Tracktuple->GetEntry(0);
3578 cout <<
" writing to header. run number " << (
int)
runnumber << endl;
3579 pt->AddText(Form(
"Run number: %i", (
int)
runnumber));
3587 cout <<
" writing to header. number of tracks " << Tracktuple->GetEntries() << endl;
3588 pt->AddText(Form(
"Total no. tracks: %lli", Tracktuple->GetEntries()));
3594 float bhitst[4]={0};
3599 cout <<
" debug 1 " << endl;
3600 bhitst[0] = resAr0->GetEntries();
3601 bhitst[2] = resAr2->GetEntries();
3602 float nhAr1 = resAr1->GetEntries();
3603 float nhXe1 = resXe1->GetEntries();
3604 cout <<
" debug 2 " << endl;
3605 bhitst[1] = nhAr1 + nhXe1;
3609 nhAr3 = resAr3->GetEntries();
3611 nhXe3 = resXe3->GetEntries();
3612 bhitst[3] = nhAr3 + nhXe3;
3613 cout <<
" debug 3 " << endl;
3614 rest[0] = resAr0->GetFunction(
"gaus")->GetParameter(2);
3615 rest[2] = resAr2->GetFunction(
"gaus")->GetParameter(2);
3616 rest[1] = (resAr1->GetFunction(
"gaus")->GetParameter(2) * nhAr1 + resXe1->GetFunction(
"gaus")->GetParameter(2) * nhXe1) / bhitst[1];
3617 if (resAr3 and resXe3)
3618 rest[3] = (resAr3->GetFunction(
"gaus")->GetParameter(2) * nhAr3 + resXe3->GetFunction(
"gaus")->GetParameter(2) * nhXe3) / bhitst[3];
3619 cout <<
" debug 4 " << endl;
3620 trest[0] = tresAr0->GetFunction(
"gaus")->GetParameter(1);
3621 trest[2] = tresAr2->GetFunction(
"gaus")->GetParameter(1);
3622 trest[1] = (tresAr1->GetFunction(
"gaus")->GetParameter(1) * nhAr1 + tresXe1->GetFunction(
"gaus")->GetParameter(1) * nhXe1) / bhitst[1];
3624 trest[3] = (tresAr3->GetFunction(
"gaus")->GetParameter(1) * nhAr3 + tresXe3->GetFunction(
"gaus")->GetParameter(1) * nhXe3) / bhitst[3];
3625 cout <<
" debug 5 " << endl;
3626 treswt[0] = tresAr0->GetFunction(
"gaus")->GetParameter(2);
3627 treswt[2] = tresAr2->GetFunction(
"gaus")->GetParameter(2);
3628 treswt[1] = (tresAr1->GetFunction(
"gaus")->GetParameter(2) * nhAr1 + tresXe1->GetFunction(
"gaus")->GetParameter(2) * nhXe1) / bhitst[1];
3630 treswt[3] = (tresAr3->GetFunction(
"gaus")->GetParameter(2) * nhAr3 + tresXe3->GetFunction(
"gaus")->GetParameter(2) * nhXe3) / bhitst[3];
3631 cout <<
" debug 6 " << endl;
3635 TDirectory *
errors =
nullptr;
3636 TDirectory *errorsAr =
nullptr;
3637 bool iserrors =
false;
3638 bool iserrorsAr =
false;
3639 if (
file->FindKey(
"ErrorsAr"))
3641 errorsAr = (TDirectory *)
file->FindKey(
"ErrorsAr")->ReadObj();
3642 if (errorsAr !=
nullptr)
3645 if (
file->FindKey(
"Errors"))
3647 errors = (TDirectory *)
file->FindKey(
"Errors")->ReadObj();
3660 TH2F *residual_ea =
nullptr;
3661 TH2F *residual_ec =
nullptr;
3666 TH2F *residual_eaP =
nullptr;
3667 TH2F *residual_ecP =
nullptr;
3670 TH2F *residualAr_ba =
nullptr;
3671 TH2F *residualAr_bc =
nullptr;
3672 TH2F *residualAr_ea =
nullptr;
3673 TH2F *residualAr_ec =
nullptr;
3676 TH2F *residualAr_baP =
nullptr;
3677 TH2F *residualAr_bcP =
nullptr;
3678 TH2F *residualAr_eaP =
nullptr;
3679 TH2F *residualAr_ecP =
nullptr;
3681 if (iserrors &&
errors->FindKey(
"tresidual_trt") &&
errors->FindKey(
"tresidual_trtP"))
3684 if (
errors->FindKey(
"tresidual_ea"))
3685 residual_ea = (
TH2F *)
errors->FindKey(
"tresidual_ea")->ReadObj();
3686 if (
errors->FindKey(
"tresidual_ec"))
3687 residual_ec = (
TH2F *)
errors->FindKey(
"tresidual_ec")->ReadObj();
3690 if (
errors->FindKey(
"tresidual_eaP"))
3691 residual_eaP = (
TH2F *)
errors->FindKey(
"tresidual_eaP")->ReadObj();
3692 if (
errors->FindKey(
"tresidual_ecP"))
3693 residual_ecP = (
TH2F *)
errors->FindKey(
"tresidual_ecP")->ReadObj();
3697 cout <<
" No time residual histograms in endcaps: tresidual_trt and tresidual_trtP " << endl;
3699 if (iserrorsAr && errorsAr->FindKey(
"tresidualAr_trt") && errorsAr->FindKey(
"tresidualAr_trtP"))
3702 if (errorsAr->FindKey(
"tresidualAr_ba"))
3703 residualAr_ba = (
TH2F *)errorsAr->FindKey(
"tresidualAr_ba")->ReadObj();
3704 if (errorsAr->FindKey(
"tresidualAr_bc"))
3705 residualAr_bc = (
TH2F *)errorsAr->FindKey(
"tresidualAr_bc")->ReadObj();
3706 if (errorsAr->FindKey(
"tresidualAr_ea"))
3707 residualAr_ea = (
TH2F *)errorsAr->FindKey(
"tresidualAr_ea")->ReadObj();
3708 if (errorsAr->FindKey(
"tresidualAr_ec"))
3709 residualAr_ec = (
TH2F *)errorsAr->FindKey(
"tresidualAr_ec")->ReadObj();
3712 if (errorsAr->FindKey(
"tresidualAr_baP"))
3713 residualAr_baP = (
TH2F *)errorsAr->FindKey(
"tresidualAr_baP")->ReadObj();
3714 if (errorsAr->FindKey(
"tresidualAr_bcP"))
3715 residualAr_bcP = (
TH2F *)errorsAr->FindKey(
"tresidualAr_bcP")->ReadObj();
3716 if (errorsAr->FindKey(
"tresidualAr_eaP"))
3717 residualAr_eaP = (
TH2F *)errorsAr->FindKey(
"tresidualAr_eaP")->ReadObj();
3718 if (errorsAr->FindKey(
"tresidualAr_ecP"))
3719 residualAr_ecP = (
TH2F *)errorsAr->FindKey(
"tresidualAr_ecP")->ReadObj();
3723 cout <<
" No time residual histograms for Argon layers : tresidualAr_trt and tresidualAr_trtP " << endl;
3730 if (residualAr_ba && residualAr_baP && residualAr_ba->GetEntries() > 0)
3732 ratioba = residualAr_baP->GetEntries() / residualAr_ba->GetEntries();
3734 if (residualAr_bc && residualAr_bcP && residualAr_ea && residualAr_bc->GetEntries() > 0)
3736 ratiobc = residualAr_bcP->GetEntries() / residualAr_bc->GetEntries();
3738 if (residual_ea && residual_eaP && residualAr_ea && residualAr_eaP && residual_ea->GetEntries() > 0)
3740 ratioea = (residual_eaP->GetEntries() + residualAr_eaP->GetEntries()) / (residual_ea->GetEntries() + residualAr_ea->GetEntries());
3742 if (residual_ec && residualAr_ecP &&residualAr_ec && residual_ec->GetEntries() > 0)
3744 ratioec = (residual_ecP->GetEntries() + residualAr_ecP->GetEntries()) / (residual_ec->GetEntries() + residualAr_ec->GetEntries());
3747 pt->AddText(
"Barrels:");
3748 pt->AddText(Form(
" (side C) hits: %i residual: %.4f mm Time res peak: %.3f ns ", (
int)bhitst[0], rest[0], trest[0]));
3749 pt->AddText(Form(
" (side C) Time res width: %.2f ns Ratio prec hits: %.3f ", treswt[0], ratioba));
3750 pt->AddText(Form(
" (side A) hits: %i residual: %.4f mm Time res peak: %.3f ns ", (
int)bhitst[2], rest[2], trest[2]));
3751 pt->AddText(Form(
" (side A) Time res width: %.2f ns Ratio prec hits: %.3f ", treswt[2], ratiobc));
3752 pt->AddText(
" Endcaps:");
3753 pt->AddText(Form(
" (side C) hits: %i residual: %.4f mm Time res peak: %.3f ns", (
int)bhitst[1], rest[1], trest[1]));
3754 pt->AddText(Form(
" (side C) Time res width: %.2f ns Ratio prec hits: %.3f ", treswt[1], ratioea));
3755 pt->AddText(Form(
" (side A) hits: %i residual: %.4f mm Time res peak: %.3f ns", (
int)bhitst[3], rest[3], trest[3]));
3756 pt->AddText(Form(
" (side A) Time res width: %.2f ns Ratio prec hits: %.3f ", treswt[3], ratioec));
3758 pt->SetLabel(Form(
"TRT calibration iteration summary"));