#include #include #include #include #include "TLorentzVector.h" #include #include "THStack.h" #include"TFile.h" #include "TH1.h" // put here the include files you need #include "TStopwatch.h" #include using namespace std; #include #include #include #include using namespace std; void Stack_Hist() { double lumi = 300; gStyle->SetOptStat(0); //to switch for stat. box TString dirname = "/home/ahmed/tau_analysis"; TString rootH1TT = "h1_e3e3bar.root"; TString rootH2TT= "h_tata.root"; TString rootZTT = "z_tata.root"; TString rootTT = "tata.root"; //TString ps_name = "tt_plots_log.ps"; TString ps_name = "tt_plots_log.ps"; rootH2TT=dirname + "/" + rootH2TT; rootZTT=dirname + "/" + rootZTT; rootTT=dirname + "/" + rootTT; rootH1TT =dirname + "/" + rootH1TT ; delete gROOT->GetListOfFiles()->FindObject( rootH2TT); delete gROOT->GetListOfFiles()->FindObject( rootZTT); delete gROOT->GetListOfFiles()->FindObject(rootTT); delete gROOT->GetListOfFiles()->FindObject(rootH1TT); TFile *rootH2TTbar= new TFile(rootH2TT); TFile *rootZTTbar = new TFile(rootZTT); TFile *rootTTbar= new TFile(rootTT); TFile *rootH1TTbar = new TFile(rootH1TT); TH1F *hmc[4][8];TString hname_mc[8]; hname_mc[0]="tau1_pt"; hname_mc[1]="tau1_eta"; hname_mc[2]="tau2_pt"; hname_mc[3]="tau2_eta"; hname_mc[4]="h_mass"; hname_mc[5]="h_pt"; hname_mc[6]="h_eta"; hname_mc[7]="DR_tau"; double Y_min[0xA ^ 10]; double Y_max[0xA ^ 10]; for(int i=0; i<8; i++ ){ //cout <<"... coloring mc hmc["<Get(hname_mc[i]); hmc[1][i] = (TH1F*)rootZTTbar->Get(hname_mc[i]); hmc[2][i] = (TH1F*)rootTTbar->Get(hname_mc[i]); hmc[3][i] = (TH1F*)rootH1TTbar->Get(hname_mc[i]); Y_min[i] = (hmc[2][i]->GetMaximum()/10000); if(i==0||i==2||i==7)Y_max[i] = 1.4*(hmc[2][i]->GetMaximum()); else if(i==4||i==5||i==7)Y_max[i] = 1800*(hmc[3][i]->GetMaximum()); else if(i==6)Y_max[i] = 12000*(hmc[3][i]->GetMaximum()); else Y_max[i] = 1200*(hmc[3][i]->GetMaximum()); hmc[0][i]->GetYaxis()->SetRangeUser(Y_min[i],Y_max[i]); if(i==0||i==2||i==4|| i==5)hmc[0][i]->GetXaxis()->SetRangeUser(0,1000.); if(i==1||i==3|| i==6||i==7)hmc[0][i]->GetXaxis()->SetRangeUser(-5.,5.); if(i==0||i==2||i==4|| i==5)hmc[1][i]->GetXaxis()->SetRangeUser(0.,1000.); if(i==1||i==3|| i==6||i==7)hmc[1][i]->GetXaxis()->SetRangeUser(-6.,6.); if(i==0||i==2||i==4|| i==5)hmc[2][i]->GetXaxis()->SetRangeUser(0.,1000.); if(i==1||i==3|| i==6||i==7)hmc[2][i]->GetXaxis()->SetRangeUser(-5.,5.); if(i==0||i==2||i==4|| i==5)hmc[3][i]->GetXaxis()->SetRangeUser(0.,1000.); if(i==1||i==3|| i==6||i==7)hmc[3][i]->GetXaxis()->SetRangeUser(-5.,5.); hmc[0][i]->SetLineColor(kAzure+9); hmc[0][i]->SetFillColor(kAzure+9); hmc[1][i]->SetLineColor(kOrange); hmc[1][i]->SetFillColor(kOrange); hmc[2][i]->SetLineColor(kViolet); hmc[2][i]->SetFillColor(kViolet); hmc[3][i]->SetLineColor(kRed+2); hmc[3][i]->SetFillColor(kRed+2); hmc[0][i]->SetMarkerColor(kAzure+9); hmc[1][i]->SetMarkerColor(kOrange); hmc[2][i]->SetMarkerColor(kViolet); hmc[3][i]->SetMarkerColor(kRed+2); }//mc for cout<<" ...1 "<Add(hmc[0][j]); t[j]->Add(hmc[1][j]); t[j]->Add(hmc[2][j]); t[j]->Add(hmc[3][j]); } cout<<" ...2 "<AddEntry( hmc[0][0],"H2TT ","f"); legend->AddEntry( hmc[1][0],"ZTT","f"); legend->AddEntry( hmc[2][0],"TT","f"); legend->AddEntry( hmc[3][0],"H1TTbar","signal"); legend->SetBorderSize(0.); //no border for legend legend->SetFillColor(0); legend->SetHeader("L_{data} = 300 fb^{-1}"); TPostScript* ps = new TPostScript(ps_name,112);//111 portrait 112 landscape 113 eps ps->Range(20.0,20.0); TCanvas* C = new TCanvas("Fig","Fig"); gPad->SetLogy(); for(int i=0; i<8; i++ ){ if(i==1||i==3||i==6)gPad->SetLogy(0);else gPad->SetLogy(1); //else gPad->SetLogy(); hmc[0][i]->Draw(); gPad->SetLogy(0); t[i]->Draw("Hist,same"); hmc[0][i]->Draw("same"); gPad->RedrawAxis(); /* if(i==174)leg->Draw(); else*/ legend->Draw(); C->Update(); } ps->Print(); ps->Close(); system("ps2pdf tt_plots_log.ps");cout<<" ps converted..."<