void gg2() { 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(); gStyle->SetOptDate(0); gStyle->SetGridStyle(1); gStyle->SetGridColor(kGray); gStyle->SetOptTitle(0); 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(); // c1->SetLogx(); // c1->SetLogy(); const Int_t m = 20; Double_t rr[m] = {.200,.205,.210,.215,.220,.225,.230,.235,.240,.245, .250,.255,.260,.265,.270,.275,.280,.320,.390,.490}; Double_t ss[m] = {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1000000,10000000,1000000}; const Int_t n45=4, n60=8, n100=7, n150=6, m45=4, m60=11, m100=12, m150=14; Double_t r45a[n45] = {(0.2217+0.2176+0.2199)/3.,(0.2267+0.2274+0.2249)/3., (0.2312+0.2274+0.2296)/3.,(0.2378+0.2370+0.2347)/3.}; Double_t g45a[n45] = {58.16, 107.74, 145.51, 66.58}; Double_t Coef45a[n45]= {22.12, 22.12, 22.12, 91.54}; Double_t r60a[n60-2] = {(0.2101+0.2080+0.2107)/3., (0.2189+0.2225+0.2201)/3., (0.2307+0.2275+0.2303)/3., (0.2398+0.2423+0.2402)/3., (0.2491+0.2519+0.2500)/3., (0.2591+0.2616+0.2597)/3.}; Double_t g60a[n60-2] = {25.66, 63.62, 60.39, 82.01, 99.69, 101.89}; Double_t Coef60a[n60-2]= {9.01, 9.01, 22.12, 45.73, 91.54, 225.18}; Double_t r100a[n100-1] = {(0.2385+0.2423+0.2405)/3., (0.2487+0.2523+0.2503)/3., (0.2586+0.2616+0.2600)/3., (0.2723+0.2715+0.2696)/3., (0.2784+0.2811+0.2796)/3., (0.2830+0.2863+0.2843)/3.}; Double_t g100a[n100-1] = {47.96, 102.71, 88.47, 102.26, 99.92, 152.05}; Double_t Coef100a[n100-1]= {9.01, 9.01, 22.12, 45.73, 91.54, 91.54}; Double_t r150a[n150] = {(0.2794+0.2815+0.2796)/3., (0.2884+0.2914+0.2893)/3., (0.2987+0.3010+0.2991)/3., (0.3082+0.3108+0.3090)/3., (0.3184+0.3206+0.3184)/3., (0.3328+0.3305+0.3282)/3.}; Double_t g150a[n150] = {65.00, 120.49, 93.64, 86.48, 168.81, 194.15}; Double_t Coef150a[n150]= {9.01, 9.01, 22.12, 45.73, 45.73, 91.54}; const Int_t m150=7, m100=2; Double_t r150[m150] = {0.41, 0.42, 0.43, 0.44, 0.45, 0.46, 0.47}; Double_t g150[m150] = { 19.14, 27.86, 40.78, 62.14, 102.44, 162.00, 102.87}; Double_t Coef150[m150]= {9.01, 9.01, 9.01, 9.01, 9.01, 9.01, 22.12}; Double_t r100[m100] = {0.39, 0.40}; Double_t g100[m100] = {79.17, 146.39}; Double_t Coef100[m100]= {9.01, 9.01}; Double_t a,b,c; for (Int_t i=0;iSetLineColor(4); gr->SetLineWidth(4); gr->SetMarkerColor(4); gr->SetMarkerStyle(21); // gr->SetMarkerSize(0.1); // gr->SetTitle("Charge Gain vs #Delta GEM, kV "); gr->GetYaxis()->SetTitle("Charge Gain "); gr->GetXaxis()->SetTitle("#Delta GEM, kV "); gr->SetMaximum(51000.); gr->SetMinimum(200.); gr->Draw("AP"); gStyle->SetOptFit(000); gr3 = new TGraph(n45,r45a,g45a); gr3->SetLineColor(1); gr3->SetLineWidth(2); gr3->SetMarkerColor(1); gr3->SetMarkerStyle(21); gr3->Draw("P"); gr3->Fit("expo"); gr3->GetFunction("expo")->SetLineWidth(1); gr3->GetFunction("expo")->SetLineColor(1); gr3->GetFunction("expo")->SetLineStyle(1); a = gr3->GetFunction("expo")->GetParameter("Constant"); b = gr3->GetFunction("expo")->GetParameter("Slope"); c = 45.; fout<SetLineColor(1); gr4->SetLineWidth(2); gr4->SetMarkerColor(1); gr4->SetMarkerStyle(21); gr4->Draw("P"); gr4->Fit("expo"); gr4->GetFunction("expo")->SetLineWidth(1); gr4->GetFunction("expo")->SetLineColor(1); gr4->GetFunction("expo")->SetLineStyle(2); a = gr4->GetFunction("expo")->GetParameter("Constant"); b = gr4->GetFunction("expo")->GetParameter("Slope"); c = 60.; fout<SetLineColor(1); gr5->SetLineWidth(2); gr5->SetMarkerColor(1); gr5->SetMarkerStyle(21); gr5->Draw("P"); gr5->Fit("expo"); gr5->GetFunction("expo")->SetLineWidth(1); gr5->GetFunction("expo")->SetLineColor(1); gr5->GetFunction("expo")->SetLineStyle(3); a = gr5->GetFunction("expo")->GetParameter("Constant"); b = gr5->GetFunction("expo")->GetParameter("Slope"); c = 100.; fout<SetLineColor(1); gr6->SetLineWidth(2); gr6->SetMarkerColor(1); gr6->SetMarkerStyle(21); gr6->Draw("P"); gr6->Fit("expo"); gr6->GetFunction("expo")->SetLineWidth(1); gr6->GetFunction("expo")->SetLineColor(1); gr6->GetFunction("expo")->SetLineStyle(4); a = gr6->GetFunction("expo")->GetParameter("Constant"); b = gr6->GetFunction("expo")->GetParameter("Slope"); c = 150.; fout<SetLineColor(1); gr7->SetLineWidth(2); gr7->SetMarkerColor(1); gr7->SetMarkerStyle(25); gr7->Draw("P"); gr7->Fit("expo"); gr7->GetFunction("expo")->SetLineWidth(1); gr7->GetFunction("expo")->SetLineColor(1); gr7->GetFunction("expo")->SetLineStyle(5); a = gr7->GetFunction("expo")->GetParameter("Constant"); b = gr7->GetFunction("expo")->GetParameter("Slope"); c = 100.; fout<SetLineColor(1); gr8->SetLineWidth(2); gr8->SetMarkerColor(1); gr8->SetMarkerStyle(25); gr8->Draw("P"); gr8->Fit("expo"); gr8->GetFunction("expo")->SetLineWidth(1); gr8->GetFunction("expo")->SetLineColor(1); gr8->GetFunction("expo")->SetLineStyle(6); a = gr8->GetFunction("expo")->GetParameter("Constant"); b = gr8->GetFunction("expo")->GetParameter("Slope"); c = 150.; fout<SetNDC(); t->SetTextFont(32); t->SetTextAlign(12); t->SetTextSize(0.04); t->SetTextColor(1); t->DrawLatex(0.15,0.87,"Neon+0.1% H_{2} & 0.01% H_{2} T=293K"); t->DrawLatex(0.22,0.65,"45"); t->DrawLatex(0.24,0.79,"60"); t->DrawLatex(0.35,0.78,"100"); t->DrawLatex(0.45,0.8,"150"); t->DrawLatex(0.60,0.40,"100"); t->DrawLatex(0.75,0.50,"150"); t->DrawLatex(0.5,0.7,"0.1% H2"); t->DrawLatex(0.50,0.20,"0.01% H2"); pad2->cd(); pad2->SetFillColor(0); pad2->SetLogy(); const Int_t m1 = 20; Double_t rr1[m1] = {.170,.205,.210,.215,.220,.225,.230,.235,.240,.245, .250,.255,.260,.265,.270,.275,.280,.320,.390,.490}; Double_t ss1[m1] = {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1000000,10000000,1000000}; gr = new TGraph(m-2,rr1,ss1); gr->SetLineColor(4); gr->SetLineWidth(4); gr->SetMarkerColor(4); gr->SetMarkerStyle(21); // gr->SetMarkerSize(0.1); // gr->SetTitle("Charge Gain vs #Delta GEM, kV "); gr->GetYaxis()->SetTitle("Charge Gain "); gr->GetXaxis()->SetTitle("#Delta GEM, kV "); gr->SetMaximum(51000.); gr->SetMinimum(200.); gr->Draw("AP"); const Int_t k30=5, k45=4, k60=4, k100=4, k150=5; Double_t r30k[k30] = {(0.1823+0.1789+0.1809)/3.,(0.1874+0.1836+0.1857)/3., (0.1925+0.1886+0.1907)/3.,(0.2020+0.1986+0.2003)/3., (0.2119+0.2082+0.2101)/3.}; Double_t g30k[k30] = {64.50, 109.60, 71.13, 93.16, 129.39}; Double_t Coef30k[k30]= {9.01, 9.01, 22.12, 45.73, 91.54}; Double_t r45k[k45] = {(0.1873+0.1888+0.1907)/3.,(0.2020+0.1985+0.2003)/3., (0.2115+0.2084+0.2102)/3.,(0.2216+0.2181+0.2200)/3.}; Double_t g45k[k45] = { 96.97, 123.86, 163.47, 219.94}; Double_t Coef45k[k45]= {9.01, 22.12, 45.73, 91.54}; Double_t r60k[k60] = {(0.2023+0.1984+0.2005)/3., (0.2120+0.2084+0.2102)/3., (0.2214+0.2181+0.2200)/3., (0.2322+0.2279+0.2299)/3.}; Double_t g60k[k60] = {128.59, 141.84, 182.56, 239.4}; Double_t Coef60k[k60]= {9.01, 22.12, 45.73, 91.54}; Double_t r100k[k100] = {(0.2280+0.2327+0.2303)/3., (0.2414+0.2376+0.2400)/3., (0.2507+0.2473+0.2497)/3., (0.2576+0.2621+0.2598)/3.}; Double_t g100k[k100] = {64.30, 160.29, 195.07, 102.57}; Double_t Coef100k[k100]= {22.12, 22.12, 45.73, 225.18}; Double_t r150k[k150] = {(0.2575+0.2620+0.2602)/3., (0.2673+0.2718+0.2700)/3., (0.2771+0.2813+0.2796)/3., (0.2873+0.2913+0.2896)/3., (0.2982+0.3012+0.2994)/3.}; Double_t g150k[k150] = {69.40, 158.89, 150.42, 167.95, 79.00}; Double_t Coef150k[k150]= {9.01, 9.01, 22.12, 45.73, 225.18 }; for (Int_t i=0;iSetLineColor(1); gr31->SetLineWidth(2); gr31->SetMarkerColor(1); gr31->SetMarkerStyle(24); gr31->Draw("P"); gr31->Fit("expo"); gr31->GetFunction("expo")->SetLineWidth(1); gr31->GetFunction("expo")->SetLineColor(1); gr31->GetFunction("expo")->SetLineStyle(1); a = gr31->GetFunction("expo")->GetParameter("Constant"); b = gr31->GetFunction("expo")->GetParameter("Slope"); c = 30.; fout<SetLineColor(1); gr11->SetLineWidth(2); gr11->SetMarkerColor(1); gr11->SetMarkerStyle(24); gr11->Draw("P"); gr11->Fit("expo"); gr11->GetFunction("expo")->SetLineWidth(1); gr11->GetFunction("expo")->SetLineColor(1); gr11->GetFunction("expo")->SetLineStyle(2); a = gr11->GetFunction("expo")->GetParameter("Constant"); b = gr11->GetFunction("expo")->GetParameter("Slope"); c = 45.; fout<SetLineColor(1); gr41->SetLineWidth(2); gr41->SetMarkerColor(1); gr41->SetMarkerStyle(24); gr41->Draw("P"); gr41->Fit("expo"); gr41->GetFunction("expo")->SetLineWidth(1); gr41->GetFunction("expo")->SetLineColor(1); gr41->GetFunction("expo")->SetLineStyle(3); a = gr41->GetFunction("expo")->GetParameter("Constant"); b = gr41->GetFunction("expo")->GetParameter("Slope"); c = 60.; fout<SetLineColor(1); gr51->SetLineWidth(2); gr51->SetMarkerColor(1); gr51->SetMarkerStyle(24); gr51->Draw("P"); gr51->Fit("expo"); gr51->GetFunction("expo")->SetLineWidth(1); gr51->GetFunction("expo")->SetLineColor(1); gr51->GetFunction("expo")->SetLineStyle(4); a = gr51->GetFunction("expo")->GetParameter("Constant"); b = gr51->GetFunction("expo")->GetParameter("Slope"); c = 100.; fout<SetLineColor(1); gr61->SetLineWidth(2); gr61->SetMarkerColor(1); gr61->SetMarkerStyle(24); gr61->Draw("P"); gr61->Fit("expo"); gr61->GetFunction("expo")->SetLineWidth(1); gr61->GetFunction("expo")->SetLineColor(1); gr51->GetFunction("expo")->SetLineStyle(5); a = gr61->GetFunction("expo")->GetParameter("Constant"); b = gr61->GetFunction("expo")->GetParameter("Slope"); c = 150.; fout<SetTextColor(1); t->DrawLatex(0.15,0.87,"Neon+1.0% H_{2} T=293K"); t->DrawLatex(0.30,0.7,"30"); t->DrawLatex(0.37,0.83,"45"); t->DrawLatex(0.45,0.79,"60"); t->DrawLatex(0.53,0.68,"100"); t->DrawLatex(0.74,0.82,"150"); c1->SaveAs("gg2.pdf"); }