From 63e2bb972def564ec23076cf843e2dfcda5736ff Mon Sep 17 00:00:00 2001 From: jklay Date: Wed, 11 Nov 2009 06:16:03 +0000 Subject: [PATCH] updated plotting macros --- PWG4/macros/electrons/makeCombinedData.C | 4 +- PWG4/macros/electrons/plotNPERates.C | 4 +- PWG4/macros/electrons/plotPIDCompare.C | 85 +++++++++++++++++++++++- 3 files changed, 87 insertions(+), 6 deletions(-) diff --git a/PWG4/macros/electrons/makeCombinedData.C b/PWG4/macros/electrons/makeCombinedData.C index 1477cfb3b51..9da100d65c1 100644 --- a/PWG4/macros/electrons/makeCombinedData.C +++ b/PWG4/macros/electrons/makeCombinedData.C @@ -710,8 +710,8 @@ void makeTRKElectrons(TH2F* jjtrk, TH2F* bjtrk, TH2F* wjtrk) { for(Int_t i = 5; i<= convtrk->GetNbinsX(); i++) { Double_t dither = rand2.Gaus(0.,fooconvtrk->GetBinContent(i)/2.); if(dither + fooconvtrk->GetBinContent(i) < fooconvtrk->GetBinContent(i)/100.) dither = 0.; - // convtrk->SetBinContent(i,fooconvtrk->GetBinContent(i)+dither); - //convtrk->SetBinError(i,sqrt(fooconvtrk->GetBinContent(i))); + convtrk->SetBinContent(i,fooconvtrk->GetBinContent(i)+dither); + convtrk->SetBinError(i,sqrt(fooconvtrk->GetBinContent(i))); } convtrk->Draw(); fooconvtrk->Draw("same"); diff --git a/PWG4/macros/electrons/plotNPERates.C b/PWG4/macros/electrons/plotNPERates.C index 0c1592fafb5..94d0410c082 100644 --- a/PWG4/macros/electrons/plotNPERates.C +++ b/PWG4/macros/electrons/plotNPERates.C @@ -31,8 +31,8 @@ void plotNPERates(const char* which = "EMC") { // leg->AddEntry(htte,"Misidentified hadrons","l"); gStyle->SetOptStat(0); - drawAnnualYields(which); - drawPtCutRates(which); + // drawAnnualYields(which); + // drawPtCutRates(which); //drawCompareTruth(); } diff --git a/PWG4/macros/electrons/plotPIDCompare.C b/PWG4/macros/electrons/plotPIDCompare.C index de58969bed6..d208803bfab 100644 --- a/PWG4/macros/electrons/plotPIDCompare.C +++ b/PWG4/macros/electrons/plotPIDCompare.C @@ -115,9 +115,15 @@ void plotPIDCompare(char* which = "EMC") { Double_t efinal = 0.258; TGraphErrors* eerr = new TGraphErrors(); eerr->SetName("emcErr"); + int count=0; for(Int_t i = 1; i <= hcorr->GetNbinsX(); i++) { - eerr->SetPoint(i-1,hcorr->GetBinCenter(i),hcorr->GetBinContent(i)); - eerr->SetPointError(i-1,0.,efinal*hcorr->GetBinContent(i)); + if (hcorr->GetBinCenter(i) <10.0) continue; + if (hcorr->GetBinCenter(i) >50.0) break; + cout <<"bin:"<< i << ", bin-center:"<< hcorr->GetBinCenter(i)<< endl; + eerr->SetPoint(count,hcorr->GetBinCenter(i),hcorr->GetBinContent(i)); + eerr->SetPointError(count,0.,efinal*hcorr->GetBinContent(i)); + if(hcorr->GetBinCenter(i) <20.0) eerr->SetPointError(count,0.,1.5*efinal*hcorr->GetBinContent(i)); + count++; } eerr->SetFillColor(kRed-8); eerr->Draw("3same"); @@ -144,5 +150,80 @@ void plotPIDCompare(char* which = "EMC") { // latex->Draw(); crates->Print("NPERates_PIDCompare_all.pdf"); + + TCanvas* ccomp = new TCanvas("ccomp","",0,0,600,800); + ccomp->SetFillColor(0); + ccomp->SetBorderMode(0); + ccomp->SetBorderSize(2); + ccomp->SetFrameBorderMode(0); + ccomp->SetFrameBorderMode(0); + TPad* upperPad = new TPad("upperPad", "upperPad", + .005, .2525, .995, .995); + upperPad->SetFillColor(0); + upperPad->SetBorderMode(0); + upperPad->SetBorderSize(2); + upperPad->SetFrameBorderMode(0); + upperPad->SetFrameBorderMode(0); + TPad* lowerPad = new TPad("lowerPad", "lowerPad", + .005, .005, .995, .2525); + lowerPad->SetFillColor(0); + lowerPad->SetFillColor(0); + lowerPad->SetBorderMode(0); + lowerPad->SetBorderSize(2); + lowerPad->SetFrameBorderMode(0); + lowerPad->SetFrameBorderMode(0); + upperPad->Draw(); + lowerPad->Draw(); + upperPad->cd(); + gPad->SetLogy(); + hcorr->SetTitle("Efficiency corrected non-photonic electrons"); + hcorr->SetYTitle("Annual yield in EMCAL dN/dp_{T} (GeV/c)^{-1}"); + hcorr->SetXTitle("p_{T} (GeV/c)"); + hcorr->GetXaxis()->SetRangeUser(10.,49.); + hcorr->GetYaxis()->SetTitleOffset(1.2); + hcorr->Draw(); + eerr->Draw("3same"); + hcorr->Draw("same"); + allMC->Draw("same"); + TLegend *myleg = new TLegend(0.3,0.7,0.9,0.9); + myleg->SetFillColor(0); + myleg->AddEntry(allMC,"MC Electrons","l"); + myleg->AddEntry(hcorr,"Eff. corrected EMCAL N-P electrons","pl"); + myleg->AddEntry(eerr,"Systematic uncertainty","f"); + myleg->Draw(); + lowerPad->cd(); + TH1F* hmc = (TH1F*)allMC->Clone(); hmc->SetName("hmc"); + hmc->Rebin(5); hmc->Scale(0.2); + TH1F* hmcratio = (TH1F*)hcorr->Clone(); hmcratio->SetName("hmcratio"); + hmcratio->Divide(hmc); + hmcratio->SetTitle(); + hmcratio->SetYTitle("MC/Data"); + hmcratio->GetYaxis()->SetRangeUser(0.,2.); + hmcratio->GetYaxis()->SetNdivisions(505); + hmcratio->GetYaxis()->SetLabelSize(2.*hmcratio->GetYaxis()->GetLabelSize()); + hmcratio->GetYaxis()->SetTitleSize(3.*hmcratio->GetYaxis()->GetTitleSize()); + hmcratio->GetYaxis()->SetTitleOffset(0.3); + hmcratio->SetXTitle(""); + hmcratio->GetXaxis()->SetLabelSize(2.*hmcratio->GetXaxis()->GetLabelSize()); + hmcratio->Draw(); + TGraphErrors* rerr = new TGraphErrors(); + rerr->SetName("ratioErr"); + count=0; + for(Int_t i = 1; i <= hmcratio->GetNbinsX(); i++) { + if (hmcratio->GetBinCenter(i) <10.0) continue; + if (hmcratio->GetBinCenter(i) >50.0) break; + rerr->SetPoint(count,hmcratio->GetBinCenter(i),hmcratio->GetBinContent(i)); + rerr->SetPointError(count,0.,efinal*hmcratio->GetBinContent(i)); + if(hmcratio->GetBinCenter(i) <20.0) rerr->SetPointError(count,0.,1.5*efinal*hmcratio->GetBinContent(i)); + count++; + } + rerr->SetFillColor(kRed-8); + rerr->Draw("3same"); + hmcratio->Draw("same"); + TLine* line = new TLine(10.,1.,50.,1.); + line->SetLineStyle(2); + line->Draw(); + ccomp->Print("EMCAL_NPE.pdf"); + crates->cd(); } -- 2.39.3