1643{
1644
1645
1646
1647 float t0,
dt0, bindex;
1648
1653 if (abs(det) == 2)
1655
1656 this->SetName(Form("BoardT0Var_%i", det));
1657
1658 unique_ptr<TFile>
file(
new TFile(infile));
1659
1660 cout <<
"In BoardVariationsTRes infile: " << string(infile) <<
" detector " <<
det << endl;
1662 TNtuple *BoardtupleTRes = (TNtuple *)
file->Get(
"Board_Artuple");
1663 TNtuple *BoardtupleXe = (TNtuple *)
file->Get(
"Boardtuple");
1664
1665 BoardtupleTRes->SetBranchAddress(
"tres", &
t0);
1666 BoardtupleTRes->SetBranchAddress("dres", &dt0);
1667 if (abs(det) == 2)
1668 {
1669 BoardtupleXe->SetBranchAddress(
"tres", &
t0);
1670 BoardtupleXe->SetBranchAddress("dres", &dt0);
1671 }
1672
1673 int ipnt = 0;
1674 if (abs(det) == 1)
1675 {
1676 for (int imod = 0; imod < 32; imod++)
1677 {
1678 for (int ibrd = 0; ibrd < 9; ibrd++)
1679 {
1680
1681 bindex = 9 * imod + ibrd;
1682
1683 BoardtupleTRes->Draw(">>tmplist", Form("brd==%i && det==%i && mod==%i", ibrd, det, imod));
1684 TEventList *elist = (TEventList *)
gDirectory->Get(
"tmplist");
1685 for (
int ib = 0;
ib < elist->GetN();
ib++)
1686 {
1687 ipnt++;
1688 BoardtupleTRes->GetEntry(elist->GetEntry(ib));
1689 this->SetPoint(ipnt, bindex + 1,
t0);
1690 this->SetPointError(ipnt, 0, dt0);
1695
1696 }
1697 }
1698 }
1699 }
1700 else if (abs(det) == 2)
1701 {
1702 for (int imod = 0; imod < 32; imod++)
1703 {
1704 for (int ilay = 0; ilay < 14; ilay++)
1705 {
1706
1707 bindex = 14 * imod + ilay;
1708
1709 BoardtupleTRes->Draw(">>tmplist1", Form("lay==%i && det==%i && mod==%i", ilay, det, imod));
1710 TEventList *elist = (TEventList *)
gDirectory->Get(
"tmplist1");
1711 for (
int ib = 0;
ib < elist->GetN();
ib++)
1712 {
1713 ipnt++;
1714 BoardtupleTRes->GetEntry(elist->GetEntry(ib));
1715 this->SetPoint(ipnt, bindex + 1,
t0);
1716 this->SetPointError(ipnt, 0, dt0);
1721
1722 }
1723
1724 BoardtupleXe->Draw(">>tmplistXe", Form("lay==%i && det==%i && mod==%i", ilay, det, imod));
1725 elist = (TEventList *)
gDirectory->Get(
"tmplistXe");
1726 for (
int ib = 0;
ib < elist->GetN();
ib++)
1727 {
1728 ipnt++;
1729 BoardtupleXe->GetEntry(elist->GetEntry(ib));
1730 this->SetPoint(ipnt, bindex + 1,
t0);
1731 this->SetPointError(ipnt, 0, dt0);
1736
1737 }
1738 }
1739 }
1740 }
1741
1742 this->fMaximum =
maxy;
1743 this->fMinimum =
miny;
1744 if (abs(det) == 1)
1745 {
1746
1747 this->SetTitle(Form(
"Barrel Board Sigma Time Residuals (%c-side)",
detlet[det + 1]));
1748 }
1749 else
1750 {
1751 if (det+1 >=3){
1752 throw std::out_of_range("Out-of-bounds access to the detlet array");
1753 }
1754 this->SetTitle(Form(
"Endcap Board Sigma Time Residuals (%c-side)",
detlet[det + 1]));
1755 }
1756 this->SetLineColor(4);
1757 this->RemovePoint(0);
1758
1760
1761 cout << " found " << ipnt << " board t0s " << endl;
1762
1763}