void gg1() {
TLegend* legend = 0L;
ofstream fout("out.txt");
TCanvas *c1 = new TCanvas("c1","A Simple Graph Example",200,10,800,600);
c1->SetFillColor(0);
c1->SetGrid();
c1->SetLogx();
c1->SetLogy();
pad1 = new TPad("pad1","This is pad1",0.02,0.02,0.48,0.83,33);
pad1->SetLogy();
pad1->SetFillColor(0);
pad2 = new TPad("pad2","This is pad2",0.52,0.02,0.98,0.83,33);
pad1->Draw();
pad2->Draw();
pad1->cd();
pad1->SetGrid();
pad1->SetLogx();
pad1->SetLogy();
pad1->SetFillColor(0);
const Int_t n = 5, n45 = 5, n60=7, n100=7, n150=6;
Double_t ratio[n] = {10, 10, 10, 10, 10,};
Double_t gg[n] = {200, 2000, 10000, 20000, 38000};
Double_t r45a[n45-1] = {0.456444, 0.452449, 0.449876, 0.448528 };
Double_t g45a[n45-1] = { 1286.5, 2383.21, 3218.68, 6094.73};
Double_t r60a[n60-2] = {0.434328, 0.425592, 0.416711, 0.408938, 0.387027};
Double_t g60a[n60-2] = {573.216, 1335.83, 3750.32, 9125.62, 22943.6};
Double_t r100a[n100-1] = {0.306558, 0.304032, 0.297827, 0.293789, 0.290856, 0.283958};
Double_t g100a[n100-1] = {432.12, 925.417, 1956.96, 4676.35, 9146.68, 13918.7};
Double_t r150a[n150] = {0.260789, 0.262564, 0.25891, 0.256049, 0.25232, 0.242539};
Double_t g150a[n150] = {585.65, 1085.61, 2071.32, 3954.73, 7719.68, 17772.5};
const Int_t m150=9, m100=2;
Double_t g150m[m150-2]= {172.451, 251.019, 367.428, 559.881, 922.984, 1459.62, 2275.48};
Double_t r150m[m150-2]= {1.1804, 1.17029, 1.1766, 1.16228, 1.13842, 1.10616, 1.0724};
Double_t g100m[m100]= {713.322, 1318.97};
Double_t r100m[m100]= {0.96502, 1.01467};
Double_t a, b;
gr = new TGraph(n,gg,ratio);
gr->SetLineColor(4);
gr->SetLineWidth(4);
gr->SetMarkerColor(4);
gr->SetMarkerStyle(21);
gr->SetTitle("N_{#gamma}/N_{e} vs Charge Gain ");
gr->GetXaxis()->SetTitle("Charge Gain ");
gr->GetYaxis()->SetTitle("N_{#gamma}/N_{e}");
gr->SetMaximum(2.0);
gr->SetMinimum(0.02);
gr->Draw("AP");
gStyle->SetOptFit(000);
gr1 = new TGraph(n45-1,g45a,r45a);
gr1->SetLineColor(1);
gr1->SetLineWidth(2);
gr1->SetMarkerColor(1);
gr1->SetMarkerStyle(21);
gr1->Draw("P");
gr1->Fit("pol1","");
gr1->GetFunction("pol1")->SetLineWidth(1);
gr1->GetFunction("pol1")->SetLineColor(1);
gr1->GetFunction("pol1")->SetLineStyle(1);
a = gr1->GetFunction("pol1")->GetParameter(0);
b = gr1->GetFunction("pol1")->GetParameter(1);
fout<<"APD 45 Psi "<SetLineColor(1);
gr2->SetLineWidth(2);
gr2->SetMarkerColor(1);
gr2->SetMarkerStyle(22);
gr2->Draw("P");
gr2->Fit("pol1","");
gr2->GetFunction("pol1")->SetLineWidth(1);
gr2->GetFunction("pol1")->SetLineColor(1);
gr2->GetFunction("pol1")->SetLineStyle(2);
a = gr2->GetFunction("pol1")->GetParameter(0);
b = gr2->GetFunction("pol1")->GetParameter(1);
fout<<"APD 60 Psi "<SetLineColor(1);
gr3->SetLineWidth(2);
gr3->SetMarkerColor(1);
gr3->SetMarkerStyle(23);
gr3->Draw("P");
gr3->Fit("pol1","");
gr3->GetFunction("pol1")->SetLineWidth(1);
gr3->GetFunction("pol1")->SetLineColor(1);
gr3->GetFunction("pol1")->SetLineStyle(3);
a = gr3->GetFunction("pol1")->GetParameter(0);
b = gr3->GetFunction("pol1")->GetParameter(1);
fout<<"APD 100 Psi "<SetLineColor(1);
gr4->SetLineWidth(2);
gr4->SetMarkerColor(1);
gr4->SetMarkerStyle(24);
gr4->Draw("P");
gr4->Fit("pol1","");
gr4->GetFunction("pol1")->SetLineWidth(1);
gr4->GetFunction("pol1")->SetLineColor(1);
gr4->GetFunction("pol1")->SetLineStyle(4);
a = gr4->GetFunction("pol1")->GetParameter(0);
b = gr4->GetFunction("pol1")->GetParameter(1);
fout<<"PMT 150 Psi "<SetLineColor(1);
gr5->SetLineWidth(2);
gr5->SetMarkerColor(1);
gr5->SetMarkerStyle(22);
gr5->Draw("P");
gr5->Fit("pol1","");
gr5->GetFunction("pol1")->SetLineWidth(1);
gr5->GetFunction("pol1")->SetLineColor(1);
gr5->GetFunction("pol1")->SetLineStyle(2);
a = gr5->GetFunction("pol1")->GetParameter(0);
b = gr5->GetFunction("pol1")->GetParameter(1);
fout<<"PMT 150 Psi "<SetLineColor(1);
gr6->SetLineWidth(2);
gr6->SetMarkerColor(1);
gr6->SetMarkerStyle(21);
gr6->Draw("P");
gr6->Fit("pol1","");
gr6->GetFunction("pol1")->SetLineWidth(1);
gr6->GetFunction("pol1")->SetLineColor(1);
gr6->GetFunction("pol1")->SetLineStyle(1);
a = gr6->GetFunction("pol1")->GetParameter(0);
b = gr6->GetFunction("pol1")->GetParameter(1);
fout<<"PMT 100 Psi "<SetNDC();
t->SetTextFont(32);
t->SetTextAlign(12);
t->SetTextSize(0.035);
t->SetTextColor(1);
t->DrawLatex(0.15,0.87,"Neon+0.1% H_{2} & 0.01% H_{2} T=293K");
t->DrawLatex(0.35,0.66,"45");
t->DrawLatex(0.20,0.64,"60");
t->DrawLatex(0.15,0.58,"100");
t->DrawLatex(0.17,0.54,"150");
t->DrawLatex(0.23,0.76,"100");
t->DrawLatex(0.20,0.83,"150");
t->DrawLatex(0.45,0.82,"0.01% H2");
t->DrawLatex(0.40,0.5,"0.1% H2");
pad2->cd();
pad2->SetGrid();
pad2->SetLogx();
pad2->SetLogy();
pad2->SetFillColor(0);
gr = new TGraph(n,gg,ratio);
gr->SetLineColor(4);
gr->SetLineWidth(4);
gr->SetMarkerColor(4);
gr->SetMarkerStyle(21);
gr->SetTitle("N_{#gamma}/N_{e} vs Charge Gain ");
gr->GetXaxis()->SetTitle("Charge Gain ");
gr->GetYaxis()->SetTitle("N_{#gamma}/N_{e}");
gr->SetMaximum(2.0);
gr->SetMinimum(0.02);
gr->Draw("AP");
gStyle->SetOptFit(000);
const Int_t k30=5, k45=4, k60=4, k100=3, k150=3;
Double_t r30k[k30] = {0.215475, 0.214399, 0.2147, 0.217265, 0.220405};
Double_t g30k[k30] = {581.145, 987.496, 1573.4, 4260.21, 11844.4};
Double_t r45k[k45] = {0.136039, 0.143073, 0.141919, 0.142967};
Double_t g45k[k45] = {873.7, 2739.78, 7475.48, 20133.3};
Double_t r60k[k60] = {0.104654, 0.107904, 0.107981, 0.109529};
Double_t g60k[k60] = {1158.6, 3137.5, 8348.47, 21914.7};
Double_t r100k[k100] = {0.0523186, 0.0532423, 0.0535629};
Double_t g100k[k100] = {3545.61, 8920.55, 23096.7};
Double_t r150k[k150] = {0.0286003, 0.0303109, 0.0295415};
Double_t g150k[k150] = {3327.29, 7680.35, 17789.2};
gr21 = new TGraph(k30,g30k,r30k);
gr21->SetLineColor(1);
gr21->SetLineWidth(2);
gr21->SetMarkerColor(1);
gr21->SetMarkerStyle(21);
gr21->Draw("P");
gr21->Fit("pol1","");
gr21->GetFunction("pol1")->SetLineWidth(1);
gr21->GetFunction("pol1")->SetLineColor(1);
gr21->GetFunction("pol1")->SetLineStyle(1);
a = gr21->GetFunction("pol1")->GetParameter(0);
b = gr21->GetFunction("pol1")->GetParameter(1);
fout<<"APD 30 Psi "<SetLineColor(1);
gr31->SetLineWidth(2);
gr31->SetMarkerColor(1);
gr31->SetMarkerStyle(22);
gr31->Draw("P");
gr31->Fit("pol1","");
gr31->GetFunction("pol1")->SetLineWidth(1);
gr31->GetFunction("pol1")->SetLineColor(1);
gr31->GetFunction("pol1")->SetLineStyle(2);
a = gr31->GetFunction("pol1")->GetParameter(0);
b = gr31->GetFunction("pol1")->GetParameter(1);
fout<<"APD 45 Psi "<SetLineColor(1);
gr41->SetLineWidth(2);
gr41->SetMarkerColor(1);
gr41->SetMarkerStyle(23);
gr41->Draw("P");
gr41->Fit("pol1","");
gr41->GetFunction("pol1")->SetLineWidth(1);
gr41->GetFunction("pol1")->SetLineColor(1);
gr41->GetFunction("pol1")->SetLineStyle(3);
a = gr41->GetFunction("pol1")->GetParameter(0);
b = gr41->GetFunction("pol1")->GetParameter(1);
fout<<"PMT 60 Psi "<SetLineColor(1);
gr51->SetLineWidth(2);
gr51->SetMarkerColor(1);
gr51->SetMarkerStyle(24);
gr51->Draw("P");
gr51->Fit("pol1","");
gr51->GetFunction("pol1")->SetLineWidth(1);
gr51->GetFunction("pol1")->SetLineColor(1);
gr51->GetFunction("pol1")->SetLineStyle(4);
a = gr51->GetFunction("pol1")->GetParameter(0);
b = gr51->GetFunction("pol1")->GetParameter(1);
fout<<"APD 100 Psi "<SetLineColor(1);
gr61->SetLineWidth(2);
gr61->SetMarkerColor(1);
gr61->SetMarkerStyle(25);
gr61->Draw("P");
gr61->Fit("pol1","");
gr61->GetFunction("pol1")->SetLineWidth(1);
gr61->GetFunction("pol1")->SetLineColor(1);
gr61->GetFunction("pol1")->SetLineStyle(5);
a = gr61->GetFunction("pol1")->GetParameter(0);
b = gr61->GetFunction("pol1")->GetParameter(1);
fout<<"APD 150 Psi "<SetTextColor(1);
t->DrawLatex(0.15,0.87,"Neon+1.0% H_{2} T=293K");
t->DrawLatex(0.21,0.52,"30");
t->DrawLatex(0.27,0.44,"45");
t->DrawLatex(0.30,0.39,"60");
t->DrawLatex(0.35,0.27,"100");
t->DrawLatex(0.37,0.18,"150");
c1->SaveAs("gg1.pdf");
}