Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:12:08

0001 //
0002 //  PIDplots.cc
0003 //  
0004 //  Author :    Weihu Ma
0005 //  Created:    04/2021
0006 //  Version:    1.0
0007 //
0008 #include <iostream>
0009 #include <fstream>
0010 #include <sstream>
0011 #include <stdlib.h>
0012 
0013 #include "omp.h"
0014 #include "PIDplots.h"
0015 #include "sPhenixStyle.h"
0016 #include "sPhenixStyle.C"
0017 
0018 using namespace std;
0019 //_________________________________________________________________
0020 //////////////////////////////////////////////////////////////////////////////////////////////////////int main
0021 int main(int argc, char **argv){
0022   printf("Starting the program, numargs = %d\n",argc);
0023   for(Int_t i=0;i<argc;i++) printf("arg #%d = %s\n",i,argv[i]);
0024   TROOT amdv_dens("amdv_dens", "amdv_dens");
0025   TApplication theApp("App", &argc, argv);
0026   
0027   const bool run_eID=true;
0028   
0029   PIDplots pidplots;
0030   
0031   pidplots.inputpars();
0032   
0033   pidplots.eID();
0034     
0035   printf("end.\n");
0036   
0037   return 0;
0038 }
0039    
0040 //////////////////////////
0041 void PIDplots::inputpars(){
0042   me=0.511*0.001;//Gev electron/positron mass
0043   mep=0.511*0.001;//Gev electron mass
0044   men=0.511*0.001;//Gev positron mass
0045   pi=TMath::Pi();
0046   
0047   tag=1;
0048   //tag=1 for upsilon/embed run; 
0049   //tag=2 for electron,pion,antiproton/embed run; 
0050   //tag=3 for single particles identification and efficiency;
0051  //////////////////////////////////////////////input and output
0052   if(tag==1){//tag=1 for upsilon run
0053     Nfile=13; //input number of files
0054     Nevent=2000; //event number of each Nfile (maximum number for ifiles)
0055     Nmpnbin=400;//bin number for plot; Nmpnbin=200 or 400; Nmpnbin<=400.
0056     
0057     rYs[0]=9755.0/13680.0;//Yield ratio of Upsilon 1S corresponding to the input_file[0]
0058     rYs[1]=2540.0/13680.0;//Yield ratio of Upsilon 2S corresponding to the input_file[1]
0059     rYs[2]=1400.0/13680.0;//Yield ratio of Upsilon 3S corresponding to the input_file[2]
0060     
0061     //single-Upsilon decay electrons
0062     input_file[0] ="/sphenix/u/weihuma/RunOutput/G4sPHENIX_upsilon_1s_2000_POSCOR_g4svtx_eval.root";//2000 events
0063     //input_file[1] ="/sphenix/u/weihuma/RunOutput/G4sPHENIX_upsilon_2s_2000_POSCOR_g4svtx_eval.root";//2000 events
0064     //input_file[2] ="/sphenix/u/weihuma/RunOutput/G4sPHENIX_upsilon_3s_2000_POSCOR_g4svtx_eval.root";//2000 events
0065 
0066     input_file[1] ="/sphenix/u/weihuma/RunOutput/G4sPHENIX_pi-_1000_0_POSCOR_g4svtx_eval.root";//1000 events
0067     input_file[2] ="/sphenix/u/weihuma/RunOutput/G4sPHENIX_pi-_1000_1_POSCOR_g4svtx_eval.root";//1000 events
0068     input_file[3] ="/sphenix/u/weihuma/RunOutput/G4sPHENIX_pi-_1000_2_POSCOR_g4svtx_eval.root";//1000 events
0069     input_file[4] ="/sphenix/u/weihuma/RunOutput/G4sPHENIX_pi-_1000_3_POSCOR_g4svtx_eval.root";//1000 events
0070     input_file[5] ="/sphenix/u/weihuma/RunOutput/G4sPHENIX_K-_1000_0_POSCOR_g4svtx_eval.root";//1000 events
0071     input_file[6] ="/sphenix/u/weihuma/RunOutput/G4sPHENIX_K-_1000_1_POSCOR_g4svtx_eval.root";//1000 events
0072     input_file[7] ="/sphenix/u/weihuma/RunOutput/G4sPHENIX_K-_1000_2_POSCOR_g4svtx_eval.root";//1000 events
0073     input_file[8] ="/sphenix/u/weihuma/RunOutput/G4sPHENIX_K-_1000_3_POSCOR_g4svtx_eval.root";//1000 events
0074     input_file[9] ="/sphenix/u/weihuma/RunOutput/G4sPHENIX_antiproton_0_1000_POSCOR_g4svtx_eval.root";//1000 events
0075     input_file[10] ="/sphenix/u/weihuma/RunOutput/G4sPHENIX_antiproton_1000_1_POSCOR_g4svtx_eval.root";//1000 events
0076     input_file[11] ="/sphenix/u/weihuma/RunOutput/G4sPHENIX_antiproton_1000_2_POSCOR_g4svtx_eval.root";//1000 events
0077     input_file[12] ="/sphenix/u/weihuma/RunOutput/G4sPHENIX_antiproton_1000_3_POSCOR_g4svtx_eval.root";//1000 events
0078     
0079     //embed-Upsilon decay electrons
0080     
0081     
0082     output_eID ="/sphenix/u/weihuma/analysis/TrackPid/anaplots/output/upsilon/eID_embed_upsilon.root";
0083     output_plot_eID ="/sphenix/u/weihuma/analysis/TrackPid/anaplots/output/upsilon/eID_plot_e+e-_embed_upsilon";
0084     output_plot_eID_eta ="/sphenix/u/weihuma/analysis/TrackPid/anaplots/output/upsilon/efficiency_eta_e+e-_embed_upsilon";
0085     output_plot_eID_pt ="/sphenix/u/weihuma/analysis/TrackPid/anaplots/output/upsilon/efficiency_pt_e+e-_embed_upsilon";
0086     output_plot_eID_HOM ="/sphenix/u/weihuma/analysis/TrackPid/anaplots/output/upsilon/efficiency_HOM_e+e-_embed_upsilon";
0087     output_plot_eID_HOP ="/sphenix/u/weihuma/analysis/TrackPid/anaplots/output/upsilon/efficiency_HOP_e+e-_embed_upsilon";
0088     output_plot_eID_EOP ="/sphenix/u/weihuma/analysis/TrackPid/anaplots/output/upsilon/efficiency_EOP_e+e-_embed_upsilon";
0089   }
0090   if(tag==2){//tag=2 for embed run
0091     Nfile=180; //input number of files
0092     Nevent=2000; //event number of each Nfile (maximum number for ifiles)
0093     Nmpnbin=400;//bin number for plot; Nmpnbin=200 or 400; Nmpnbin<=400.
0094 
0095     output_eID ="/sphenix/u/weihuma/analysis/TrackPid/anaplots/output/embed/eID_embed.root";
0096     output_plot_eID ="/sphenix/u/weihuma/analysis/TrackPid/anaplots/output/embed/eID_plot_e+e-_embed";
0097     output_plot_eID_eta ="/sphenix/u/weihuma/analysis/TrackPid/anaplots/output/embed/efficiency_eta_e+e-_embed";
0098     output_plot_eID_pt ="/sphenix/u/weihuma/analysis/TrackPid/anaplots/output/embed/efficiency_pt_e+e-_embed";
0099     output_plot_eID_HOM ="/sphenix/u/weihuma/analysis/TrackPid/anaplots/output/embed/efficiency_HOM_e+e-_embed";
0100     output_plot_eID_HOP ="/sphenix/u/weihuma/analysis/TrackPid/anaplots/output/embed/efficiency_HOP_e+e-_embed";
0101     output_plot_eID_EOP ="/sphenix/u/weihuma/analysis/TrackPid/anaplots/output/embed/efficiency_EOP_e+e-_embed";
0102   }
0103   
0104   if(tag==3){//tag=3 for single particle identification and efficiency
0105     Nfile=16; //input number of files
0106     Nevent=1000; //event number of each Nfile (maximum number for ifiles)
0107     Nmpnbin=200;//bin number for plot; Nmpnbin=200 or 400; Nmpnbin<=400. 
0108   
0109     input_file[0] ="/sphenix/u/weihuma/RunOutput/G4sPHENIX_e-_1000_0_POSCOR_g4svtx_eval.root";//1000 events
0110     input_file[1] ="/sphenix/u/weihuma/RunOutput/G4sPHENIX_e-_1000_1_POSCOR_g4svtx_eval.root";//1000 events
0111     input_file[2] ="/sphenix/u/weihuma/RunOutput/G4sPHENIX_e-_1000_2_POSCOR_g4svtx_eval.root";//1000 events
0112     input_file[3] ="/sphenix/u/weihuma/RunOutput/G4sPHENIX_e-_1000_3_POSCOR_g4svtx_eval.root";//1000 events
0113     input_file[4] ="/sphenix/u/weihuma/RunOutput/G4sPHENIX_pi-_1000_0_POSCOR_g4svtx_eval.root";//1000 events
0114     input_file[5] ="/sphenix/u/weihuma/RunOutput/G4sPHENIX_pi-_1000_1_POSCOR_g4svtx_eval.root";//1000 events
0115     input_file[6] ="/sphenix/u/weihuma/RunOutput/G4sPHENIX_pi-_1000_2_POSCOR_g4svtx_eval.root";//1000 events
0116     input_file[7] ="/sphenix/u/weihuma/RunOutput/G4sPHENIX_pi-_1000_3_POSCOR_g4svtx_eval.root";//1000 events
0117     input_file[8] ="/sphenix/u/weihuma/RunOutput/G4sPHENIX_K-_1000_0_POSCOR_g4svtx_eval.root";//1000 events
0118     input_file[9] ="/sphenix/u/weihuma/RunOutput/G4sPHENIX_K-_1000_1_POSCOR_g4svtx_eval.root";//1000 events
0119     input_file[10] ="/sphenix/u/weihuma/RunOutput/G4sPHENIX_K-_1000_2_POSCOR_g4svtx_eval.root";//1000 events
0120     input_file[11] ="/sphenix/u/weihuma/RunOutput/G4sPHENIX_K-_1000_3_POSCOR_g4svtx_eval.root";//1000 events
0121     input_file[12] ="/sphenix/u/weihuma/RunOutput/G4sPHENIX_antiproton_0_1000_POSCOR_g4svtx_eval.root";//1000 events
0122     input_file[13] ="/sphenix/u/weihuma/RunOutput/G4sPHENIX_antiproton_1000_1_POSCOR_g4svtx_eval.root";//1000 events
0123     input_file[14] ="/sphenix/u/weihuma/RunOutput/G4sPHENIX_antiproton_1000_2_POSCOR_g4svtx_eval.root";//1000 events
0124     input_file[15] ="/sphenix/u/weihuma/RunOutput/G4sPHENIX_antiproton_1000_3_POSCOR_g4svtx_eval.root";//1000 events
0125     
0126     output_eID ="/sphenix/u/weihuma/analysis/TrackPid/anaplots/output/single/eID_single.root";
0127     output_plot_eID ="/sphenix/u/weihuma/analysis/TrackPid/anaplots/output/single/eID_plot_single_antiproton";
0128     output_plot_eID_eta ="/sphenix/u/weihuma/analysis/TrackPid/anaplots/output/single/efficiency_eta_single";
0129     output_plot_eID_pt ="/sphenix/u/weihuma/analysis/TrackPid/anaplots/output/single/efficiency_pt_single";
0130     output_plot_eID_HOM ="/sphenix/u/weihuma/analysis/TrackPid/anaplots/output/single/efficiency_HOM_single";
0131     output_plot_eID_HOP ="/sphenix/u/weihuma/analysis/TrackPid/anaplots/output/single/efficiency_HOP_single";
0132     output_plot_eID_EOP ="/sphenix/u/weihuma/analysis/TrackPid/anaplots/output/single/efficiency_EOP_single";
0133   }
0134  
0135 }
0136 
0137 void PIDplots::fhistogram_eID(){  
0138   h1pt_e= new TH1F("h1pt_e","pt",200,0,20);
0139   h1EOP= new TH1F("h1EOP","cemce3x3/p",200,0,10);
0140   h1EOP_e= new TH1F("h1EOP_e","cemce3x3/p",200,0,10);
0141   h1HOM= new TH1F("h1HOM","hcalin3x3/cemce3x3",200,0,10);
0142   h1HOP= new TH1F("h1HOP","hcalin3x3+hcalout3x3/cemce3x3",200,0,10);
0143   
0144   h1dR= new TH1F("h1dR","dR",400,0,0.2);//dR=sqrt(deta*deta+dphi*dphi)
0145   h1gflavor= new TH1F("h1gflavor","Eop>0.8&Eop<1.2&hcaline3x3<0.2",2000,-1000,1000);
0146   
0147 }
0148 
0149 ///////////////////////////////////////////////////////////////////////////////////////////void PIDplots::eID()
0150 void PIDplots::eID(){
0151   fHistogramFile_eID = new TFile(output_eID,"RECREATE");
0152   fHistogramFile_eID->cd();
0153   fhistogram_eID();
0154   
0155   for(int i=0;i<50;i++){
0156       
0157     NEID_electron_eta[i]=0;
0158     NEID_electron_pt[i]=0;
0159     NEID_electron_HOM[i]=0;
0160     NEID_electron_EOP[i]=0;
0161     NEID_electron_HOP[i]=0;
0162     N_electron_eta[i]=0;
0163     N_electron_pt[i]=0;
0164     N_electron_HOM[i]=0;
0165     N_electron_EOP[i]=0;
0166     N_electron_HOP[i]=0;
0167     
0168     eta_point[i]=0.0;
0169     pt_point[i]=0.0;
0170     HOM_point[i]=0.0;
0171     HOP_point[i]=0.0;
0172     EOP_point[i]=0.0;
0173     
0174     N_pion_eta[i]=0;
0175     N_K_eta[i]=0;
0176     N_antiproton_eta[i]=0;
0177     
0178     N_pion_pt[i]=0;
0179     N_K_pt[i]=0;
0180     N_antiproton_pt[i]=0;
0181     
0182     N_pion_HOM[i]=0;
0183     N_K_HOM[i]=0;
0184     N_antiproton_HOM[i]=0;
0185     
0186     N_pion_HOP[i]=0;
0187     N_K_HOP[i]=0;
0188     N_antiproton_HOP[i]=0;
0189     
0190     N_pion_EOP[i]=0;
0191     N_K_EOP[i]=0;
0192     N_antiproton_EOP[i]=0;
0193     
0194     NEID_pion_eta[i]=0;
0195         NEID_K_eta[i]=0;
0196         NEID_antiproton_eta[i]=0;
0197     
0198     NEID_pion_pt[i]=0;
0199     NEID_K_pt[i]=0;
0200     NEID_antiproton_pt[i]=0;
0201     
0202   }
0203   NEID_electron=0; 
0204   NEID_pion=0;
0205   NEID_K=0; 
0206   NEID_antiproton=0;
0207   
0208 
0209   for(int ifile=0;ifile<Nfile;ifile++){
0210       TNtuple *ntp_vertex=0;
0211       TNtuple *ntp_gtrack=0;
0212       TNtuple *ntp_track=0;
0213       
0214       TFile *file3;
0215      // file3 = new TFile(input_file[ifile]);
0216       if(tag==1 or 3){
0217         file3 = new TFile(input_file[ifile]);
0218         file3->GetObject("ntp_vertex",ntp_vertex);
0219         file3->GetObject("ntp_gtrack",ntp_gtrack);
0220         file3->GetObject("ntp_track",ntp_track);
0221       }
0222       //////////
0223       int temifile=0;
0224       if(ifile<60) temifile=ifile+40;
0225       if(ifile>=60 && ifile<120) temifile=ifile+40-60;
0226       if(ifile>=120 && ifile<180) temifile=ifile+40-120;
0227       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);
0228       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);
0229       if(ifile>=120 && ifile<180){
0230             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);
0231             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);
0232       }
0233       if(gSystem->AccessPathName(input_file_embed)) {
0234             printf("no data existing for %s\n",input_file_embed);
0235             continue;
0236       }
0237       TFile file2(input_file_embed);
0238       if(tag==2){
0239         file2.GetObject("ntp_vertex",ntp_vertex);
0240         file2.GetObject("ntp_gtrack",ntp_gtrack);
0241         file2.GetObject("ntp_track",ntp_track);
0242         printf("inputfile: %s\n",input_file_embed);
0243       }
0244       
0245       //cout<<"ntp_vertex->GetEntries=  "<<ntp_vertex->GetEntries()<<endl;
0246      // cout<<"ntp_gtrack->GetEntries=  "<<ntp_gtrack->GetEntries()<<endl;
0247       cout<<"ntp_track->GetEntries=  "<<ntp_track->GetEntries()<<endl;
0248       
0249     
0250       for(int ientry=0;ientry<ntp_track->GetEntries();ientry++) {//ntp_track
0251          ntp_track->GetEntry(ientry);
0252          float *content2=ntp_track->GetArgs();  
0253          int event2=0,trackID2=0;
0254          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;
0255          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;
0256          float gflavor2=0;
0257 
0258             event2=content2[0];
0259             trackID2=content2[2];
0260             px2=content2[3];
0261             py2=content2[4];
0262             pz2=content2[5];
0263             pt2=content2[6];
0264             eta2=content2[7];
0265             phi2=content2[8];
0266             charge2=content2[12];
0267             quality2=content2[13];
0268             nhits2=content2[16];
0269             nmaps2=content2[17];
0270             nintt2=content2[18];
0271             ntpc2=content2[19];
0272             cemcdphi2=content2[43];
0273             cemcdeta2=content2[44];
0274             cemce3x32=content2[45];
0275             cemce2=content2[46];
0276             hcalindphi2=content2[47];
0277             hcalindeta2=content2[48];
0278             hcaline3x32=content2[49];
0279             hcaline2=content2[50];
0280             hcaloutdphi2=content2[51];
0281             hcaloutdeta2=content2[52];
0282             hcaloute3x32=content2[53];
0283             hcaloute2=content2[54];
0284             gflavor2=content2[56];
0285             gpt2=content2[69];
0286          
0287         
0288          float p2=TMath::Sqrt(px2*px2+py2*py2+pz2*pz2);
0289          float E2=TMath::Sqrt(me*me+p2*p2);
0290          float EOP=cemce3x32/p2;// E/p
0291          float HOP=(hcaline3x32+hcaloute3x32)/p2;// H/p
0292          float HOM=hcaline3x32/cemce3x32;// EHcalin/EEmcal
0293          float dR=TMath::Sqrt(cemcdphi2*cemcdphi2+cemcdeta2*cemcdeta2);
0294          float pt=TMath::Sqrt(px2*px2+py2*py2);
0295        
0296 
0297        if(nmaps2>0 && nintt2>0 && ntpc2>20 && quality2<10){
0298            
0299          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;
0300          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;
0301          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;
0302          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;
0303          cout<<"NEID_electron= "<<NEID_electron<<"NEID_pion= "<<NEID_pion<<"NEID_electron= "<<NEID_K<<"NEID_electron= "<<NEID_antiproton<<endl;
0304 
0305          if((TMath::Abs(eta2)>0.0 && TMath::Abs(eta2)<1.1) && (gpt2>0.0 && gpt2<20.0)){
0306             if(TMath::Abs(gflavor2)==11)h1pt_e->Fill(pt2);
0307             h1dR->Fill(dR);
0308             h1EOP->Fill(EOP);
0309             if(TMath::Abs(gflavor2)==11)h1EOP_e->Fill(EOP);
0310             h1HOM->Fill(HOM);
0311             h1HOP->Fill(HOP);
0312             h1gflavor->Fill(gflavor2);
0313          }
0314     
0315          for(int i=0;i<11;i++){
0316             eta_point[i]=i*1.0/10+0.05;
0317             if((TMath::Abs(eta2)>(eta_point[i]-0.05)) && (TMath::Abs(eta2)<(eta_point[i]+0.05)) && (gpt2>0.0 & gpt2<20.0)){
0318                 if(TMath::Abs(gflavor2)==11) N_electron_eta[i]=N_electron_eta[i]+1;
0319                 if(TMath::Abs(gflavor2)==211) N_pion_eta[i]=N_pion_eta[i]+1;
0320                 if(TMath::Abs(gflavor2)==321) N_K_eta[i]=N_K_eta[i]+1;
0321                 if(TMath::Abs(gflavor2)==2212) N_antiproton_eta[i]=N_antiproton_eta[i]+1;
0322             
0323                 if(EOP>0.7 && EOP<1.5 && HOM<0.2 && pt>2.0 ){
0324                     if(TMath::Abs(gflavor2)==11) NEID_electron_eta[i]=NEID_electron_eta[i]+1;               
0325                     if(TMath::Abs(gflavor2)==211) NEID_pion_eta[i]=NEID_pion_eta[i]+1;
0326                     if(TMath::Abs(gflavor2)==321) NEID_K_eta[i]=NEID_K_eta[i]+1;
0327                     if(TMath::Abs(gflavor2)==2212) NEID_antiproton_eta[i]=NEID_antiproton_eta[i]+1;
0328                     cout<<"NEID_pion_eta= "<<NEID_pion_eta[i]<<endl;
0329                 }
0330             }
0331          }
0332 
0333          for(int i=0;i<16;i++){
0334             pt_point[i]=i*10.0/10+0.5;
0335             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)){
0336                 if(TMath::Abs(gflavor2)==11) N_electron_pt[i]=N_electron_pt[i]+1;
0337                 if(TMath::Abs(gflavor2)==211) N_pion_pt[i]=N_pion_pt[i]+1;
0338                 if(TMath::Abs(gflavor2)==321) N_K_pt[i]=N_K_pt[i]+1;
0339                 if(TMath::Abs(gflavor2)==2212) N_antiproton_pt[i]=N_antiproton_pt[i]+1;
0340 
0341                 if(EOP>0.7 && EOP<1.5 && HOM<0.2){
0342                     if(TMath::Abs(gflavor2)==11) NEID_electron_pt[i]=NEID_electron_pt[i]+1;     
0343                     if(TMath::Abs(gflavor2)==211) NEID_pion_pt[i]=NEID_pion_pt[i]+1;
0344                     if(TMath::Abs(gflavor2)==321) NEID_K_pt[i]=NEID_K_pt[i]+1;
0345                     if(TMath::Abs(gflavor2)==2212) NEID_antiproton_pt[i]=NEID_antiproton_pt[i]+1;
0346                     cout<<"NEID_pion_pt= "<<NEID_pion_pt[i]<<endl;
0347                 }
0348             }
0349          }
0350 
0351          for(int i=0;i<20;i++){
0352             HOM_point[i]=i*0.5/10+0.05;
0353             if(HOM<HOM_point[i] && (TMath::Abs(eta2)>0.0 && TMath::Abs(eta2)<1.1) && (gpt2>0.0 && gpt2<20.0)){
0354                 if(TMath::Abs(gflavor2)==11) N_electron_HOM[i]=N_electron_HOM[i]+1;
0355                 if(TMath::Abs(gflavor2)==211) N_pion_HOM[i]=N_pion_HOM[i]+1;
0356                 if(TMath::Abs(gflavor2)==321) N_K_HOM[i]=N_K_HOM[i]+1;
0357                 if(TMath::Abs(gflavor2)==2212) N_antiproton_HOM[i]=N_antiproton_HOM[i]+1;
0358             }
0359         }
0360         
0361          for(int i=0;i<20;i++){
0362             HOP_point[i]=i*0.5/10+0.05;
0363             if(HOP>HOP_point[i] && (TMath::Abs(eta2)>0.0 && TMath::Abs(eta2)<1.1) && (gpt2>0.0 && gpt2<20.0)){
0364                 if(TMath::Abs(gflavor2)==11) N_electron_HOP[i]=N_electron_HOP[i]+1;
0365                 if(TMath::Abs(gflavor2)==211) N_pion_HOP[i]=N_pion_HOP[i]+1;
0366                 if(TMath::Abs(gflavor2)==321) N_K_HOP[i]=N_K_HOP[i]+1;
0367                 if(TMath::Abs(gflavor2)==2212) N_antiproton_HOP[i]=N_antiproton_HOP[i]+1;
0368             }
0369          }
0370       
0371          for(int i=0;i<9;i++){
0372             EOP_point[i]=1.0-i*1.0/10;
0373             if(EOP>EOP_point[i] && EOP<1.5 && (TMath::Abs(eta2)>0.0 && TMath::Abs(eta2)<1.1) && (gpt2>0.0 && gpt2<20.0)){
0374                 if(TMath::Abs(gflavor2)==11) N_electron_EOP[i]=N_electron_EOP[i]+1;
0375                 if(TMath::Abs(gflavor2)==211) N_pion_EOP[i]=N_pion_EOP[i]+1;
0376                 if(TMath::Abs(gflavor2)==321) N_K_EOP[i]=N_K_EOP[i]+1;
0377                 if(TMath::Abs(gflavor2)==2212) N_antiproton_EOP[i]=N_antiproton_EOP[i]+1;
0378             }
0379          }
0380          
0381        }//if(nmaps2>1 && nintt2>1 && ntpc2>25){
0382     
0383     }//for(int ientry=0;ientry<ntp_track->GetEntries();ientry++) { 
0384   }//for(int ifile=0;ifile<1;ifile++){
0385     
0386   eIDoutput();
0387   fHistogramFile_eID->Write();
0388   fHistogramFile_eID->Close();
0389   
0390 }//end of PIDplots::eID()
0391 
0392 void PIDplots::eIDoutput(){  
0393   float aa_eta[20],cc_eta[20],ee_eta[20],ff_eta[20],hh_eta[20];
0394   float aa_pt[20],cc_pt[20],ee_pt[20],ff_pt[20],hh_pt[20];
0395   float aa_HOM[20],cc_HOM[20],ee_HOM[20],ff_HOM[20],hh_HOM[20];
0396   float aa_HOP[20],cc_HOP[20],ee_HOP[20],ff_HOP[20],hh_HOP[20];
0397   float aa_EOP[20],cc_EOP[20],ee_EOP[20],ff_EOP[20],hh_EOP[20];
0398   float ree_eta[20],rff_eta[20],rhh_eta[20],ree_pt[20],rff_pt[20],rhh_pt[20];
0399   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];
0400   
0401   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];
0402   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];
0403   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];
0404   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];
0405   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];
0406   
0407   for(int i=0;i<20;i++){
0408     aa_eta[i]=0.0;
0409         cc_eta[i]=0.0;
0410     ee_eta[i]=0.0;
0411     ff_eta[i]=0.0;
0412     hh_eta[i]=0.0;
0413         ree_eta[i]=0.0;
0414     rff_eta[i]=0.0;
0415     rhh_eta[i]=0.0;
0416         err_ree_eta[i]=0.0;
0417     err_rff_eta[i]=0.0;
0418     err_rhh_eta[i]=0.0;
0419     
0420     aa_pt[i]=0.0;
0421         cc_pt[i]=0.0;
0422     ee_pt[i]=0.0;
0423     ff_pt[i]=0.0;
0424     hh_pt[i]=0.0;
0425         ree_pt[i]=0.0;
0426     rff_pt[i]=0.0;
0427     rhh_pt[i]=0.0;
0428         err_ree_pt[i]=0.0;
0429     err_rff_pt[i]=0.0;
0430     err_rhh_pt[i]=0.0;
0431     
0432     aa_HOM[i]=0.0;
0433     cc_HOM[i]=0.0;
0434     ee_HOM[i]=0.0;
0435     ff_HOM[i]=0.0;
0436     hh_HOM[i]=0.0;
0437         ree_HOM[i]=0.0;
0438     rff_HOM[i]=0.0;
0439     rhh_HOM[i]=0.0;
0440         err_ree_HOM[i]=0.0;
0441     err_rff_HOM[i]=0.0;
0442     err_rhh_HOM[i]=0.0;
0443     
0444         aa_HOP[i]=0.0;
0445     cc_HOP[i]=0.0;
0446     ee_HOP[i]=0.0;
0447     ff_HOP[i]=0.0;
0448     hh_HOP[i]=0.0;
0449         ree_HOP[i]=0.0;
0450     rff_HOP[i]=0.0;
0451     rhh_HOP[i]=0.0;
0452         err_ree_HOP[i]=0.0;
0453     err_rff_HOP[i]=0.0;
0454     err_rhh_HOP[i]=0.0;
0455     
0456     aa_EOP[i]=0.0;
0457     cc_EOP[i]=0.0;
0458     ee_EOP[i]=0.0;
0459     ff_EOP[i]=0.0;
0460     hh_EOP[i]=0.0;
0461         ree_EOP[i]=0.0;
0462     rff_EOP[i]=0.0;
0463     rhh_EOP[i]=0.0;
0464         err_ree_EOP[i]=0.0;
0465     err_rff_EOP[i]=0.0;
0466     err_rhh_EOP[i]=0.0;
0467     
0468     
0469     err_aa_eta[i]=0.0;
0470         err_cc_eta[i]=0.0;
0471     err_ee_eta[i]=0.0;
0472     err_ff_eta[i]=0.0;
0473     err_hh_eta[i]=0.0;
0474     
0475     err_aa_pt[i]=0.0;
0476     err_cc_pt[i]=0.0;
0477     err_ee_pt[i]=0.0;
0478     err_ff_pt[i]=0.0;
0479     err_hh_pt[i]=0.0;
0480     
0481     err_aa_HOM[i]=0.0;
0482     err_cc_HOM[i]=0.0;
0483     err_ee_HOM[i]=0.0;
0484     err_ff_HOM[i]=0.0;
0485     err_hh_HOM[i]=0.0;
0486     
0487         err_aa_HOP[i]=0.0;
0488     err_cc_HOP[i]=0.0;
0489     err_ee_HOP[i]=0.0;
0490     err_ff_HOP[i]=0.0;
0491     err_hh_HOP[i]=0.0;
0492 
0493     
0494     err_aa_EOP[i]=0.0;
0495     err_cc_EOP[i]=0.0;
0496     err_ee_EOP[i]=0.0;
0497     err_ff_EOP[i]=0.0;
0498     err_hh_EOP[i]=0.0;
0499 
0500     
0501     
0502   }
0503   //////////////////////////////////////////////////////////////eta
0504   FILE *outfile1;
0505   TString fname1;
0506   fname1 = Form("%s.dat",output_plot_eID_eta);
0507   outfile1 =fopen(fname1.Data(),"w");
0508   int Nplot_electron_eta=0,Nplot_pion_eta=0,Nplot_K_eta=0,Nplot_antiproton_eta=0;
0509   for(int i=0;i<11;i++){
0510    // 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;
0511    // 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;
0512     
0513     aa_eta[i]=eta_point[i];
0514     err_aa_eta[i]=0.05;
0515     if(N_electron_eta[i]>0 && NEID_electron_eta[i]>0){
0516         cc_eta[i]=1.0*NEID_electron_eta[i]/N_electron_eta[i];
0517         err_cc_eta[i]=1.0*TMath::Sqrt((1.0/NEID_electron_eta[i]+1.0/N_electron_eta[i]))*cc_eta[i];
0518         Nplot_electron_eta=Nplot_electron_eta+1;
0519     }
0520     if(N_pion_eta[i]>0 && NEID_pion_eta[i]>0){
0521         ee_eta[i]=1.0*NEID_pion_eta[i]/N_pion_eta[i];
0522         err_ee_eta[i]=1.0*TMath::Sqrt((1.0/NEID_pion_eta[i]+1.0/N_pion_eta[i]))*ee_eta[i];
0523         Nplot_pion_eta=Nplot_pion_eta+1;
0524     }
0525     if(N_K_eta[i]>0 && NEID_K_eta[i]>0){
0526         ff_eta[i]=1.0*NEID_K_eta[i]/N_K_eta[i];
0527         err_ff_eta[i]=1.0*TMath::Sqrt((1.0/NEID_K_eta[i]+1.0/N_K_eta[i]))*ff_eta[i];
0528         Nplot_K_eta=Nplot_K_eta+1;
0529     }
0530     if(N_antiproton_eta[i]>0 && NEID_antiproton_eta[i]>0){
0531         hh_eta[i]=1.0*NEID_antiproton_eta[i]/N_antiproton_eta[i];
0532         err_hh_eta[i]=1.0*TMath::Sqrt((1.0/NEID_antiproton_eta[i]+1.0/N_antiproton_eta[i]))*hh_eta[i];
0533         Nplot_antiproton_eta=Nplot_antiproton_eta+1;
0534     }
0535       
0536     float aa,cc,ee,ff,hh;
0537     float err_aa,err_cc,err_ee,err_ff,err_hh;
0538     aa=aa_eta[i];
0539     cc=cc_eta[i];
0540     ee=ee_eta[i];
0541     ff=ff_eta[i];
0542     hh=hh_eta[i];
0543     
0544     if(ee_eta[i]>0.0){
0545         ree_eta[i]=1.0/ee_eta[i];
0546         err_ree_eta[i]=ree_eta[i]*ree_eta[i]*err_ee_eta[i];
0547     }
0548    //cout<<cc_eta[i]<<"; "<<ree_eta[i]<<"; "<<err_ree_eta[i]<<endl;
0549     if(ff_eta[i]>0.0){
0550         rff_eta[i]=1.0/ff_eta[i];
0551         err_rff_eta[i]=rff_eta[i]*rff_eta[i]*err_ff_eta[i];
0552     }
0553     if(hh_eta[i]>0.0){
0554         rhh_eta[i]=1.0/hh_eta[i];
0555         err_rhh_eta[i]=rhh_eta[i]*rhh_eta[i]*err_hh_eta[i];
0556     }
0557      
0558     fprintf(outfile1,"eta:  %f    %f    %f    %f    %f\n",aa,cc,ee,ff,hh);
0559      
0560   }
0561   
0562   //////////////////////////////////////////////////////////////pt
0563   FILE *outfile2;
0564   TString fname2;
0565   fname2 = Form("%s.dat",output_plot_eID_pt);
0566   outfile2 =fopen(fname2.Data(),"w");
0567   int Nplot_electron_pt=0,Nplot_pion_pt=0,Nplot_K_pt=0,Nplot_antiproton_pt=0;
0568   for(int i=0;i<16;i++){
0569    // 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;
0570    // 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;
0571     
0572     aa_pt[i]=pt_point[i];
0573     err_aa_pt[i]=0.5;
0574     if(N_electron_pt[i]>0 && NEID_electron_pt[i]>0){
0575         cc_pt[i]=1.0*NEID_electron_pt[i]/N_electron_pt[i];
0576         err_cc_pt[i]=1.0*TMath::Sqrt((1.0/NEID_electron_pt[i]+1.0/N_electron_pt[i]))*cc_pt[i];
0577         Nplot_electron_pt=Nplot_electron_pt+1;
0578        // cout<<cc_pt[i]<<"; "<<err_cc_pt[i]<<endl;
0579     }
0580     if(N_pion_pt[i]>0 && NEID_pion_pt[i]>0){
0581         ee_pt[i]=1.0*NEID_pion_pt[i]/N_pion_pt[i];
0582         err_ee_pt[i]=1.0*TMath::Sqrt((1.0/NEID_pion_pt[i]+1.0/N_pion_pt[i]))*ee_pt[i];
0583         Nplot_pion_pt=Nplot_pion_pt+1;
0584         //cout<<ee_pt[i]<<"; "<<err_ee_pt[i]<<endl;
0585     }
0586     if(N_K_pt[i]>0 && NEID_K_pt[i]>0){
0587         ff_pt[i]=1.0*NEID_K_pt[i]/N_K_pt[i];
0588         err_ff_pt[i]=1.0*TMath::Sqrt((1.0/NEID_K_pt[i]+1.0/N_K_pt[i]))*ff_pt[i];
0589         Nplot_K_pt=Nplot_K_pt+1;
0590     }
0591     if(N_antiproton_pt[i]>0 && NEID_antiproton_pt[i]>0){
0592         hh_pt[i]=1.0*NEID_antiproton_pt[i]/N_antiproton_pt[i];
0593         err_hh_pt[i]=1.0*TMath::Sqrt((1.0/NEID_antiproton_pt[i]+1.0/N_antiproton_pt[i]))*hh_pt[i];
0594         Nplot_antiproton_pt=Nplot_antiproton_pt+1;
0595     }
0596       
0597     float aa,cc,ee,ff,hh;
0598     float err_aa,err_cc,err_ee,err_ff,err_hh;
0599     aa=aa_pt[i];
0600     cc=cc_pt[i];
0601     ee=ee_pt[i];
0602     ff=ff_pt[i];
0603     hh=hh_pt[i];
0604     
0605     if(ee_pt[i]>0.0){
0606         ree_pt[i]=1.0/ee_pt[i];
0607         err_ree_pt[i]=ree_pt[i]*ree_pt[i]*err_ee_pt[i];
0608        // cout<<cc_pt[i]<<"; "<<ree_pt[i]<<"; "<<err_ree_pt[i]<<endl;
0609     }
0610     cout<<cc_pt[i]<<"; "<<ree_pt[i]<<"; "<<err_ree_pt[i]<<endl;
0611     if(ff_pt[i]>0.0){
0612         rff_pt[i]=1.0/ff_pt[i];
0613         err_rff_pt[i]=rff_pt[i]*rff_pt[i]*err_ff_pt[i];
0614     }
0615     if(hh_pt[i]>0.0){
0616         rhh_pt[i]=1.0/hh_pt[i];
0617         err_rhh_pt[i]=rhh_pt[i]*rhh_pt[i]*err_hh_pt[i];
0618     }
0619     cout<<cc_pt[i]<<"; "<<rhh_pt[i]<<"; "<<err_rhh_pt[i]<<endl;
0620     fprintf(outfile2,"pt:  %f    %f    %f    %f    %f\n",aa,cc,ee,ff,hh);
0621   }
0622  
0623   
0624 //////////////////////////////////////////////////////////////HOM
0625   FILE *outfile3;
0626   TString fname3;
0627   fname3 = Form("%s.dat",output_plot_eID_HOM);
0628   outfile3 =fopen(fname3.Data(),"w");
0629   int Nplot_electron_HOM=0,Nplot_pion_HOM=0,Nplot_K_HOM=0,Nplot_antiproton_HOM=0;
0630   for(int i=0;i<20;i++){
0631     //if(NEID_electron==0 or NEID_pion==0 or NEID_K==0 or NEID_antiproton==0)continue;
0632     //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;
0633       
0634     aa_HOM[i]=HOM_point[i];
0635     err_aa_HOM[i]=0.0;
0636     if(NEID_electron>0 & N_electron_HOM[i]>0){
0637         cc_HOM[i]=1.0*N_electron_HOM[i]/NEID_electron;
0638         err_cc_HOM[i]=1.0*TMath::Sqrt((1.0/N_electron_HOM[i]+1.0/NEID_electron))*cc_HOM[i];
0639         Nplot_electron_HOM=Nplot_electron_HOM+1;
0640     }
0641     if(NEID_pion>0 & N_pion_HOM[i]>0){
0642         ee_HOM[i]=1.0*N_pion_HOM[i]/NEID_pion;
0643         err_ee_HOM[i]=1.0*TMath::Sqrt((1.0/N_pion_HOM[i]+1.0/NEID_pion))*ee_HOM[i];
0644         Nplot_pion_HOM=Nplot_pion_HOM+1;
0645     }
0646     if(NEID_K>0 & N_K_HOM[i]>0){
0647         ff_HOM[i]=1.0*N_K_HOM[i]/NEID_K;
0648         err_ff_HOM[i]=1.0*TMath::Sqrt((1.0/N_K_HOM[i]+1.0/NEID_K))*ff_HOM[i];
0649         Nplot_K_HOM=Nplot_K_HOM+1;
0650     }
0651     if(NEID_antiproton>0 & N_antiproton_HOM[i]>0){
0652         hh_HOM[i]=1.0*N_antiproton_HOM[i]/NEID_antiproton;
0653         err_hh_HOM[i]=1.0*TMath::Sqrt((1.0/N_antiproton_HOM[i]+1.0/NEID_antiproton))*hh_HOM[i];
0654         Nplot_antiproton_HOM=Nplot_antiproton_HOM+1;
0655     }
0656         
0657     float aa,cc,ee,ff,hh;
0658     float err_aa,err_cc,err_ee,err_ff,err_hh;
0659     aa=aa_HOM[i];
0660     cc=cc_HOM[i];
0661     ee=ee_HOM[i];
0662     ff=ff_HOM[i];
0663     hh=hh_HOM[i];
0664     
0665     if(ee_HOM[i]>0.0){
0666         ree_HOM[i]=1.0/ee_HOM[i];
0667         err_ree_HOM[i]=ree_HOM[i]*ree_HOM[i]*err_ee_HOM[i];
0668     }
0669     if(ff_HOM[i]>0.0){
0670         rff_HOM[i]=1.0/ff_HOM[i];
0671         err_rff_HOM[i]=rff_HOM[i]*rff_HOM[i]*err_ff_HOM[i];
0672     }
0673     if(hh_HOM[i]>0.0){
0674         rhh_HOM[i]=1.0/hh_HOM[i];
0675         err_rhh_HOM[i]=rhh_HOM[i]*rhh_HOM[i]*err_hh_HOM[i];
0676     }
0677      
0678     
0679         err_aa=err_aa_HOM[i];
0680     err_cc=err_cc_HOM[i];
0681     err_ee=err_ee_HOM[i];
0682     err_ff=err_ff_HOM[i];
0683     err_hh=err_hh_HOM[i];
0684     
0685     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);
0686   }
0687   
0688   //////////////////////////////////////////////////////////////EOP
0689   FILE *outfile4;
0690   TString fname4;
0691   fname4 = Form("%s.dat",output_plot_eID_EOP);
0692   outfile4 =fopen(fname4.Data(),"w");
0693   int Nplot_electron_EOP=0,Nplot_pion_EOP=0,Nplot_K_EOP=0,Nplot_antiproton_EOP=0;
0694   for(int i=0;i<9;i++){
0695     //if(NEID_electron==0 or NEID_pion==0 or NEID_K==0 or NEID_antiproton==0)continue;
0696    // 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;
0697     
0698     aa_EOP[i]=EOP_point[i];
0699     err_aa_EOP[i]=0.0;
0700     if(NEID_electron>0 & N_electron_EOP[i]>0){
0701         cc_EOP[i]=1.0*N_electron_EOP[i]/NEID_electron;
0702         err_cc_EOP[i]=1.0*TMath::Sqrt((1.0/N_electron_EOP[i]+1.0/NEID_electron))*cc_EOP[i];
0703         Nplot_electron_EOP=Nplot_electron_EOP+1;
0704        // cout<<cc_EOP[i]<<"; "<<err_cc_EOP[i]<<endl;
0705     }
0706     if(NEID_pion>0 & N_pion_EOP[i]>0){
0707         ee_EOP[i]=1.0*N_pion_EOP[i]/NEID_pion;
0708         err_ee_EOP[i]=1.0*TMath::Sqrt((1.0/N_pion_EOP[i]+1.0/NEID_pion))*ee_EOP[i];
0709         Nplot_pion_EOP=Nplot_pion_EOP+1;
0710     }
0711     if(NEID_K>0 & N_K_EOP[i]>0){
0712         ff_EOP[i]=1.0*N_K_EOP[i]/NEID_K;
0713         err_ff_EOP[i]=1.0*TMath::Sqrt((1.0/N_K_EOP[i]+1.0/NEID_K))*ff_EOP[i];
0714         Nplot_K_EOP=Nplot_K_EOP+1;
0715     }
0716     if(NEID_antiproton>0 & N_antiproton_EOP[i]>0){
0717         hh_EOP[i]=1.0*N_antiproton_EOP[i]/NEID_antiproton;
0718         err_hh_EOP[i]=1.0*TMath::Sqrt((1.0/N_antiproton_EOP[i]+1.0/NEID_antiproton))*hh_EOP[i];
0719         Nplot_antiproton_EOP=Nplot_antiproton_EOP+1;
0720     }
0721         
0722     float aa,cc,ee,ff,hh;
0723     float err_aa,err_cc,err_ee,err_ff,err_hh;
0724     aa=aa_EOP[i];
0725     cc=cc_EOP[i];
0726     ee=ee_EOP[i];
0727     ff=ff_EOP[i];
0728     hh=hh_EOP[i];
0729     
0730     if(ee_EOP[i]>0.0){
0731         ree_EOP[i]=1.0/ee_EOP[i];
0732         err_ree_EOP[i]=ree_EOP[i]*ree_EOP[i]*err_ee_EOP[i];
0733        // cout<<ree_EOP[i]<<"; "<<err_ree_EOP[i]<<endl;
0734     }
0735     if(ff_EOP[i]>0.0){
0736         rff_EOP[i]=1.0/ff_EOP[i];
0737         err_rff_EOP[i]=rff_EOP[i]*rff_EOP[i]*err_ff_EOP[i];
0738     }
0739     if(hh_EOP[i]>0.0){
0740         rhh_EOP[i]=1.0/hh_EOP[i];
0741         err_rhh_EOP[i]=rhh_EOP[i]*rhh_EOP[i]*err_hh_EOP[i];
0742     }
0743     
0744     err_aa=err_aa_EOP[i];
0745     err_cc=err_cc_EOP[i];
0746     err_ee=err_ee_EOP[i];
0747     err_ff=err_ff_EOP[i];
0748     err_hh=err_hh_EOP[i];
0749     
0750     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);
0751   }
0752   
0753   //////////////////////////////////////////////////////////////HOP
0754   FILE *outfile5;
0755   TString fname5;
0756   fname5 = Form("%s.dat",output_plot_eID_HOP);
0757   outfile5 =fopen(fname5.Data(),"w");
0758   int Nplot_electron_HOP=0,Nplot_pion_HOP=0,Nplot_K_HOP=0,Nplot_antiproton_HOP=0;
0759   for(int i=0;i<20;i++){
0760     //if(NEID_electron==0 or NEID_pion==0 or NEID_K==0 or NEID_antiproton==0)continue;
0761     //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;
0762       
0763     aa_HOP[i]=HOP_point[i];
0764     err_aa_HOP[i]=0.0;
0765     if(NEID_electron>0 & N_electron_HOP[i]>0){
0766         cc_HOP[i]=1.0*N_electron_HOP[i]/NEID_electron;
0767         err_cc_HOP[i]=1.0*TMath::Sqrt((1.0/N_electron_HOP[i]+1.0/NEID_electron))*cc_HOP[i];
0768         Nplot_electron_HOP=Nplot_electron_HOP+1;
0769     }
0770     if(NEID_pion>0 & N_pion_HOP[i]>0){
0771         ee_HOP[i]=1.0*N_pion_HOP[i]/NEID_pion;
0772         err_ee_HOP[i]=1.0*TMath::Sqrt((1.0/N_pion_HOP[i]+1.0/NEID_pion))*ee_HOP[i];
0773         Nplot_pion_HOP=Nplot_pion_HOP+1;
0774     }
0775     if(NEID_K>0 & N_K_HOP[i]>0){
0776         ff_HOP[i]=1.0*N_K_HOP[i]/NEID_K;
0777         err_ff_HOP[i]=1.0*TMath::Sqrt((1.0/N_K_HOP[i]+1.0/NEID_K))*ff_HOP[i];
0778         Nplot_K_HOP=Nplot_K_HOP+1;
0779     }
0780     if(NEID_antiproton>0 & N_antiproton_HOP[i]>0){
0781         hh_HOP[i]=1.0*N_antiproton_HOP[i]/NEID_antiproton;
0782         err_hh_HOP[i]=1.0*TMath::Sqrt((1.0/N_antiproton_HOP[i]+1.0/NEID_antiproton))*hh_HOP[i];
0783         Nplot_antiproton_HOP=Nplot_antiproton_HOP+1;
0784     }
0785         
0786     float aa,cc,ee,ff,hh;
0787     float err_aa,err_cc,err_ee,err_ff,err_hh;
0788     aa=aa_HOP[i];
0789     cc=cc_HOP[i];
0790     ee=ee_HOP[i];
0791     ff=ff_HOP[i];
0792     hh=hh_HOP[i];
0793     
0794     if(ee_HOP[i]>0.0){
0795         ree_HOP[i]=1.0/ee_HOP[i];
0796         err_ree_HOP[i]=ree_HOP[i]*ree_HOP[i]*err_ee_HOP[i];
0797     }
0798     if(ff_HOP[i]>0.0){
0799         rff_HOP[i]=1.0/ff_HOP[i];
0800         err_rff_HOP[i]=rff_HOP[i]*rff_HOP[i]*err_ff_HOP[i];
0801     }
0802     if(hh_HOP[i]>0.0){
0803         rhh_HOP[i]=1.0/hh_HOP[i];
0804         err_rhh_HOP[i]=rhh_HOP[i]*rhh_HOP[i]*err_hh_HOP[i];
0805     }
0806     
0807     err_aa=err_aa_HOP[i];
0808     err_cc=err_cc_HOP[i];
0809     err_ee=err_ee_HOP[i];
0810     err_ff=err_ff_HOP[i];
0811     err_hh=err_hh_HOP[i];
0812     
0813     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);
0814   }
0815   
0816 
0817   /////////////////////////////
0818   gROOT->LoadMacro("sPhenixStyle.C");
0819   SetsPhenixStyle();
0820   TCanvas *canv= new TCanvas("canv","Cali Canvas",1800,4750);
0821   canv->Divide(2,5);
0822   
0823  ///////////////////////////////////////////////////////// canv->cd(1);
0824   canv->cd(1);
0825   TPad *pad1 = new TPad("pad1","pad1",0,0,0.99,0.99);
0826   pad1->Draw();    
0827   pad1->cd();
0828   //pad1->SetFrameLineWidth(2);
0829   //pad1->SetFrameLineColor(1);
0830   Float_t Xmin,Xmax;
0831   Float_t Ymin,Ymax;
0832   Ymin=-0.05;
0833   if(tag==2)Ymax=2.0;
0834   if(tag==1 or 3)Ymax=2.0;
0835   Xmin=0.0;
0836   Xmax=1.1; 
0837   
0838   
0839   
0840   TH1F *hframe0;
0841   hframe0=gPad->DrawFrame(Xmin,Ymin,Xmax,Ymax);
0842   hframe0->GetXaxis()->SetTitle("|#eta|"); 
0843   //hframe0->GetXaxis()->CenterTitle(); 
0844   hframe0->GetYaxis()->SetTitle("Survival probability (%)");
0845   //hframe0->GetYaxis()->CenterTitle();
0846  
0847   TGraphErrors *g1,*g11,*g12,*g13;  
0848   g1=new TGraphErrors(11,aa_eta,cc_eta,err_aa_eta,err_cc_eta);
0849   g1->SetMarkerStyle(26);
0850   g1->SetMarkerColor(1);
0851   g1->SetLineColor(1);
0852   g1->SetLineStyle(1);
0853   g1->SetLineWidth(1.2);
0854   g1->SetMarkerSize(3.0);
0855   g1->Draw("p");
0856   g11=new TGraphErrors(11,aa_eta,ee_eta,err_aa_eta,err_ee_eta);
0857   g11->SetMarkerStyle(26);
0858   g11->SetMarkerColor(2);
0859   g11->SetLineColor(2);
0860   g11->SetLineStyle(1);
0861   g11->SetLineWidth(1.2);
0862   g11->SetMarkerSize(3.0);
0863   g11->Draw("p");
0864   g12=new TGraphErrors(11,aa_eta,ff_eta,err_aa_eta,err_ff_eta);
0865   g12->SetMarkerStyle(26);
0866   g12->SetMarkerColor(3);
0867   g12->SetLineColor(3);
0868   g12->SetLineStyle(1);
0869   g12->SetLineWidth(1.2);
0870   g12->SetMarkerSize(3.0);
0871   if(tag==1 or 3) g12->Draw("p");
0872   g13=new TGraphErrors(11,aa_eta,hh_eta,err_aa_eta,err_hh_eta);
0873   g13->SetMarkerStyle(26);
0874   g13->SetMarkerColor(4);
0875   g13->SetLineColor(4);
0876   g13->SetLineStyle(1);
0877   g13->SetLineWidth(1.2);
0878   g13->SetMarkerSize(3.0);
0879   g13->Draw("p");
0880   
0881   TLegend *legtitle1 =new TLegend(0.20,0.85,0.35,0.92,"#it{#bf{sPHENIX}} Simulation Internal");
0882   legtitle1->SetTextSize(0.035);
0883   legtitle1->Draw();
0884   
0885   TLegend *legtitle11;
0886   if(tag==2)legtitle11 =new TLegend(0.20,0.82,0.35,0.85,"Embed");
0887   if(tag==1 or 3)legtitle11 =new TLegend(0.20,0.82,0.35,0.85,"Single particle");
0888   legtitle11->SetTextSize(0.030);
0889   legtitle11->Draw();
0890   
0891   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");
0892   legtitle12->SetTextSize(0.028);
0893   legtitle12->Draw();
0894   
0895   TLegend *legtitle13 =new TLegend(0.20,0.72,0.35,0.76,"@:p_{t}>2GeV");
0896   legtitle13->SetTextSize(0.028);
0897   legtitle13->Draw();
0898    
0899   TLegend *leg1 =new TLegend(0.65,0.63,0.90,0.92);
0900   leg1->AddEntry(g1," e^{+} & e^{-}","lep");
0901   leg1->AddEntry(g11," #pi^{+} & #pi^{-}","lep");
0902   if(tag==1 or 3)leg1->AddEntry(g12," K^{+} & K^{-}","lep");
0903   leg1->AddEntry(g13," p & #bar{p}","lep");
0904   leg1->Draw();
0905    
0906  ///////////////////////////////////////////////////////// canv->cd(2); 
0907   canv->cd(2);
0908   TPad *pad2 = new TPad("pad2","pad2",0,0,0.99,0.99);
0909   pad2->Draw();    
0910   pad2->cd();
0911  // pad2->SetFrameLineWidth(2);
0912  // pad2->SetFrameLineColor(1);
0913 
0914   Ymin=-0.05;
0915   if(tag==2)Ymax=2.0;
0916   if(tag==1 or 3)Ymax=2.0;
0917   Xmin=0.0;
0918   Xmax=16.0;  
0919  
0920   
0921   hframe0=gPad->DrawFrame(Xmin,Ymin,Xmax,Ymax);
0922   hframe0->GetXaxis()->SetTitle("p_{t} (GeV)"); 
0923 //  hframe0->GetXaxis()->CenterTitle(); 
0924   hframe0->GetYaxis()->SetTitle("Survival probability (%)");
0925 //  hframe0->GetYaxis()->CenterTitle();
0926   
0927   
0928   TGraphErrors *g2,*g21,*g22,*g23;  
0929   g2=new TGraphErrors(16,aa_pt,cc_pt,err_aa_pt,err_cc_pt);
0930   g2->SetMarkerStyle(26);
0931   g2->SetMarkerColor(1);
0932   g2->SetLineColor(1);
0933   g2->SetLineStyle(1);
0934   g2->SetLineWidth(1.2);
0935   g2->SetMarkerSize(3.0);
0936   g2->Draw("p");
0937   g21=new TGraphErrors(16,aa_pt,ee_pt,err_aa_pt,err_ee_pt);
0938   g21->SetMarkerStyle(26);
0939   g21->SetMarkerColor(2);
0940   g21->SetLineColor(2);
0941   g21->SetLineStyle(1);
0942   g21->SetLineWidth(1.2);
0943   g21->SetMarkerSize(3.0);
0944   g21->Draw("p");
0945   g22=new TGraphErrors(16,aa_pt,ff_pt,err_aa_pt,err_ff_pt);
0946   g22->SetMarkerStyle(26);
0947   g22->SetMarkerColor(3);
0948   g22->SetLineColor(3);
0949   g22->SetLineStyle(1);
0950   g22->SetLineWidth(1.2);
0951   g22->SetMarkerSize(3.0);
0952   if(tag==1 or 3) g22->Draw("p");
0953   g23=new TGraphErrors(16,aa_pt,hh_pt,err_aa_pt,err_hh_pt);
0954   g23->SetMarkerStyle(26);
0955   g23->SetMarkerColor(4);
0956   g23->SetLineColor(4);
0957   g23->SetLineStyle(1);
0958   g23->SetLineWidth(1.2);
0959   g23->SetMarkerSize(3.0);
0960   g23->Draw("p");
0961   
0962   TLegend *legtitle2 =new TLegend(0.20,0.85,0.35,0.92,"#it{#bf{sPHENIX}} Simulation Internal");
0963   legtitle2->SetTextSize(0.035);
0964   legtitle2->Draw();
0965   
0966   TLegend *legtitle21;
0967   if(tag==2)legtitle21 =new TLegend(0.20,0.82,0.35,0.85,"Embed");
0968   if(tag==1 or 3)legtitle21 =new TLegend(0.20,0.82,0.35,0.85,"Single particle");
0969   legtitle21->SetTextSize(0.030);
0970   legtitle21->Draw();
0971   
0972   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");
0973   legtitle22->SetTextSize(0.025);
0974   legtitle22->Draw();
0975   
0976   TLegend *leg2 =new TLegend(0.65,0.63,0.90,0.92);
0977   leg2->AddEntry(g2," e^{+} & e^{-}","lep");
0978   leg2->AddEntry(g21," #pi^{+} & #pi^{-}","lep");
0979   if(tag==1 or 3) leg2->AddEntry(g22," K^{+} & K^{-}","lep");
0980   leg2->AddEntry(g23," p & #bar{p}","lep");
0981   leg2->Draw();
0982   
0983  ///////////////////////////////////////////////////////// canv->cd(3);
0984   canv->cd(3);
0985   TPad *pad3 = new TPad("pad3","pad3",0,0,0.99,0.99);
0986   pad3->Draw();    
0987   pad3->cd();
0988 
0989   Ymin=0;
0990   Ymax=1.2;
0991   Xmin=0.0;
0992   Xmax=1.2;  
0993     
0994   hframe0=gPad->DrawFrame(Xmin,Ymin,Xmax,Ymax);
0995   hframe0->GetXaxis()->SetTitle("E_{iHCal}/E_{EMCal}<x_{cut}"); 
0996  // hframe0->GetXaxis()->CenterTitle(); 
0997   hframe0->GetYaxis()->SetTitle("Survival probability (%)");
0998  // hframe0->GetYaxis()->CenterTitle();
0999  
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 
1054  ///////////////////////////////////////////////////////// canv->cd(4);
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   
1122  ///////////////////////////////////////////////////////// canv->cd(5); 
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   
1192   ///////////////////////////////////////////////////////// canv->cd(6); 
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   
1261   ///////////////////////////////////////////////////////// canv->cd(7); 
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   
1336   ///////////////////////////////////////////////////////// canv->cd(8); 
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   
1404   ///////////////////////////////////////////////////////// canv->cd(9); 
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   
1482   ///////////////////////////////////////////////////////// canv->cd(10); 
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   
1563   /////////////////////////////////////////////////////////////////plot only one separately 
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