updated plotting macros for ppr
authorjklay <jklay@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 26 Oct 2009 06:33:27 +0000 (06:33 +0000)
committerjklay <jklay@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 26 Oct 2009 06:33:27 +0000 (06:33 +0000)
PWG4/macros/electrons/plotEff.C [new file with mode: 0644]
PWG4/macros/electrons/plotHRF.C [new file with mode: 0644]
PWG4/macros/electrons/plotMCRates.C
PWG4/macros/electrons/plotNPERates.C

diff --git a/PWG4/macros/electrons/plotEff.C b/PWG4/macros/electrons/plotEff.C
new file mode 100644 (file)
index 0000000..a3847cf
--- /dev/null
@@ -0,0 +1,114 @@
+
+
+{
+  //=========Macro generated from canvas: c7/7 efficiency per pt
+  //=========  (Sat Oct 24 13:36:23 2009) by ROOT version5.14/00
+  TCanvas *c7 = new TCanvas("c7", "7 efficiency per pt",158,233,600,400);
+  c7->Range(-5,-0.08875,55,0.89875);
+  c7->SetFillColor(0);
+  c7->SetBorderMode(0);
+  c7->SetBorderSize(2);
+  c7->SetFrameBorderMode(0);
+  c7->SetFrameBorderMode(0);
+
+  TGraphErrors *gre = new TGraphErrors(5);
+  gre->SetName("Graph");
+  gre->SetTitle("PID efficiency");
+  gre->SetFillColor(1);
+  gre->SetMarkerStyle(20);
+  gre->SetPoint(0,5,0.140749);
+  gre->SetPointError(0,0,0);
+  gre->SetPoint(1,15,0.559721);
+  gre->SetPointError(1,0,0);
+  gre->SetPoint(2,25,0.465536);
+  gre->SetPointError(2,0,0);
+  gre->SetPoint(3,35,0.418012);
+  gre->SetPointError(3,0,0);
+  gre->SetPoint(4,45,0.341103);
+  gre->SetPointError(4,0,0);
+
+  TH1 *Graph1 = new TH1F("Graph1","PID efficiency",100,1,49);
+  Graph1->SetMinimum(0.01);
+  Graph1->SetMaximum(0.8);
+  Graph1->SetDirectory(0);
+  Graph1->SetStats(0);
+  Graph1->GetXaxis()->SetTitle("pT (GeV/c)");
+  Graph1->GetYaxis()->SetTitle("efficiency");
+  gre->SetHistogram(Graph1);
+
+  gre->Draw("apl");
+
+  gre = new TGraphErrors(5);
+  gre->SetName("Graph2");
+  gre->SetTitle("Graph2");
+  gre->SetFillColor(1);
+  gre->SetMarkerColor(2);
+  gre->SetMarkerStyle(20);
+  gre->SetPoint(0,5,0.136597);
+  gre->SetPointError(0,0,0);
+  gre->SetPoint(1,15,0.525284);
+  gre->SetPointError(1,0,0);
+  gre->SetPoint(2,25,0.425577);
+  gre->SetPointError(2,0,0);
+  gre->SetPoint(3,35,0.397009);
+  gre->SetPointError(3,0,0);
+  gre->SetPoint(4,45,0.316323);
+  gre->SetPointError(4,0,0);
+  gre->Draw("pl");
+
+  TLegend *leg = new TLegend(0.5,0.6,0.85,0.85,NULL,"brNDC");
+  leg->SetBorderSize(1);
+  leg->SetLineColor(1);
+  leg->SetLineStyle(1);
+  leg->SetLineWidth(1);
+  leg->SetFillColor(10);
+  leg->SetFillStyle(1001);
+  TLegendEntry *entry=leg->AddEntry("Graph","Identified Electrons (EMCAL)","p");
+  entry->SetLineColor(1);
+  entry->SetLineStyle(1);
+  entry->SetLineWidth(1);
+  entry->SetMarkerColor(1);
+  entry->SetMarkerStyle(20);
+  entry->SetMarkerSize(1);
+  entry->SetTextAlign(12);
+  entry->SetTextColor(1);
+  entry=leg->AddEntry("Graph2","Identified Electrons (EMCAL+TRD+TPC)","p");
+  entry->SetLineColor(1);
+  entry->SetLineStyle(1);
+  entry->SetLineWidth(1);
+  entry->SetMarkerColor(2);
+  entry->SetMarkerStyle(20);
+  entry->SetMarkerSize(1);
+  entry->SetTextAlign(12);
+  entry->SetTextColor(1);
+  leg->Draw();
+  TLatex *   tex = new TLatex(0.4,0.91,"LHC09b4, 5.5Tev, b-jet");
+  tex->SetNDC();
+  tex->SetTextSize(0.04);
+  tex->SetLineWidth(2);
+  tex->Draw();
+  tex = new TLatex(0.4,0.85,"oct20");
+  tex->SetNDC();
+  tex->SetTextSize(0.04);
+  tex->SetLineWidth(2);
+  tex->Draw();
+  tex = new TLatex(0.15,0.85,"version = 99");
+  tex->SetNDC();
+  tex->SetTextSize(0.04);
+  tex->SetLineWidth(2);
+  tex->Draw();
+  tex = new TLatex(0.15,0.75,"nEvents=406580");
+  tex->SetNDC();
+  tex->SetTextSize(0.04);
+  tex->SetLineWidth(2);
+  tex->Draw();
+
+  TPaveText *pt = new TPaveText(0.01,0.940161,0.217919,0.995,"blNDC");
+  pt->SetName("title");
+  pt->SetBorderSize(1);
+  text = pt->AddText("PID efficiency");
+  pt->Draw();
+  c7->Modified();
+  c7->cd();
+  c7->SetSelected(c7);
+}
diff --git a/PWG4/macros/electrons/plotHRF.C b/PWG4/macros/electrons/plotHRF.C
new file mode 100644 (file)
index 0000000..e2ebb04
--- /dev/null
@@ -0,0 +1,123 @@
+{
+  //=========Macro generated from canvas: c3/cr
+  //=========  (Sat Oct 24 14:06:41 2009) by ROOT version5.23/01
+  TCanvas *c3 = new TCanvas("c3", "cr",0,0,1000,600);
+  gStyle->SetOptStat(0);
+  c3->Range(0,0,1,1);
+  c3->SetFillColor(0);
+  c3->SetBorderMode(0);
+  c3->SetBorderSize(2);
+  c3->SetFrameBorderMode(0);
+
+  TGraphBentErrors *grbe = new TGraphBentErrors(4);
+  grbe->SetName("Graph");
+  grbe->SetTitle("Graph");
+  grbe->SetFillColor(1);
+  grbe->SetMarkerColor(2);
+  grbe->SetMarkerStyle(21);
+  grbe->SetPoint(0,10,1163);
+  grbe->SetPointError(0,0,0,319.8685,242.6435,0,0,0,0);
+  grbe->SetPoint(1,20,1473);
+  grbe->SetPointError(1,0,0,355.2512,271.8543,0,0,0,0);
+  grbe->SetPoint(2,40,2172);
+  grbe->SetPointError(2,0,0,490.1327,376.0158,0,0,0,0);
+  grbe->SetPoint(3,80,3329);
+  grbe->SetPointError(3,0,0,800.9482,426.2069,0,0,0,0);
+
+  TH1 *Graph1 = new TH1F("Graph1","",100,3,87);
+  Graph1->SetMinimum(10);
+  Graph1->SetMaximum(5000);
+  Graph1->SetDirectory(0);
+  Graph1->SetStats(0);
+  Graph1->GetXaxis()->SetTitle("p_{T}^{track} (GeV/c)");
+  //  Graph1->GetXaxis()->SetTitleOffset(1.5);
+  Graph1->GetYaxis()->SetTitle("Rejection Power");
+  //Graph1->GetYaxis()->SetTitleOffset(1.5);
+  grbe->SetHistogram(Graph1);
+
+  grbe->Draw("apl");
+
+  grbe = new TGraphBentErrors(4);
+  grbe->SetName("Grapha");
+  grbe->SetTitle("Grapha");
+  grbe->SetFillColor(1);
+  grbe->SetMarkerColor(4);
+  grbe->SetMarkerStyle(21);
+  grbe->SetPoint(0,10,214);
+  grbe->SetPointError(0,0,0,23.04028,20.36199,0,0,0,0);
+  grbe->SetPoint(1,20,600);
+  grbe->SetPointError(1,0,0,86.54205,72.02112,0,0,0,0);
+  grbe->SetPoint(2,40,651);
+  grbe->SetPointError(2,0,0,77.49317,70.38893,0,0,0,0);
+  grbe->SetPoint(3,80,1705);
+  grbe->SetPointError(3,0,0,249.8343,221.2924,0,0,0,0);
+
+  TH1 *Graph2 = new TH1F("Graph2","Rejection Power",100,3,87);
+  Graph2->SetMinimum(17.42646);
+  Graph2->SetMaximum(2099.826);
+  Graph2->SetDirectory(0);
+  Graph2->SetStats(0);
+  Graph2->GetXaxis()->SetTitle("p_{T}^{track} (GeV/c)");
+  Graph2->GetYaxis()->SetTitle("Rejection Power");
+  grbe->SetHistogram(Graph2);
+
+  grbe->Draw("pl");
+
+  grbe = new TGraphBentErrors(2);
+  grbe->SetName("Graphb");
+  grbe->SetTitle("Graphb");
+  grbe->SetFillColor(1);
+  grbe->SetMarkerColor(6);
+  grbe->SetMarkerStyle(29);
+  grbe->SetMarkerSize(2);
+  grbe->SetPoint(0,40,686);
+  grbe->SetPointError(0,0,0,0,0,0,0,0,0);
+  grbe->SetPoint(1,80,1210);
+  grbe->SetPointError(1,0,0,0,0,0,0,0,0);
+
+  TH1 *Graph3 = new TH1F("Graph3","Rejection Power",100,36,84);
+  Graph3->SetMinimum(633.6);
+  Graph3->SetMaximum(1262.4);
+  Graph3->SetDirectory(0);
+  Graph3->SetStats(0);
+  Graph3->GetXaxis()->SetTitle("p_{T}^{track} (GeV/c)");
+  Graph3->GetYaxis()->SetTitle("Rejection Power");
+  grbe->SetHistogram(Graph3);
+
+  grbe->Draw("pl");
+
+  TLegend *leg = new TLegend(0.15,0.7,0.7,0.9,NULL,"brNDC");
+  leg->SetBorderSize(1);
+  leg->SetTextFont(62);
+  leg->SetTextSize(0.03);
+  leg->SetLineColor(1);
+  leg->SetLineStyle(1);
+  leg->SetLineWidth(1);
+  leg->SetFillColor(0);
+  leg->SetFillStyle(1001);
+  TLegendEntry *entry=leg->AddEntry("Graph","80% e^{-} Efficiency - Simulation","p");
+  entry->SetLineColor(1);
+  entry->SetLineStyle(1);
+  entry->SetLineWidth(1);
+  entry->SetMarkerColor(1);
+  entry->SetMarkerStyle(21);
+  entry->SetMarkerSize(1);
+  entry=leg->AddEntry("Grapha","90% e^{-} Efficiency - Simulation","p");
+  entry->SetLineColor(1);
+  entry->SetLineStyle(1);
+  entry->SetLineWidth(1);
+  entry->SetMarkerColor(1);
+  entry->SetMarkerStyle(21);
+  entry->SetMarkerSize(1);
+  entry=leg->AddEntry("Graphb","90% e^{-} Efficiency - Test Beam","p");
+  entry->SetLineColor(1);
+  entry->SetLineStyle(1);
+  entry->SetLineWidth(1);
+  entry->SetMarkerColor(1);
+  entry->SetMarkerStyle(21);
+  entry->SetMarkerSize(1);
+  leg->Draw();
+  //  c3->Modified();
+  //c3->cd();
+  //c3->SetSelected(c3);
+}
index 8d9cb18..baccabf 100644 (file)
@@ -23,23 +23,19 @@ TH1F* hije;
 \r
 TLegend* leg;\r
 \r
-void plotMCRates(char* hijfname = "scale/histosLHC08d6.root",\r
-                char* jjfname = "scale/histosscaledLHC09b2ESD.root",\r
-                char* bfname = "scale/histosscaledLHC09b4.root",\r
-                char* wfname = "scale/histosWBoson.root") {\r
+void plotMCRates(char* hijfname = "data/scaled25Oct09/histosLHC08d6.root",\r
+                char* jjfname = "data/scaled25Oct09/TOTALhistosscaled-LHC09b2-0.root",\r
+                char* bfname = "data/scaled25Oct09/histosscaledLHC09b4AODc.root",\r
+                char* wfname = "data/scaled25Oct09/histosWBoson.root") {\r
 \r
   //For HIJING need to divide by the number of events, which we\r
   //can get from the file and do when we perform scaling\r
   double hijscale = 0.05*(1.E6)*0.5*7700; //0-5% * seconds*lumi*PbPb x-section\r
   //For bjet and jet-jet events\r
   double pyscale = (1.E6)*0.5*208*208*100/360; //seconds*lumi*Pb*Pb*acceptance\r
-  double bscale = pyscale*0.10; //Branching ratio for forced\r
-                               //semi-leptonic decays\r
-  double wscale = pyscale*6.29e-05; //JLK: This is temporary X-sec\r
-                                    //info from 2-29 GeV bin until we\r
-                                    //get pyxsec files; also need to\r
-                                    //divide by nTrials.  For now,\r
-                                    //use nEvt\r
+  double bscale = pyscale; //Do we need the Branching ratio for forced\r
+                               //semi-leptonic decays?\r
+  double wscale = pyscale; \r
   \r
   TFile* hijfile = new TFile(hijfname);\r
   if(!hijfile) { printf("NO HIJING FILE\n"); return; }\r
@@ -72,13 +68,12 @@ void plotMCRates(char* hijfname = "scale/histosLHC08d6.root",
 \r
   TFile* wfile = new TFile(wfname);\r
   if(!wfile) { printf("NO W-BOSON FILE\n"); return; }\r
-  TList* wlist = (TList*)wfile->Get("histos");\r
-  TH2F* wmcele = (TH2F*)histos->FindObject("AnaElectron_hPtMCElectron");\r
-  TH1F* wmchad = (TH1F*)histos->FindObject("AnaElectron_hPtMCHadron");\r
-  TH1F* wmult = (TH1F*)histos->FindObject("AnaElectron_hRefMult");\r
+  TH2F* wmcele = (TH2F*)wfile->Get("AnaElectron_hPtMCElectron");\r
+  TH1F* wmchad = (TH1F*)wfile->Get("AnaElectron_hPtMCHadron");\r
+  TH1F* wmult = (TH1F*)wfile->Get("AnaElectron_hRefMult");\r
   Int_t nEvtW = wmult->GetEntries();\r
-  wmcele->Scale(wscale/nEvtW);\r
-  wmchad->Scale(wscale/nEvtW);\r
+  wmcele->Scale(wscale);\r
+  wmchad->Scale(wscale);\r
 \r
   printf("Event statistics: %d (HIJING)  %d (JET-JET)  %d (B-JET)  %d (W-Boson)\n",nEvt,nEvtJJ,nEvtB,nEvtW);\r
 \r
@@ -138,14 +133,22 @@ void plotMCRates(char* hijfname = "scale/histosLHC08d6.root",
 \r
 }\r
 \r
-void ScaleAndConfigure(TH1F* hist,Double_t scale, Int_t color,Bool_t keepErr)\r
+void ScaleAndConfigure(TH1F* hist,Double_t scale, Int_t color,Bool_t keepErr=kFALSE)\r
 {\r
   hist->Scale(scale);\r
   hist->SetLineColor(color);\r
   hist->SetLineWidth(2);\r
   if(keepErr == kFALSE) {\r
     //remove the error bars - useful for MC rates\r
-    for(Int_t i = 1; i < hist->GetNbinsX(); i++) {\r
+    for(Int_t i = 1; i <= hist->GetNbinsX(); i++) {\r
+      if(hist->GetBinContent(i) > 0.) {\r
+        if(hist->GetBinError(i)/hist->GetBinContent(i) > 0.5) {\r
+          Double_t avg = 0.;\r
+          if(i > 1 && i < hist->GetNbinsX())\r
+            avg = (hist->GetBinContent(i-1) + hist->GetBinContent(i+1))/2.;\r
+          hist->SetBinContent(i,avg);\r
+        }\r
+      }\r
       hist->SetBinError(i,0.);\r
     }\r
   }\r
@@ -158,7 +161,7 @@ void drawAnnualYields() {
   gPad->SetLogy();\r
   all->SetXTitle("p_{T} (GeV/c)");\r
   all->SetYTitle("Annual yield");\r
-  all->GetYaxis()->SetRangeUser(1.E1,3.E9);\r
+  all->GetYaxis()->SetRangeUser(1,6.E8);\r
   all->GetXaxis()->SetRangeUser(0.,50.);\r
   all->Draw();\r
   bele->Draw("same");  \r
@@ -178,6 +181,7 @@ void drawAnnualYields() {
   leg->AddEntry(conv,"Conversion e","l");\r
   leg->AddEntry(wz,"W Boson e","l");\r
   leg->Draw();\r
+  crates->Print("MCRates_all.pdf");\r
 \r
 }\r
 \r
@@ -188,7 +192,7 @@ void drawSigBkg() {
   gPad->SetLogy();\r
   all->SetXTitle("p_{T} (GeV/c)");\r
   all->SetYTitle("Annual yield");\r
-  all->GetYaxis()->SetRangeUser(1.E1,3.E9);\r
+  all->GetYaxis()->SetRangeUser(1.,6.E8);\r
   all->GetXaxis()->SetRangeUser(0.,50.);\r
   all->Draw();\r
   sige->Draw("same");  \r
@@ -204,6 +208,7 @@ void drawSigBkg() {
   leg1->AddEntry(bkge,"Jet-Jet Events","l");\r
   leg1->AddEntry(walle,"W-decay Events","l");\r
   leg1->Draw();\r
+  csigbkg->Print("MCRates_byEventSource.pdf");\r
 \r
 }\r
 \r
@@ -220,7 +225,7 @@ void drawPtCutRates() {
   TH1F* convptcut = GetPtCutHisto(conv);\r
   TH1F* wzptcut = GetPtCutHisto(wz);\r
   alleptcut->GetXaxis()->SetRangeUser(0,50);\r
-  alleptcut->GetYaxis()->SetRangeUser(100,alleptcut->GetMaximum()*2);\r
+  alleptcut->GetYaxis()->SetRangeUser(10,6.e8);\r
   alleptcut->SetXTitle("p_{T}^{cut} (GeV/c)");\r
   alleptcut->SetYTitle("Annual Yield in EMCAL for p_{T}>p_{T}^{cut}");\r
   alleptcut->SetTitle("Annual electron yield in Pb+Pb for p_{T}>p_{T}^{cut}");\r
@@ -232,6 +237,7 @@ void drawPtCutRates() {
   convptcut->Draw("same");\r
   wzptcut->Draw("same");\r
   leg->Draw();\r
+  cptcut->Print("MCRates_ptcut_all.pdf");\r
 \r
 }\r
 \r
@@ -260,11 +266,11 @@ void drawHadEleRatios() {
     allratio->SetBinError(i,0.);\r
     behratio->SetBinError(i,0.);\r
   }\r
-  allratio->Rebin();\r
-  behratio->Rebin();\r
-  allratio->GetYaxis()->SetRangeUser(1,10000);\r
-  allratio->GetXaxis()->SetRangeUser(0,50);\r
-  behratio->GetXaxis()->SetRangeUser(0,50);\r
+  allratio->Rebin(5); allratio->Scale(1./5.);\r
+  behratio->Rebin(5); behratio->Scale(1./5.);\r
+  allratio->GetYaxis()->SetRangeUser(50,1e4);\r
+  allratio->GetXaxis()->SetRangeUser(0,49);\r
+  behratio->GetXaxis()->SetRangeUser(0,49);\r
   allratio->SetMarkerStyle(20);\r
   behratio->SetMarkerStyle(24);\r
   allratio->Fit("pol0");\r
@@ -276,7 +282,7 @@ void drawHadEleRatios() {
   heleg->AddEntry(allratio,"All electrons","l");\r
   heleg->AddEntry(behratio,"Bottom electrons","p");\r
   heleg->Draw();\r
-\r
+  ceh->Print("MCRates_heratio.pdf");\r
 }\r
 \r
 TH1F* GetPtCutHisto(TH1F* input) \r
index bd5708a..8eb7721 100644 (file)
@@ -8,6 +8,7 @@
 /////////////////////////////////////////////////\r
 \r
 TH1F *alltte,      *alltrk,      *allemc;\r
+TH1F *sumtte,      *sumtrk,      *sumemc;\r
 TH1F *bpttte,      *bpttrk,      *bptemc;\r
 TH1F *cpttte,      *cpttrk,      *cptemc;\r
 TH1F *candbpttte,  *candbpttrk,  *candbptemc;\r
@@ -20,23 +21,19 @@ TH1F *misidpttte,  *misidpttrk,  *misidptemc;
 TLegend* leg;\r
 \r
 void plotNPERates(char* which = "TTE", \r
-                 char* hijfname = "scale/histosLHC08d6.root",\r
-                 char* jjfname = "scale/histosscaledLHC09b2ESD.root",\r
-                 char* bfname = "scale/histosscaledLHC09b4.root",\r
-                 char* wfname = "scale/histosWBoson.root") {\r
+                 char* hijfname = "data/scaled25Oct09/histosLHC08d6.root",\r
+                 char* jjfname = "data/scaled25Oct09/TOTALhistosscaled-LHC09b2-0.root",\r
+                 char* bfname = "data/scaled25Oct09/histosscaledLHC09b4AODc.root",\r
+                 char* wfname = "data/scaled25Oct09/histosWboson.root") {\r
 \r
   //For HIJING need to divide by the number of events, which we\r
   //can get from the file and do when we perform scaling\r
   double hijscale = 0.05*(1.E6)*0.5*7700; //0-5% * seconds*lumi*PbPb x-section\r
   //For bjet and jet-jet events\r
   double pyscale = (1.E6)*0.5*208*208*100/360; //seconds*lumi*Pb*Pb*acceptance\r
-  double bscale = pyscale*0.10; //Branching ratio for forced\r
-                               //semi-leptonic decays\r
-  double wscale = pyscale*6.29e-05; //JLK: This is temporary X-sec\r
-                                    //info from 2-29 GeV bin until we\r
-                                    //get pyxsec files; also need to\r
-                                    //divide by nTrials.  For now,\r
-                                    //use nEvt\r
+  double bscale = pyscale; //Do we need to scale by Branching ratio for forced\r
+                               //semi-leptonic decays?\r
+  double wscale = pyscale;\r
   \r
   TFile* hijfile = new TFile(hijfname);\r
   if(!hijfile) { printf("NO HIJING FILE\n"); return; }\r
@@ -75,15 +72,14 @@ void plotNPERates(char* which = "TTE",
 \r
   TFile* wfile = new TFile(wfname);\r
   if(!wfile) { printf("NO W-BOSON FILE\n"); return; }\r
-  TList* wlist = (TList*)wfile->Get("histos");\r
-  TH2F* wtte = (TH2F*)histos->FindObject("AnaElectron_hPtNPEleTTE");\r
-  TH2F* wemc = (TH2F*)histos->FindObject("AnaElectron_hPtNPEleEMCAL");\r
-  TH2F* wtrk = (TH2F*)histos->FindObject("AnaElectron_hPtNPEleTPCTRD");\r
-  TH1F* wmult = (TH1F*)histos->FindObject("AnaElectron_hRefMult");\r
+  TH2F* wtte = (TH2F*)wfile->Get("AnaElectron_hPtNPEleTTE");\r
+  TH2F* wemc = (TH2F*)wfile->Get("AnaElectron_hPtNPEleEMCAL");\r
+  TH2F* wtrk = (TH2F*)wfile->Get("AnaElectron_hPtNPEleTPCTRD");\r
+  TH1F* wmult = (TH1F*)wfile->Get("AnaElectron_hRefMult");\r
   Int_t nEvtW = wmult->GetEntries();\r
-  wtte->Scale(wscale/nEvtW);\r
-  wemc->Scale(wscale/nEvtW);\r
-  wtrk->Scale(wscale/nEvtW);\r
+  wtte->Scale(wscale); //already scaled by evts\r
+  wemc->Scale(wscale); //already scaled by evts\r
+  wtrk->Scale(wscale); //already scaled by evts\r
 \r
   printf("Event statistics: %d (HIJING)  %d (JET-JET)  %d (B-JET)  %d (W-Boson)\n",nEvt,nEvtJJ,nEvtB,nEvtW);\r
 \r
@@ -101,13 +97,18 @@ void plotNPERates(char* which = "TTE",
   convpttte = (TH1F*)combTTE->ProjectionX("convtte",5,5);\r
   dalitzpttte = (TH1F*)combTTE->ProjectionX("dalitztte",6,6);\r
   otherpttte = (TH1F*)combTTE->ProjectionX("othertte",8,8);\r
+  sumtte = (TH1F*)bpttte->Clone(); sumtte->SetName("sumtte");\r
+  sumtte->Add(cpttte); sumtte->Add(candbpttte); sumtte->Add(convpttte);\r
+  sumtte->Add(dalitzpttte); //sumtte->Add(otherpttte);\r
   misidpttte = (TH1F*)combTTE->ProjectionX("misidtte",9,9);\r
 \r
   wzpttte = (TH1F*)wtte->ProjectionX("wz",7,7);\r
   alltte->Add(wzpttte);\r
+  sumtte->Add(wzpttte);\r
 \r
   double myscale = 1.; //we already scaled them\r
   ScaleAndConfigure(alltte,myscale,kBlack,kFALSE);\r
+  ScaleAndConfigure(sumtte,myscale,kBlack,kFALSE);\r
   ScaleAndConfigure(bpttte,myscale,kRed,kFALSE);\r
   ScaleAndConfigure(cpttte,myscale,kBlue,kFALSE);\r
   ScaleAndConfigure(candbpttte,myscale,kViolet,kFALSE);\r
@@ -130,13 +131,18 @@ void plotNPERates(char* which = "TTE",
   convptemc = (TH1F*)combEMC->ProjectionX("convemc",5,5);\r
   dalitzptemc = (TH1F*)combEMC->ProjectionX("dalitzemc",6,6);\r
   otherptemc = (TH1F*)combEMC->ProjectionX("otheremc",8,8);\r
+  sumemc = (TH1F*)bptemc->Clone(); sumemc->SetName("sumemc");\r
+  sumemc->Add(cptemc); sumemc->Add(candbptemc); sumemc->Add(convptemc);\r
+  sumemc->Add(dalitzptemc); //sumemc->Add(otherptemc);\r
   misidptemc = (TH1F*)combEMC->ProjectionX("misidemc",9,9);\r
 \r
   wzptemc = (TH1F*)wemc->ProjectionX("wz",7,7);\r
   allemc->Add(wzptemc);\r
+  sumemc->Add(wzptemc);\r
 \r
   double myscale = 1.; //we already scaled them\r
   ScaleAndConfigure(allemc,myscale,kBlack,kFALSE);\r
+  ScaleAndConfigure(sumemc,myscale,kBlack,kFALSE);\r
   ScaleAndConfigure(bptemc,myscale,kRed,kFALSE);\r
   ScaleAndConfigure(cptemc,myscale,kBlue,kFALSE);\r
   ScaleAndConfigure(candbptemc,myscale,kViolet,kFALSE);\r
@@ -159,13 +165,18 @@ void plotNPERates(char* which = "TTE",
   convpttrk = (TH1F*)combTRK->ProjectionX("convtrk",5,5);\r
   dalitzpttrk = (TH1F*)combTRK->ProjectionX("dalitztrk",6,6);\r
   otherpttrk = (TH1F*)combTRK->ProjectionX("othertrk",8,8);\r
+  sumtrk = (TH1F*)bpttrk->Clone(); sumtrk->SetName("sumtrk");\r
+  sumtrk->Add(cpttrk); sumtrk->Add(candbpttrk); sumtrk->Add(convpttrk);\r
+  sumtrk->Add(dalitzpttrk); //sumtrk->Add(otherpttrk);\r
   misidpttrk = (TH1F*)combTRK->ProjectionX("misidtrk",9,9);\r
 \r
   wzpttrk = (TH1F*)wtrk->ProjectionX("wztrk",7,7);\r
   alltrk->Add(wzpttrk);\r
+  sumtrk->Add(wzpttrk);\r
 \r
   double myscale = 1.; //we already scaled them\r
   ScaleAndConfigure(alltrk,myscale,kBlack,kFALSE);\r
+  ScaleAndConfigure(sumtrk,myscale,kBlack,kFALSE);\r
   ScaleAndConfigure(bpttrk,myscale,kRed,kFALSE);\r
   ScaleAndConfigure(cpttrk,myscale,kBlue,kFALSE);\r
   ScaleAndConfigure(candbpttrk,myscale,kViolet,kFALSE);\r
@@ -175,16 +186,17 @@ void plotNPERates(char* which = "TTE",
   ScaleAndConfigure(wzpttrk,myscale,kOrange-7,kFALSE);\r
 \r
   //define common legend\r
-  leg = new TLegend(0.6,0.6,0.9,0.9);\r
+  leg = new TLegend(0.5,0.6,0.9,0.9);\r
   leg->SetTextSize(leg->GetTextSize()*1.2);\r
-  leg->AddEntry(alltte,"All Non-phot. electrons","l");\r
+  //leg->AddEntry(alltte,"All N-P e candidates","l");\r
+  leg->AddEntry(sumtte,"All N-P electrons","l");\r
   leg->AddEntry(bpttte,"Bottom e","l");\r
   leg->AddEntry(cpttte,"Charm e","l");\r
   leg->AddEntry(candbpttte,"B-->C e","l");\r
   leg->AddEntry(dalitzpttte,"Dalitz e","l");\r
   leg->AddEntry(convpttte,"Conversion e","l");\r
   leg->AddEntry(wzpttte,"W Boson e","l");\r
-  leg->AddEntry(misidpttte,"Mis-identified hadrons","l");\r
+  //leg->AddEntry(misidpttte,"Mis-identified hadrons","l");\r
 \r
   gStyle->SetOptStat(0);\r
   drawAnnualYields(which);\r
@@ -200,41 +212,113 @@ void ScaleAndConfigure(TH1F* hist,Double_t scale, Int_t color,Bool_t keepErr)
   hist->SetLineWidth(2);\r
   if(keepErr == kFALSE) {\r
     //remove the error bars - useful for MC rates\r
-    for(Int_t i = 1; i < hist->GetNbinsX(); i++) {\r
+    for(Int_t i = 1; i <= hist->GetNbinsX(); i++) {\r
+      if(hist->GetBinContent(i) > 0.) {\r
+       if(hist->GetBinError(i)/hist->GetBinContent(i) > 0.5) {\r
+         Double_t avg = 0.;\r
+         if(i > 1 && i < hist->GetNbinsX()) \r
+           avg = (hist->GetBinContent(i-1) + hist->GetBinContent(i+1))/2.;\r
+         hist->SetBinContent(i,avg);\r
+       }\r
+      }\r
       hist->SetBinError(i,0.);\r
     }\r
   } else {\r
     //Set the error bars to statistics of the bin content\r
-    for(Int_t i = 1; i < hist->GetNbinsX(); i++) {\r
+    for(Int_t i = 1; i <= hist->GetNbinsX(); i++) {\r
+      if(hist->GetBinContent(i) > 0.) {\r
+       if(hist->GetBinError(i)/hist->GetBinContent(i) > 0.5) {\r
+         Double_t avg = 0;\r
+         if(i > 1 && i < hist->GetNbinsX()) \r
+           avg = (hist->GetBinContent(i-1) + hist->GetBinContent(i+1))/2.;\r
+         hist->SetBinContent(i,avg);\r
+       }\r
+      }\r
       hist->SetBinError(i,TMath::Sqrt(hist->GetBinContent(i)));\r
     }\r
   }\r
 \r
 }\r
 \r
-void drawAnnualYields(char* which = "TTE") {\r
+void drawAnnualYields(char* which = "EMC") {\r
 \r
   TCanvas* crates = new TCanvas();\r
   crates->cd();\r
   gPad->SetLogy();\r
 \r
+  if(strcmp(which,"EMC")==0) {\r
+    /*\r
+    allemc->SetXTitle("p_{T} (GeV/c)");\r
+    allemc->SetYTitle("Annual yield");\r
+    allemc->SetTitle("Annual yield of non-phot. electron candidates (EMCAL pid)");\r
+    allemc->Rebin(2); allemc->Scale(0.5);\r
+    */\r
+    sumemc->SetXTitle("p_{T} (GeV/c)");\r
+    sumemc->SetYTitle("Annual yield");\r
+    sumemc->SetTitle("Annual yield of non-phot. electrons (EMCAL pid)");\r
+    sumemc->Rebin(2); sumemc->Scale(0.5);\r
+\r
+    bptemc->Rebin(2); bptemc->Scale(0.5);\r
+    cptemc->Rebin(2); cptemc->Scale(0.5);\r
+    candbptemc->Rebin(2); candbptemc->Scale(0.5);\r
+    convptemc->Rebin(2); convptemc->Scale(0.5);\r
+    dalitzptemc->Rebin(2); dalitzptemc->Scale(0.5);\r
+    wzptemc->Rebin(2); wzptemc->Scale(0.5);\r
+    misidptemc->Rebin(2); misidptemc->Scale(0.5);\r
+    /*\r
+    allemc->GetYaxis()->SetRangeUser(1.,allemc->GetMaximum()*2.);\r
+    allemc->GetXaxis()->SetRangeUser(0.,49.);\r
+    allemc->Draw();\r
+    */\r
+    sumemc->GetYaxis()->SetRangeUser(1.,sumemc->GetMaximum()*2.);\r
+    sumemc->GetXaxis()->SetRangeUser(0.,49.);\r
+    sumemc->Draw();\r
+    bptemc->Draw("same");\r
+    cptemc->Draw("same");\r
+    candbptemc->Draw("same");\r
+    convptemc->Draw("same");\r
+    dalitzptemc->Draw("same");\r
+    wzptemc->Draw("same");\r
+    //misidptemc->Draw("same");\r
+    leg->Draw();\r
+    crates->Print("NPERates_EMC_all.pdf");\r
+  }\r
   if(strcmp(which,"TTE")==0) {\r
-    alltte->SetXTitle("p_{T} (GeV/c)");\r
+    /*    alltte->SetXTitle("p_{T} (GeV/c)");\r
     alltte->SetYTitle("Annual yield");\r
-    alltte->SetTitle("Annual yield of non-phot. electrons identified with TPC+TRD+EMCAL");\r
-    alltte->GetYaxis()->SetRangeUser(1.,alltte->GetMaximum()*2.);\r
-    alltte->GetXaxis()->SetRangeUser(0.,50.);\r
+    alltte->SetTitle("Annual yield of non-phot. electron candidates (Tracking+EMCAL pid)");\r
+    alltte->Rebin(2); alltte->Scale(0.5);\r
+    */\r
+    sumtte->SetXTitle("p_{T} (GeV/c)");\r
+    sumtte->SetYTitle("Annual yield");\r
+    sumtte->SetTitle("Annual yield of non-phot. electrons (Tracking+EMCAL pid)");\r
+    sumtte->Rebin(2); sumtte->Scale(0.5);\r
+    bpttte->Rebin(2); bpttte->Scale(0.5);\r
+    cpttte->Rebin(2); cpttte->Scale(0.5);\r
+    candbpttte->Rebin(2); candbpttte->Scale(0.5);\r
+    convpttte->Rebin(2); convpttte->Scale(0.5);\r
+    dalitzpttte->Rebin(2); dalitzpttte->Scale(0.5);\r
+    wzpttte->Rebin(2); wzpttte->Scale(0.5);\r
+    misidpttte->Rebin(2); misidpttte->Scale(0.5);\r
+    /*    alltte->GetYaxis()->SetRangeUser(1.,alltte->GetMaximum()*2.);\r
+    alltte->GetXaxis()->SetRangeUser(0.,49.);\r
     alltte->Draw();\r
+    */\r
+    sumtte->GetYaxis()->SetRangeUser(1.,sumtte->GetMaximum()*2.);\r
+    sumtte->GetXaxis()->SetRangeUser(0.,49.);\r
+    sumtte->Draw();\r
     bpttte->Draw("same");\r
     cpttte->Draw("same");\r
     candbpttte->Draw("same");\r
     convpttte->Draw("same");\r
     dalitzpttte->Draw("same");\r
     wzpttte->Draw("same");\r
-    misidpttte->Draw("same");\r
+    //misidpttte->Draw("same");\r
     leg->Draw();\r
+    crates->Print("NPERates_TTE_all.pdf");\r
   }\r
 \r
+\r
 }\r
 \r
 void drawComparePID() {\r
@@ -243,39 +327,68 @@ void drawComparePID() {
   crates->cd();\r
   gPad->SetLogy();\r
   alltrk->SetXTitle("p_{T} (GeV/c)");\r
-  alltrk->SetYTitle("Annual yield");\r
-  alltrk->SetTitle("PID comparison: Tracking only vs. with EMCAL");\r
-  alltrk->GetYaxis()->SetRangeUser(1.,alltrk->GetMaximum()*2.);\r
-  alltrk->GetXaxis()->SetRangeUser(0.,50.);\r
+  alltrk->SetYTitle("Annual yield of electron candidates");\r
+  alltrk->SetTitle("PID comparison: Tracking only vs. EMCAL only");\r
+  alltrk->Rebin(2); alltrk->Scale(0.5);\r
+  alltrk->GetYaxis()->SetRangeUser(10.,alltrk->GetMaximum()*2.);\r
+  alltrk->GetXaxis()->SetRangeUser(0.,49.);\r
   alltrk->Draw();\r
+  misidpttrk->Rebin(2); misidpttrk->Scale(0.5);\r
   misidpttrk->Draw("same");\r
-  TH1F* tempalltte = (TH1F*)alltte->Clone();\r
-  tempalltte->SetNameTitle("tempalltte","tempalltte");\r
-  tempalltte->SetLineColor(kBlue);\r
-  tempalltte->Draw("same");\r
+  TH1F* tempallemc = (TH1F*)allemc->Clone();\r
+  tempallemc->SetNameTitle("tempallemc","tempallemc");\r
+  tempallemc->SetLineColor(kBlue);\r
+  tempallemc->Draw("same");\r
   \r
-  TH1F* tempmisidtte = (TH1F*)misidpttte->Clone();\r
-  tempmisidtte->SetNameTitle("tempmisidtte","tempmisidtte");\r
-  tempmisidtte->SetLineColor(kOrange-3);\r
-  tempmisidtte->Draw("same");\r
+  TH1F* tempmisidemc = (TH1F*)misidptemc->Clone();\r
+  tempmisidemc->SetNameTitle("tempmisidemc","tempmisidemc");\r
+  tempmisidemc->SetLineColor(kOrange-3);\r
+  tempmisidemc->Draw("same");\r
 \r
-  TLegend* leg2 = new TLegend(0.6,0.6,0.9,0.9);\r
+  TLegend* leg2 = new TLegend(0.35,0.6,0.9,0.9);\r
   leg2->SetTextSize(leg->GetTextSize()*1.2);\r
   leg2->AddEntry(alltrk,"All electrons (Tracking PID only)","l");\r
   leg2->AddEntry(misidpttrk,"Hadron contamination (Tracking PID only)","l");\r
-  leg2->AddEntry(tempalltte,"All electrons (with EMCAL PID)","l");\r
-  leg2->AddEntry(tempmisidtte,"Hadron contamination (with EMCAL PID)","l");\r
+  leg2->AddEntry(tempallemc,"All electrons (EMCAL PID)","l");\r
+  leg2->AddEntry(tempmisidemc,"Hadron contamination (EMCAL PID)","l");\r
   leg2->Draw();\r
-\r
+  crates->Print("NPERates_PIDCompare_all.pdf");\r
 }\r
 \r
-void drawPtCutRates(char* which = "TTE") {\r
+void drawPtCutRates(char* which = "EMC") {\r
 \r
   TCanvas* cptcut = new TCanvas();\r
   cptcut->cd();\r
   gPad->SetLogy();\r
+  if(strcmp(which,"EMC")==0) {\r
+    //    TH1F* alleptcut = GetPtCutHisto(allemc);\r
+    TH1F* alleptcut = GetPtCutHisto(sumemc);\r
+    TH1F* beleptcut = GetPtCutHisto(bptemc);\r
+    TH1F* celeptcut = GetPtCutHisto(cptemc);\r
+    TH1F* cbeleptcut = GetPtCutHisto(candbptemc);\r
+    TH1F* dalitzptcut = GetPtCutHisto(dalitzptemc);\r
+    TH1F* convptcut = GetPtCutHisto(convptemc);\r
+    TH1F* wzptcut = GetPtCutHisto(wzptemc);\r
+    TH1F* misidptcut = GetPtCutHisto(misidptemc);\r
+    alleptcut->SetXTitle("p_{T}^{cut} (GeV/c)");\r
+    alleptcut->SetYTitle("Annual Yield in EMCAL for p_{T}>p_{T}^{cut}");\r
+    alleptcut->SetTitle("Annual non-phot. electrons for p_{T}>p_{T}^{cut} (EMCAL pid)");\r
+    alleptcut->GetXaxis()->SetRangeUser(0,49);\r
+    alleptcut->GetYaxis()->SetRangeUser(1,alleptcut->GetMaximum()*2);\r
+    alleptcut->Draw();\r
+    beleptcut->Draw("same");\r
+    celeptcut->Draw("same");\r
+    cbeleptcut->Draw("same");\r
+    dalitzptcut->Draw("same");\r
+    convptcut->Draw("same");\r
+    wzptcut->Draw("same");\r
+    //misidptcut->Draw("same");\r
+    leg->Draw();\r
+    cptcut->Print("NPERates_EMC_ptcut_all.pdf");\r
+  }\r
   if(strcmp(which,"TTE")==0) {\r
-    TH1F* alleptcut = GetPtCutHisto(alltte);\r
+    //    TH1F* alleptcut = GetPtCutHisto(alltte);\r
+    TH1F* alleptcut = GetPtCutHisto(sumtte);\r
     TH1F* beleptcut = GetPtCutHisto(bpttte);\r
     TH1F* celeptcut = GetPtCutHisto(cpttte);\r
     TH1F* cbeleptcut = GetPtCutHisto(candbpttte);\r
@@ -283,11 +396,11 @@ void drawPtCutRates(char* which = "TTE") {
     TH1F* convptcut = GetPtCutHisto(convpttte);\r
     TH1F* wzptcut = GetPtCutHisto(wzpttte);\r
     TH1F* misidptcut = GetPtCutHisto(misidpttte);\r
-    alleptcut->GetXaxis()->SetRangeUser(0,50);\r
-    alleptcut->GetYaxis()->SetRangeUser(1,alleptcut->GetMaximum()*2);\r
     alleptcut->SetXTitle("p_{T}^{cut} (GeV/c)");\r
     alleptcut->SetYTitle("Annual Yield in EMCAL for p_{T}>p_{T}^{cut}");\r
-    alleptcut->SetTitle("Annual non-phot. electron yield for p_{T}>p_{T}^{cut} (TPC+TRD+EMCAL)");\r
+    alleptcut->SetTitle("Annual non-phot. electrons for p_{T}>p_{T}^{cut} (Tracking+EMCAL pid)");\r
+    alleptcut->GetXaxis()->SetRangeUser(0,49);\r
+    alleptcut->GetYaxis()->SetRangeUser(1,alleptcut->GetMaximum()*2);\r
     alleptcut->Draw();\r
     beleptcut->Draw("same");\r
     celeptcut->Draw("same");\r
@@ -295,9 +408,10 @@ void drawPtCutRates(char* which = "TTE") {
     dalitzptcut->Draw("same");\r
     convptcut->Draw("same");\r
     wzptcut->Draw("same");\r
-    misidptcut->Draw("same");\r
+    //misidptcut->Draw("same");\r
 \r
     leg->Draw();\r
+    cptcut->Print("NPERates_TTE_ptcut_all.pdf");\r
   }\r
 \r
 }\r
@@ -315,7 +429,7 @@ TH1F* GetPtCutHisto(TH1F* input)
   for(Int_t i = 1; i <= result->GetNbinsX(); i++) {\r
     Double_t val = input->Integral(i,result->GetNbinsX());\r
     result->SetBinContent(i,val);\r
-    result->SetBinError(i,TMath::Sqrt(val));\r
+    result->SetBinError(i,0.);\r
   }\r
 \r
   return result;\r