Hi,
I’m attempting to create a plot that overlays a set of histograms that have the same x-axis but different y-axes. I’m able to do this, however the title for the right side axis is not visible. It seems to be hidden under some sort of right side margin, but I don’t know how to fix this.
Here is what I am able to get the plot to look like:
toptageff.pdf (20 KB)
Here is the working code (it’s loading three ROOT files, but I can’t upload them here. If this is a problem I’ll add in some dummy histograms).
[code]//#include “AtlasStyle.h”
//#include “AtlasUtils.h”
#include “TCanvas.h”
#include “TPad.h”
void TopTagEff (){
//SetAtlasStyle();
//#ifdef CINT
// gROOT->LoadMacro(“AtlasUtils.C”);
//#endif
gStyle->SetFrameFillColor(0);
gStyle->SetFrameFillStyle(0);
TCanvas *c1 = new TCanvas(“c1”,“c1”,800,600);
//ATLAS_LABEL(0.2,0.85);
//myText(0.2,0.8,1,“Internal”);
TPad *pad1 = new TPad(“pad1”,"",0,0,0.90,1.0);
TPad *pad2 = new TPad(“pad2”,"",0,0,1.0,1.0);
//pad1->SetFillStyle(4000);
//pad1->SetFrameFillStyle(0);
pad2->SetFillStyle(4000); // Makes pad2
pad2->SetFrameFillStyle(0); // transparent.
TLegend *l1 = new TLegend(0.510496,0.702797,0.89069,0.912587);
myText(0.510496,0.65,1,"#sqrt{s} = 8 TeV");
TFile *signal = new TFile(“FourtopRPP_082113_MKK1000Var3MV1.root”);
TFile *sgluon = new TFile(“SglSgl_082013_1000GeVCurrent.root”);
TFile *contact = new TFile(“Signal4top_contact_082013Current.root”);
signal->cd();
TH2F mkk1000 = (TH2F)(signal->Get(“Run159802_toptag_eff_pt_R10”));
TH1F h_mkk1000 = (TH1F)mkk1000->ProfileX();
TH2F mkk1200 = (TH2F)(signal->Get(“Run159803_toptag_eff_pt_R10”));
TH1F h_mkk1200 = (TH1F)mkk1200->ProfileX();
TH1F mkk1000_pt = (TH1F)signal->Get(“Run159802_truth_top_pt;1”);
TH1F mkk1200_pt = (TH1F)signal->Get(“Run159803_truth_top_pt;1”);
sgluon->cd();
TH1F sgluon_top_pt = (TH1F)sgluon->Get(“truth_top_pt;1”);
contact->cd();
TH1F contact_top_pt = (TH1F)contact->Get(“truth_top_pt;1”);
pad1->Draw();
pad1->cd();
double scale = mkk1000_pt->Integral();
mkk1000_pt->Scale(1./scale);
scale = mkk1200_pt->Integral();
mkk1200_pt->Scale(1./scale);
scale = sgluon_top_pt->Integral();
sgluon_top_pt->Scale(1./scale);
scale = contact_top_pt->Integral();
contact_top_pt->Scale(1./scale);
contact_top_pt->GetYaxis()->SetRangeUser(0,0.06);
contact_top_pt->GetXaxis()->SetRangeUser(0,1400.);
contact_top_pt->GetYaxis()->SetTitle(“Fraction of entries / 20 GeV”);
contact_top_pt->GetYaxis()->SetNdivisions(10);
contact_top_pt->GetYaxis()->SetLabelSize(0.04);
contact_top_pt->GetYaxis()->SetTitleSize(0.04);
contact_top_pt->GetXaxis()->SetLabelSize(0.04);
contact_top_pt->GetXaxis()->SetTitleSize(0.04);
contact_top_pt->GetXaxis()->SetTitle(“p^{truth}_{T,top} [GeV]”);
contact_top_pt->SetLineColor(kGreen+2);
contact->Draw(“HY-”);
sgluon_top_pt->SetLineColor(kBlue+2);
sgluon->Draw(“sameAH”);
mkk1000_pt->SetLineColor(kRed+2);
mkk1000_pt->Draw(“sameAH”);
mkk1200_pt->Draw(“sameH”);
pad1->Update();
pad2->Draw();
pad2->cd();
h_mkk1000->GetYaxis()->SetRangeUser(0,1.0);
h_mkk1000->GetYaxis()->SetTitleSize(0.04);
h_mkk1000->GetYaxis()->SetLabelSize(0.04);
h_mkk1000->GetXaxis()->SetLabelSize(0.04);
h_mkk1000->GetXaxis()->SetRangeUser(0,1400);
h_mkk1000->GetYaxis()->SetTitle(“Efficiency”);
h_mkk1200->GetYaxis()->SetRangeUser(0,1.0);
h_mkk1000->Draw(“Y+”);
pad2->Update();
pad2->Modified();
l1->AddEntry(h_mkk1000,“Top-tag Efficiency”,“pl”);
l1->AddEntry(contact_top_pt,“Contact Interaction”,“F”);
l1->AddEntry(sgluon_top_pt,“Sgluon, m_{S}=1 TeV”,“F”);
l1->AddEntry(mkk1000_pt,“2UED, M_{KK}=1.0 TeV”,“F”);
l1->AddEntry(mkk1200_pt,“2UED, M_{KK}=1.2 TeV”,“F”);
l1->SetFillColor(0);
l1->SetBorderSize(0);
l1->Draw();
c1->SaveAs(“toptageff.pdf”);
}
#ifndef CINT
int main() {
TopTagEff();
}
#endif
[/code]
TopTagEff.C (3.48 KB)
Basically, the right side should have a label that says “Efficiency”.
Thanks for any help or hints.
Cheers,
Peter