748{
749
750 ofstream txtfile(Form("finedelays_%i.txt", detector), ios::out);
751
752 float t0o, chip,
dt0, rt0;
753 int nchip[9] = {10, 11, 15, 9, 9, 11, 12, 13, 14};
754
755 this->SetBins(104, 0.5, 104.5);
756 this->SetName(Form("ChipT0Var_%i", detector));
757
758 TFile *
file =
new TFile(infile);
759 cout <<
"In ChipVariations infile: " <<
infile <<
" detector " <<
detector << endl;
761 TNtuple *Chiptuple = (TNtuple *)
file->Get(
"Chiptuple");
762
763 Chiptuple->SetBranchAddress("rt0", &rt0);
764 Chiptuple->SetBranchAddress("t0offset", &t0o);
765 Chiptuple->SetBranchAddress("chp", &chip);
766 Chiptuple->SetBranchAddress("dt0", &dt0);
767
769 for (int ibrd = 0; ibrd < 9; ibrd++)
770 {
771
772 Chiptuple->Draw(">>tmplist", Form("brd==%i && t0offset!=0 && ftype>1 && det==%i", ibrd, detector));
773 TEventList *elist = (TEventList *)
gDirectory->Get(
"tmplist");
774
775 int mchip = 0;
776 for (
int ib = 0;
ib < elist->GetN();
ib++)
777 {
779 Chiptuple->GetEntry(elist->GetEntry(ib));
780 if (ibrd < 2)
782 if (ibrd >= 2 && ibrd < 5)
783 mchip = (
int)chip + 21;
784 if (ibrd >= 5)
785 mchip = (
int)chip + 21 + 33;
786 this->Fill(mchip, t0o);
787 }
788 }
789
791 for (int ibrd = 0; ibrd < 9; ibrd++)
792 {
793 for (int ichp = 0; ichp < nchip[ibrd]; ichp++)
794 {
795 int mchip = 0;
796 if (ibrd == 0)
797 mchip = ichp + 1;
798 if (ibrd == 1)
799 mchip = ichp + nchip[ibrd - 1] + 1;
800 if (ibrd == 2)
801 mchip = ichp + 1;
802 if (ibrd == 3)
803 mchip = ichp + nchip[ibrd - 1] + 1;
804 if (ibrd == 4)
805 mchip = ichp + nchip[ibrd - 1] + nchip[ibrd - 2] + 1;
806 if (ibrd == 5)
807 mchip = ichp + 1;
808 if (ibrd == 6)
809 mchip = ichp + nchip[ibrd - 1] + 1;
810 if (ibrd == 7)
811 mchip = ichp + nchip[ibrd - 1] + nchip[ibrd - 2] + 1;
812 if (ibrd == 8)
813 mchip = ichp + nchip[ibrd - 1] + nchip[ibrd - 2] + nchip[ibrd - 3] + 1;
814 txtfile << ibrd <<
" " << mchip <<
" " <<
detector <<
" " <<
ic <<
" " << this->GetBinContent(ic + 1) << endl;
816 }
817 }
818
819
820 this->SetTitle(Form(
"Chip T0 offset (phi-mod average, %c-side)",
detlet[detector + 1]));
821 this->SetStats(kFALSE);
822 this->SetLineColor(2);
823 this->GetYaxis()->SetTitle("T0_{board}-T0_{chip} / ns");
824 this->GetXaxis()->SetTitle("chip #");
825
826 txtfile.close();
829}