{
// Example of the fit of correction function for B=2 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_B2", "eta_correction_fit",600,400);

   TGraph *graph = new TGraph(83);
   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.075,0.510575);
   graph->SetPoint(1,-2.025,0.888556);
   graph->SetPoint(2,-1.975,1.39621);
   graph->SetPoint(3,-1.925,1.72041);
   graph->SetPoint(4,-1.875,2.196);
   graph->SetPoint(5,-1.825,2.67576);
   graph->SetPoint(6,-1.775,2.95348);
   graph->SetPoint(7,-1.725,3.18897);
   graph->SetPoint(8,-1.675,3.18788);
   graph->SetPoint(9,-1.625,3.1222);
   graph->SetPoint(10,-1.575,3.08357);
   graph->SetPoint(11,-1.525,3.07465);
   graph->SetPoint(12,-1.475,2.96261);
   graph->SetPoint(13,-1.425,2.90841);
   graph->SetPoint(14,-1.375,2.77213);
   graph->SetPoint(15,-1.325,2.74666);
   graph->SetPoint(16,-1.275,2.67784);
   graph->SetPoint(17,-1.225,2.56749);
   graph->SetPoint(18,-1.175,2.54858);
   graph->SetPoint(19,-1.125,2.46527);
   graph->SetPoint(20,-1.075,2.40203);
   graph->SetPoint(21,-1.025,2.39094);
   graph->SetPoint(22,-0.975,2.32949);
   graph->SetPoint(23,-0.925,2.2471);
   graph->SetPoint(24,-0.875,2.21773);
   graph->SetPoint(25,-0.825,2.19778);
   graph->SetPoint(26,-0.775,2.14798);
   graph->SetPoint(27,-0.725,2.10652);
   graph->SetPoint(28,-0.675,2.11412);
   graph->SetPoint(29,-0.625,2.07577);
   graph->SetPoint(30,-0.575,2.06189);
   graph->SetPoint(31,-0.525,1.99606);
   graph->SetPoint(32,-0.475,1.98502);
   graph->SetPoint(33,-0.425,1.97452);
   graph->SetPoint(34,-0.375,1.97039);
   graph->SetPoint(35,-0.325,1.91977);
   graph->SetPoint(36,-0.275,1.93886);
   graph->SetPoint(37,-0.225,1.92329);
   graph->SetPoint(38,-0.175,1.93867);
   graph->SetPoint(39,-0.125,1.93253);
   graph->SetPoint(40,-0.075,1.90817);
   graph->SetPoint(41,-0.025,1.91673);
   graph->SetPoint(42,0.025,1.90734);
   graph->SetPoint(43,0.075,1.894);
   graph->SetPoint(44,0.125,1.90932);
   graph->SetPoint(45,0.175,1.91197);
   graph->SetPoint(46,0.225,1.92045);
   graph->SetPoint(47,0.275,1.91232);
   graph->SetPoint(48,0.325,1.93608);
   graph->SetPoint(49,0.375,1.95023);
   graph->SetPoint(50,0.425,1.99316);
   graph->SetPoint(51,0.475,2.00982);
   graph->SetPoint(52,0.525,2.03531);
   graph->SetPoint(53,0.575,2.02758);
   graph->SetPoint(54,0.625,2.06366);
   graph->SetPoint(55,0.675,2.10765);
   graph->SetPoint(56,0.725,2.13574);
   graph->SetPoint(57,0.775,2.14918);
   graph->SetPoint(58,0.825,2.20192);
   graph->SetPoint(59,0.875,2.22922);
   graph->SetPoint(60,0.925,2.24951);
   graph->SetPoint(61,0.975,2.315);
   graph->SetPoint(62,1.025,2.35333);
   graph->SetPoint(63,1.075,2.37733);
   graph->SetPoint(64,1.125,2.48384);
   graph->SetPoint(65,1.175,2.54395);
   graph->SetPoint(66,1.225,2.57782);
   graph->SetPoint(67,1.275,2.62798);
   graph->SetPoint(68,1.325,2.73328);
   graph->SetPoint(69,1.375,2.77425);
   graph->SetPoint(70,1.425,2.9122);
   graph->SetPoint(71,1.475,2.95068);
   graph->SetPoint(72,1.525,3.00106);
   graph->SetPoint(73,1.575,3.20299);
   graph->SetPoint(74,1.625,3.17384);
   graph->SetPoint(75,1.675,3.14568);
   graph->SetPoint(76,1.725,3.00016);
   graph->SetPoint(77,1.775,2.89933);
   graph->SetPoint(78,1.825,2.56774);
   graph->SetPoint(79,1.875,2.32685);
   graph->SetPoint(80,1.925,1.90848);
   graph->SetPoint(81,1.975,1.31611);
   graph->SetPoint(82,2.025,0.79753);
   
   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.0226761);
   etacorr3->SetParameter(0,1.89769);
   etacorr3->SetParError(0,0.322074);
   etacorr3->SetParLimits(0,0,0);
   etacorr3->SetParameter(1,0.433823);
   etacorr3->SetParError(1,0.755569);
   etacorr3->SetParLimits(1,0,0);
   etacorr3->SetParameter(2,0.0180832);
   etacorr3->SetParError(2,0.303724);
   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.0226761);
   etacorr3->SetParameter(0,1.89769);
   etacorr3->SetParError(0,0.322074);
   etacorr3->SetParLimits(0,0,0);
   etacorr3->SetParameter(1,0.433823);
   etacorr3->SetParError(1,0.755569);
   etacorr3->SetParLimits(1,0,0);
   etacorr3->SetParameter(2,0.0180832);
   etacorr3->SetParError(2,0.303724);
   etacorr3->SetParLimits(2,0,0);
   etacorr3->Draw("lsame");
   
   graph = new TGraph(96);
   graph->SetName("Graph");
   graph->SetTitle("Graph");
   graph->SetFillColor(1);
   graph->SetMarkerColor(4);
   graph->SetMarkerStyle(26);
   graph->SetPoint(0,-2.375,0.64339);
   graph->SetPoint(1,-2.325,1.07247);
   graph->SetPoint(2,-2.275,1.55052);
   graph->SetPoint(3,-2.225,1.83827);
   graph->SetPoint(4,-2.175,2.34437);
   graph->SetPoint(5,-2.125,2.71478);
   graph->SetPoint(6,-2.075,2.93201);
   graph->SetPoint(7,-2.025,3.10825);
   graph->SetPoint(8,-1.975,3.12979);
   graph->SetPoint(9,-1.925,3.05592);
   graph->SetPoint(10,-1.875,3.03037);
   graph->SetPoint(11,-1.825,3.0218);
   graph->SetPoint(12,-1.775,2.87534);
   graph->SetPoint(13,-1.725,2.79361);
   graph->SetPoint(14,-1.675,2.70712);
   graph->SetPoint(15,-1.625,2.62764);
   graph->SetPoint(16,-1.575,2.55702);
   graph->SetPoint(17,-1.525,2.46525);
   graph->SetPoint(18,-1.475,2.42259);
   graph->SetPoint(19,-1.425,2.34382);
   graph->SetPoint(20,-1.375,2.25328);
   graph->SetPoint(21,-1.325,2.24584);
   graph->SetPoint(22,-1.275,2.17513);
   graph->SetPoint(23,-1.225,2.1238);
   graph->SetPoint(24,-1.175,2.10881);
   graph->SetPoint(25,-1.125,2.05538);
   graph->SetPoint(26,-1.075,2.02537);
   graph->SetPoint(27,-1.025,1.97898);
   graph->SetPoint(28,-0.975,1.93676);
   graph->SetPoint(29,-0.925,1.90623);
   graph->SetPoint(30,-0.875,1.89632);
   graph->SetPoint(31,-0.825,1.87756);
   graph->SetPoint(32,-0.775,1.83784);
   graph->SetPoint(33,-0.725,1.81881);
   graph->SetPoint(34,-0.675,1.79019);
   graph->SetPoint(35,-0.625,1.76091);
   graph->SetPoint(36,-0.575,1.76627);
   graph->SetPoint(37,-0.525,1.73867);
   graph->SetPoint(38,-0.475,1.77949);
   graph->SetPoint(39,-0.425,1.75636);
   graph->SetPoint(40,-0.375,1.71776);
   graph->SetPoint(41,-0.325,1.69086);
   graph->SetPoint(42,-0.275,1.67482);
   graph->SetPoint(43,-0.225,1.68314);
   graph->SetPoint(44,-0.175,1.67712);
   graph->SetPoint(45,-0.125,1.67617);
   graph->SetPoint(46,-0.075,1.65933);
   graph->SetPoint(47,-0.025,1.69143);
   graph->SetPoint(48,0.025,1.6478);
   graph->SetPoint(49,0.075,1.68943);
   graph->SetPoint(50,0.125,1.68273);
   graph->SetPoint(51,0.175,1.66856);
   graph->SetPoint(52,0.225,1.67059);
   graph->SetPoint(53,0.275,1.68641);
   graph->SetPoint(54,0.325,1.69761);
   graph->SetPoint(55,0.375,1.72111);
   graph->SetPoint(56,0.425,1.71192);
   graph->SetPoint(57,0.475,1.7184);
   graph->SetPoint(58,0.525,1.73271);
   graph->SetPoint(59,0.575,1.77406);
   graph->SetPoint(60,0.625,1.7713);
   graph->SetPoint(61,0.675,1.82452);
   graph->SetPoint(62,0.725,1.8249);
   graph->SetPoint(63,0.775,1.85061);
   graph->SetPoint(64,0.825,1.87413);
   graph->SetPoint(65,0.875,1.90339);
   graph->SetPoint(66,0.925,1.89974);
   graph->SetPoint(67,0.975,1.98723);
   graph->SetPoint(68,1.025,1.98464);
   graph->SetPoint(69,1.075,1.99852);
   graph->SetPoint(70,1.125,2.04403);
   graph->SetPoint(71,1.175,2.11162);
   graph->SetPoint(72,1.225,2.14858);
   graph->SetPoint(73,1.275,2.15762);
   graph->SetPoint(74,1.325,2.22704);
   graph->SetPoint(75,1.375,2.28424);
   graph->SetPoint(76,1.425,2.37243);
   graph->SetPoint(77,1.475,2.40872);
   graph->SetPoint(78,1.525,2.49188);
   graph->SetPoint(79,1.575,2.57696);
   graph->SetPoint(80,1.625,2.63389);
   graph->SetPoint(81,1.675,2.7443);
   graph->SetPoint(82,1.725,2.77061);
   graph->SetPoint(83,1.775,2.87419);
   graph->SetPoint(84,1.825,2.95354);
   graph->SetPoint(85,1.875,3.07022);
   graph->SetPoint(86,1.925,3.14689);
   graph->SetPoint(87,1.975,3.107);
   graph->SetPoint(88,2.025,2.97943);
   graph->SetPoint(89,2.075,2.90136);
   graph->SetPoint(90,2.125,2.6787);
   graph->SetPoint(91,2.175,2.41574);
   graph->SetPoint(92,2.225,2.08883);
   graph->SetPoint(93,2.275,1.50325);
   graph->SetPoint(94,2.325,0.987313);
   graph->SetPoint(95,2.375,0.516231);
   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.0242613);
   etacorr2->SetParameter(0,1.66772);
   etacorr2->SetParError(0,0.279027);
   etacorr2->SetParLimits(0,0,0);
   etacorr2->SetParameter(1,0.274011);
   etacorr2->SetParError(1,0.479042);
   etacorr2->SetParLimits(1,0,0);
   etacorr2->SetParameter(2,0.0317032);
   etacorr2->SetParError(2,0.140382);
   etacorr2->SetParLimits(2,0,0);
   etacorr2->Draw("lsame");
   
   graph = new TGraph(118);
   graph->SetName("Graph");
   graph->SetTitle("Graph");
   graph->SetFillColor(1);
   graph->SetMarkerStyle(25);
   graph->SetMarkerSize(1.3);
   graph->SetPoint(0,-2.925,0.680246);
   graph->SetPoint(1,-2.875,1.08565);
   graph->SetPoint(2,-2.825,1.47379);
   graph->SetPoint(3,-2.775,1.83543);
   graph->SetPoint(4,-2.725,2.27506);
   graph->SetPoint(5,-2.675,2.58797);
   graph->SetPoint(6,-2.625,2.85905);
   graph->SetPoint(7,-2.575,3.00895);
   graph->SetPoint(8,-2.525,3.02085);
   graph->SetPoint(9,-2.475,2.92546);
   graph->SetPoint(10,-2.425,2.89721);
   graph->SetPoint(11,-2.375,2.82915);
   graph->SetPoint(12,-2.325,2.78355);
   graph->SetPoint(13,-2.275,2.64137);
   graph->SetPoint(14,-2.225,2.54994);
   graph->SetPoint(15,-2.175,2.47726);
   graph->SetPoint(16,-2.125,2.44968);
   graph->SetPoint(17,-2.075,2.35127);
   graph->SetPoint(18,-2.025,2.24403);
   graph->SetPoint(19,-1.975,2.17327);
   graph->SetPoint(20,-1.925,2.10793);
   graph->SetPoint(21,-1.875,2.0495);
   graph->SetPoint(22,-1.825,2.02959);
   graph->SetPoint(23,-1.775,1.98095);
   graph->SetPoint(24,-1.725,1.93926);
   graph->SetPoint(25,-1.675,1.8831);
   graph->SetPoint(26,-1.625,1.84796);
   graph->SetPoint(27,-1.575,1.80774);
   graph->SetPoint(28,-1.525,1.76129);
   graph->SetPoint(29,-1.475,1.72107);
   graph->SetPoint(30,-1.425,1.70757);
   graph->SetPoint(31,-1.375,1.66823);
   graph->SetPoint(32,-1.325,1.67211);
   graph->SetPoint(33,-1.275,1.61586);
   graph->SetPoint(34,-1.225,1.60808);
   graph->SetPoint(35,-1.175,1.61447);
   graph->SetPoint(36,-1.125,1.55989);
   graph->SetPoint(37,-1.075,1.52585);
   graph->SetPoint(38,-1.025,1.52665);
   graph->SetPoint(39,-0.975,1.49544);
   graph->SetPoint(40,-0.925,1.48005);
   graph->SetPoint(41,-0.875,1.46431);
   graph->SetPoint(42,-0.825,1.46674);
   graph->SetPoint(43,-0.775,1.44223);
   graph->SetPoint(44,-0.725,1.43434);
   graph->SetPoint(45,-0.675,1.42766);
   graph->SetPoint(46,-0.625,1.44038);
   graph->SetPoint(47,-0.575,1.42356);
   graph->SetPoint(48,-0.525,1.41513);
   graph->SetPoint(49,-0.475,1.3979);
   graph->SetPoint(50,-0.425,1.40379);
   graph->SetPoint(51,-0.375,1.38172);
   graph->SetPoint(52,-0.325,1.36944);
   graph->SetPoint(53,-0.275,1.38063);
   graph->SetPoint(54,-0.225,1.3787);
   graph->SetPoint(55,-0.175,1.3778);
   graph->SetPoint(56,-0.125,1.36206);
   graph->SetPoint(57,-0.075,1.36118);
   graph->SetPoint(58,-0.025,1.37771);
   graph->SetPoint(59,0.025,1.36046);
   graph->SetPoint(60,0.075,1.34996);
   graph->SetPoint(61,0.125,1.39088);
   graph->SetPoint(62,0.175,1.36672);
   graph->SetPoint(63,0.225,1.36957);
   graph->SetPoint(64,0.275,1.3595);
   graph->SetPoint(65,0.325,1.36439);
   graph->SetPoint(66,0.375,1.39318);
   graph->SetPoint(67,0.425,1.38871);
   graph->SetPoint(68,0.475,1.40101);
   graph->SetPoint(69,0.525,1.40117);
   graph->SetPoint(70,0.575,1.41955);
   graph->SetPoint(71,0.625,1.41838);
   graph->SetPoint(72,0.675,1.44375);
   graph->SetPoint(73,0.725,1.44031);
   graph->SetPoint(74,0.775,1.44457);
   graph->SetPoint(75,0.825,1.46804);
   graph->SetPoint(76,0.875,1.49247);
   graph->SetPoint(77,0.925,1.49302);
   graph->SetPoint(78,0.975,1.50251);
   graph->SetPoint(79,1.025,1.51929);
   graph->SetPoint(80,1.075,1.5385);
   graph->SetPoint(81,1.125,1.55825);
   graph->SetPoint(82,1.175,1.59708);
   graph->SetPoint(83,1.225,1.60115);
   graph->SetPoint(84,1.275,1.63479);
   graph->SetPoint(85,1.325,1.63394);
   graph->SetPoint(86,1.375,1.67331);
   graph->SetPoint(87,1.425,1.72007);
   graph->SetPoint(88,1.475,1.75351);
   graph->SetPoint(89,1.525,1.77291);
   graph->SetPoint(90,1.575,1.81525);
   graph->SetPoint(91,1.625,1.85328);
   graph->SetPoint(92,1.675,1.89163);
   graph->SetPoint(93,1.725,1.94334);
   graph->SetPoint(94,1.775,1.95825);
   graph->SetPoint(95,1.825,2.02459);
   graph->SetPoint(96,1.875,2.09718);
   graph->SetPoint(97,1.925,2.15816);
   graph->SetPoint(98,1.975,2.1889);
   graph->SetPoint(99,2.025,2.28904);
   graph->SetPoint(100,2.075,2.31655);
   graph->SetPoint(101,2.125,2.39211);
   graph->SetPoint(102,2.175,2.48568);
   graph->SetPoint(103,2.225,2.59307);
   graph->SetPoint(104,2.275,2.66832);
   graph->SetPoint(105,2.325,2.73139);
   graph->SetPoint(106,2.375,2.83066);
   graph->SetPoint(107,2.425,2.9246);
   graph->SetPoint(108,2.475,3.00226);
   graph->SetPoint(109,2.525,2.95095);
   graph->SetPoint(110,2.575,2.86809);
   graph->SetPoint(111,2.625,2.78932);
   graph->SetPoint(112,2.675,2.54424);
   graph->SetPoint(113,2.725,2.28276);
   graph->SetPoint(114,2.775,1.99268);
   graph->SetPoint(115,2.825,1.50407);
   graph->SetPoint(116,2.875,0.995803);
   graph->SetPoint(117,2.925,0.588558);
   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.0145555);
   etacorr1->SetParameter(0,1.3697);
   etacorr1->SetParError(0,0.226255);
   etacorr1->SetParLimits(0,0,0);
   etacorr1->SetParameter(1,0.117086);
   etacorr1->SetParError(1,0.251958);
   etacorr1->SetParLimits(1,0,0);
   etacorr1->SetParameter(2,0.0246994);
   etacorr1->SetParError(2,0.0477997);
   etacorr1->SetParLimits(2,0,0);
   etacorr1->Draw("lsame");
   
   ceta->Modified();

}