/* * Plots the GC cut efficiencies and rejection factors * as a function of GC cut position for a given kinematic. * */ #include #include #include "TAxis.h" #include "TCanvas.h" #include "TGraph.h" #include "TPad.h" #include "TGaxis.h" #include "TVector.h" using namespace std; void plot_data_final() { //[...] //SNIPPED //[...] TCanvas *c1 = new TCanvas("c1","GC Cut Efficiency Study",200,10,700,500); c1->SetFillColor(10); c1->cd(); TPad *pad1 = new TPad("pad1","",0,0,1,1); TPad *pad2 = new TPad("pad2","",0,0,1,1); pad2->SetFillStyle(4000); //pad2 will be transparent pad1->Draw(); pad1->cd(); pad1->SetLogy(1); TGraph *g1 = new TGraphErrors(cp,eff_2,ex,err_2); g1->SetMarkerStyle(4); g1->SetMarkerColor(kBlue); g1->SetTitle(title); g1->GetXaxis()->SetTitle(x_axis); g1->GetXaxis()->CenterTitle(); g1->GetXaxis()->SetLimits(x2_min,x2_max); g1->GetYaxis()->SetTitle(y2); g1->GetYaxis()->SetTitleColor(kBlue); g1->GetYaxis()->SetLabelColor(kBlue); g1->GetYaxis()->CenterTitle(); g1->GetYaxis()->SetRangeUser(y2_min,y2_max); g1->Draw("AP"); pad2->SetLogy(0); //compute the pad range with suitable margins Double_t ymin = 50; Double_t ymax = 100; Double_t dy = (ymax-ymin)/(0.8); //10 per cent margins top and bottom Double_t xmin = 0; Double_t xmax = 800; Double_t dx = (xmax-xmin)/0.8; //10 per cent margins left and right pad2->Range(xmin-0.1*dx,ymin-0.1*dy,xmax+0.1*dx,ymax+0.1*dy); pad2->Draw(); pad2->cd(); TGraph *g2 = new TGraphErrors(cp,eff_1,ex,err_1); g2->SetMarkerStyle(4); g2->SetMarkerColor(kRed); g2->Draw("sameP"); pad2->Update(); // draw axis on the right side of the pad TGaxis *axis = new TGaxis(x1_max,y1_min,x1_max,y1_max,y1_min,y1_max,50510,"+L"); axis->SetLabelColor(kRed); axis->SetTitle(y1); axis->SetTitleColor(kRed); axis->CenterTitle(); axis->Draw(); }