Problems Formating axis on 2 pads

If I try to format the axis where it’s marked “//error” it crashes root… what’s wrong! I’ve tried this for hours.

{
//set Canvas Stylings	
gROOT->SetStyle("Plain");
gStyle->SetPadTickX(1);
gStyle->SetPadTickY(1);

gStyle->SetTitleSize(0.05593);
gStyle->SetTitleXOffset(0.95);
gStyle->SetTitleXSize(0.08);
gStyle->SetTitleFont(132,"xyz");
gStyle->SetLabelFont(132,"xyz");

gStyle->SetTitleYOffset(1.0);
gStyle->SetTitleYSize(0.06593);
gStyle->SetTitleXSize(0.06593);

gStyle->SetTitleBorderSize(0);
gStyle->SetNdivisions(10,"xyz");
gStyle->SetLabelSize(0.035,"xyz");
gStyle->SetOptStat(000000);
gStyle->SetPadBottomMargin(0.15);
gStyle->SetPadLeftMargin(0.15);

//create legend root
TFile *tleg = new TFile("legend.root","recreate");

TH1F *h1 = new TH1F("data","",100,-4,4);
h1->FillRandom("gaus",2000);
h1->SetFillColor(kOrange+1);
h1->Write();
TH1F *h2 = new TH1F("ttbar","",100,-4,4);
h2->FillRandom("gaus",2000);
h2->SetFillColor(2);
h2->Write();
TH1F *h3 = new TH1F("ww","",100,-4,4);
h3->FillRandom("gaus",2000);
h3->SetFillColor(28);
h3->Write();
TH1F *h4 = new TH1F("wz","",100,-4,4);
h4->FillRandom("gaus",2000);
h4->SetFillColor(5);
h4->Write();
TH1F *h5 = new TH1F("zz","",100,-4,4);
h5->FillRandom("gaus",2000);
h5->SetFillColor(6);
h5->Write();
TH1F *h6 = new TH1F("signal","",100,-4,4);
h6->FillRandom("gaus",2000);
h6->SetFillColor(7);
h6->Write();
TH1F *h7 = new TH1F("zjets","",100,-4,4);
h7->FillRandom("gaus",2000);
h7->SetFillColor(8);
h7->Write();
TH1F *h8 = new TH1F("wjets","",100,-4,4);
h8->FillRandom("gaus",2000);
h8->SetFillColor(9);
h8->Write();

//legend
TLegend *leg = new TLegend(0.01,0.2,0.151,0.7);
leg->AddEntry(data,"Data","f");
leg->AddEntry(wjets,"W+jets","f");
leg->AddEntry(zjets,"Z+jets","f");
leg->AddEntry(ww,"WW","f");
leg->AddEntry(wz,"WZ","f");
leg->AddEntry(zz,"ZZ","f");
leg->AddEntry(ttbar,"ttbar","f");
leg->SetFillColor(10);
leg->SetBorderSize(0);
leg->SetTextFont(132);

Double_t w = 1152;
Double_t h = 1440;
Double_t min = 0;
Double_t max = 200;
TFile *e = new TFile("bgvdata.root");
TFile *ts = new TFile("stack.root");
TFile *d = new TFile("../data.root");

//legend
TLegend *leg1 = new TLegend(0.01,0.2,0.151,0.27);
e->cd();
leg1->AddEntry(M_ll,"(Data-Bg)/Bg","f");
leg1->SetFillColor(10);
leg1->SetBorderSize(0);
leg1->SetTextFont(132);

//Set Globals
gStyle->SetEndErrorSize(3);
gStyle->SetErrorX(1.);

//Format Canvases 
TCanvas *tc = new TCanvas("tc","",w,h);
tc->Divide(1,2);
tc->cd(1);
TPad *p1 = new TPad("p1","p1",0,0,1,1);
p1->SetNumber(1);
//p1->SetBottomMargin(0);
p1->SetLeftMargin(0.2);
p1->SetRightMargin(0.05);
tc->cd(2);
TPad *p2 = new TPad("p2","p2",0,0,1,1);
p2->SetNumber(2);
//p2->SetTopMargin(0);
p2->SetLeftMargin(0.2);
p2->SetRightMargin(0.05);

////////////////////////////////////////////////////////////////////////////////
////                              M_ll                                      ////
////////////////////////////////////////////////////////////////////////////////
TH1F *th1 = (TH1F*)ts->Get("stack_ll");
TH1F *th2 = (TH1F*)e->Get("M_ll");
TH1F *dp = (TH1F*)d->Get("M_ll");
min=75;
max=107;


//pad1
tc->cd(1);
p1->Draw();
p1->cd();
th1->Draw();
dp->SetMarkerStyle(20);
dp->SetMarkerColor(kOrange+1);
dp->Draw("PE1SAME");
//th1->GetXaxis()->SetTitle("M_{ll} [GeV/c^2]");  //error
//th1->GetYaxis()->SetTitle("Events");  //error
//th1->GetXaxis()->SetTitleSize(0.05);  //error
//th1->GetYaxis()->SetTitleSize(0.05);  //error
//th1->GetXaxis()->SetRangeUser(min,max); //error
leg->Draw("SAME");
tc->cd(1);
p1->SetLogy();
p1->Update();
tc->cd();
tc->Update();
//pad2
tc->cd(2);
p2->Draw();
p2->cd();
th2->Draw();
th2->GetXaxis()->SetTitle("M_{ll} [GeV/c^2]");
th2->GetYaxis()->SetTitle("Events");
th2->GetXaxis()->SetTitleSize(0.05);
th2->GetYaxis()->SetTitleSize(0.05);
th2->GetXaxis()->SetRangeUser(min,max);
leg1->Draw("SAME");
p2->Update();
tc.Print("print.pdf");
}

Cat you provide the missing file ?

Error in <TFile::TFile>: file bgvdata.root does not exist
Error in <TFile::TFile>: file ../data.root does not exist