#include "TFile.h" #include "TTree.h" #include "TH1.h" #include "TH2.h" #include "TH3.h" #include "TCanvas.h" #include "TAxis.h" void drawDM(TH1D* histNamedata01, TH1D* histNamedata02, TH1D* histNamedata03, TH1D* histNameinmc01, TH1D* histNameinmc02, TH1D* histNameinmc03, TString figName01, TString titleCan01) { TCanvas* canvName01 = new TCanvas("canvName01", titleCan01, 960, 320); canvName01->Divide(2,1); canvName01->cd(1); gPad->SetLeftMargin(0.28); histNamedata01->SetMinimum(0.0); histNamedata01->SetLineColor(kBlack); histNamedata01->GetYaxis()->SetTitleOffset(1.4); histNamedata01->GetYaxis()->SetLabelSize(0.03); histNamedata01->Draw(); histNamedata02->SetLineColor(kBlue); histNamedata02->SetLineStyle(5); histNamedata02->Draw("SAME"); histNamedata03->SetLineColor(kRed); histNamedata03->SetLineStyle(5); histNamedata03->Draw("SAME"); canvName01->cd(2); gPad->SetLeftMargin(0.28); histNameinmc01->SetMinimum(0.0); histNameinmc01->SetLineColor(kBlack); histNameinmc01->GetYaxis()->SetTitleOffset(1.4); histNameinmc01->GetYaxis()->SetLabelSize(0.03); histNameinmc01->Draw(); histNameinmc02->SetLineColor(kBlue); histNameinmc02->SetLineStyle(5); histNameinmc02->Draw("SAME"); histNameinmc03->SetLineColor(kRed); histNameinmc03->SetLineStyle(5); histNameinmc03->Draw("SAME"); /* canvName01->cd(3); gPad->SetLeftMargin(0.28); histNamesgmc01->SetMinimum(0.0); histNamesgmc01->SetLineColor(kBlack); histNamesgmc01->GetYaxis()->SetTitleOffset(1.4); histNamesgmc01->GetYaxis()->SetLabelSize(0.03); histNamesgmc01->Draw(); histNamesgmc02->SetLineColor(kBlue); histNamesgmc02->SetLineStyle(5); histNamesgmc02->Draw("SAME"); histNamesgmc03->SetLineColor(kRed); histNamesgmc03->SetLineStyle(5); histNamesgmc03->Draw("SAME"); */ canvName01->SaveAs(figName01); } void drawDMLog(TH1D* histNamedata01, TH1D* histNamedata02, TH1D* histNamedata03, TH1D* histNameinmc01, TH1D* histNameinmc02, TH1D* histNameinmc03, TString figLogName01, TString titleCan01) { TCanvas* canvName01 = new TCanvas("canvName01", titleCan01, 960, 320); canvName01->Divide(2,1); canvName01->cd(1); gPad->SetLeftMargin(0.28); gPad->SetLogy(); histNamedata01->SetMinimum(0.1); histNamedata01->SetLineColor(kBlack); histNamedata01->GetYaxis()->SetTitleOffset(1.4); histNamedata01->GetYaxis()->SetLabelSize(0.03); histNamedata01->Draw(); histNamedata02->SetLineColor(kBlue); histNamedata02->SetLineStyle(5); histNamedata02->SetLineStyle(5); histNamedata02->Draw("SAME"); histNamedata03->SetLineColor(kRed); histNamedata03->SetLineStyle(5); histNamedata03->Draw("SAME"); canvName01->cd(2); gPad->SetLeftMargin(0.28); gPad->SetLogy(); histNameinmc01->SetMinimum(0.1); histNameinmc01->SetLineColor(kBlack); histNameinmc01->GetYaxis()->SetTitleOffset(1.4); histNameinmc01->GetYaxis()->SetLabelSize(0.03); histNameinmc01->Draw(); histNameinmc02->SetLineColor(kBlue); histNameinmc02->SetLineStyle(5); histNameinmc02->SetLineStyle(5); histNameinmc02->Draw("SAME"); histNameinmc03->SetLineColor(kRed); histNameinmc03->SetLineStyle(5); histNameinmc03->Draw("SAME"); /* canvName01->cd(3); gPad->SetLeftMargin(0.28); gPad->SetLogy(); histNamesgmc01->SetMinimum(0.1); histNamesgmc01->SetLineColor(kBlack); histNamesgmc01->GetYaxis()->SetTitleOffset(1.4); histNamesgmc01->GetYaxis()->SetLabelSize(0.03); histNamesgmc01->Draw(); histNamesgmc02->SetLineColor(kBlue); histNamesgmc02->SetLineStyle(5); histNamesgmc02->SetLineStyle(5); histNamesgmc02->Draw("SAME"); histNamesgmc03->SetLineColor(kRed); histNamesgmc03->SetLineStyle(5); histNamesgmc03->Draw("SAME"); */ canvName01->SaveAs(figLogName01); } void drawTrueSideBand(Int_t hist1D = 1, Int_t hist1Dlog = 1, Int_t hist2D = 0, Int_t hist2Dlog = 0, Int_t hist3D = 0) { TString fileNamedata = "./histroot/ana_p2gamma_Cuts_NewData.root"; TFile *fdata = TFile::Open(fileNamedata); TString fileNameinmc = "./histroot/hist_p2gamma_inc_010000.root"; TFile *finmc = TFile::Open(fileNameinmc); TString figsDir = "./figsCutsTSB/"; cout<<"root file is: "<Get(treeName02); cout<<"02"<Scale(norm); cout<<"02 norm"<Add(histNamedata01, histNamedata02, 1, -1); cout<<"03 add"<Get(treeName01); TH1D* histNameinmc02 = (TH1D*)finmc->Get(treeName02); TH1D* histNameinmc03 = new TH1D(Form("histNameinmc03_%d", i), treeName03, 100, minx, maxx); histNameinmc02->Scale(norm); histNameinmc03->Add(histNameinmc01, histNameinmc02, 1, -1); drawDM(histNamedata01, histNamedata02, histNamedata03, histNameinmc01, histNameinmc02, histNameinmc03, figName01, titleCan01); drawDMLog(histNamedata01, histNamedata02, histNamedata03, histNameinmc01, histNameinmc02, histNameinmc03, figLogName01, titleCan01); } const int maxTH1DHistNum = 7; TString histTH1DName[maxTH1DHistNum] = {"IM_2gamma", "UE", "MMsq", "MMXp", "ME", "BE", "Delta_phi"}; // add any TH1D histogram name const int ncuts=13; double min_ME[ncuts] = {-4.0, -4.0, -4.0, -2.0, -0.70, -0.70, -0.70, -0.70, -0.70, -0.70, -0.70, -0.70, -0.70}; double max_ME[ncuts] = {8.0, 8.0, 8.0, 6.0, 0.70, 0.70, 0.70, 0.70, 0.70, 0.70, 0.70, 0.70, 0.70}; double min_IM_2gamma[ncuts] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; double max_IM_2gamma[ncuts] = {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}; double min_MMsq[ncuts] = {-1.0, -1.0, -1.0, -0.01, -0.01, -0.01, -0.01, -0.01, -0.01, -0.01, -0.01, -0.01, -0.01}; double max_MMsq[ncuts] = {1.0, 1.0, 1.0, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01}; double min_MMXp[ncuts] = {-4.0, -4.0, -4.0, -1.6, -1.5, -1.5, -1.5, -1.5, -1.5, -1.5, -1.5, -1.5, -1.5}; double max_MMXp[ncuts] = {4.0, 4.0, 4.0, 3.2, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0}; double min_UE[ncuts] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; double max_UE[ncuts] = {3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0}; double min_BE[ncuts] = {0.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0}; double max_BE[ncuts] = {12.0, 12.0, 12.0, 12.0, 12.0, 12.0, 12.0, 12.0, 12.0, 12.0, 12.0, 12.0, 12.0}; double min_Delta_phi[ncuts] = {0.0, 0.0, 175.0, 175.0, 175.0, 175.0, 175.0, 175.0, 175.0, 175.0, 175.0, 175.0, 175.0}; double max_Delta_phi[ncuts] = {360.0, 360.0, 185.0, 185.0, 185.0, 185.0, 185.0, 185.0, 185.0, 185.0, 185.0, 185.0, 185.0}; for(int i=0; i9) {figtail = Form("_%d", j);} cout<<"histogram is: "<Scale(norm); histNamedata03->Add(histNamedata01, histNamedata02, 1, -1); TH1D* histNameinmc01 = (TH1D*)finmc->Get(treeName01); TH1D* histNameinmc02 = (TH1D*)finmc->Get(treeName02); TH1D* histNameinmc03 = new TH1D(Form("histNameinmc03_%d_%d", i, j), treeName03, 100, minx, maxx); histNameinmc02->Scale(norm); histNameinmc03->Add(histNameinmc01, histNameinmc02, 1, -1); drawDM(histNamedata01, histNamedata02, histNamedata03, histNameinmc01, histNameinmc02, histNameinmc03, figName01, titleCan01); drawDMLog(histNamedata01, histNamedata02, histNamedata03, histNameinmc01, histNameinmc02, histNameinmc03, figLogName01, titleCan01); } } }