7 #include <TGraphErrors.h>
26 gStyle->SetOptStat(0);
28 TFile *fin =
new TFile(
"Interpolated.root");
35 double inteval = 12.5;
36 double xinitial = -188;
38 double yinitial = -77;
98 for(
int j = 0;
j < All;
j++)
100 TCanvas *c22 =
new TCanvas(
"c22",
"c22",0,0,800,600);
104 TFile *fin =
new TFile(
"Interpolated2.root");
105 x = xinitial - inteval *
j;
111 Center = Inter->GetXaxis()->FindBin(x);
118 cout <<
"OK 0" << endl;
120 xlow = x - bins *
step;
121 xhigh = x + bins *
step;
123 binlow = Inter->GetXaxis()->FindBin(xlow);
125 binhigh = Inter->GetXaxis()->FindBin(xhigh);
127 YBins = (Ymax - Ymin)/step;
129 cout <<
"binlow = " << binlow << endl;
130 cout <<
"binhigh = " << binhigh << endl;
133 TH1D *
h1 =
new TH1D(
"h1",
"",YBins,Ymin,Ymax);
136 Inter->ProjectionY(
"h1",binlow,binhigh);
145 Ybinmin = h1->GetXaxis()->FindBin(Ymin);
148 Ybinmax = h1->GetXaxis()->FindBin(Ymax);
149 cout <<
" OK 1" << endl;
151 N = (Ybinmax - Ybinmin)/NBins;
186 sprintf(HistoName,
"Result%d.root",j);
188 TFile *
fout =
new TFile(HistoName,
"RECREATE");
189 h1->GetXaxis()->SetTitle(
"y (mm)");
190 h1->GetYaxis()->SetTitle(
"Average Energy (GeV)");
196 if(j == 1 || j == 3 || j == 5) sprintf(Title,
"10 X Bin Average Energy vs Vertical Position Tower Between %d and %d",k,l);
198 if(j == 0 || j == 2 || j == 4 || j == 6 ) sprintf(Title,
"10 X Bin Average Energy vs Vertical Position Tower %d",m);
210 sprintf(outname,
"Result/Energy vs 10-Bin Average Y %d.png",j);
216 c22->SaveAs(outname);
224 for(
int j = 0;
j < HAll;
j++)
226 TCanvas *c22 =
new TCanvas(
"c22",
"c22",0,0,800,600);
230 TFile *fin =
new TFile(
"Interpolated2.root");
231 y = yinitial - inteval *
j;
237 Center = Inter->GetXaxis()->FindBin(x);
246 ylow = y - bins *
step;
247 yhigh = y + bins *
step;
249 ybinlow = Inter->GetYaxis()->FindBin(ylow);
251 ybinhigh = Inter->GetYaxis()->FindBin(yhigh);
255 YBins = (Ymax - Ymin)/step;
257 cout <<
"ybinlow = " <<ybinlow << endl;
258 cout <<
"ybinhigh = " << ybinhigh << endl;
261 TH1D *
h1 =
new TH1D(
"h1",
"",YBins,Ymin,Ymax);
264 Inter->ProjectionX(
"h1",ybinlow,ybinhigh);
273 Ybinmin = h1->GetXaxis()->FindBin(Ymin);
276 Ybinmax = h1->GetXaxis()->FindBin(Ymax);
277 cout <<
" OK 1" << endl;
279 N = (Ybinmax - Ybinmin)/NBins;
314 sprintf(HistoName,
"Result%d.root",j);
316 TFile *
fout =
new TFile(HistoName,
"RECREATE");
317 h1->GetXaxis()->SetTitle(
"x (mm)");
318 h1->GetYaxis()->SetTitle(
"Average Energy (GeV)");
324 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);
326 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);
338 sprintf(outname,
"Result2/Energy vs 10-Bin Average X %d.png",j);
344 c22->SaveAs(outname);
346 cout <<
" OK 2" << endl;