void plotKK(int iShow){
  gROOT->Reset();
  gROOT->SetStyle("Plain");
  gStyle->SetOptStat(0);

  TFile *hFileKp = new TFile("myOutKp.root");
  TFile *hFileKm = new TFile("myOutKm.root");


  TH1D *hMX;       hFileKp->GetObject("hMX",hMX);
  TH1D *hMXKp;     hFileKp->GetObject("hMassX",hMXKp);
  TH1D *hMXKm;     hFileKm->GetObject("hMassX",hMXKm);
  
  TH1D *hMXDiff = (TH1D*)hMX->Clone("hMXDiff");

  TH1D *hMXK = (TH1D*)hMXKp->Clone("hMXK");
  hMXK->Add(hMXKm);

  hMXDiff->Add(hMX,hMXK,1.0,-1.0);



  hMX->SetLineColor(1);
  hMXDiff->SetLineColor(1);
  hMXKp->SetLineColor(2);
  hMXKm->SetLineColor(3);
  hMXK->SetLineColor(4);

  hMXKp->SetMarkerStyle(21);
  hMXKp->SetMarkerColor(2);

  hMXKm->SetMarkerStyle(21);
  hMXKm->SetMarkerColor(3);

  hMXK->SetMarkerStyle(21);
  hMXK->SetMarkerColor(4);

  hMX->GetXaxis()->SetTitle("Mass[K^{+}K^{-}#pi^{0}]/GeV");
  hMX->GetYaxis()->SetTitle("Q-weighted counts");

  hMXDiff->GetXaxis()->SetTitle("Mass[K^{+}K^{-}#pi^{0}]/GeV");
  hMXDiff->GetYaxis()->SetTitle("Q-weighted counts");

  hMX->GetXaxis()->SetTitleOffset(1.2);
  hMX->GetYaxis()->SetTitleOffset(1.2);
  hMX->GetXaxis()->SetTitleFont(62);
  hMX->GetYaxis()->SetTitleFont(62);
  hMX->GetXaxis()->SetLabelFont(62);
  hMX->GetYaxis()->SetLabelFont(62);
  hMX->GetXaxis()->SetLabelSize(0.04);
  hMX->GetYaxis()->SetLabelSize(0.04);
  hMX->SetMarkerStyle(21);

  hMXDiff->GetXaxis()->SetTitleOffset(1.2);
  hMXDiff->GetYaxis()->SetTitleOffset(1.2);
  hMXDiff->GetXaxis()->SetTitleFont(62);
  hMXDiff->GetYaxis()->SetTitleFont(62);
  hMXDiff->GetXaxis()->SetLabelFont(62);
  hMXDiff->GetYaxis()->SetLabelFont(62);
  hMXDiff->GetXaxis()->SetLabelSize(0.04);
  hMXDiff->GetYaxis()->SetLabelSize(0.04);
  hMXDiff->SetMarkerStyle(21);

  if (iShow == 1) {
    hMX->Draw("e1");
  }

  if (iShow == 2) {
    hMX->Draw("e1");
    hMXKp->Draw("same");
    //hMXKm->Draw("same");
    //hMXK->Draw("same");

    Double_t xl1=0.13, yl1 = 0.63, xl2=xl1+0.23, yl2=yl1+0.25;
    TLegend *legend = new TLegend(xl1,yl1,xl2,yl2);
    legend->SetFillColor(0);
    legend->SetLineColor(0);
    legend->SetTextSize(0.06);
    legend->AddEntry(hMXK,"Total K^{+}K^{-}#pi^{0}","p");
    legend->AddEntry(hMXKp,"Extracted K*^{+} K^{-}","p");
    //legend->AddEntry(hMXKm,"Extracted K^{-}*K^{+}","p");
    //legend->AddEntry(hMXK,"Total K*K","p");
    legend->Draw();

  }

  if (iShow == 3) {
    hMX->Draw("e1");
    hMXKp->Draw("same");
    hMXKm->Draw("same");
    //hMXK->Draw("same");

    Double_t xl1=0.13, yl1 = 0.63, xl2=xl1+0.23, yl2=yl1+0.25;
    TLegend *legend = new TLegend(xl1,yl1,xl2,yl2);
    legend->SetFillColor(0);
    legend->SetLineColor(0);
    legend->SetTextSize(0.06);
    legend->AddEntry(hMXK,"Total K^{+}K^{-}#pi^{0}","p");
    legend->AddEntry(hMXKp,"Extracted K*^{+} K^{-}","p");
    legend->AddEntry(hMXKm,"Extracted K*^{-} K^{+}","p");
    //legend->AddEntry(hMXK,"Total K*K","p");
    legend->Draw();

  }

  if (iShow == 4) {
    hMX->Draw("e1");
    hMXKp->Draw("same");
    hMXKm->Draw("same");
    hMXK->Draw("same");

    Double_t xl1=0.13, yl1 = 0.63, xl2=xl1+0.23, yl2=yl1+0.25;
    TLegend *legend = new TLegend(xl1,yl1,xl2,yl2);
    legend->SetFillColor(0);
    legend->SetLineColor(0);
    legend->SetTextSize(0.06);
    legend->AddEntry(hMXK,"Total K^{+}K^{-}#pi^{0}","p");
    legend->AddEntry(hMXKp,"Extracted K^{+}*K^{-}","p");
    legend->AddEntry(hMXKm,"Extracted K^{-}*K^{+}","p");
    legend->AddEntry(hMXK,"Total K*K","p");
    legend->Draw();

  }

  if (iShow == 5) {
    hMXDiff->Draw("e1");

    Double_t xl1=0.13, yl1 = 0.63, xl2=xl1+0.23, yl2=yl1+0.25;
    TLegend *legend = new TLegend(xl1,yl1,xl2,yl2);
    legend->SetFillColor(0);
    legend->SetLineColor(0);
    legend->SetTextSize(0.06);
    legend->AddEntry(hMXDiff,"With K*K subtracted","p");
    legend->Draw();

  }

  if (iShow == 6) {

    TF1 *f1 = new TF1("f1","gaus(0)+pol1(3)");
    f1->SetParameter(0,6.25608e+02);
    f1->SetParameter(1,1.40985e+00);
    f1->SetParameter(2,2.02437e-02);
    f1->SetParameter(3,6.05480e+03);
    f1->SetParameter(4,-4.05746e+03);

    f1->SetLineWidth(2);
    f1->SetLineColor(4);
    hMXDiff->Fit("f1","B","R",1.36,1.47);

    double cVal = f1->GetParameter(1);
    double cErr = f1->GetParError(1);

    double sigVal = f1->GetParameter(2);
    double sigErr = f1->GetParError(2);

    double FWHMval = sigVal*2.35;
    double FWHMerr = sigErr*2.35;

    hMXDiff->Draw("e1");

    Double_t xl1=0.13, yl1 = 0.63, xl2=xl1+0.23, yl2=yl1+0.25;
    TLegend *legend = new TLegend(xl1,yl1,xl2,yl2);
    legend->SetFillColor(0);
    legend->SetLineColor(0);
    legend->SetTextSize(0.06);
    legend->AddEntry(hMXDiff,"With K*K subtracted","p");
    legend->Draw();

    char  tString1[120];
    char  tString2[120];
    char  tString3[120];
    char  tString4[120];

    sprintf(tString1,"            center = %6.2f +/- %4.2f MeV",cVal*1000,cErr*1000);
    sprintf(tString2,"PDG: #eta(1405) = 1408.8   +/-  2.0 MeV");
    sprintf(tString3,"            width  = %6.2f +/- %4.2f MeV",FWHMval*1000,FWHMerr*1000);
    sprintf(tString4,"PDG: #eta(1405) =  50.1   +/-  2.6 MeV");

    TLatex *t1 = new TLatex();
    TLatex *t2 = new TLatex();
    TLatex *t3 = new TLatex();
    TLatex *t4 = new TLatex();

    t1->SetNDC();
    t1->SetTextSize(0.04);
    t2->SetNDC();
    t2->SetTextSize(0.04);
    t3->SetNDC();
    t3->SetTextSize(0.04);
    t4->SetNDC();
    t4->SetTextSize(0.04);

    double xLocationFraction = 0.22;
    double yLocationFraction = 0.35;
    t1->DrawLatex(xLocationFraction,yLocationFraction,tString1);
    t2->DrawLatex(xLocationFraction,yLocationFraction-0.05,tString2);

    t3->DrawLatex(xLocationFraction,yLocationFraction-0.15,tString3);
    t4->DrawLatex(xLocationFraction,yLocationFraction-0.2,tString4);


  }

  if (iShow == 7) {

    TF1 *f1 = new TF1("f1","gaus(0)+pol1(3)");
    f1->SetParameter(0,1.21744e+03);
    f1->SetParameter(1,1.40644e+00);
    f1->SetParameter(2,3.20916e-02);
    f1->SetParameter(3,-9.01714e+03);
    f1->SetParameter(4,6.92818e+03);

    f1->SetLineWidth(2);
    f1->SetLineColor(4);
    hMX->Fit("f1","B","R",1.36,1.49);

    double cVal = f1->GetParameter(1);
    double cErr = f1->GetParError(1);

    double sigVal = f1->GetParameter(2);
    double sigErr = f1->GetParError(2);

    double FWHMval = sigVal*2.35;
    double FWHMerr = sigErr*2.35;

    hMX->Draw("e1");

    Double_t xl1=0.13, yl1 = 0.63, xl2=xl1+0.23, yl2=yl1+0.25;
    TLegend *legend = new TLegend(xl1,yl1,xl2,yl2);
    legend->SetFillColor(0);
    legend->SetLineColor(0);
    legend->SetTextSize(0.06);
    legend->AddEntry(hMXDiff,"With K*K subtracted","p");
    //legend->Draw();

    char  tString1[120];
    char  tString2[120];
    char  tString3[120];
    char  tString4[120];

    sprintf(tString1,"            center = %6.2f +/- %4.2f",cVal*1000,cErr*1000);
    sprintf(tString2,"PDG: #eta(1405) = 1408.8   +/-  2.0");
    sprintf(tString3,"            width  = %6.2f +/- %4.2f",FWHMval*1000,FWHMerr*1000);
    sprintf(tString4,"PDG: #eta(1405) =  50.1   +/-  2.6");

    TLatex *t1 = new TLatex();
    TLatex *t2 = new TLatex();
    TLatex *t3 = new TLatex();
    TLatex *t4 = new TLatex();

    t1->SetNDC();
    t1->SetTextSize(0.04);
    t2->SetNDC();
    t2->SetTextSize(0.04);
    t3->SetNDC();
    t3->SetTextSize(0.04);
    t4->SetNDC();
    t4->SetTextSize(0.04);

    double xLocationFraction = 0.5;
    double yLocationFraction = 0.35;
    t1->DrawLatex(xLocationFraction,yLocationFraction,tString1);
    t2->DrawLatex(xLocationFraction,yLocationFraction-0.05,tString2);

    t3->DrawLatex(xLocationFraction,yLocationFraction-0.15,tString3);
    t4->DrawLatex(xLocationFraction,yLocationFraction-0.2,tString4);


  }

  if (iShow == 8) {

    TF1 *f1 = new TF1("f1","gaus(0)+pol1(3)");
    f1->SetParameter(0,4.01421e+02);
    f1->SetParameter(1,1.28164e+00);
    f1->SetParameter(2,1.41296e-02);
    f1->SetParameter(3,-4.08805e+03);
    f1->SetParameter(4,3.39777e+03);

    f1->SetLineWidth(2);
    f1->SetLineColor(4);
    hMX->Fit("f1","B","R",1.22,1.33);

    double cVal = f1->GetParameter(1);
    double cErr = f1->GetParError(1);

    double sigVal = f1->GetParameter(2);
    double sigErr = f1->GetParError(2);

    double FWHMval = sigVal*2.35;
    double FWHMerr = sigErr*2.35;

    hMX->Draw("e1");

    Double_t xl1=0.13, yl1 = 0.63, xl2=xl1+0.23, yl2=yl1+0.25;
    TLegend *legend = new TLegend(xl1,yl1,xl2,yl2);
    legend->SetFillColor(0);
    legend->SetLineColor(0);
    legend->SetTextSize(0.06);
    legend->AddEntry(hMXDiff,"With K*K subtracted","p");
    //legend->Draw();

    char  tString1[120];
    char  tString2[120];
    char  tString3[120];
    char  tString4[120];
    char  tString5[120];
    char  tString6[120];

    sprintf(tString1,"               center = %6.2f +/- %4.2f",cVal*1000,cErr*1000);
    sprintf(tString2,"PDG: f_1(1285) = 1281.9   +/-  0.5");
    sprintf(tString3,"PDG:   #eta(1295) = 1294   +/-  4");

    sprintf(tString4,"               width  = %6.2f +/- %4.2f",FWHMval*1000,FWHMerr*1000);
    sprintf(tString5,"PDG: f_1(1285) =  22.7   +/-  1.1");
    sprintf(tString6,"PDG:   #eta(1295) =  55   +/-  5");

    TLatex *t1 = new TLatex();
    TLatex *t2 = new TLatex();
    TLatex *t3 = new TLatex();
    TLatex *t4 = new TLatex();
    TLatex *t5 = new TLatex();
    TLatex *t6 = new TLatex();

    t1->SetNDC();
    t1->SetTextSize(0.04);
    t2->SetNDC();
    t2->SetTextSize(0.04);
    t3->SetNDC();
    t3->SetTextSize(0.04);
    t4->SetNDC();
    t4->SetTextSize(0.04);
    t5->SetNDC();
    t5->SetTextSize(0.04);
    t6->SetNDC();
    t6->SetTextSize(0.04);

    double xLocationFraction = 0.12;
    double yLocationFraction = 0.85;
    t1->DrawLatex(xLocationFraction,yLocationFraction,tString1);
    t2->DrawLatex(xLocationFraction,yLocationFraction-0.05,tString2);
    t3->DrawLatex(xLocationFraction,yLocationFraction-0.10,tString3);

    t4->DrawLatex(xLocationFraction,yLocationFraction-0.20,tString4);
    t5->DrawLatex(xLocationFraction,yLocationFraction-0.25,tString5);
    t6->DrawLatex(xLocationFraction,yLocationFraction-0.30,tString6);


  }
  if (iShow == 9){
    hMX->Draw("e1");
  }
}
