7 #include <TGraphErrors.h>
26 gStyle->SetOptStat(0);
28 TFile *fin =
new TFile(
"Interpolated2.root");
35 double inteval = 12.5;
36 double xinitial = -188;
38 double yinitial = -77;
96 for(
int j = 0;
j < All;
j++)
98 TCanvas *c22 =
new TCanvas(
"c22",
"c22",0,0,800,600);
102 TFile *fin =
new TFile(
"Interpolated2.root");
103 x = xinitial - inteval *
j;
109 Center = Inter->GetXaxis()->FindBin(x);
116 cout <<
"OK 0" << endl;
118 xlow = x - bins *
step;
119 xhigh = x + bins *
step;
121 binlow = Inter->GetXaxis()->FindBin(xlow);
123 binhigh = Inter->GetXaxis()->FindBin(xhigh);
125 YBins = (Ymax - Ymin)/step;
127 cout <<
"binlow = " << binlow << endl;
128 cout <<
"binhigh = " << binhigh << endl;
131 TH1D *
h1 =
new TH1D(
"h1",
"",YBins,Ymin,Ymax);
134 Inter->ProjectionY(
"h1",binlow,binhigh);
143 Ybinmin = h1->GetXaxis()->FindBin(Ymin);
146 Ybinmax = h1->GetXaxis()->FindBin(Ymax);
147 cout <<
" OK 1" << endl;
149 N = (Ybinmax - Ybinmin)/NBins;
184 sprintf(HistoName,
"Result%d.root",j);
186 TFile *
fout =
new TFile(HistoName,
"RECREATE");
187 h1->GetXaxis()->SetTitle(
"y (mm)");
188 h1->GetYaxis()->SetTitle(
"Average Energy (GeV)");
194 if(j == 1 || j == 3 || j == 5) sprintf(Title,
"10 X Bin Average Energy vs Vertical Position Tower Between %d and %d",k,l);
196 if(j == 0 || j == 2 || j == 4 || j == 6 ) sprintf(Title,
"10 X Bin Average Energy vs Vertical Position Tower %d",m);
208 sprintf(outname,
"Result/Energy vs 10-Bin Average Y %d.png",j);
214 c22->SaveAs(outname);
221 for(
int j = 0;
j < HAll;
j++)
223 TCanvas *c22 =
new TCanvas(
"c22",
"c22",0,0,800,600);
227 TFile *fin =
new TFile(
"Interpolated2.root");
228 y = yinitial - inteval *
j;
234 Center = Inter->GetXaxis()->FindBin(x);
243 ylow = y - bins *
step;
244 yhigh = y + bins *
step;
246 ybinlow = Inter->GetYaxis()->FindBin(ylow);
248 ybinhigh = Inter->GetYaxis()->FindBin(yhigh);
252 YBins = (Ymax - Ymin)/step;
254 cout <<
"ybinlow = " <<ybinlow << endl;
255 cout <<
"ybinhigh = " << ybinhigh << endl;
258 TH1D *
h1 =
new TH1D(
"h1",
"",YBins,Ymin,Ymax);
261 Inter->ProjectionX(
"h1",ybinlow,ybinhigh);
270 Ybinmin = h1->GetXaxis()->FindBin(Ymin);
273 Ybinmax = h1->GetXaxis()->FindBin(Ymax);
274 cout <<
" OK 1" << endl;
276 N = (Ybinmax - Ybinmin)/NBins;
311 sprintf(HistoName,
"Result%d.root",j);
313 TFile *
fout =
new TFile(HistoName,
"RECREATE");
314 h1->GetXaxis()->SetTitle(
"x (mm)");
315 h1->GetYaxis()->SetTitle(
"Average Energy (GeV)");
321 if(j == 1 || j == 3 || j == 5 || j == 7 || j == 9) sprintf(Title,
"10 X Bin Average Energy vs Horizontal Position Tower Between %d and %d",k,l);
323 if(j == 0 || j == 2 || j == 4 || j == 6 || j == 8 || j == 10 ) sprintf(Title,
"10 X Bin Average Energy vs Horizontal Position Tower %d",m);
335 sprintf(outname,
"Result/Energy vs 10-Bin Average X %d.png",j);
341 c22->SaveAs(outname);
343 cout <<
" OK 2" << endl;