7 #include <TGraphErrors.h>
23 gStyle->SetOptStat(0);
25 TFile *fin =
new TFile(
"EnergyPosition3.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);
94 TCanvas *c1 =
new TCanvas(
"c1",
"c1",0,0,800,600);
98 EnPo->GetXaxis()->SetTitle(
"Horizontal Axis (mm)");
99 EnPo->GetYaxis()->SetTitle(
"Vertical Axis (mm)");
101 EnPo->SetTitle(
"Energy vs Horizontal and Vertical Positions Before Interpolation - 0 Degree");
106 c1->SaveAs(
"Before0Degree.png");
108 for(
int i = 0;
i < XBins;
i++)
114 for(
int j = 0;
j < YBins;
j++)
123 value[
i][
j] = EnPo->GetBinContent(
i,
j);
131 for(
int i = backward;
i < XBins - backward;
i++)
134 for(
int j = backward;
j < YBins - backward;
j++)
141 for(
int k =
i - backward; k <
i + forward +1; k++)
144 for(
int m =
j - backward;
m <
j+backward+1;
m++)
147 if(value[k][
m] > 0) NumberofValue = NumberofValue + 1;
149 Sum = Sum + value[
k][
m];
155 cout <<
"Number of Value = " << NumberofValue << endl;
157 cout <<
"Sum = " << Sum << endl;
159 if(NumberofValue > 0) finalvalue[
i][
j] = Sum/NumberofValue;
161 cout <<
" i = " <<
i <<
" j = " <<
j << endl;
163 cout <<
"Final Value is " << finalvalue[
i][
j] << endl;
168 Inter->SetBinContent(
i,
j,finalvalue[
i][
j]);
240 Inter->GetXaxis()->SetTitle(
"Horizontal Axis (mm)");
241 Inter->GetYaxis()->SetTitle(
"Vertical Axis (mm)");
242 Inter->SetTitle(
"Energy vs Horizontal and Vertical Positions After Interpolation - 0 Degree");
244 TFile *
fout =
new TFile(
"Interpolated2.root",
"RECREATE");
248 TCanvas *c22 =
new TCanvas(
"c22",
"c22",0,0,800,600);
252 Inter->SetMinimum(3.5);
254 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);
357 TLine *l6 =
new TLine(x1,Ymin,x1,Ymax);
363 texCol=
new TLatex(x1,Ymax,
"Tower 6");
364 texCol->SetTextAlign(33);
365 texCol->SetTextSize(0.03);
366 texCol->SetTextFont(42);
373 TLine *l7 =
new TLine(x2,Ymin,x2,Ymax);
379 texCol=
new TLatex(x2,Ymax,
"Tower 5");
380 texCol->SetTextAlign(33);
381 texCol->SetTextSize(0.03);
382 texCol->SetTextFont(42);
388 TLine *l8 =
new TLine(x3,Ymin,x3,Ymax);
394 texCol=
new TLatex(x3,Ymax,
"Tower 4");
395 texCol->SetTextAlign(33);
396 texCol->SetTextSize(0.03);
397 texCol->SetTextFont(42);
403 TLine *l9 =
new TLine(x4,Ymin,x4,Ymax);
409 texCol=
new TLatex(x4,Ymax,
"Tower 3");
410 texCol->SetTextAlign(33);
411 texCol->SetTextSize(0.03);
412 texCol->SetTextFont(42);
419 TLine *l10 =
new TLine(x5,Ymin,x5,Ymax);
420 l10->SetLineWidth(1);
425 texCol=
new TLatex(x5,Ymax,
"Tower 2");
426 texCol->SetTextAlign(33);
427 texCol->SetTextSize(0.03);
428 texCol->SetTextFont(42);
433 TLine *l11 =
new TLine(Xmax,Ymin,Xmax,Ymax);
434 l11->SetLineWidth(1);
439 texCol=
new TLatex(Xmax,Ymax,
"Tower 1");
440 texCol->SetTextAlign(33);
441 texCol->SetTextSize(0.03);
442 texCol->SetTextFont(42);
449 c22->SaveAs(
"Interpolation 0 Degree.png");