Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PIDplots.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PIDplots.cc
1 //
2 // PIDplots.cc
3 //
4 // Author : Weihu Ma
5 // Created: 04/2021
6 // Version: 1.0
7 //
8 #include <iostream>
9 #include <fstream>
10 #include <sstream>
11 #include <stdlib.h>
12 
13 #include "omp.h"
14 #include "PIDplots.h"
15 #include "sPhenixStyle.h"
16 #include "sPhenixStyle.C"
17 
18 using namespace std;
19 //_________________________________________________________________
21 int main(int argc, char **argv){
22  printf("Starting the program, numargs = %d\n",argc);
23  for(Int_t i=0;i<argc;i++) printf("arg #%d = %s\n",i,argv[i]);
24  TROOT amdv_dens("amdv_dens", "amdv_dens");
25  TApplication theApp("App", &argc, argv);
26 
27  const bool run_eID=true;
28 
29  PIDplots pidplots;
30 
31  pidplots.inputpars();
32 
33  pidplots.eID();
34 
35  printf("end.\n");
36 
37  return 0;
38 }
39 
42  me=0.511*0.001;//Gev electron/positron mass
43  mep=0.511*0.001;//Gev electron mass
44  men=0.511*0.001;//Gev positron mass
45  pi=TMath::Pi();
46 
47  tag=1;
48  //tag=1 for upsilon/embed run;
49  //tag=2 for electron,pion,antiproton/embed run;
50  //tag=3 for single particles identification and efficiency;
52  if(tag==1){//tag=1 for upsilon run
53  Nfile=13; //input number of files
54  Nevent=2000; //event number of each Nfile (maximum number for ifiles)
55  Nmpnbin=400;//bin number for plot; Nmpnbin=200 or 400; Nmpnbin<=400.
56 
57  rYs[0]=9755.0/13680.0;//Yield ratio of Upsilon 1S corresponding to the input_file[0]
58  rYs[1]=2540.0/13680.0;//Yield ratio of Upsilon 2S corresponding to the input_file[1]
59  rYs[2]=1400.0/13680.0;//Yield ratio of Upsilon 3S corresponding to the input_file[2]
60 
61  //single-Upsilon decay electrons
62  input_file[0] ="/sphenix/u/weihuma/RunOutput/G4sPHENIX_upsilon_1s_2000_POSCOR_g4svtx_eval.root";//2000 events
63  //input_file[1] ="/sphenix/u/weihuma/RunOutput/G4sPHENIX_upsilon_2s_2000_POSCOR_g4svtx_eval.root";//2000 events
64  //input_file[2] ="/sphenix/u/weihuma/RunOutput/G4sPHENIX_upsilon_3s_2000_POSCOR_g4svtx_eval.root";//2000 events
65 
66  input_file[1] ="/sphenix/u/weihuma/RunOutput/G4sPHENIX_pi-_1000_0_POSCOR_g4svtx_eval.root";//1000 events
67  input_file[2] ="/sphenix/u/weihuma/RunOutput/G4sPHENIX_pi-_1000_1_POSCOR_g4svtx_eval.root";//1000 events
68  input_file[3] ="/sphenix/u/weihuma/RunOutput/G4sPHENIX_pi-_1000_2_POSCOR_g4svtx_eval.root";//1000 events
69  input_file[4] ="/sphenix/u/weihuma/RunOutput/G4sPHENIX_pi-_1000_3_POSCOR_g4svtx_eval.root";//1000 events
70  input_file[5] ="/sphenix/u/weihuma/RunOutput/G4sPHENIX_K-_1000_0_POSCOR_g4svtx_eval.root";//1000 events
71  input_file[6] ="/sphenix/u/weihuma/RunOutput/G4sPHENIX_K-_1000_1_POSCOR_g4svtx_eval.root";//1000 events
72  input_file[7] ="/sphenix/u/weihuma/RunOutput/G4sPHENIX_K-_1000_2_POSCOR_g4svtx_eval.root";//1000 events
73  input_file[8] ="/sphenix/u/weihuma/RunOutput/G4sPHENIX_K-_1000_3_POSCOR_g4svtx_eval.root";//1000 events
74  input_file[9] ="/sphenix/u/weihuma/RunOutput/G4sPHENIX_antiproton_0_1000_POSCOR_g4svtx_eval.root";//1000 events
75  input_file[10] ="/sphenix/u/weihuma/RunOutput/G4sPHENIX_antiproton_1000_1_POSCOR_g4svtx_eval.root";//1000 events
76  input_file[11] ="/sphenix/u/weihuma/RunOutput/G4sPHENIX_antiproton_1000_2_POSCOR_g4svtx_eval.root";//1000 events
77  input_file[12] ="/sphenix/u/weihuma/RunOutput/G4sPHENIX_antiproton_1000_3_POSCOR_g4svtx_eval.root";//1000 events
78 
79  //embed-Upsilon decay electrons
80 
81 
82  output_eID ="/sphenix/u/weihuma/analysis/TrackPid/anaplots/output/upsilon/eID_embed_upsilon.root";
83  output_plot_eID ="/sphenix/u/weihuma/analysis/TrackPid/anaplots/output/upsilon/eID_plot_e+e-_embed_upsilon";
84  output_plot_eID_eta ="/sphenix/u/weihuma/analysis/TrackPid/anaplots/output/upsilon/efficiency_eta_e+e-_embed_upsilon";
85  output_plot_eID_pt ="/sphenix/u/weihuma/analysis/TrackPid/anaplots/output/upsilon/efficiency_pt_e+e-_embed_upsilon";
86  output_plot_eID_HOM ="/sphenix/u/weihuma/analysis/TrackPid/anaplots/output/upsilon/efficiency_HOM_e+e-_embed_upsilon";
87  output_plot_eID_HOP ="/sphenix/u/weihuma/analysis/TrackPid/anaplots/output/upsilon/efficiency_HOP_e+e-_embed_upsilon";
88  output_plot_eID_EOP ="/sphenix/u/weihuma/analysis/TrackPid/anaplots/output/upsilon/efficiency_EOP_e+e-_embed_upsilon";
89  }
90  if(tag==2){//tag=2 for embed run
91  Nfile=180; //input number of files
92  Nevent=2000; //event number of each Nfile (maximum number for ifiles)
93  Nmpnbin=400;//bin number for plot; Nmpnbin=200 or 400; Nmpnbin<=400.
94 
95  output_eID ="/sphenix/u/weihuma/analysis/TrackPid/anaplots/output/embed/eID_embed.root";
96  output_plot_eID ="/sphenix/u/weihuma/analysis/TrackPid/anaplots/output/embed/eID_plot_e+e-_embed";
97  output_plot_eID_eta ="/sphenix/u/weihuma/analysis/TrackPid/anaplots/output/embed/efficiency_eta_e+e-_embed";
98  output_plot_eID_pt ="/sphenix/u/weihuma/analysis/TrackPid/anaplots/output/embed/efficiency_pt_e+e-_embed";
99  output_plot_eID_HOM ="/sphenix/u/weihuma/analysis/TrackPid/anaplots/output/embed/efficiency_HOM_e+e-_embed";
100  output_plot_eID_HOP ="/sphenix/u/weihuma/analysis/TrackPid/anaplots/output/embed/efficiency_HOP_e+e-_embed";
101  output_plot_eID_EOP ="/sphenix/u/weihuma/analysis/TrackPid/anaplots/output/embed/efficiency_EOP_e+e-_embed";
102  }
103 
104  if(tag==3){//tag=3 for single particle identification and efficiency
105  Nfile=16; //input number of files
106  Nevent=1000; //event number of each Nfile (maximum number for ifiles)
107  Nmpnbin=200;//bin number for plot; Nmpnbin=200 or 400; Nmpnbin<=400.
108 
109  input_file[0] ="/sphenix/u/weihuma/RunOutput/G4sPHENIX_e-_1000_0_POSCOR_g4svtx_eval.root";//1000 events
110  input_file[1] ="/sphenix/u/weihuma/RunOutput/G4sPHENIX_e-_1000_1_POSCOR_g4svtx_eval.root";//1000 events
111  input_file[2] ="/sphenix/u/weihuma/RunOutput/G4sPHENIX_e-_1000_2_POSCOR_g4svtx_eval.root";//1000 events
112  input_file[3] ="/sphenix/u/weihuma/RunOutput/G4sPHENIX_e-_1000_3_POSCOR_g4svtx_eval.root";//1000 events
113  input_file[4] ="/sphenix/u/weihuma/RunOutput/G4sPHENIX_pi-_1000_0_POSCOR_g4svtx_eval.root";//1000 events
114  input_file[5] ="/sphenix/u/weihuma/RunOutput/G4sPHENIX_pi-_1000_1_POSCOR_g4svtx_eval.root";//1000 events
115  input_file[6] ="/sphenix/u/weihuma/RunOutput/G4sPHENIX_pi-_1000_2_POSCOR_g4svtx_eval.root";//1000 events
116  input_file[7] ="/sphenix/u/weihuma/RunOutput/G4sPHENIX_pi-_1000_3_POSCOR_g4svtx_eval.root";//1000 events
117  input_file[8] ="/sphenix/u/weihuma/RunOutput/G4sPHENIX_K-_1000_0_POSCOR_g4svtx_eval.root";//1000 events
118  input_file[9] ="/sphenix/u/weihuma/RunOutput/G4sPHENIX_K-_1000_1_POSCOR_g4svtx_eval.root";//1000 events
119  input_file[10] ="/sphenix/u/weihuma/RunOutput/G4sPHENIX_K-_1000_2_POSCOR_g4svtx_eval.root";//1000 events
120  input_file[11] ="/sphenix/u/weihuma/RunOutput/G4sPHENIX_K-_1000_3_POSCOR_g4svtx_eval.root";//1000 events
121  input_file[12] ="/sphenix/u/weihuma/RunOutput/G4sPHENIX_antiproton_0_1000_POSCOR_g4svtx_eval.root";//1000 events
122  input_file[13] ="/sphenix/u/weihuma/RunOutput/G4sPHENIX_antiproton_1000_1_POSCOR_g4svtx_eval.root";//1000 events
123  input_file[14] ="/sphenix/u/weihuma/RunOutput/G4sPHENIX_antiproton_1000_2_POSCOR_g4svtx_eval.root";//1000 events
124  input_file[15] ="/sphenix/u/weihuma/RunOutput/G4sPHENIX_antiproton_1000_3_POSCOR_g4svtx_eval.root";//1000 events
125 
126  output_eID ="/sphenix/u/weihuma/analysis/TrackPid/anaplots/output/single/eID_single.root";
127  output_plot_eID ="/sphenix/u/weihuma/analysis/TrackPid/anaplots/output/single/eID_plot_single_antiproton";
128  output_plot_eID_eta ="/sphenix/u/weihuma/analysis/TrackPid/anaplots/output/single/efficiency_eta_single";
129  output_plot_eID_pt ="/sphenix/u/weihuma/analysis/TrackPid/anaplots/output/single/efficiency_pt_single";
130  output_plot_eID_HOM ="/sphenix/u/weihuma/analysis/TrackPid/anaplots/output/single/efficiency_HOM_single";
131  output_plot_eID_HOP ="/sphenix/u/weihuma/analysis/TrackPid/anaplots/output/single/efficiency_HOP_single";
132  output_plot_eID_EOP ="/sphenix/u/weihuma/analysis/TrackPid/anaplots/output/single/efficiency_EOP_single";
133  }
134 
135 }
136 
138  h1pt_e= new TH1F("h1pt_e","pt",200,0,20);
139  h1EOP= new TH1F("h1EOP","cemce3x3/p",200,0,10);
140  h1EOP_e= new TH1F("h1EOP_e","cemce3x3/p",200,0,10);
141  h1HOM= new TH1F("h1HOM","hcalin3x3/cemce3x3",200,0,10);
142  h1HOP= new TH1F("h1HOP","hcalin3x3+hcalout3x3/cemce3x3",200,0,10);
143 
144  h1dR= new TH1F("h1dR","dR",400,0,0.2);//dR=sqrt(deta*deta+dphi*dphi)
145  h1gflavor= new TH1F("h1gflavor","Eop>0.8&Eop<1.2&hcaline3x3<0.2",2000,-1000,1000);
146 
147 }
148 
151  fHistogramFile_eID = new TFile(output_eID,"RECREATE");
152  fHistogramFile_eID->cd();
153  fhistogram_eID();
154 
155  for(int i=0;i<50;i++){
156 
157  NEID_electron_eta[i]=0;
158  NEID_electron_pt[i]=0;
159  NEID_electron_HOM[i]=0;
160  NEID_electron_EOP[i]=0;
161  NEID_electron_HOP[i]=0;
162  N_electron_eta[i]=0;
163  N_electron_pt[i]=0;
164  N_electron_HOM[i]=0;
165  N_electron_EOP[i]=0;
166  N_electron_HOP[i]=0;
167 
168  eta_point[i]=0.0;
169  pt_point[i]=0.0;
170  HOM_point[i]=0.0;
171  HOP_point[i]=0.0;
172  EOP_point[i]=0.0;
173 
174  N_pion_eta[i]=0;
175  N_K_eta[i]=0;
176  N_antiproton_eta[i]=0;
177 
178  N_pion_pt[i]=0;
179  N_K_pt[i]=0;
180  N_antiproton_pt[i]=0;
181 
182  N_pion_HOM[i]=0;
183  N_K_HOM[i]=0;
184  N_antiproton_HOM[i]=0;
185 
186  N_pion_HOP[i]=0;
187  N_K_HOP[i]=0;
188  N_antiproton_HOP[i]=0;
189 
190  N_pion_EOP[i]=0;
191  N_K_EOP[i]=0;
192  N_antiproton_EOP[i]=0;
193 
194  NEID_pion_eta[i]=0;
195  NEID_K_eta[i]=0;
196  NEID_antiproton_eta[i]=0;
197 
198  NEID_pion_pt[i]=0;
199  NEID_K_pt[i]=0;
200  NEID_antiproton_pt[i]=0;
201 
202  }
203  NEID_electron=0;
204  NEID_pion=0;
205  NEID_K=0;
206  NEID_antiproton=0;
207 
208 
209  for(int ifile=0;ifile<Nfile;ifile++){
210  TNtuple *ntp_vertex=0;
211  TNtuple *ntp_gtrack=0;
212  TNtuple *ntp_track=0;
213 
214  TFile *file3;
215  // file3 = new TFile(input_file[ifile]);
216  if(tag==1 or 3){
217  file3 = new TFile(input_file[ifile]);
218  file3->GetObject("ntp_vertex",ntp_vertex);
219  file3->GetObject("ntp_gtrack",ntp_gtrack);
220  file3->GetObject("ntp_track",ntp_track);
221  }
223  int temifile=0;
224  if(ifile<60) temifile=ifile+40;
225  if(ifile>=60 && ifile<120) temifile=ifile+40-60;
226  if(ifile>=120 && ifile<180) temifile=ifile+40-120;
227  if(ifile<60)sprintf(input_file_embed,"/sphenix/sim/sim01/sphnxpro/MDC1/embedpion/embedelectronsDST_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000001-031%d_g4svtx_eval.root",temifile);
228  if(ifile>=60 && ifile<120)sprintf(input_file_embed,"/sphenix/sim/sim01/sphnxpro/MDC1/embedpion/embedpionsDST_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000001-043%d_g4svtx_eval.root",temifile);
229  if(ifile>=120 && ifile<180){
230  sprintf(input_file_embed,"/sphenix/sim/sim01/sphnxpro/MDC1/embedpion/data/embedantiprotonsDST_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000001-021%d_g4svtx_eval.root",temifile);
231  if(ifile==153)sprintf(input_file_embed,"/sphenix/sim/sim01/sphnxpro/MDC1/embedpion/data/embedantiprotonsDST_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000001-02139_g4svtx_eval.root",temifile);
232  }
233  if(gSystem->AccessPathName(input_file_embed)) {
234  printf("no data existing for %s\n",input_file_embed);
235  continue;
236  }
237  TFile file2(input_file_embed);
238  if(tag==2){
239  file2.GetObject("ntp_vertex",ntp_vertex);
240  file2.GetObject("ntp_gtrack",ntp_gtrack);
241  file2.GetObject("ntp_track",ntp_track);
242  printf("inputfile: %s\n",input_file_embed);
243  }
244 
245  //cout<<"ntp_vertex->GetEntries= "<<ntp_vertex->GetEntries()<<endl;
246  // cout<<"ntp_gtrack->GetEntries= "<<ntp_gtrack->GetEntries()<<endl;
247  cout<<"ntp_track->GetEntries= "<<ntp_track->GetEntries()<<endl;
248 
249 
250  for(int ientry=0;ientry<ntp_track->GetEntries();ientry++) {//ntp_track
251  ntp_track->GetEntry(ientry);
252  float *content2=ntp_track->GetArgs();
253  int event2=0,trackID2=0;
254  float px2=0.0,py2=0.0,pz2=0.0,pt2=0.0,gpt2=0.0,eta2=0.0,phi2=0.0,charge2=0.0,quality2=0.0,nhits2=0.0,nmaps2=0.0,nintt2=0.0,ntpc2=0.0;
255  float cemcdphi2=0.0,cemcdeta2=0.0,cemce3x32=0.0,cemce2=0.0,hcalindphi2=0.0,hcalindeta2=0.0,hcaline3x32=0.0,hcaline2=0.0,hcaloutdphi2=0.0,hcaloutdeta2=0.0,hcaloute3x32=0.0,hcaloute2=0.0;
256  float gflavor2=0;
257 
258  event2=content2[0];
259  trackID2=content2[2];
260  px2=content2[3];
261  py2=content2[4];
262  pz2=content2[5];
263  pt2=content2[6];
264  eta2=content2[7];
265  phi2=content2[8];
266  charge2=content2[12];
267  quality2=content2[13];
268  nhits2=content2[16];
269  nmaps2=content2[17];
270  nintt2=content2[18];
271  ntpc2=content2[19];
272  cemcdphi2=content2[43];
273  cemcdeta2=content2[44];
274  cemce3x32=content2[45];
275  cemce2=content2[46];
276  hcalindphi2=content2[47];
277  hcalindeta2=content2[48];
278  hcaline3x32=content2[49];
279  hcaline2=content2[50];
280  hcaloutdphi2=content2[51];
281  hcaloutdeta2=content2[52];
282  hcaloute3x32=content2[53];
283  hcaloute2=content2[54];
284  gflavor2=content2[56];
285  gpt2=content2[69];
286 
287 
288  float p2=TMath::Sqrt(px2*px2+py2*py2+pz2*pz2);
289  float E2=TMath::Sqrt(me*me+p2*p2);
290  float EOP=cemce3x32/p2;// E/p
291  float HOP=(hcaline3x32+hcaloute3x32)/p2;// H/p
292  float HOM=hcaline3x32/cemce3x32;// EHcalin/EEmcal
293  float dR=TMath::Sqrt(cemcdphi2*cemcdphi2+cemcdeta2*cemcdeta2);
294  float pt=TMath::Sqrt(px2*px2+py2*py2);
295 
296 
297  if(nmaps2>0 && nintt2>0 && ntpc2>20 && quality2<10){
298 
299  if(TMath::Abs(gflavor2)==11 && (TMath::Abs(eta2)>0.0 && TMath::Abs(eta2)<1.1) && (gpt2>0.0 && gpt2<20.0) && quality2<20) NEID_electron=NEID_electron+1;
300  if(TMath::Abs(gflavor2)==211 && (TMath::Abs(eta2)>0.0 && TMath::Abs(eta2)<1.1) && (gpt2>0.0 && gpt2<20.0) && quality2<20) NEID_pion=NEID_pion+1;
301  if(TMath::Abs(gflavor2)==321 && (TMath::Abs(eta2)>0.0 && TMath::Abs(eta2)<1.1) && (gpt2>0.0 && gpt2<20.0) && quality2<20) NEID_K=NEID_K+1;
302  if(TMath::Abs(gflavor2)==2212 && (TMath::Abs(eta2)>0.0 && TMath::Abs(eta2)<1.1) && (gpt2>0.0 && gpt2<20.0) && quality2<20) NEID_antiproton=NEID_antiproton+1;
303  cout<<"NEID_electron= "<<NEID_electron<<"NEID_pion= "<<NEID_pion<<"NEID_electron= "<<NEID_K<<"NEID_electron= "<<NEID_antiproton<<endl;
304 
305  if((TMath::Abs(eta2)>0.0 && TMath::Abs(eta2)<1.1) && (gpt2>0.0 && gpt2<20.0)){
306  if(TMath::Abs(gflavor2)==11)h1pt_e->Fill(pt2);
307  h1dR->Fill(dR);
308  h1EOP->Fill(EOP);
309  if(TMath::Abs(gflavor2)==11)h1EOP_e->Fill(EOP);
310  h1HOM->Fill(HOM);
311  h1HOP->Fill(HOP);
312  h1gflavor->Fill(gflavor2);
313  }
314 
315  for(int i=0;i<11;i++){
316  eta_point[i]=i*1.0/10+0.05;
317  if((TMath::Abs(eta2)>(eta_point[i]-0.05)) && (TMath::Abs(eta2)<(eta_point[i]+0.05)) && (gpt2>0.0 & gpt2<20.0)){
318  if(TMath::Abs(gflavor2)==11) N_electron_eta[i]=N_electron_eta[i]+1;
319  if(TMath::Abs(gflavor2)==211) N_pion_eta[i]=N_pion_eta[i]+1;
320  if(TMath::Abs(gflavor2)==321) N_K_eta[i]=N_K_eta[i]+1;
321  if(TMath::Abs(gflavor2)==2212) N_antiproton_eta[i]=N_antiproton_eta[i]+1;
322 
323  if(EOP>0.7 && EOP<1.5 && HOM<0.2 && pt>2.0 ){
324  if(TMath::Abs(gflavor2)==11) NEID_electron_eta[i]=NEID_electron_eta[i]+1;
325  if(TMath::Abs(gflavor2)==211) NEID_pion_eta[i]=NEID_pion_eta[i]+1;
326  if(TMath::Abs(gflavor2)==321) NEID_K_eta[i]=NEID_K_eta[i]+1;
327  if(TMath::Abs(gflavor2)==2212) NEID_antiproton_eta[i]=NEID_antiproton_eta[i]+1;
328  cout<<"NEID_pion_eta= "<<NEID_pion_eta[i]<<endl;
329  }
330  }
331  }
332 
333  for(int i=0;i<16;i++){
334  pt_point[i]=i*10.0/10+0.5;
335  if(pt>(pt_point[i]-0.5) && pt<(pt_point[i]+0.5) && (TMath::Abs(eta2)>0.0 && TMath::Abs(eta2)<1.1) && (gpt2>0.0 && gpt2<20.0)){
336  if(TMath::Abs(gflavor2)==11) N_electron_pt[i]=N_electron_pt[i]+1;
337  if(TMath::Abs(gflavor2)==211) N_pion_pt[i]=N_pion_pt[i]+1;
338  if(TMath::Abs(gflavor2)==321) N_K_pt[i]=N_K_pt[i]+1;
339  if(TMath::Abs(gflavor2)==2212) N_antiproton_pt[i]=N_antiproton_pt[i]+1;
340 
341  if(EOP>0.7 && EOP<1.5 && HOM<0.2){
342  if(TMath::Abs(gflavor2)==11) NEID_electron_pt[i]=NEID_electron_pt[i]+1;
343  if(TMath::Abs(gflavor2)==211) NEID_pion_pt[i]=NEID_pion_pt[i]+1;
344  if(TMath::Abs(gflavor2)==321) NEID_K_pt[i]=NEID_K_pt[i]+1;
345  if(TMath::Abs(gflavor2)==2212) NEID_antiproton_pt[i]=NEID_antiproton_pt[i]+1;
346  cout<<"NEID_pion_pt= "<<NEID_pion_pt[i]<<endl;
347  }
348  }
349  }
350 
351  for(int i=0;i<20;i++){
352  HOM_point[i]=i*0.5/10+0.05;
353  if(HOM<HOM_point[i] && (TMath::Abs(eta2)>0.0 && TMath::Abs(eta2)<1.1) && (gpt2>0.0 && gpt2<20.0)){
354  if(TMath::Abs(gflavor2)==11) N_electron_HOM[i]=N_electron_HOM[i]+1;
355  if(TMath::Abs(gflavor2)==211) N_pion_HOM[i]=N_pion_HOM[i]+1;
356  if(TMath::Abs(gflavor2)==321) N_K_HOM[i]=N_K_HOM[i]+1;
357  if(TMath::Abs(gflavor2)==2212) N_antiproton_HOM[i]=N_antiproton_HOM[i]+1;
358  }
359  }
360 
361  for(int i=0;i<20;i++){
362  HOP_point[i]=i*0.5/10+0.05;
363  if(HOP>HOP_point[i] && (TMath::Abs(eta2)>0.0 && TMath::Abs(eta2)<1.1) && (gpt2>0.0 && gpt2<20.0)){
364  if(TMath::Abs(gflavor2)==11) N_electron_HOP[i]=N_electron_HOP[i]+1;
365  if(TMath::Abs(gflavor2)==211) N_pion_HOP[i]=N_pion_HOP[i]+1;
366  if(TMath::Abs(gflavor2)==321) N_K_HOP[i]=N_K_HOP[i]+1;
367  if(TMath::Abs(gflavor2)==2212) N_antiproton_HOP[i]=N_antiproton_HOP[i]+1;
368  }
369  }
370 
371  for(int i=0;i<9;i++){
372  EOP_point[i]=1.0-i*1.0/10;
373  if(EOP>EOP_point[i] && EOP<1.5 && (TMath::Abs(eta2)>0.0 && TMath::Abs(eta2)<1.1) && (gpt2>0.0 && gpt2<20.0)){
374  if(TMath::Abs(gflavor2)==11) N_electron_EOP[i]=N_electron_EOP[i]+1;
375  if(TMath::Abs(gflavor2)==211) N_pion_EOP[i]=N_pion_EOP[i]+1;
376  if(TMath::Abs(gflavor2)==321) N_K_EOP[i]=N_K_EOP[i]+1;
377  if(TMath::Abs(gflavor2)==2212) N_antiproton_EOP[i]=N_antiproton_EOP[i]+1;
378  }
379  }
380 
381  }//if(nmaps2>1 && nintt2>1 && ntpc2>25){
382 
383  }//for(int ientry=0;ientry<ntp_track->GetEntries();ientry++) {
384  }//for(int ifile=0;ifile<1;ifile++){
385 
386  eIDoutput();
387  fHistogramFile_eID->Write();
388  fHistogramFile_eID->Close();
389 
390 }//end of PIDplots::eID()
391 
393  float aa_eta[20],cc_eta[20],ee_eta[20],ff_eta[20],hh_eta[20];
394  float aa_pt[20],cc_pt[20],ee_pt[20],ff_pt[20],hh_pt[20];
395  float aa_HOM[20],cc_HOM[20],ee_HOM[20],ff_HOM[20],hh_HOM[20];
396  float aa_HOP[20],cc_HOP[20],ee_HOP[20],ff_HOP[20],hh_HOP[20];
397  float aa_EOP[20],cc_EOP[20],ee_EOP[20],ff_EOP[20],hh_EOP[20];
398  float ree_eta[20],rff_eta[20],rhh_eta[20],ree_pt[20],rff_pt[20],rhh_pt[20];
399  float ree_EOP[20],rff_EOP[20],rhh_EOP[20],ree_HOM[20],rff_HOM[20],rhh_HOM[20],ree_HOP[20],rff_HOP[20],rhh_HOP[20];
400 
401  float err_aa_eta[20],err_cc_eta[20],err_aa_pt[20],err_cc_pt[20],err_aa_HOM[20],err_cc_HOM[20],err_aa_HOP[20],err_cc_HOP[20],err_aa_EOP[20],err_cc_EOP[20];
402  float err_ee_eta[20],err_ff_eta[20],err_hh_eta[20],err_ee_pt[20],err_ff_pt[20],err_hh_pt[20];
403  float err_ee_HOM[20],err_ff_HOM[20],err_hh_HOM[20],err_ee_HOP[20],err_ff_HOP[20],err_hh_HOP[20],err_ee_EOP[20],err_ff_EOP[20],err_hh_EOP[20];
404  float err_ree_eta[20],err_rff_eta[20],err_rhh_eta[20],err_ree_pt[20],err_rff_pt[20],err_rhh_pt[20];
405  float err_ree_HOM[20],err_rff_HOM[20],err_rhh_HOM[20],err_ree_HOP[20],err_rff_HOP[20],err_rhh_HOP[20],err_ree_EOP[20],err_rff_EOP[20],err_rhh_EOP[20];
406 
407  for(int i=0;i<20;i++){
408  aa_eta[i]=0.0;
409  cc_eta[i]=0.0;
410  ee_eta[i]=0.0;
411  ff_eta[i]=0.0;
412  hh_eta[i]=0.0;
413  ree_eta[i]=0.0;
414  rff_eta[i]=0.0;
415  rhh_eta[i]=0.0;
416  err_ree_eta[i]=0.0;
417  err_rff_eta[i]=0.0;
418  err_rhh_eta[i]=0.0;
419 
420  aa_pt[i]=0.0;
421  cc_pt[i]=0.0;
422  ee_pt[i]=0.0;
423  ff_pt[i]=0.0;
424  hh_pt[i]=0.0;
425  ree_pt[i]=0.0;
426  rff_pt[i]=0.0;
427  rhh_pt[i]=0.0;
428  err_ree_pt[i]=0.0;
429  err_rff_pt[i]=0.0;
430  err_rhh_pt[i]=0.0;
431 
432  aa_HOM[i]=0.0;
433  cc_HOM[i]=0.0;
434  ee_HOM[i]=0.0;
435  ff_HOM[i]=0.0;
436  hh_HOM[i]=0.0;
437  ree_HOM[i]=0.0;
438  rff_HOM[i]=0.0;
439  rhh_HOM[i]=0.0;
440  err_ree_HOM[i]=0.0;
441  err_rff_HOM[i]=0.0;
442  err_rhh_HOM[i]=0.0;
443 
444  aa_HOP[i]=0.0;
445  cc_HOP[i]=0.0;
446  ee_HOP[i]=0.0;
447  ff_HOP[i]=0.0;
448  hh_HOP[i]=0.0;
449  ree_HOP[i]=0.0;
450  rff_HOP[i]=0.0;
451  rhh_HOP[i]=0.0;
452  err_ree_HOP[i]=0.0;
453  err_rff_HOP[i]=0.0;
454  err_rhh_HOP[i]=0.0;
455 
456  aa_EOP[i]=0.0;
457  cc_EOP[i]=0.0;
458  ee_EOP[i]=0.0;
459  ff_EOP[i]=0.0;
460  hh_EOP[i]=0.0;
461  ree_EOP[i]=0.0;
462  rff_EOP[i]=0.0;
463  rhh_EOP[i]=0.0;
464  err_ree_EOP[i]=0.0;
465  err_rff_EOP[i]=0.0;
466  err_rhh_EOP[i]=0.0;
467 
468 
469  err_aa_eta[i]=0.0;
470  err_cc_eta[i]=0.0;
471  err_ee_eta[i]=0.0;
472  err_ff_eta[i]=0.0;
473  err_hh_eta[i]=0.0;
474 
475  err_aa_pt[i]=0.0;
476  err_cc_pt[i]=0.0;
477  err_ee_pt[i]=0.0;
478  err_ff_pt[i]=0.0;
479  err_hh_pt[i]=0.0;
480 
481  err_aa_HOM[i]=0.0;
482  err_cc_HOM[i]=0.0;
483  err_ee_HOM[i]=0.0;
484  err_ff_HOM[i]=0.0;
485  err_hh_HOM[i]=0.0;
486 
487  err_aa_HOP[i]=0.0;
488  err_cc_HOP[i]=0.0;
489  err_ee_HOP[i]=0.0;
490  err_ff_HOP[i]=0.0;
491  err_hh_HOP[i]=0.0;
492 
493 
494  err_aa_EOP[i]=0.0;
495  err_cc_EOP[i]=0.0;
496  err_ee_EOP[i]=0.0;
497  err_ff_EOP[i]=0.0;
498  err_hh_EOP[i]=0.0;
499 
500 
501 
502  }
504  FILE *outfile1;
505  TString fname1;
506  fname1 = Form("%s.dat",output_plot_eID_eta);
507  outfile1 =fopen(fname1.Data(),"w");
508  int Nplot_electron_eta=0,Nplot_pion_eta=0,Nplot_K_eta=0,Nplot_antiproton_eta=0;
509  for(int i=0;i<11;i++){
510  // if(N_electron_eta[i]==0 or N_pion_eta[i]==0 or N_K_eta[i]==0 or N_antiproton_eta[i]==0)continue;
511  // if(NEID_electron_eta[i]==0 or NEID_pion_eta[i]==0 or NEID_K_eta[i]==0 or NEID_antiproton_eta[i]==0)continue;
512 
513  aa_eta[i]=eta_point[i];
514  err_aa_eta[i]=0.05;
515  if(N_electron_eta[i]>0 && NEID_electron_eta[i]>0){
516  cc_eta[i]=1.0*NEID_electron_eta[i]/N_electron_eta[i];
517  err_cc_eta[i]=1.0*TMath::Sqrt((1.0/NEID_electron_eta[i]+1.0/N_electron_eta[i]))*cc_eta[i];
518  Nplot_electron_eta=Nplot_electron_eta+1;
519  }
520  if(N_pion_eta[i]>0 && NEID_pion_eta[i]>0){
521  ee_eta[i]=1.0*NEID_pion_eta[i]/N_pion_eta[i];
522  err_ee_eta[i]=1.0*TMath::Sqrt((1.0/NEID_pion_eta[i]+1.0/N_pion_eta[i]))*ee_eta[i];
523  Nplot_pion_eta=Nplot_pion_eta+1;
524  }
525  if(N_K_eta[i]>0 && NEID_K_eta[i]>0){
526  ff_eta[i]=1.0*NEID_K_eta[i]/N_K_eta[i];
527  err_ff_eta[i]=1.0*TMath::Sqrt((1.0/NEID_K_eta[i]+1.0/N_K_eta[i]))*ff_eta[i];
528  Nplot_K_eta=Nplot_K_eta+1;
529  }
530  if(N_antiproton_eta[i]>0 && NEID_antiproton_eta[i]>0){
531  hh_eta[i]=1.0*NEID_antiproton_eta[i]/N_antiproton_eta[i];
532  err_hh_eta[i]=1.0*TMath::Sqrt((1.0/NEID_antiproton_eta[i]+1.0/N_antiproton_eta[i]))*hh_eta[i];
533  Nplot_antiproton_eta=Nplot_antiproton_eta+1;
534  }
535 
536  float aa,cc,ee,ff,hh;
537  float err_aa,err_cc,err_ee,err_ff,err_hh;
538  aa=aa_eta[i];
539  cc=cc_eta[i];
540  ee=ee_eta[i];
541  ff=ff_eta[i];
542  hh=hh_eta[i];
543 
544  if(ee_eta[i]>0.0){
545  ree_eta[i]=1.0/ee_eta[i];
546  err_ree_eta[i]=ree_eta[i]*ree_eta[i]*err_ee_eta[i];
547  }
548  //cout<<cc_eta[i]<<"; "<<ree_eta[i]<<"; "<<err_ree_eta[i]<<endl;
549  if(ff_eta[i]>0.0){
550  rff_eta[i]=1.0/ff_eta[i];
551  err_rff_eta[i]=rff_eta[i]*rff_eta[i]*err_ff_eta[i];
552  }
553  if(hh_eta[i]>0.0){
554  rhh_eta[i]=1.0/hh_eta[i];
555  err_rhh_eta[i]=rhh_eta[i]*rhh_eta[i]*err_hh_eta[i];
556  }
557 
558  fprintf(outfile1,"eta: %f %f %f %f %f\n",aa,cc,ee,ff,hh);
559 
560  }
561 
563  FILE *outfile2;
564  TString fname2;
565  fname2 = Form("%s.dat",output_plot_eID_pt);
566  outfile2 =fopen(fname2.Data(),"w");
567  int Nplot_electron_pt=0,Nplot_pion_pt=0,Nplot_K_pt=0,Nplot_antiproton_pt=0;
568  for(int i=0;i<16;i++){
569  // if(N_electron_pt[i]==0 or N_pion_pt[i]==0 or N_K_pt[i]==0 or N_antiproton_pt[i]==0)continue;
570  // if(NEID_electron_pt[i]==0 or NEID_pion_pt[i]==0 or NEID_K_pt[i]==0 or NEID_antiproton_pt[i]==0)continue;
571 
572  aa_pt[i]=pt_point[i];
573  err_aa_pt[i]=0.5;
574  if(N_electron_pt[i]>0 && NEID_electron_pt[i]>0){
575  cc_pt[i]=1.0*NEID_electron_pt[i]/N_electron_pt[i];
576  err_cc_pt[i]=1.0*TMath::Sqrt((1.0/NEID_electron_pt[i]+1.0/N_electron_pt[i]))*cc_pt[i];
577  Nplot_electron_pt=Nplot_electron_pt+1;
578  // cout<<cc_pt[i]<<"; "<<err_cc_pt[i]<<endl;
579  }
580  if(N_pion_pt[i]>0 && NEID_pion_pt[i]>0){
581  ee_pt[i]=1.0*NEID_pion_pt[i]/N_pion_pt[i];
582  err_ee_pt[i]=1.0*TMath::Sqrt((1.0/NEID_pion_pt[i]+1.0/N_pion_pt[i]))*ee_pt[i];
583  Nplot_pion_pt=Nplot_pion_pt+1;
584  //cout<<ee_pt[i]<<"; "<<err_ee_pt[i]<<endl;
585  }
586  if(N_K_pt[i]>0 && NEID_K_pt[i]>0){
587  ff_pt[i]=1.0*NEID_K_pt[i]/N_K_pt[i];
588  err_ff_pt[i]=1.0*TMath::Sqrt((1.0/NEID_K_pt[i]+1.0/N_K_pt[i]))*ff_pt[i];
589  Nplot_K_pt=Nplot_K_pt+1;
590  }
591  if(N_antiproton_pt[i]>0 && NEID_antiproton_pt[i]>0){
592  hh_pt[i]=1.0*NEID_antiproton_pt[i]/N_antiproton_pt[i];
593  err_hh_pt[i]=1.0*TMath::Sqrt((1.0/NEID_antiproton_pt[i]+1.0/N_antiproton_pt[i]))*hh_pt[i];
594  Nplot_antiproton_pt=Nplot_antiproton_pt+1;
595  }
596 
597  float aa,cc,ee,ff,hh;
598  float err_aa,err_cc,err_ee,err_ff,err_hh;
599  aa=aa_pt[i];
600  cc=cc_pt[i];
601  ee=ee_pt[i];
602  ff=ff_pt[i];
603  hh=hh_pt[i];
604 
605  if(ee_pt[i]>0.0){
606  ree_pt[i]=1.0/ee_pt[i];
607  err_ree_pt[i]=ree_pt[i]*ree_pt[i]*err_ee_pt[i];
608  // cout<<cc_pt[i]<<"; "<<ree_pt[i]<<"; "<<err_ree_pt[i]<<endl;
609  }
610  cout<<cc_pt[i]<<"; "<<ree_pt[i]<<"; "<<err_ree_pt[i]<<endl;
611  if(ff_pt[i]>0.0){
612  rff_pt[i]=1.0/ff_pt[i];
613  err_rff_pt[i]=rff_pt[i]*rff_pt[i]*err_ff_pt[i];
614  }
615  if(hh_pt[i]>0.0){
616  rhh_pt[i]=1.0/hh_pt[i];
617  err_rhh_pt[i]=rhh_pt[i]*rhh_pt[i]*err_hh_pt[i];
618  }
619  cout<<cc_pt[i]<<"; "<<rhh_pt[i]<<"; "<<err_rhh_pt[i]<<endl;
620  fprintf(outfile2,"pt: %f %f %f %f %f\n",aa,cc,ee,ff,hh);
621  }
622 
623 
625  FILE *outfile3;
626  TString fname3;
627  fname3 = Form("%s.dat",output_plot_eID_HOM);
628  outfile3 =fopen(fname3.Data(),"w");
629  int Nplot_electron_HOM=0,Nplot_pion_HOM=0,Nplot_K_HOM=0,Nplot_antiproton_HOM=0;
630  for(int i=0;i<20;i++){
631  //if(NEID_electron==0 or NEID_pion==0 or NEID_K==0 or NEID_antiproton==0)continue;
632  //if(N_electron_HOM[i]==0 or N_pion_HOM[i]==0 or N_K_HOM[i]==0 or N_antiproton_HOM[i]==0)continue;
633 
634  aa_HOM[i]=HOM_point[i];
635  err_aa_HOM[i]=0.0;
636  if(NEID_electron>0 & N_electron_HOM[i]>0){
637  cc_HOM[i]=1.0*N_electron_HOM[i]/NEID_electron;
638  err_cc_HOM[i]=1.0*TMath::Sqrt((1.0/N_electron_HOM[i]+1.0/NEID_electron))*cc_HOM[i];
639  Nplot_electron_HOM=Nplot_electron_HOM+1;
640  }
641  if(NEID_pion>0 & N_pion_HOM[i]>0){
642  ee_HOM[i]=1.0*N_pion_HOM[i]/NEID_pion;
643  err_ee_HOM[i]=1.0*TMath::Sqrt((1.0/N_pion_HOM[i]+1.0/NEID_pion))*ee_HOM[i];
644  Nplot_pion_HOM=Nplot_pion_HOM+1;
645  }
646  if(NEID_K>0 & N_K_HOM[i]>0){
647  ff_HOM[i]=1.0*N_K_HOM[i]/NEID_K;
648  err_ff_HOM[i]=1.0*TMath::Sqrt((1.0/N_K_HOM[i]+1.0/NEID_K))*ff_HOM[i];
649  Nplot_K_HOM=Nplot_K_HOM+1;
650  }
651  if(NEID_antiproton>0 & N_antiproton_HOM[i]>0){
652  hh_HOM[i]=1.0*N_antiproton_HOM[i]/NEID_antiproton;
653  err_hh_HOM[i]=1.0*TMath::Sqrt((1.0/N_antiproton_HOM[i]+1.0/NEID_antiproton))*hh_HOM[i];
654  Nplot_antiproton_HOM=Nplot_antiproton_HOM+1;
655  }
656 
657  float aa,cc,ee,ff,hh;
658  float err_aa,err_cc,err_ee,err_ff,err_hh;
659  aa=aa_HOM[i];
660  cc=cc_HOM[i];
661  ee=ee_HOM[i];
662  ff=ff_HOM[i];
663  hh=hh_HOM[i];
664 
665  if(ee_HOM[i]>0.0){
666  ree_HOM[i]=1.0/ee_HOM[i];
667  err_ree_HOM[i]=ree_HOM[i]*ree_HOM[i]*err_ee_HOM[i];
668  }
669  if(ff_HOM[i]>0.0){
670  rff_HOM[i]=1.0/ff_HOM[i];
671  err_rff_HOM[i]=rff_HOM[i]*rff_HOM[i]*err_ff_HOM[i];
672  }
673  if(hh_HOM[i]>0.0){
674  rhh_HOM[i]=1.0/hh_HOM[i];
675  err_rhh_HOM[i]=rhh_HOM[i]*rhh_HOM[i]*err_hh_HOM[i];
676  }
677 
678 
679  err_aa=err_aa_HOM[i];
680  err_cc=err_cc_HOM[i];
681  err_ee=err_ee_HOM[i];
682  err_ff=err_ff_HOM[i];
683  err_hh=err_hh_HOM[i];
684 
685  fprintf(outfile3," %f %f %f %f %f %f %f %f %f %f\n",aa,err_aa,cc,err_cc,ee,err_ee,ff,err_ff,hh,err_hh);
686  }
687 
689  FILE *outfile4;
690  TString fname4;
691  fname4 = Form("%s.dat",output_plot_eID_EOP);
692  outfile4 =fopen(fname4.Data(),"w");
693  int Nplot_electron_EOP=0,Nplot_pion_EOP=0,Nplot_K_EOP=0,Nplot_antiproton_EOP=0;
694  for(int i=0;i<9;i++){
695  //if(NEID_electron==0 or NEID_pion==0 or NEID_K==0 or NEID_antiproton==0)continue;
696  // if(N_electron_EOP[i]==0 or N_pion_EOP[i]==0 or N_K_EOP[i]==0 or N_antiproton_EOP[i]==0)continue;
697 
698  aa_EOP[i]=EOP_point[i];
699  err_aa_EOP[i]=0.0;
700  if(NEID_electron>0 & N_electron_EOP[i]>0){
701  cc_EOP[i]=1.0*N_electron_EOP[i]/NEID_electron;
702  err_cc_EOP[i]=1.0*TMath::Sqrt((1.0/N_electron_EOP[i]+1.0/NEID_electron))*cc_EOP[i];
703  Nplot_electron_EOP=Nplot_electron_EOP+1;
704  // cout<<cc_EOP[i]<<"; "<<err_cc_EOP[i]<<endl;
705  }
706  if(NEID_pion>0 & N_pion_EOP[i]>0){
707  ee_EOP[i]=1.0*N_pion_EOP[i]/NEID_pion;
708  err_ee_EOP[i]=1.0*TMath::Sqrt((1.0/N_pion_EOP[i]+1.0/NEID_pion))*ee_EOP[i];
709  Nplot_pion_EOP=Nplot_pion_EOP+1;
710  }
711  if(NEID_K>0 & N_K_EOP[i]>0){
712  ff_EOP[i]=1.0*N_K_EOP[i]/NEID_K;
713  err_ff_EOP[i]=1.0*TMath::Sqrt((1.0/N_K_EOP[i]+1.0/NEID_K))*ff_EOP[i];
714  Nplot_K_EOP=Nplot_K_EOP+1;
715  }
716  if(NEID_antiproton>0 & N_antiproton_EOP[i]>0){
717  hh_EOP[i]=1.0*N_antiproton_EOP[i]/NEID_antiproton;
718  err_hh_EOP[i]=1.0*TMath::Sqrt((1.0/N_antiproton_EOP[i]+1.0/NEID_antiproton))*hh_EOP[i];
719  Nplot_antiproton_EOP=Nplot_antiproton_EOP+1;
720  }
721 
722  float aa,cc,ee,ff,hh;
723  float err_aa,err_cc,err_ee,err_ff,err_hh;
724  aa=aa_EOP[i];
725  cc=cc_EOP[i];
726  ee=ee_EOP[i];
727  ff=ff_EOP[i];
728  hh=hh_EOP[i];
729 
730  if(ee_EOP[i]>0.0){
731  ree_EOP[i]=1.0/ee_EOP[i];
732  err_ree_EOP[i]=ree_EOP[i]*ree_EOP[i]*err_ee_EOP[i];
733  // cout<<ree_EOP[i]<<"; "<<err_ree_EOP[i]<<endl;
734  }
735  if(ff_EOP[i]>0.0){
736  rff_EOP[i]=1.0/ff_EOP[i];
737  err_rff_EOP[i]=rff_EOP[i]*rff_EOP[i]*err_ff_EOP[i];
738  }
739  if(hh_EOP[i]>0.0){
740  rhh_EOP[i]=1.0/hh_EOP[i];
741  err_rhh_EOP[i]=rhh_EOP[i]*rhh_EOP[i]*err_hh_EOP[i];
742  }
743 
744  err_aa=err_aa_EOP[i];
745  err_cc=err_cc_EOP[i];
746  err_ee=err_ee_EOP[i];
747  err_ff=err_ff_EOP[i];
748  err_hh=err_hh_EOP[i];
749 
750  fprintf(outfile4," %f %f %f %f %f %f %f %f %f %f\n",aa,err_aa,cc,err_cc,ee,err_ee,ff,err_ff,hh,err_hh);
751  }
752 
754  FILE *outfile5;
755  TString fname5;
756  fname5 = Form("%s.dat",output_plot_eID_HOP);
757  outfile5 =fopen(fname5.Data(),"w");
758  int Nplot_electron_HOP=0,Nplot_pion_HOP=0,Nplot_K_HOP=0,Nplot_antiproton_HOP=0;
759  for(int i=0;i<20;i++){
760  //if(NEID_electron==0 or NEID_pion==0 or NEID_K==0 or NEID_antiproton==0)continue;
761  //if(N_electron_HOP[i]==0 or N_pion_HOP[i]==0 or N_K_HOP[i]==0 or N_antiproton_HOP[i]==0)continue;
762 
763  aa_HOP[i]=HOP_point[i];
764  err_aa_HOP[i]=0.0;
765  if(NEID_electron>0 & N_electron_HOP[i]>0){
766  cc_HOP[i]=1.0*N_electron_HOP[i]/NEID_electron;
767  err_cc_HOP[i]=1.0*TMath::Sqrt((1.0/N_electron_HOP[i]+1.0/NEID_electron))*cc_HOP[i];
768  Nplot_electron_HOP=Nplot_electron_HOP+1;
769  }
770  if(NEID_pion>0 & N_pion_HOP[i]>0){
771  ee_HOP[i]=1.0*N_pion_HOP[i]/NEID_pion;
772  err_ee_HOP[i]=1.0*TMath::Sqrt((1.0/N_pion_HOP[i]+1.0/NEID_pion))*ee_HOP[i];
773  Nplot_pion_HOP=Nplot_pion_HOP+1;
774  }
775  if(NEID_K>0 & N_K_HOP[i]>0){
776  ff_HOP[i]=1.0*N_K_HOP[i]/NEID_K;
777  err_ff_HOP[i]=1.0*TMath::Sqrt((1.0/N_K_HOP[i]+1.0/NEID_K))*ff_HOP[i];
778  Nplot_K_HOP=Nplot_K_HOP+1;
779  }
780  if(NEID_antiproton>0 & N_antiproton_HOP[i]>0){
781  hh_HOP[i]=1.0*N_antiproton_HOP[i]/NEID_antiproton;
782  err_hh_HOP[i]=1.0*TMath::Sqrt((1.0/N_antiproton_HOP[i]+1.0/NEID_antiproton))*hh_HOP[i];
783  Nplot_antiproton_HOP=Nplot_antiproton_HOP+1;
784  }
785 
786  float aa,cc,ee,ff,hh;
787  float err_aa,err_cc,err_ee,err_ff,err_hh;
788  aa=aa_HOP[i];
789  cc=cc_HOP[i];
790  ee=ee_HOP[i];
791  ff=ff_HOP[i];
792  hh=hh_HOP[i];
793 
794  if(ee_HOP[i]>0.0){
795  ree_HOP[i]=1.0/ee_HOP[i];
796  err_ree_HOP[i]=ree_HOP[i]*ree_HOP[i]*err_ee_HOP[i];
797  }
798  if(ff_HOP[i]>0.0){
799  rff_HOP[i]=1.0/ff_HOP[i];
800  err_rff_HOP[i]=rff_HOP[i]*rff_HOP[i]*err_ff_HOP[i];
801  }
802  if(hh_HOP[i]>0.0){
803  rhh_HOP[i]=1.0/hh_HOP[i];
804  err_rhh_HOP[i]=rhh_HOP[i]*rhh_HOP[i]*err_hh_HOP[i];
805  }
806 
807  err_aa=err_aa_HOP[i];
808  err_cc=err_cc_HOP[i];
809  err_ee=err_ee_HOP[i];
810  err_ff=err_ff_HOP[i];
811  err_hh=err_hh_HOP[i];
812 
813  fprintf(outfile5," %f %f %f %f %f %f %f %f %f %f\n",aa,err_aa,cc,err_cc,ee,err_ee,ff,err_ff,hh,err_hh);
814  }
815 
816 
818  gROOT->LoadMacro("sPhenixStyle.C");
819  SetsPhenixStyle();
820  TCanvas *canv= new TCanvas("canv","Cali Canvas",1800,4750);
821  canv->Divide(2,5);
822 
824  canv->cd(1);
825  TPad *pad1 = new TPad("pad1","pad1",0,0,0.99,0.99);
826  pad1->Draw();
827  pad1->cd();
828  //pad1->SetFrameLineWidth(2);
829  //pad1->SetFrameLineColor(1);
830  Float_t Xmin,Xmax;
831  Float_t Ymin,Ymax;
832  Ymin=-0.05;
833  if(tag==2)Ymax=2.0;
834  if(tag==1 or 3)Ymax=2.0;
835  Xmin=0.0;
836  Xmax=1.1;
837 
838 
839 
840  TH1F *hframe0;
841  hframe0=gPad->DrawFrame(Xmin,Ymin,Xmax,Ymax);
842  hframe0->GetXaxis()->SetTitle("|#eta|");
843  //hframe0->GetXaxis()->CenterTitle();
844  hframe0->GetYaxis()->SetTitle("Survival probability (%)");
845  //hframe0->GetYaxis()->CenterTitle();
846 
847  TGraphErrors *g1,*g11,*g12,*g13;
848  g1=new TGraphErrors(11,aa_eta,cc_eta,err_aa_eta,err_cc_eta);
849  g1->SetMarkerStyle(26);
850  g1->SetMarkerColor(1);
851  g1->SetLineColor(1);
852  g1->SetLineStyle(1);
853  g1->SetLineWidth(1.2);
854  g1->SetMarkerSize(3.0);
855  g1->Draw("p");
856  g11=new TGraphErrors(11,aa_eta,ee_eta,err_aa_eta,err_ee_eta);
857  g11->SetMarkerStyle(26);
858  g11->SetMarkerColor(2);
859  g11->SetLineColor(2);
860  g11->SetLineStyle(1);
861  g11->SetLineWidth(1.2);
862  g11->SetMarkerSize(3.0);
863  g11->Draw("p");
864  g12=new TGraphErrors(11,aa_eta,ff_eta,err_aa_eta,err_ff_eta);
865  g12->SetMarkerStyle(26);
866  g12->SetMarkerColor(3);
867  g12->SetLineColor(3);
868  g12->SetLineStyle(1);
869  g12->SetLineWidth(1.2);
870  g12->SetMarkerSize(3.0);
871  if(tag==1 or 3) g12->Draw("p");
872  g13=new TGraphErrors(11,aa_eta,hh_eta,err_aa_eta,err_hh_eta);
873  g13->SetMarkerStyle(26);
874  g13->SetMarkerColor(4);
875  g13->SetLineColor(4);
876  g13->SetLineStyle(1);
877  g13->SetLineWidth(1.2);
878  g13->SetMarkerSize(3.0);
879  g13->Draw("p");
880 
881  TLegend *legtitle1 =new TLegend(0.20,0.85,0.35,0.92,"#it{#bf{sPHENIX}} Simulation Internal");
882  legtitle1->SetTextSize(0.035);
883  legtitle1->Draw();
884 
885  TLegend *legtitle11;
886  if(tag==2)legtitle11 =new TLegend(0.20,0.82,0.35,0.85,"Embed");
887  if(tag==1 or 3)legtitle11 =new TLegend(0.20,0.82,0.35,0.85,"Single particle");
888  legtitle11->SetTextSize(0.030);
889  legtitle11->Draw();
890 
891  TLegend *legtitle12 =new TLegend(0.20,0.78,0.35,0.80,"@:0.7<E_{EMCal}/p<1.5 & E_{iHCal}/E_{EMCal}<0.2");
892  legtitle12->SetTextSize(0.028);
893  legtitle12->Draw();
894 
895  TLegend *legtitle13 =new TLegend(0.20,0.72,0.35,0.76,"@:p_{t}>2GeV");
896  legtitle13->SetTextSize(0.028);
897  legtitle13->Draw();
898 
899  TLegend *leg1 =new TLegend(0.65,0.63,0.90,0.92);
900  leg1->AddEntry(g1," e^{+} & e^{-}","lep");
901  leg1->AddEntry(g11," #pi^{+} & #pi^{-}","lep");
902  if(tag==1 or 3)leg1->AddEntry(g12," K^{+} & K^{-}","lep");
903  leg1->AddEntry(g13," p & #bar{p}","lep");
904  leg1->Draw();
905 
907  canv->cd(2);
908  TPad *pad2 = new TPad("pad2","pad2",0,0,0.99,0.99);
909  pad2->Draw();
910  pad2->cd();
911  // pad2->SetFrameLineWidth(2);
912  // pad2->SetFrameLineColor(1);
913 
914  Ymin=-0.05;
915  if(tag==2)Ymax=2.0;
916  if(tag==1 or 3)Ymax=2.0;
917  Xmin=0.0;
918  Xmax=16.0;
919 
920 
921  hframe0=gPad->DrawFrame(Xmin,Ymin,Xmax,Ymax);
922  hframe0->GetXaxis()->SetTitle("p_{t} (GeV)");
923 // hframe0->GetXaxis()->CenterTitle();
924  hframe0->GetYaxis()->SetTitle("Survival probability (%)");
925 // hframe0->GetYaxis()->CenterTitle();
926 
927 
928  TGraphErrors *g2,*g21,*g22,*g23;
929  g2=new TGraphErrors(16,aa_pt,cc_pt,err_aa_pt,err_cc_pt);
930  g2->SetMarkerStyle(26);
931  g2->SetMarkerColor(1);
932  g2->SetLineColor(1);
933  g2->SetLineStyle(1);
934  g2->SetLineWidth(1.2);
935  g2->SetMarkerSize(3.0);
936  g2->Draw("p");
937  g21=new TGraphErrors(16,aa_pt,ee_pt,err_aa_pt,err_ee_pt);
938  g21->SetMarkerStyle(26);
939  g21->SetMarkerColor(2);
940  g21->SetLineColor(2);
941  g21->SetLineStyle(1);
942  g21->SetLineWidth(1.2);
943  g21->SetMarkerSize(3.0);
944  g21->Draw("p");
945  g22=new TGraphErrors(16,aa_pt,ff_pt,err_aa_pt,err_ff_pt);
946  g22->SetMarkerStyle(26);
947  g22->SetMarkerColor(3);
948  g22->SetLineColor(3);
949  g22->SetLineStyle(1);
950  g22->SetLineWidth(1.2);
951  g22->SetMarkerSize(3.0);
952  if(tag==1 or 3) g22->Draw("p");
953  g23=new TGraphErrors(16,aa_pt,hh_pt,err_aa_pt,err_hh_pt);
954  g23->SetMarkerStyle(26);
955  g23->SetMarkerColor(4);
956  g23->SetLineColor(4);
957  g23->SetLineStyle(1);
958  g23->SetLineWidth(1.2);
959  g23->SetMarkerSize(3.0);
960  g23->Draw("p");
961 
962  TLegend *legtitle2 =new TLegend(0.20,0.85,0.35,0.92,"#it{#bf{sPHENIX}} Simulation Internal");
963  legtitle2->SetTextSize(0.035);
964  legtitle2->Draw();
965 
966  TLegend *legtitle21;
967  if(tag==2)legtitle21 =new TLegend(0.20,0.82,0.35,0.85,"Embed");
968  if(tag==1 or 3)legtitle21 =new TLegend(0.20,0.82,0.35,0.85,"Single particle");
969  legtitle21->SetTextSize(0.030);
970  legtitle21->Draw();
971 
972  TLegend *legtitle22 =new TLegend(0.20,0.78,0.35,0.80,"@:0.7<E_{EMCal}/p<1.5 & E_{iHCal}/E_{EMCal}<0.2");
973  legtitle22->SetTextSize(0.025);
974  legtitle22->Draw();
975 
976  TLegend *leg2 =new TLegend(0.65,0.63,0.90,0.92);
977  leg2->AddEntry(g2," e^{+} & e^{-}","lep");
978  leg2->AddEntry(g21," #pi^{+} & #pi^{-}","lep");
979  if(tag==1 or 3) leg2->AddEntry(g22," K^{+} & K^{-}","lep");
980  leg2->AddEntry(g23," p & #bar{p}","lep");
981  leg2->Draw();
982 
984  canv->cd(3);
985  TPad *pad3 = new TPad("pad3","pad3",0,0,0.99,0.99);
986  pad3->Draw();
987  pad3->cd();
988 
989  Ymin=0;
990  Ymax=1.2;
991  Xmin=0.0;
992  Xmax=1.2;
993 
994  hframe0=gPad->DrawFrame(Xmin,Ymin,Xmax,Ymax);
995  hframe0->GetXaxis()->SetTitle("E_{iHCal}/E_{EMCal}<x_{cut}");
996  // hframe0->GetXaxis()->CenterTitle();
997  hframe0->GetYaxis()->SetTitle("Survival probability (%)");
998  // hframe0->GetYaxis()->CenterTitle();
999 
1000 
1001  TGraphErrors *g3,*g31,*g32,*g33;
1002  g3=new TGraphErrors(20,aa_HOM,cc_HOM,err_aa_HOM,err_cc_HOM);
1003  g3->SetMarkerStyle(26);
1004  g3->SetMarkerColor(1);
1005  g3->SetLineColor(1);
1006  g3->SetLineStyle(1);
1007  g3->SetLineWidth(1.2);
1008  g3->SetMarkerSize(3.0);
1009  g3->Draw("pc");
1010  g31=new TGraphErrors(20,aa_HOM,ee_HOM,err_aa_HOM,err_ee_HOM);
1011  g31->SetMarkerStyle(26);
1012  g31->SetMarkerColor(2);
1013  g31->SetLineColor(2);
1014  g31->SetLineStyle(1);
1015  g31->SetLineWidth(1.2);
1016  g31->SetMarkerSize(3.0);
1017  g31->Draw("pc");
1018  g32=new TGraphErrors(20,aa_HOM,ff_HOM,err_aa_HOM,err_ff_HOM);
1019  g32->SetMarkerStyle(26);
1020  g32->SetMarkerColor(3);
1021  g32->SetLineColor(3);
1022  g32->SetLineStyle(1);
1023  g32->SetLineWidth(1.2);
1024  g32->SetMarkerSize(3.0);
1025  if(tag==1 or 3) g32->Draw("pc");
1026  g33=new TGraphErrors(20,aa_HOM,hh_HOM,err_aa_HOM,err_hh_HOM);
1027  g33->SetMarkerStyle(26);
1028  g33->SetMarkerColor(4);
1029  g33->SetLineColor(4);
1030  g33->SetLineStyle(1);
1031  g33->SetLineWidth(1.2);
1032  g33->SetMarkerSize(3.0);
1033  g33->Draw("pc");
1034 
1035  TLegend *legtitle3 =new TLegend(0.20,0.85,0.35,0.92,"#it{#bf{sPHENIX}} Simulation Internal");
1036  legtitle3->SetTextSize(0.035);
1037  legtitle3->Draw();
1038 
1039  TLegend *legtitle31;
1040  if(tag==2)legtitle31 =new TLegend(0.20,0.82,0.35,0.85,"Embed");
1041  if(tag==1 or 3)legtitle31 =new TLegend(0.20,0.82,0.35,0.85,"Single particle");
1042  legtitle31->SetTextSize(0.030);
1043  legtitle31->Draw();
1044 
1045  TLegend *leg3;
1046  // if(tag==2) leg3 =new TLegend(0.65,0.60,0.90,0.90);
1047  if(tag==3 or 2) leg3 =new TLegend(0.70,0.28,0.78,0.58);
1048  leg3->AddEntry(g3," e^{+} & e^{-}","ep");
1049  leg3->AddEntry(g31," #pi^{+} & #pi^{-}","ep");
1050  if(tag==1 or 3) leg3->AddEntry(g32," K^{+} & K^{-}","ep");
1051  leg3->AddEntry(g33," p & #bar{p}","ep");
1052  leg3->Draw();
1053 
1055  canv->cd(4);
1056  TPad *pad4 = new TPad("pad4","pad4",0,0,0.99,0.99);
1057  pad4->Draw();
1058  pad4->cd();
1059 
1060  Ymin=0;
1061  Ymax=1.8;
1062  Xmin=0.0;
1063  Xmax=1.2;
1064 
1065  hframe0=gPad->DrawFrame(Xmin,Ymin,Xmax,Ymax);
1066  hframe0->GetXaxis()->SetTitle("x_{cut}<E_{EMCal}/p<1.5");
1067  //hframe0->GetXaxis()->CenterTitle();
1068  hframe0->GetYaxis()->SetTitle("Survival probability (%)");
1069  //hframe0->GetYaxis()->CenterTitle();
1070 
1071  TGraphErrors *g4,*g41,*g42,*g43;
1072  g4=new TGraphErrors(9,aa_EOP,cc_EOP,err_aa_EOP,err_cc_EOP);
1073  g4->SetMarkerStyle(26);
1074  g4->SetMarkerColor(1);
1075  g4->SetLineColor(1);
1076  g4->SetLineStyle(1);
1077  g4->SetLineWidth(1.2);
1078  g4->SetMarkerSize(3.0);
1079  g4->Draw("pc");
1080  g41=new TGraphErrors(9,aa_EOP,ee_EOP,err_aa_EOP,err_ee_EOP);
1081  g41->SetMarkerStyle(26);
1082  g41->SetMarkerColor(2);
1083  g41->SetLineColor(2);
1084  g41->SetLineStyle(1);
1085  g41->SetLineWidth(1.2);
1086  g41->SetMarkerSize(3.0);
1087  g41->Draw("pc");
1088  g42=new TGraphErrors(9,aa_EOP,ff_EOP,err_aa_EOP,err_ff_EOP);
1089  g42->SetMarkerStyle(26);
1090  g42->SetMarkerColor(3);
1091  g42->SetLineColor(3);
1092  g42->SetLineStyle(1);
1093  g42->SetLineWidth(1.2);
1094  g42->SetMarkerSize(3.0);
1095  if(tag==1 or 3) g42->Draw("pc");
1096  g43=new TGraphErrors(9,aa_EOP,hh_EOP,err_aa_EOP,err_hh_EOP);
1097  g43->SetMarkerStyle(26);
1098  g43->SetMarkerColor(4);
1099  g43->SetLineColor(4);
1100  g43->SetLineStyle(1);
1101  g43->SetLineWidth(1.2);
1102  g43->SetMarkerSize(3.0);
1103  g43->Draw("pc");
1104 
1105  TLegend *legtitle4 =new TLegend(0.20,0.85,0.35,0.92,"#it{#bf{sPHENIX}} Simulation Internal");
1106  legtitle4->SetTextSize(0.035);
1107  legtitle4->Draw();
1108 
1109  TLegend *legtitle41;
1110  if(tag==2)legtitle41 =new TLegend(0.20,0.82,0.35,0.85,"Embed");
1111  if(tag==1 or 3)legtitle41 =new TLegend(0.20,0.82,0.35,0.85,"Single particle");
1112  legtitle41->SetTextSize(0.030);
1113  legtitle41->Draw();
1114 
1115  TLegend *leg4 =new TLegend(0.65,0.60,0.90,0.90);
1116  leg4->AddEntry(g4," e^{+} & e^{-}","ep");
1117  leg4->AddEntry(g41," #pi^{+} & #pi^{-}","ep");
1118  if(tag==1 or 3) leg4->AddEntry(g42," K^{+} & K^{-}","ep");
1119  leg4->AddEntry(g43," p & #bar{p}","ep");
1120  leg4->Draw();
1121 
1123  canv->cd(5);
1124  TPad *pad5 = new TPad("pad5","pad5",0,0,0.99,0.99);
1125  pad5->Draw();
1126  pad5->cd();
1127  // pad5->SetFrameLineWidth(2);
1128  // pad5->SetFrameLineColor(1);
1129 
1130  Ymin=0.0;
1131  Ymax=1.3;
1132  Xmin=0.0;
1133  Xmax=1.2;
1134 
1135  hframe0=gPad->DrawFrame(Xmin,Ymin,Xmax,Ymax);
1136  hframe0->GetXaxis()->SetTitle("(E_{iHCal}+E_{oHCal})/E_{EMCal}>x_{cut}");
1137  // hframe0->GetXaxis()->CenterTitle();
1138  hframe0->GetYaxis()->SetTitle("Survival probability (%)");
1139  // hframe0->GetYaxis()->CenterTitle();
1140 
1141  TGraphErrors *g5,*g51,*g52,*g53;
1142  g5=new TGraphErrors(20,aa_HOP,cc_HOP,err_aa_HOP,err_cc_HOP);
1143  g5->SetMarkerStyle(26);
1144  g5->SetMarkerColor(1);
1145  g5->SetLineColor(1);
1146  g5->SetLineStyle(1);
1147  g5->SetLineWidth(1.2);
1148  g5->SetMarkerSize(3.0);
1149  g5->Draw("pc");
1150  g51=new TGraphErrors(20,aa_HOP,ee_HOP,err_aa_HOP,err_ee_HOP);
1151  g51->SetMarkerStyle(26);
1152  g51->SetMarkerColor(2);
1153  g51->SetLineColor(2);
1154  g51->SetLineStyle(1);
1155  g51->SetLineWidth(1.2);
1156  g51->SetMarkerSize(3.0);
1157  g51->Draw("pc");
1158  g52=new TGraphErrors(20,aa_HOP,ff_HOP,err_aa_HOP,err_ff_HOP);
1159  g52->SetMarkerStyle(26);
1160  g52->SetMarkerColor(3);
1161  g52->SetLineColor(3);
1162  g52->SetLineStyle(1);
1163  g52->SetLineWidth(1.2);
1164  g52->SetMarkerSize(3.0);
1165  if(tag==1 or 3) g52->Draw("pc");
1166  g53=new TGraphErrors(20,aa_HOP,hh_HOP,err_aa_HOP,err_hh_HOP);
1167  g53->SetMarkerStyle(26);
1168  g53->SetMarkerColor(4);
1169  g53->SetLineColor(4);
1170  g53->SetLineStyle(1);
1171  g53->SetLineWidth(1.2);
1172  g53->SetMarkerSize(3.0);
1173  g53->Draw("pc");
1174 
1175  TLegend *legtitle5 =new TLegend(0.20,0.85,0.35,0.92,"#it{#bf{sPHENIX}} Simulation Internal");
1176  legtitle5->SetTextSize(0.035);
1177  legtitle5->Draw();
1178 
1179  TLegend *legtitle51;
1180  if(tag==2)legtitle51 =new TLegend(0.20,0.82,0.35,0.85,"Embed");
1181  if(tag==1 or 3)legtitle51 =new TLegend(0.20,0.82,0.35,0.85,"Single particle");
1182  legtitle51->SetTextSize(0.030);
1183  legtitle51->Draw();
1184 
1185  TLegend *leg5 =new TLegend(0.65,0.60,0.90,0.90);
1186  leg5->AddEntry(g5," e^{+} & e^{-}","ep");
1187  leg5->AddEntry(g51," #pi^{+} & #pi^{-}","ep");
1188  if(tag==1 or 3) leg5->AddEntry(g52," K^{+} & K^{-}","ep");
1189  leg5->AddEntry(g53," p & #bar{p}","ep");
1190  leg5->Draw();
1191 
1193  canv->cd(6);
1194  TPad *pad6 = new TPad("pad6","pad6",0,0,0.99,0.99);
1195  pad6->Draw();
1196  pad6->cd();
1197 
1198  if(tag==2){
1199  Ymin=1.0;
1200  Ymax=10000.0;
1201  Xmin=0.6;
1202  Xmax=1.0;
1203  }
1204  if(tag==1 or 3){
1205  Ymin=1.0;
1206  Ymax=100000.0;
1207  Xmin=0.45;
1208  Xmax=1.0;
1209  }
1210  gPad->SetLogy();
1211 
1212  hframe0=gPad->DrawFrame(Xmin,Ymin,Xmax,Ymax);
1213  hframe0->GetXaxis()->SetTitle("eID-Eff.-E_{EMCal}/p(%)");
1214  // hframe0->GetXaxis()->CenterTitle();
1215  hframe0->GetYaxis()->SetTitle("Rejection");
1216  // hframe0->GetYaxis()->CenterTitle();
1217 
1218 
1219  TGraphErrors *g61,*g62,*g63;
1220  g61=new TGraphErrors(9,cc_EOP,ree_EOP,err_cc_EOP,err_ree_EOP);
1221  g61->SetMarkerStyle(26);
1222  g61->SetMarkerColor(2);
1223  g61->SetLineColor(2);
1224  g61->SetLineStyle(1);
1225  g61->SetLineWidth(1.2);
1226  g61->SetMarkerSize(3.0);
1227  g61->Draw("pl");
1228  g62=new TGraphErrors(9,cc_EOP,rff_EOP,err_cc_EOP,err_rff_EOP);
1229  g62->SetMarkerStyle(26);
1230  g62->SetMarkerColor(3);
1231  g62->SetLineColor(3);
1232  g62->SetLineStyle(1);
1233  g62->SetLineWidth(1.2);
1234  g62->SetMarkerSize(3.0);
1235  if(tag==1 or 3) g62->Draw("pl");
1236  g63=new TGraphErrors(9,cc_EOP,rhh_EOP,err_cc_EOP,err_rhh_EOP);
1237  g63->SetMarkerStyle(26);
1238  g63->SetMarkerColor(4);
1239  g63->SetLineColor(4);
1240  g63->SetLineStyle(1);
1241  g63->SetLineWidth(1.2);
1242  g63->SetMarkerSize(3.0);
1243  g63->Draw("pl");
1244 
1245  TLegend *legtitle6 =new TLegend(0.20,0.85,0.35,0.92,"#it{#bf{sPHENIX}} Simulation Internal");
1246  legtitle6->SetTextSize(0.035);
1247  legtitle6->Draw();
1248 
1249  TLegend *legtitle61;
1250  if(tag==2)legtitle61 =new TLegend(0.20,0.82,0.35,0.85,"Embed");
1251  if(tag==1 or 3)legtitle61 =new TLegend(0.20,0.82,0.35,0.85,"Single particle");
1252  legtitle61->SetTextSize(0.030);
1253  legtitle61->Draw();
1254 
1255  TLegend *leg6 =new TLegend(0.65,0.65,0.90,0.90);
1256  leg6->AddEntry(g61," #pi^{+} & #pi^{-}","lep");
1257  if(tag==1 or 3) leg6->AddEntry(g62," K^{+} & K^{-}","lep");
1258  leg6->AddEntry(g63," p & #bar{p}","lep");
1259  leg6->Draw();
1260 
1262  canv->cd(7);
1263  TPad *pad7 = new TPad("pad7","pad7",0,0,0.99,0.99);
1264  pad7->Draw();
1265  pad7->cd();
1266  if(tag==1){
1267  Ymin=1.0;
1268  Ymax=50.0;
1269  Xmin=0.88;
1270  Xmax=1.0;
1271  }
1272  if(tag==2){
1273  Ymin=1.0;
1274  Ymax=50;
1275  Xmin=0.7;
1276  Xmax=1.0;
1277  }
1278  if(tag==3){
1279  Ymin=1.0;
1280  Ymax=50.0;
1281  Xmin=0.85;
1282  Xmax=0.93;
1283  }
1284  gPad->SetLogy();
1285 
1286  hframe0=gPad->DrawFrame(Xmin,Ymin,Xmax,Ymax);
1287  hframe0->GetXaxis()->SetTitle("eID-Eff.-E_{iHCal}/E_{EMCal}(%)");
1288  // hframe0->GetXaxis()->CenterTitle();
1289  hframe0->GetYaxis()->SetTitle("Rejection");
1290  // hframe0->GetYaxis()->CenterTitle();
1291 
1292 
1293  TGraphErrors *g71,*g72,*g73;
1294  g71=new TGraphErrors(20,cc_HOM,ree_HOM,err_cc_HOM,err_ree_HOM);
1295  g71->SetMarkerStyle(26);
1296  g71->SetMarkerColor(2);
1297  g71->SetLineColor(2);
1298  g71->SetLineStyle(1);
1299  g71->SetLineWidth(1.2);
1300  g71->SetMarkerSize(3.0);
1301  g71->Draw("pl");
1302  g72=new TGraphErrors(20,cc_HOM,rff_HOM,err_cc_HOM,err_rff_HOM);
1303  g72->SetMarkerStyle(26);
1304  g72->SetMarkerColor(3);
1305  g72->SetLineColor(3);
1306  g72->SetLineStyle(1);
1307  g72->SetLineWidth(1.2);
1308  g72->SetMarkerSize(3.0);
1309  if(tag==1 or 3) g72->Draw("pl");
1310  g73=new TGraphErrors(20,cc_HOM,rhh_HOM,err_cc_HOM,err_rhh_HOM);
1311  g73->SetMarkerStyle(26);
1312  g73->SetMarkerColor(4);
1313  g73->SetLineColor(4);
1314  g73->SetLineStyle(1);
1315  g73->SetLineWidth(1.2);
1316  g73->SetMarkerSize(3.0);
1317  g73->Draw("pl");
1318 
1319  TLegend *legtitle7 =new TLegend(0.20,0.85,0.35,0.92,"#it{#bf{sPHENIX}} Simulation Internal");
1320  legtitle7->SetTextSize(0.035);
1321  legtitle7->Draw();
1322 
1323  TLegend *legtitle71;
1324  if(tag==2)legtitle71 =new TLegend(0.20,0.82,0.35,0.85,"Embed");
1325  if(tag==1 or 3)legtitle71 =new TLegend(0.20,0.82,0.35,0.85,"Single particle");
1326  legtitle71->SetTextSize(0.030);
1327  legtitle71->Draw();
1328 
1329  TLegend *leg7 =new TLegend(0.65,0.65,0.90,0.90);
1330  leg7->SetBorderSize(0);
1331  leg7->AddEntry(g71," #pi^{+} & #pi^{-}","lep");
1332  if(tag==1 or 3) leg7->AddEntry(g72," K^{+} & K^{-}","lep");
1333  leg7->AddEntry(g73," p & #bar{p}","lep");
1334  leg7->Draw();
1335 
1337  canv->cd(8);
1338  TPad *pad8 = new TPad("pad8","pad8",0,0,0.99,0.99);
1339  pad8->Draw();
1340  pad8->cd();
1341  if(tag==2){
1342  Ymin=1.0;
1343  Ymax=20.0;
1344  Xmin=0.0;
1345  Xmax=0.4;
1346  }
1347  if(tag==1 or 3){
1348  Ymin=1.0;
1349  Ymax=500.0;
1350  Xmin=0.0;
1351  Xmax=0.06;
1352  }
1353  gPad->SetLogy();
1354 
1355  hframe0=gPad->DrawFrame(Xmin,Ymin,Xmax,Ymax);
1356  hframe0->GetXaxis()->SetTitle("eID-Eff.-(E_{iHCal}+E_{oHCal})/E_{EMCal}(%)");
1357  // hframe0->GetXaxis()->CenterTitle();
1358  hframe0->GetYaxis()->SetTitle("Rejection");
1359  // hframe0->GetYaxis()->CenterTitle();
1360 
1361 
1362  TGraphErrors *g81,*g82,*g83;
1363  g81=new TGraphErrors(20,cc_HOP,ree_HOP,err_cc_HOP,err_ree_HOP);
1364  g81->SetMarkerStyle(26);
1365  g81->SetMarkerColor(2);
1366  g81->SetLineColor(2);
1367  g81->SetLineStyle(1);
1368  g81->SetLineWidth(1.2);
1369  g81->SetMarkerSize(3.0);
1370  g81->Draw("pl");
1371  g82=new TGraphErrors(20,cc_HOP,rff_HOP,err_cc_HOP,err_rff_HOP);
1372  g82->SetMarkerStyle(26);
1373  g82->SetMarkerColor(3);
1374  g82->SetLineColor(3);
1375  g82->SetLineStyle(1);
1376  g82->SetLineWidth(1.2);
1377  g82->SetMarkerSize(3.0);
1378  if(tag==1 or 3) g82->Draw("pl");
1379  g83=new TGraphErrors(20,cc_HOP,rhh_HOP,err_cc_HOP,err_rhh_HOP);
1380  g83->SetMarkerStyle(26);
1381  g83->SetMarkerColor(4);
1382  g83->SetLineColor(4);
1383  g83->SetLineStyle(1);
1384  g83->SetLineWidth(1.2);
1385  g83->SetMarkerSize(3.0);
1386  g83->Draw("pl");
1387 
1388  TLegend *legtitle8 =new TLegend(0.20,0.85,0.35,0.92,"#it{#bf{sPHENIX}} Simulation Internal");
1389  legtitle8->SetTextSize(0.035);
1390  legtitle8->Draw();
1391 
1392  TLegend *legtitle81;
1393  if(tag==2)legtitle81 =new TLegend(0.20,0.82,0.35,0.85,"Embed");
1394  if(tag==1 or 3)legtitle81 =new TLegend(0.20,0.82,0.35,0.85,"Single particle");
1395  legtitle81->SetTextSize(0.030);
1396  legtitle81->Draw();
1397 
1398  TLegend *leg8 =new TLegend(0.65,0.65,0.90,0.90);
1399  leg8->AddEntry(g81," #pi^{+} & #pi^{-}","lep");
1400  if(tag==1 or 3) leg8->AddEntry(g82," K^{+} & K^{-}","lep");
1401  leg8->AddEntry(g83," p & #bar{p}","lep");
1402  leg8->Draw();
1403 
1405  canv->cd(9);
1406  TPad *pad9 = new TPad("pad9","pad9",0,0,0.99,0.99);
1407  pad9->Draw();
1408  pad9->cd();
1409  if(tag==2){
1410  Ymin=1.0;
1411  Ymax=5000.0;
1412  Xmin=0.0;
1413  Xmax=1.0;
1414  }
1415  if(tag==1 or 3){
1416  Ymin=1.0;
1417  Ymax=30000.0;
1418  Xmin=0.0;
1419  Xmax=1.0;
1420  }
1421  gPad->SetLogy();
1422 
1423  hframe0=gPad->DrawFrame(Xmin,Ymin,Xmax,Ymax);
1424  hframe0->GetXaxis()->SetTitle("eID-Eff.(%)");
1425  // hframe0->GetXaxis()->CenterTitle();
1426  hframe0->GetYaxis()->SetTitle("Rejection");
1427  // hframe0->GetYaxis()->CenterTitle();
1428 
1429 
1430  TGraphErrors *g91,*g92,*g93;
1431  if(tag==1 or 3)g91=new TGraphErrors(11,cc_eta,ree_eta,err_cc_eta,err_ree_eta);
1432  if(tag==2)g91=new TGraphErrors(10,cc_eta,ree_eta,err_cc_eta,err_ree_eta);
1433  g91->SetMarkerStyle(26);
1434  g91->SetMarkerColor(2);
1435  g91->SetLineColor(2);
1436  g91->SetLineStyle(1);
1437  g91->SetLineWidth(1.2);
1438  g91->SetMarkerSize(3.0);
1439  g91->Draw("p");
1440  g92=new TGraphErrors(11,cc_eta,rff_eta,err_cc_eta,err_rff_eta);
1441  g92->SetMarkerStyle(26);
1442  g92->SetMarkerColor(3);
1443  g92->SetLineColor(3);
1444  g92->SetLineStyle(1);
1445  g92->SetLineWidth(1.2);
1446  g92->SetMarkerSize(3.0);
1447  if(tag==1 or 3) g92->Draw("p");
1448  if(tag==1 or 3)g93=new TGraphErrors(11,cc_eta,rhh_eta,err_cc_eta,err_rhh_eta);
1449  if(tag==2)g93=new TGraphErrors(10,cc_eta,rhh_eta,err_cc_eta,err_rhh_eta);
1450  g93->SetMarkerStyle(26);
1451  g93->SetMarkerColor(4);
1452  g93->SetLineColor(4);
1453  g93->SetLineStyle(1);
1454  g93->SetLineWidth(1.2);
1455  g93->SetMarkerSize(3.0);
1456  g93->Draw("p");
1457 
1458  TLegend *legtitle9 =new TLegend(0.20,0.85,0.35,0.92,"#it{#bf{sPHENIX}} Simulation Internal");
1459  legtitle9->SetTextSize(0.035);
1460  legtitle9->Draw();
1461 
1462  TLegend *legtitle91;
1463  if(tag==2)legtitle91 =new TLegend(0.20,0.82,0.35,0.85,"Embed");
1464  if(tag==1 or 3)legtitle91 =new TLegend(0.20,0.82,0.35,0.85,"Single particle");
1465  legtitle91->SetTextSize(0.030);
1466  legtitle91->Draw();
1467 
1468  TLegend *legtitle92 =new TLegend(0.20,0.78,0.35,0.80,"@:0.7<E_{EMCal}/p<1.5 & E_{iHCal}/E_{EMCal}<0.2");
1469  legtitle92->SetTextSize(0.028);
1470  legtitle92->Draw();
1471 
1472  TLegend *legtitle93 =new TLegend(0.20,0.72,0.35,0.76,"@:p_{t}>2GeV");
1473  legtitle93->SetTextSize(0.028);
1474  legtitle93->Draw();
1475 
1476  TLegend *leg9 =new TLegend(0.65,0.65,0.90,0.90);
1477  leg9->AddEntry(g91," #pi^{+} & #pi^{-}","lep");
1478  if(tag==1 or 3) leg9->AddEntry(g92," K^{+} & K^{-}","lep");
1479  leg9->AddEntry(g93," p & #bar{p}","lep");
1480  leg9->Draw();
1481 
1483  canv->cd(10);
1484  TPad *pad10 = new TPad("pad10","pad10",0,0,0.99,0.99);
1485  pad10->Draw();
1486  pad10->cd();
1487  if(tag==2){
1488  Ymin=1.0;
1489  Ymax=5000.0;
1490  Xmin=0.0;
1491  Xmax=1.0;
1492  }
1493  if(tag==1 or 3){
1494  Ymin=1.0;
1495  Ymax=30000.0;
1496  Xmin=0.3;
1497  Xmax=1.0;
1498  }
1499  gPad->SetLogy();
1500 
1501  hframe0=gPad->DrawFrame(Xmin,Ymin,Xmax,Ymax);
1502  hframe0->GetXaxis()->SetTitle("eID-Eff.-p_{t}(%)");
1503  // hframe0->GetXaxis()->CenterTitle();
1504  hframe0->GetYaxis()->SetTitle("Rejection");
1505  // hframe0->GetYaxis()->CenterTitle();
1506 
1507 
1508  TGraphErrors *g101,*g102,*g103;
1509  if(tag==1 or 3)g101=new TGraphErrors(16,cc_pt,ree_pt,err_cc_pt,err_ree_pt);
1510  if(tag==2)g101=new TGraphErrors(14,cc_pt,ree_pt,err_cc_pt,err_ree_pt);
1511  g101->SetMarkerStyle(26);
1512  g101->SetMarkerColor(2);
1513  g101->SetLineColor(2);
1514  g101->SetLineStyle(1);
1515  g101->SetLineWidth(1.2);
1516  g101->SetMarkerSize(3.0);
1517  g101->Draw("p");
1518  g102=new TGraphErrors(16,cc_pt,rff_pt,err_cc_pt,err_rff_pt);
1519  g102->SetMarkerStyle(26);
1520  g102->SetMarkerColor(3);
1521  g102->SetLineColor(3);
1522  g102->SetLineStyle(1);
1523  g102->SetLineWidth(1.2);
1524  g102->SetMarkerSize(3.0);
1525  if(tag==1 or 3) g102->Draw("p");
1526  if(tag==1 or 3)g103=new TGraphErrors(16,cc_pt,rhh_pt,err_cc_pt,err_rhh_pt);
1527  if(tag==2)g103=new TGraphErrors(14,cc_pt,rhh_pt,err_cc_pt,err_rhh_pt);
1528  g103->SetMarkerStyle(26);
1529  g103->SetMarkerColor(4);
1530  g103->SetLineColor(4);
1531  g103->SetLineStyle(1);
1532  g103->SetLineWidth(1.2);
1533  g103->SetMarkerSize(3.0);
1534  g103->Draw("p");
1535 
1536  TLegend *legtitle10 =new TLegend(0.20,0.85,0.35,0.92,"#it{#bf{sPHENIX}} Simulation Internal");
1537  legtitle10->SetTextSize(0.035);
1538  legtitle10->Draw();
1539 
1540  TLegend *legtitle101;
1541  if(tag==2)legtitle101 =new TLegend(0.20,0.82,0.35,0.85,"Embed");
1542  if(tag==1 or 3)legtitle101 =new TLegend(0.20,0.82,0.35,0.85,"Single particle");
1543  legtitle101->SetTextSize(0.030);
1544  legtitle101->Draw();
1545 
1546  TLegend *legtitle102 =new TLegend(0.20,0.78,0.35,0.80,"@:0.7<E_{EMCal}/p<1.5 & E_{iHCal}/E_{EMCal}<0.2");
1547  legtitle102->SetTextSize(0.028);
1548  legtitle102->Draw();
1549 
1550  TLegend *leg10 =new TLegend(0.65,0.65,0.90,0.90);
1551  leg10->AddEntry(g101," #pi^{+} & #pi^{-}","lep");
1552  if(tag==1 or 3) leg10->AddEntry(g102," K^{+} & K^{-}","lep");
1553  leg10->AddEntry(g103," p & #bar{p}","lep");
1554  leg10->Draw();
1555 
1556 
1557  canv->RedrawAxis();
1558  TString psname1;
1559  psname1=Form("%s.pdf",output_plot_eID);
1560  canv->Print(psname1);
1561 
1562 
1564  TCanvas *cv_EOP= new TCanvas("cv_EOP","cv_EOP Canvas",800,800);
1565  cv_EOP->cd();
1566  TPad *pad = new TPad("pad","pad",0,0,0.99,0.99);
1567  pad->Draw();
1568  pad->cd();
1569 
1570  Ymin=0;
1571  Ymax=1.8;
1572  Xmin=0.0;
1573  Xmax=1.2;
1574 
1575  hframe0=gPad->DrawFrame(Xmin,Ymin,Xmax,Ymax);
1576  hframe0->GetXaxis()->SetTitle("x_{cut}<E_{EMCal}/p<1.5");
1577  hframe0->GetYaxis()->SetTitle("Survival probability (%)");
1578 
1579  g4->Draw("pc");
1580  g41->Draw("pc");
1581  if(tag==1 or 3)g42->Draw("pc");
1582  g43->Draw("pc");
1583 
1584  legtitle4->Draw();
1585  legtitle41->Draw();
1586  leg4->Draw();
1587 
1588  cv_EOP->RedrawAxis();
1589  TString psname2,psname3;
1590  psname2=Form("%s_EOP.pdf",output_plot_eID);
1591  psname3=Form("%s_EOP.png",output_plot_eID);
1592  cv_EOP->Print(psname2);
1593  cv_EOP->Print(psname3);
1594 
1595 }
1596