{
// Example of the fit of correction function for B=5 events sample

   gROOT->SetStyle("Plain");
   gStyle->SetOptTitle(0);

  gStyle->SetPadRightMargin(0.01);
  gStyle->SetPadTopMargin(0.02);
  gStyle->SetPadLeftMargin(0.16);
  gStyle->SetPadBottomMargin(0.14);
  gStyle->SetLabelSize(0.05, "xy");
  gStyle->SetTitleSize(0.07, "x");
  gStyle->SetTitleSize(0.07, "y");
  gStyle->SetTitleOffset(1.1, "y");
  gStyle->SetTitleOffset(0.8, "x");
  gStyle->SetLabelOffset(0.02, "y");

   TCanvas *ceta = new TCanvas("c_eta_correction_fit_B5", "eta_correction_fit",600,400);
   
   TGraph *graph = new TGraph(82);
   graph->SetName("Graph");
   graph->SetTitle("Graph");
   graph->SetFillColor(1);
   graph->SetLineStyle(0);
   graph->SetMarkerColor(2);
   graph->SetMarkerStyle(24);
   graph->SetMarkerSize(1.3);
   graph->SetPoint(0,-2.025,0.708354);
   graph->SetPoint(1,-1.975,1.19484);
   graph->SetPoint(2,-1.925,1.84941);
   graph->SetPoint(3,-1.875,2.45562);
   graph->SetPoint(4,-1.825,2.72249);
   graph->SetPoint(5,-1.775,2.98771);
   graph->SetPoint(6,-1.725,3.16605);
   graph->SetPoint(7,-1.675,3.28466);
   graph->SetPoint(8,-1.625,3.29255);
   graph->SetPoint(9,-1.575,3.22554);
   graph->SetPoint(10,-1.525,3.06455);
   graph->SetPoint(11,-1.475,2.98316);
   graph->SetPoint(12,-1.425,2.95733);
   graph->SetPoint(13,-1.375,2.85451);
   graph->SetPoint(14,-1.325,2.7707);
   graph->SetPoint(15,-1.275,2.65318);
   graph->SetPoint(16,-1.225,2.6256);
   graph->SetPoint(17,-1.175,2.52078);
   graph->SetPoint(18,-1.125,2.5047);
   graph->SetPoint(19,-1.075,2.44373);
   graph->SetPoint(20,-1.025,2.3871);
   graph->SetPoint(21,-0.975,2.40089);
   graph->SetPoint(22,-0.925,2.31721);
   graph->SetPoint(23,-0.875,2.21068);
   graph->SetPoint(24,-0.825,2.18813);
   graph->SetPoint(25,-0.775,2.18035);
   graph->SetPoint(26,-0.725,2.12857);
   graph->SetPoint(27,-0.675,2.11426);
   graph->SetPoint(28,-0.625,2.07141);
   graph->SetPoint(29,-0.575,2.06769);
   graph->SetPoint(30,-0.525,2.05742);
   graph->SetPoint(31,-0.475,2.00437);
   graph->SetPoint(32,-0.425,1.99734);
   graph->SetPoint(33,-0.375,1.96551);
   graph->SetPoint(34,-0.325,1.94461);
   graph->SetPoint(35,-0.275,1.98232);
   graph->SetPoint(36,-0.225,1.94373);
   graph->SetPoint(37,-0.175,1.92384);
   graph->SetPoint(38,-0.125,1.95837);
   graph->SetPoint(39,-0.075,1.94989);
   graph->SetPoint(40,-0.025,1.94564);
   graph->SetPoint(41,0.025,1.93036);
   graph->SetPoint(42,0.075,1.94703);
   graph->SetPoint(43,0.125,1.96367);
   graph->SetPoint(44,0.175,1.92417);
   graph->SetPoint(45,0.225,1.94944);
   graph->SetPoint(46,0.275,1.9631);
   graph->SetPoint(47,0.325,1.9725);
   graph->SetPoint(48,0.375,1.91255);
   graph->SetPoint(49,0.425,1.99868);
   graph->SetPoint(50,0.475,2.00022);
   graph->SetPoint(51,0.525,2.02393);
   graph->SetPoint(52,0.575,2.0778);
   graph->SetPoint(53,0.625,2.06029);
   graph->SetPoint(54,0.675,2.03646);
   graph->SetPoint(55,0.725,2.09657);
   graph->SetPoint(56,0.775,2.13745);
   graph->SetPoint(57,0.825,2.24588);
   graph->SetPoint(58,0.875,2.22267);
   graph->SetPoint(59,0.925,2.26194);
   graph->SetPoint(60,0.975,2.28208);
   graph->SetPoint(61,1.025,2.35887);
   graph->SetPoint(62,1.075,2.46785);
   graph->SetPoint(63,1.125,2.47415);
   graph->SetPoint(64,1.175,2.60788);
   graph->SetPoint(65,1.225,2.62328);
   graph->SetPoint(66,1.275,2.69379);
   graph->SetPoint(67,1.325,2.71489);
   graph->SetPoint(68,1.375,2.78424);
   graph->SetPoint(69,1.425,2.82807);
   graph->SetPoint(70,1.475,2.91853);
   graph->SetPoint(71,1.525,3.04342);
   graph->SetPoint(72,1.575,3.16998);
   graph->SetPoint(73,1.625,3.2224);
   graph->SetPoint(74,1.675,3.23098);
   graph->SetPoint(75,1.725,3.26795);
   graph->SetPoint(76,1.775,3.05643);
   graph->SetPoint(77,1.825,2.7194);
   graph->SetPoint(78,1.875,2.31125);
   graph->SetPoint(79,1.925,1.67834);
   graph->SetPoint(80,1.975,1.25093);
   graph->SetPoint(81,2.025,0.828563);
   
   TH1 *Graph1 = new TH1F("Graph1","Graph",100,-3,3);
   Graph1->SetMinimum(0);
   Graph1->SetMaximum(3.6);
   Graph1->SetDirectory(0);
   Graph1->SetStats(0);
   Graph1->GetXaxis()->SetTitle("#eta");
   Graph1->GetYaxis()->SetTitle("correction");
   graph->SetHistogram(Graph1);
   
   graph->Draw("ap");
   
   TF1 *etacorr3 = new TF1("etacorr3","[0]+[1]*x*x+[2]*x*x*x*x",-1.7,1.7);
   etacorr3->SetFillColor(19);
   etacorr3->SetFillStyle(0);
   etacorr3->SetLineColor(2);
   etacorr3->SetLineWidth(3);
   etacorr3->SetChisquare(0.0326968);
   etacorr3->SetParameter(0,1.92106);
   etacorr3->SetParError(0,0.324021);
   etacorr3->SetParLimits(0,0,0);
   etacorr3->SetParameter(1,0.399986);
   etacorr3->SetParError(1,0.760887);
   etacorr3->SetParLimits(1,0,0);
   etacorr3->SetParameter(2,0.0370416);
   etacorr3->SetParError(2,0.306276);
   etacorr3->SetParLimits(2,0,0);
   etacorr3->Draw("lsame");
   
   TF1 *etacorr3 = new TF1("etacorr3","[0]+[1]*x*x+[2]*x*x*x*x",-1.7,1.7);
   etacorr3->SetFillColor(19);
   etacorr3->SetFillStyle(0);
   etacorr3->SetLineColor(2);
   etacorr3->SetLineWidth(3);
   etacorr3->SetChisquare(0.0326968);
   etacorr3->SetParameter(0,1.92106);
   etacorr3->SetParError(0,0.324021);
   etacorr3->SetParLimits(0,0,0);
   etacorr3->SetParameter(1,0.399986);
   etacorr3->SetParError(1,0.760887);
   etacorr3->SetParLimits(1,0,0);
   etacorr3->SetParameter(2,0.0370416);
   etacorr3->SetParError(2,0.306276);
   etacorr3->SetParLimits(2,0,0);
   etacorr3->Draw("lsame");
   
   graph = new TGraph(94);
   graph->SetName("Graph");
   graph->SetTitle("Graph");
   graph->SetFillColor(1);
   graph->SetMarkerColor(4);
   graph->SetMarkerStyle(26);
   graph->SetPoint(0,-2.325,0.816567);
   graph->SetPoint(1,-2.275,1.40804);
   graph->SetPoint(2,-2.225,2.0692);
   graph->SetPoint(3,-2.175,2.4428);
   graph->SetPoint(4,-2.125,2.77592);
   graph->SetPoint(5,-2.075,3.01632);
   graph->SetPoint(6,-2.025,3.15493);
   graph->SetPoint(7,-1.975,3.22162);
   graph->SetPoint(8,-1.925,3.20788);
   graph->SetPoint(9,-1.875,3.16695);
   graph->SetPoint(10,-1.825,3.01669);
   graph->SetPoint(11,-1.775,2.91152);
   graph->SetPoint(12,-1.725,2.81535);
   graph->SetPoint(13,-1.675,2.72479);
   graph->SetPoint(14,-1.625,2.66746);
   graph->SetPoint(15,-1.575,2.60434);
   graph->SetPoint(16,-1.525,2.54824);
   graph->SetPoint(17,-1.475,2.41794);
   graph->SetPoint(18,-1.425,2.399);
   graph->SetPoint(19,-1.375,2.35102);
   graph->SetPoint(20,-1.325,2.30051);
   graph->SetPoint(21,-1.275,2.17127);
   graph->SetPoint(22,-1.225,2.16486);
   graph->SetPoint(23,-1.175,2.0827);
   graph->SetPoint(24,-1.125,2.05025);
   graph->SetPoint(25,-1.075,2.04425);
   graph->SetPoint(26,-1.025,1.97801);
   graph->SetPoint(27,-0.975,1.97475);
   graph->SetPoint(28,-0.925,1.94064);
   graph->SetPoint(29,-0.875,1.89455);
   graph->SetPoint(30,-0.825,1.86829);
   graph->SetPoint(31,-0.775,1.81441);
   graph->SetPoint(32,-0.725,1.82233);
   graph->SetPoint(33,-0.675,1.80845);
   graph->SetPoint(34,-0.625,1.78207);
   graph->SetPoint(35,-0.575,1.76196);
   graph->SetPoint(36,-0.525,1.75025);
   graph->SetPoint(37,-0.475,1.72161);
   graph->SetPoint(38,-0.425,1.71928);
   graph->SetPoint(39,-0.375,1.72441);
   graph->SetPoint(40,-0.325,1.69397);
   graph->SetPoint(41,-0.275,1.73132);
   graph->SetPoint(42,-0.225,1.71401);
   graph->SetPoint(43,-0.175,1.71127);
   graph->SetPoint(44,-0.125,1.70093);
   graph->SetPoint(45,-0.075,1.69166);
   graph->SetPoint(46,-0.025,1.71785);
   graph->SetPoint(47,0.025,1.66105);
   graph->SetPoint(48,0.075,1.67504);
   graph->SetPoint(49,0.125,1.68238);
   graph->SetPoint(50,0.175,1.72547);
   graph->SetPoint(51,0.225,1.68412);
   graph->SetPoint(52,0.275,1.68804);
   graph->SetPoint(53,0.325,1.70151);
   graph->SetPoint(54,0.375,1.67033);
   graph->SetPoint(55,0.425,1.71748);
   graph->SetPoint(56,0.475,1.74458);
   graph->SetPoint(57,0.525,1.7387);
   graph->SetPoint(58,0.575,1.79251);
   graph->SetPoint(59,0.625,1.77231);
   graph->SetPoint(60,0.675,1.80629);
   graph->SetPoint(61,0.725,1.85883);
   graph->SetPoint(62,0.775,1.82415);
   graph->SetPoint(63,0.825,1.90048);
   graph->SetPoint(64,0.875,1.91217);
   graph->SetPoint(65,0.925,1.91967);
   graph->SetPoint(66,0.975,1.94081);
   graph->SetPoint(67,1.025,2.01624);
   graph->SetPoint(68,1.075,2.00491);
   graph->SetPoint(69,1.125,2.04663);
   graph->SetPoint(70,1.175,2.1708);
   graph->SetPoint(71,1.225,2.14454);
   graph->SetPoint(72,1.275,2.18814);
   graph->SetPoint(73,1.325,2.24099);
   graph->SetPoint(74,1.375,2.31089);
   graph->SetPoint(75,1.425,2.33091);
   graph->SetPoint(76,1.475,2.4363);
   graph->SetPoint(77,1.525,2.46129);
   graph->SetPoint(78,1.575,2.59498);
   graph->SetPoint(79,1.625,2.61734);
   graph->SetPoint(80,1.675,2.69534);
   graph->SetPoint(81,1.725,2.78763);
   graph->SetPoint(82,1.775,2.80008);
   graph->SetPoint(83,1.825,2.92583);
   graph->SetPoint(84,1.875,3.10267);
   graph->SetPoint(85,1.925,3.12398);
   graph->SetPoint(86,1.975,3.20762);
   graph->SetPoint(87,2.025,3.24947);
   graph->SetPoint(88,2.075,3.15974);
   graph->SetPoint(89,2.125,2.81006);
   graph->SetPoint(90,2.175,2.46879);
   graph->SetPoint(91,2.225,1.8457);
   graph->SetPoint(92,2.275,1.37994);
   graph->SetPoint(93,2.325,0.976558);
   graph->Draw("p");
   
   TF1 *etacorr2 = new TF1("etacorr2","[0]+[1]*x*x+[2]*x*x*x*x",-2,2);
   etacorr2->SetFillColor(19);
   etacorr2->SetFillStyle(0);
   etacorr2->SetLineColor(4);
   etacorr2->SetLineWidth(3);
   etacorr2->SetChisquare(0.0298217);
   etacorr2->SetParameter(0,1.67867);
   etacorr2->SetParError(0,0.280022);
   etacorr2->SetParLimits(0,0,0);
   etacorr2->SetParameter(1,0.264189);
   etacorr2->SetParError(1,0.481731);
   etacorr2->SetParLimits(1,0,0);
   etacorr2->SetParameter(2,0.037177);
   etacorr2->SetParError(2,0.141362);
   etacorr2->SetParLimits(2,0,0);
   etacorr2->Draw("lsame");
   
   graph = new TGraph(117);
   graph->SetName("Graph");
   graph->SetTitle("Graph");
   graph->SetFillColor(1);
   graph->SetMarkerStyle(25);
   graph->SetMarkerSize(1.3);
   graph->SetPoint(0,-2.875,0.855311);
   graph->SetPoint(1,-2.825,1.43192);
   graph->SetPoint(2,-2.775,2.00344);
   graph->SetPoint(3,-2.725,2.41558);
   graph->SetPoint(4,-2.675,2.75966);
   graph->SetPoint(5,-2.625,2.96403);
   graph->SetPoint(6,-2.575,3.10296);
   graph->SetPoint(7,-2.525,3.09118);
   graph->SetPoint(8,-2.475,3.14127);
   graph->SetPoint(9,-2.425,3.04959);
   graph->SetPoint(10,-2.375,2.93606);
   graph->SetPoint(11,-2.325,2.76916);
   graph->SetPoint(12,-2.275,2.68331);
   graph->SetPoint(13,-2.225,2.59075);
   graph->SetPoint(14,-2.175,2.50699);
   graph->SetPoint(15,-2.125,2.40991);
   graph->SetPoint(16,-2.075,2.33294);
   graph->SetPoint(17,-2.025,2.27502);
   graph->SetPoint(18,-1.975,2.22422);
   graph->SetPoint(19,-1.925,2.16849);
   graph->SetPoint(20,-1.875,2.12312);
   graph->SetPoint(21,-1.825,2.05612);
   graph->SetPoint(22,-1.775,2.01655);
   graph->SetPoint(23,-1.725,1.97534);
   graph->SetPoint(24,-1.675,1.87837);
   graph->SetPoint(25,-1.625,1.82951);
   graph->SetPoint(26,-1.575,1.82534);
   graph->SetPoint(27,-1.525,1.79939);
   graph->SetPoint(28,-1.475,1.72546);
   graph->SetPoint(29,-1.425,1.75218);
   graph->SetPoint(30,-1.375,1.71721);
   graph->SetPoint(31,-1.325,1.66582);
   graph->SetPoint(32,-1.275,1.62944);
   graph->SetPoint(33,-1.225,1.63789);
   graph->SetPoint(34,-1.175,1.59078);
   graph->SetPoint(35,-1.125,1.57559);
   graph->SetPoint(36,-1.075,1.54576);
   graph->SetPoint(37,-1.025,1.55267);
   graph->SetPoint(38,-0.975,1.54435);
   graph->SetPoint(39,-0.925,1.49995);
   graph->SetPoint(40,-0.875,1.48775);
   graph->SetPoint(41,-0.825,1.48389);
   graph->SetPoint(42,-0.775,1.47094);
   graph->SetPoint(43,-0.725,1.44925);
   graph->SetPoint(44,-0.675,1.43671);
   graph->SetPoint(45,-0.625,1.45174);
   graph->SetPoint(46,-0.575,1.44996);
   graph->SetPoint(47,-0.525,1.41902);
   graph->SetPoint(48,-0.475,1.40234);
   graph->SetPoint(49,-0.425,1.44367);
   graph->SetPoint(50,-0.375,1.40599);
   graph->SetPoint(51,-0.325,1.41526);
   graph->SetPoint(52,-0.275,1.39909);
   graph->SetPoint(53,-0.225,1.40191);
   graph->SetPoint(54,-0.175,1.39888);
   graph->SetPoint(55,-0.125,1.37139);
   graph->SetPoint(56,-0.075,1.37786);
   graph->SetPoint(57,-0.025,1.38019);
   graph->SetPoint(58,0.025,1.37807);
   graph->SetPoint(59,0.075,1.39429);
   graph->SetPoint(60,0.125,1.38387);
   graph->SetPoint(61,0.175,1.38985);
   graph->SetPoint(62,0.225,1.42506);
   graph->SetPoint(63,0.275,1.41913);
   graph->SetPoint(64,0.325,1.40314);
   graph->SetPoint(65,0.375,1.38665);
   graph->SetPoint(66,0.425,1.40996);
   graph->SetPoint(67,0.475,1.41241);
   graph->SetPoint(68,0.525,1.44046);
   graph->SetPoint(69,0.575,1.40453);
   graph->SetPoint(70,0.625,1.41479);
   graph->SetPoint(71,0.675,1.45267);
   graph->SetPoint(72,0.725,1.44387);
   graph->SetPoint(73,0.775,1.44064);
   graph->SetPoint(74,0.825,1.48221);
   graph->SetPoint(75,0.875,1.48937);
   graph->SetPoint(76,0.925,1.50911);
   graph->SetPoint(77,0.975,1.50235);
   graph->SetPoint(78,1.025,1.51793);
   graph->SetPoint(79,1.075,1.55933);
   graph->SetPoint(80,1.125,1.56865);
   graph->SetPoint(81,1.175,1.60651);
   graph->SetPoint(82,1.225,1.60951);
   graph->SetPoint(83,1.275,1.66471);
   graph->SetPoint(84,1.325,1.66461);
   graph->SetPoint(85,1.375,1.71621);
   graph->SetPoint(86,1.425,1.7054);
   graph->SetPoint(87,1.475,1.75945);
   graph->SetPoint(88,1.525,1.7984);
   graph->SetPoint(89,1.575,1.8333);
   graph->SetPoint(90,1.625,1.85314);
   graph->SetPoint(91,1.675,1.89133);
   graph->SetPoint(92,1.725,1.92942);
   graph->SetPoint(93,1.775,1.98464);
   graph->SetPoint(94,1.825,2.03427);
   graph->SetPoint(95,1.875,2.13452);
   graph->SetPoint(96,1.925,2.13807);
   graph->SetPoint(97,1.975,2.1589);
   graph->SetPoint(98,2.025,2.30963);
   graph->SetPoint(99,2.075,2.40103);
   graph->SetPoint(100,2.125,2.42352);
   graph->SetPoint(101,2.175,2.52329);
   graph->SetPoint(102,2.225,2.55187);
   graph->SetPoint(103,2.275,2.6665);
   graph->SetPoint(104,2.325,2.7663);
   graph->SetPoint(105,2.375,2.87554);
   graph->SetPoint(106,2.425,3.01258);
   graph->SetPoint(107,2.475,3.05905);
   graph->SetPoint(108,2.525,3.14047);
   graph->SetPoint(109,2.575,3.13785);
   graph->SetPoint(110,2.625,3.0199);
   graph->SetPoint(111,2.675,2.70384);
   graph->SetPoint(112,2.725,2.32523);
   graph->SetPoint(113,2.775,1.865);
   graph->SetPoint(114,2.825,1.36048);
   graph->SetPoint(115,2.875,0.963561);
   graph->SetPoint(116,2.925,0.513409);
   graph->Draw("p");
   
   TF1 *etacorr1 = new TF1("etacorr1","[0]+[1]*x*x+[2]*x*x*x*x",-2.5,2.5);
   etacorr1->SetFillColor(19);
   etacorr1->SetFillStyle(0);
   etacorr1->SetLineWidth(3);
   etacorr1->SetChisquare(0.0219197);
   etacorr1->SetParameter(0,1.3933);
   etacorr1->SetParError(0,0.227911);
   etacorr1->SetParLimits(0,0,0);
   etacorr1->SetParameter(1,0.1022);
   etacorr1->SetParError(1,0.253966);
   etacorr1->SetParLimits(1,0,0);
   etacorr1->SetParameter(2,0.0285953);
   etacorr1->SetParError(2,0.0482641);
   etacorr1->SetParLimits(2,0,0);
   etacorr1->Draw("lsame");
   
   ceta->Modified();
}