1 /////////////////////////////////////////////////
\r
3 // Macro for plotting rates of identified Non-photonic electrons
\r
6 // J.L. Klay (Cal Poly)
\r
8 /////////////////////////////////////////////////
\r
10 void plotPIDCompare(char* which = "TTE") {
\r
12 gROOT->LoadMacro("makeCombinedData.C");
\r
13 makeData("data/scaled25Oct09/histosLHC08d6.root",
\r
14 "data/scaled25Oct09/TOTALhistosscaled-LHC09b2-0.root",
\r
15 "data/scaled25Oct09/histosscaledLHC09b4AODc.root",
\r
16 "data/scaled25Oct09/histosWboson.root");
\r
18 //define common legend
\r
19 TLegend* leg = new TLegend(0.5,0.6,0.9,0.9);
\r
20 leg->SetFillColor(0);
\r
21 leg->SetTextSize(leg->GetTextSize()*1.2);
\r
22 //leg->AddEntry(alltte,"All N-P e candidates","l");
\r
23 leg->AddEntry(sumtte,"All N-P electrons","l");
\r
24 leg->AddEntry(btte,"Bottom e","l");
\r
25 leg->AddEntry(ctte,"Charm e","l");
\r
26 leg->AddEntry(cbtte,"B-->C e","l");
\r
27 leg->AddEntry(daltte,"Dalitz e","l");
\r
28 leg->AddEntry(convtte,"Conversion e","l");
\r
29 leg->AddEntry(wztte,"W Boson e","l");
\r
30 //leg->AddEntry(htte,"Mis-identified hadrons","l");
\r
32 gStyle->SetOptStat(0);
\r
34 TCanvas* crates = new TCanvas("crates","",0,0,1600,600);
\r
35 crates->SetFillColor(0);
\r
36 crates->SetBorderMode(0);
\r
37 crates->SetBorderSize(2);
\r
38 crates->SetFrameBorderMode(0);
\r
39 crates->SetFrameBorderMode(0);
\r
40 crates->Divide(2,1);
\r
43 alltrk->SetXTitle("p_{T} (GeV/c)");
\r
44 alltrk->SetYTitle("Annual yield in EMCAL dN/dp_{T} (GeV/c)^{-1}");
\r
45 alltrk->SetTitle("PID comparison: Tracking only vs. EMCAL only");
\r
47 alltrk->Rebin(2); alltrk->Scale(0.5);
\r
48 alltrk->GetYaxis()->SetRangeUser(10.,alltrk->GetMaximum()*2.);
\r
49 alltrk->GetXaxis()->SetRangeUser(10.,49.);
\r
52 htrk->Rebin(2); htrk->Scale(0.5);
\r
54 TH1F* tempallemc = (TH1F*)allemc->Clone();
\r
55 tempallemc->SetNameTitle("tempallemc","tempallemc");
\r
56 tempallemc->SetLineColor(kBlue);
\r
57 tempallemc->Rebin(2); tempallemc->Scale(0.5);
\r
58 tempallemc->Draw("same");
\r
60 TH1F* temphemc = (TH1F*)hemc->Clone();
\r
61 temphemc->SetNameTitle("temphemc","temphemc");
\r
62 temphemc->SetLineColor(kOrange-3);
\r
63 temphemc->Rebin(2); temphemc->Scale(0.5);
\r
64 temphemc->Draw("same");
\r
66 TLegend* leg2 = new TLegend(0.35,0.6,0.9,0.9);
\r
67 leg2->SetFillColor(0);
\r
68 leg2->SetTextSize(leg->GetTextSize()*1.2);
\r
69 leg2->AddEntry(alltrk,"Electron Candidates (Tracking PID only)","l");
\r
70 leg2->AddEntry(htrk,"Hadron Contamination (Tracking PID only)","l");
\r
71 leg2->AddEntry(tempallemc,"Electron Candidates (EMCAL PID)","l");
\r
72 leg2->AddEntry(temphemc,"Hadron Contamination (EMCAL PID)","l");
\r
77 TH1F* subtrk = (TH1F*)alltrk->Clone();
\r
78 for(Int_t i = 1; i <= alltrk->GetNbinsX(); i++) {
\r
79 Double_t diff = alltrk->GetBinContent(i) - htrk->GetBinContent(i);
\r
81 if(diff < 0) diff = 0.;
\r
83 unc = diff/TMath::Sqrt(diff+2.*htrk->GetBinContent(i));
\r
84 printf("<%d> Cand %d, Contam %d, diff %d, unc %d\n",i,alltrk->GetBinContent(i),htrk->GetBinContent(i), diff, unc);
\r
85 subtrk->SetBinContent(i,diff);
\r
86 subtrk->SetBinError(i,unc);
\r
88 subtrk->SetYTitle("Annual yield in EMCAL dN/dp_{T} (GeV/c)^{-1}");
\r
89 subtrk->SetLineColor(kRed);
\r
90 subtrk->SetMarkerStyle(20); subtrk->SetMarkerColor(kRed);
\r
92 // sumtrk->Rebin(2); sumtrk->Scale(0.5);
\r
93 //sumtrk->Draw("same");
\r
95 TH1F* subemc = (TH1F*)tempallemc->Clone();
\r
96 for(Int_t i = 1; i <= tempallemc->GetNbinsX(); i++) {
\r
97 Double_t diff = tempallemc->GetBinContent(i) - temphemc->GetBinContent(i);
\r
99 if(diff < 0.) diff = subemc->GetBinContent(i-1);
\r
101 unc = diff/TMath::Sqrt(diff+2.*temphemc->GetBinContent(i));
\r
102 // printf("Cand %d, Contam %d, diff %d, unc %d\n",tempallemc->GetBinContent(i),temphemc->GetBinContent(i), diff, unc);
\r
103 subemc->SetBinContent(i,diff);
\r
104 subemc->SetBinError(i,unc);
\r
107 TFile* effic = new TFile("elec_eff.root");
\r
108 TH1F* heff = (TH1F*)effic->Get("h111");
\r
109 heff->Rebin(2); heff->Scale(0.5);
\r
110 TH1F* hcorr = (TH1F*)subemc->Clone();
\r
111 hcorr->SetName("hcorr");
\r
112 for(Int_t i = 1; i < heff->GetNbinsX(); i++) {
\r
113 Double_t pt = heff->GetBinCenter(i);
\r
114 Double_t eff = heff->GetBinContent(i);
\r
115 Double_t corr = 0.;
\r
116 if(eff > 0.) corr = hcorr->GetBinContent(i)/eff;
\r
117 hcorr->SetBinContent(i,corr);
\r
120 Double_t efinal = 0.258;
\r
121 TGraphErrors* eerr = new TGraphErrors();
\r
122 eerr->SetName("emcErr");
\r
123 for(Int_t i = 1; i <= hcorr->GetNbinsX(); i++) {
\r
124 eerr->SetPoint(i-1,hcorr->GetBinCenter(i),hcorr->GetBinContent(i));
\r
125 eerr->SetPointError(i-1,0.,efinal*hcorr->GetBinContent(i));
\r
127 eerr->SetFillColor(kRed-8);
\r
128 eerr->Draw("3same");
\r
129 subtrk->Draw("same");
\r
130 hcorr->SetMarkerStyle(20); hcorr->SetMarkerColor(kBlue);
\r
131 hcorr->SetLineColor(kBlue);
\r
132 hcorr->Draw("same");
\r
134 allmc->Draw("same");
\r
135 mchad->Draw("same");
\r
137 TLegend *legx = new TLegend(0.3,0.7,0.9,0.9);
\r
138 legx->SetFillColor(0);
\r
139 legx->AddEntry(subtrk,"Signal (candidates - contam) (Tracking PID only)","pl");
\r
140 legx->AddEntry(hcorr,"Eff. corrected signal (EMCAL PID)","pl");
\r
141 legx->AddEntry(eerr,"Systematic uncertainty","f");
\r
142 legx->AddEntry(allmc,"MC Electrons","l");
\r
143 legx->AddEntry(mchad,"MC Hadrons","l");
\r
147 TLatex* latex = new TLatex(0.5,0.6,"Unc = #frac{S}{#sqrt{S+2B}}");
\r
151 crates->Print("NPERates_PIDCompare_all.pdf");
\r