#include "drawAsym.h" #include "TFile.h" #include "TTree.h" #include "TH1.h" #include "TH2.h" #include "TH3.h" #include "TCanvas.h" #include "TAxis.h" double integ(TH1D* histdata, double xmin, double xmax) { TAxis *axis = histdata->GetXaxis(); int bmin = axis->FindBin(xmin); int bmax = axis->FindBin(xmax); double para = histdata->Integral(bmin, bmax); return para; } void drawTH1D2Compare(TH1D* hist1, TH1D* hist2, TString figName) { Int_t w = 960; Int_t h = 600; double minimum = 0.1; double maximum = 50*hist1->GetMaximum(); TString title_c = "Im_2g_omega"; TCanvas *c = new TCanvas("c", title_c, w, h); c->Divide(1,1); hist1->SetMinimum(minimum); gPad->SetLogy(); hist1->SetMaximum(maximum); hist1->SetLineColor(kRed); hist1->SetLineStyle(1); hist2->SetLineColor(kBlue); hist2->SetLineStyle(2); hist1->Draw(); hist2->Draw("SAME"); TLegend *leg = new TLegend(0.42,0.72, 0.72, 0.86); leg->SetHeader("The omega background"); leg->SetTextSize(0.04); leg->AddEntry(hist1, "data", "f"); leg->AddEntry(hist2, "#omega mc", "f"); leg->Draw(); c->Print(figName); return; } void drawomega() { 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 fileNameomega = "./histroot/hist_p2gamma_omega_010000.root"; TFile *fomega = TFile::Open(fileNameomega); TString figsDir = "./figsomega/"; cout<<"root file is: "<Get(histName); TH1D* histomega = (TH1D*)fomega->Get(histName); double paradata = integ(histdata, xmin, xmax); double paraomega = integ(histomega, xmin, xmax); double paraomega_eta_bf = integ(histomega, eta_min, eta_max); cout<<"paraomega_eta_bf = "<Scale(norm); double paraomega_eta = integ(histomega, eta_min, eta_max); double paradata_eta = integ(histdata, eta_min, eta_max); double fraction = paraomega_eta/paradata_eta; cout<<"paraomega_eta_af = "<