7 #include <TGraphErrors.h>
23 gStyle->SetOptStat(0);
25 TFile *fin =
new TFile(
"EnergyPosition2.root");
64 int NumX = (Xmax - Xmin)/step;
65 int NumY = (Ymax - Ymin)/step;
67 const int XBins = NumX;
69 const int YBins = NumY;
73 cout <<
"XBins = " << XBins << endl;
74 cout <<
"YBins = " << YBins << endl;
77 double value[XBins][YBins];
79 double finalvalue[XBins][YBins];
81 TH2D *Inter =
new TH2D(
"Inter",
"",XBins,Xmin,Xmax,YBins,Ymin,Ymax);
96 TCanvas *c1 =
new TCanvas(
"c1",
"c1",0,0,800,600);
100 EnPo->GetXaxis()->SetTitle(
"Horizontal Axis (mm)");
101 EnPo->GetYaxis()->SetTitle(
"Vertical Axis (mm)");
103 EnPo->SetTitle(
"Energy vs Horizontal and Vertical Positions Before Interpolation - 10 Degree");
108 c1->SaveAs(
"Before10Degree.png");
111 for(
int i = 0;
i < XBins;
i++)
117 for(
int j = 0;
j < YBins;
j++)
126 value[
i][
j] = EnPo->GetBinContent(
i,
j);
134 for(
int i = backward;
i < XBins - backward;
i++)
137 for(
int j = backward;
j < YBins - backward;
j++)
144 for(
int k =
i - backward; k <
i + forward +1; k++)
147 for(
int m =
j - backward;
m <
j+backward+1;
m++)
150 if(value[k][
m] > 0) NumberofValue = NumberofValue + 1;
152 Sum = Sum + value[
k][
m];
158 cout <<
"Number of Value = " << NumberofValue << endl;
160 cout <<
"Sum = " << Sum << endl;
162 if(NumberofValue > 0) finalvalue[
i][
j] = Sum/NumberofValue;
164 cout <<
" i = " <<
i <<
" j = " <<
j << endl;
166 cout <<
"Final Value is " << finalvalue[
i][
j] << endl;
169 Inter->SetBinContent(
i,
j,finalvalue[
i][
j]);
242 Inter->GetXaxis()->SetTitle(
"Horizontal Axis (mm)");
243 Inter->GetYaxis()->SetTitle(
"Vertical Axis (mm)");
244 Inter->SetTitle(
"Energy vs Horizontal and Vertical Positions Before Interpolation - 10 Degree");
246 TFile *
fout =
new TFile(
"Interpolated2.root",
"RECREATE");
250 TCanvas *c22 =
new TCanvas(
"c22",
"c22",0,0,800,600);
256 Inter->SetMinimum(4.5);
258 Inter->SetMaximum(9);
263 TLine *
l1 =
new TLine(Xmin,y1,Xmax,y1);
269 texCol=
new TLatex(Xmin,y1,
"Tower 6");
270 texCol->SetTextAlign(13);
271 texCol->SetTextSize(0.03);
272 texCol->SetTextFont(42);
279 TLine *
l2 =
new TLine(Xmin,y2,Xmax,y2);
285 texCol=
new TLatex(Xmin,y2,
"Tower 5");
286 texCol->SetTextAlign(13);
287 texCol->SetTextSize(0.03);
288 texCol->SetTextFont(42);
294 TLine *l3 =
new TLine(Xmin,y3,Xmax,y3);
300 texCol=
new TLatex(Xmin,y3,
"Tower 4");
301 texCol->SetTextAlign(13);
302 texCol->SetTextSize(0.03);
303 texCol->SetTextFont(42);
311 TLine *l4 =
new TLine(Xmin,y4,Xmax,y4);
317 texCol=
new TLatex(Xmin,y4,
"Tower 3");
318 texCol->SetTextAlign(13);
319 texCol->SetTextSize(0.03);
320 texCol->SetTextFont(42);
326 TLine *l4 =
new TLine(Xmin,y5,Xmax,y5);
333 texCol=
new TLatex(Xmin,y5,
"Tower 2");
334 texCol->SetTextAlign(13);
335 texCol->SetTextSize(0.03);
336 texCol->SetTextFont(42);
342 TLine *l12 =
new TLine(Xmax,Ymax,Xmax,Ymax);
343 l12->SetLineWidth(1);
348 texCol=
new TLatex(Xmin,215,
"Tower 1");
349 texCol->SetTextAlign(13);
350 texCol->SetTextSize(0.03);
351 texCol->SetTextFont(42);
359 TLine *l6 =
new TLine(x1,Ymin,x1,Ymax);
365 texCol=
new TLatex(x1,Ymax,
"Tower 6");
366 texCol->SetTextAlign(33);
367 texCol->SetTextSize(0.03);
368 texCol->SetTextFont(42);
375 TLine *l7 =
new TLine(x2,Ymin,x2,Ymax);
381 texCol=
new TLatex(x2,Ymax,
"Tower 5");
382 texCol->SetTextAlign(33);
383 texCol->SetTextSize(0.03);
384 texCol->SetTextFont(42);
390 TLine *l8 =
new TLine(x3,Ymin,x3,Ymax);
396 texCol=
new TLatex(x3,Ymax,
"Tower 4");
397 texCol->SetTextAlign(33);
398 texCol->SetTextSize(0.03);
399 texCol->SetTextFont(42);
405 TLine *l9 =
new TLine(x4,Ymin,x4,Ymax);
411 texCol=
new TLatex(x4,Ymax,
"Tower 3");
412 texCol->SetTextAlign(33);
413 texCol->SetTextSize(0.03);
414 texCol->SetTextFont(42);
421 TLine *l10 =
new TLine(x5,Ymin,x5,Ymax);
422 l10->SetLineWidth(1);
427 texCol=
new TLatex(x5,Ymax,
"Tower 2");
428 texCol->SetTextAlign(33);
429 texCol->SetTextSize(0.03);
430 texCol->SetTextFont(42);
435 TLine *l11 =
new TLine(Xmax,Ymin,Xmax,Ymax);
436 l11->SetLineWidth(1);
441 texCol=
new TLatex(Xmax,Ymax,
"Tower 1");
442 texCol->SetTextAlign(33);
443 texCol->SetTextSize(0.03);
444 texCol->SetTextFont(42);
451 c22->SaveAs(
"Interpolation10Degree.png");