00001 TFile * fuaf = TFile::Open("~/higgs_mass_file_test.root"); 00002 TFile * fucsb = TFile::Open("~/histograms_correct_HtoZZ_angular_Hm190.00_Nevt1100.root"); 00003 00004 void compare(TString hnameuaf,TString hnameucsb="default") 00005 { 00006 if (hnameucsb=="default") 00007 hnameucsb=hnameuaf; 00008 00009 TCanvas * c = new TCanvas("compare_"+hnameuaf,"***",1000,500); 00010 00011 TH1F * h_uaf = (TH1F*) fuaf->Get(hnameuaf); 00012 TH1F * h_ucsb = (TH1F*) fucsb->Get(hnameucsb); 00013 00014 h_uaf->SetLineColor(2); 00015 h_uaf->SetMarkerStyle(6); 00016 00017 h_ucsb->SetLineColor(4); 00018 h_ucsb->SetMarkerStyle(6); 00019 00020 h_uaf->Sumw2(); 00021 h_ucsb->Sumw2(); 00022 00023 h_uaf->Scale(1/(float) h_uaf->Integral()); 00024 h_ucsb->Scale(1/(float) h_ucsb->Integral()); 00025 00026 TH1F * h_ratio = new TH1F(*h_uaf); 00027 h_ratio->Divide(h_ucsb); 00028 h_ratio->SetYTitle("UAF/UCSB"); 00029 00030 h_ratio->SetLineColor(3); 00031 h_ratio->SetMarkerStyle(6); 00032 00033 c->Clear(); 00034 c->Divide(2,1); 00035 c->cd(1)->SetGrid(); 00036 00037 h_uaf->Draw("e hist"); 00038 h_ucsb->Draw("e hist same"); 00039 00040 00041 TLegend * leg = new TLegend(0.5,0.5,0.7,0.7); 00042 leg->AddEntry(h_uaf,"UAF"); 00043 leg->AddEntry(h_ucsb,"UCSB"); 00044 00045 leg->Draw(); 00046 00047 c->cd(2)->SetGrid(); 00048 gStyle->SetOptFit(true); 00049 00050 int rebin=4; 00051 h_ratio->Rebin(rebin); 00052 h_ratio->Scale(1/(float)rebin); 00053 h_ratio->Draw("e"); 00054 00055 TLine * line = new TLine(h_ratio->GetXaxis()->GetXmin(),1, 00056 h_ratio->GetXaxis()->GetXmax(),1); 00057 00058 line->SetLineStyle(9); 00059 h_ratio->Fit("pol1"); 00060 line->Draw(); 00061 }