Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 /**
0002 
0003  *\Brief Macro to create plots like ePHENIX LoI Feb. 2014 (arXiv:1402.1209v1) Fig. 2.1, 2.2, & 2.4
0004 
0005  **/
0006 
0007 int plot_momentum_vs_eta(
0008              //const TString infile = "data/pythia.ep.100.test.root"
0009              )
0010 {
0011   gStyle->SetOptStat(kFALSE);
0012 
0013   /*--------------Get Input File--------------*/
0014 
0015 //  float xsec_T1 = 0.94568934478641919;
0016 //  float xsec_T2 = 7.80038488753058562E-002;
0017 //  float xsec_T3 = 3.38307113522152677E-003;
0018 //
0019   TChain* T1 = new TChain("EICTree");
0020   T1->AddFile("data/bpage/origin/pythia.ep.20x250.250Kevents.Q2=1.0-10.0.PDF=10800_1.root");
0021   T1->AddFile("data/bpage/origin/pythia.ep.20x250.250Kevents.Q2=1.0-10.0.PDF=10800_2.root");
0022   T1->AddFile("data/bpage/origin/pythia.ep.20x250.250Kevents.Q2=1.0-10.0.PDF=10800_3.root");
0023   T1->AddFile("data/bpage/origin/pythia.ep.20x250.250Kevents.Q2=1.0-10.0.PDF=10800_4.root");
0024   T1->AddFile("data/bpage/origin/pythia.ep.20x250.250Kevents.Q2=1.0-10.0.PDF=10800_5.root");
0025   T1->AddFile("data/bpage/origin/pythia.ep.20x250.250Kevents.Q2=1.0-10.0.PDF=10800_6.root");
0026   T1->AddFile("data/bpage/origin/pythia.ep.20x250.250Kevents.Q2=1.0-10.0.PDF=10800_7.root");
0027   T1->AddFile("data/bpage/origin/pythia.ep.20x250.250Kevents.Q2=1.0-10.0.PDF=10800_8.root");
0028   T1->AddFile("data/bpage/origin/pythia.ep.20x250.250Kevents.Q2=1.0-10.0.PDF=10800_9.root");
0029   T1->AddFile("data/bpage/origin/pythia.ep.20x250.250Kevents.Q2=1.0-10.0.PDF=10800_10.root");
0030 
0031 //  T1->SetWeight(xsec_T1 / xsec_T1,"global");
0032 //
0033 //  TChain* T2 = new TChain("EICTree");
0034 //  T2->AddFile("data/bpage/origin/pythia.ep.20x250.250Kevents.Q2=10.0-100.0.PDF=10800_1.root");
0035 //  T2->SetWeight(xsec_T2 / xsec_T1,"global");
0036 //
0037 //  TChain* T3 = new TChain("EICTree");
0038 //  T3->AddFile("data/bpage/origin/pythia.ep.20x250.50Kevents.Q2=100.0-1000.0.PDF=10800_1.root");
0039 //  T3->SetWeight(xsec_T3 / xsec_T1,"global");
0040 
0041 
0042   TChain* T = new TChain("EICTree");
0043   //  T->AddFile("data/TEST/pythia.ep.20x250.1Mevents.1.RadCor=0.Q2gt1.root");
0044   //  T->AddFile("data/pythiaeRHIC/TREES/pythia.ep.20x250.RadCor=0.Q2gt1.50kevts.root");
0045   T->Add(T1);
0046   //  T->Add(T2);
0047   //  T->Add(T3);
0048 
0049   /*------------------------------------------*/
0050   /*--------------Define Cuts-----------------*/
0051 
0052   //TCut Q2_cut = "Q2 > 1";
0053 
0054   TCut electron_cut = "particles.id == 11";
0055   TCut hadron_cut = "abs(particles.id) > 100";
0056   TCut proton_cut = "particles.id == 2212";
0057   TCut neutron_cut = "particles.id == 2112";
0058   TCut Kaon_cut = "abs(particles.id) == 321 || particles.id == 311";
0059   TCut Pion_charged_cut = "abs(particles.id) == 211";
0060   //TCut Pion_cut = "abs(particles.id) == 211 || particles.id == 111";
0061   TCut photon_cut = "particles.id == 22";
0062 
0063   TCut mother_cut = "particles.parentId == 0";
0064   TCut status_cut = "particles.KS == 1";
0065 
0066   TCut eta_cut_n3n2 = "particles.eta > -3 && particles.eta < -2";
0067   TCut eta_cut_n2n1 = "particles.eta > -2 && particles.eta < -1";
0068   TCut eta_cut_n1z0 = "particles.eta > -1 && particles.eta < -0";
0069 
0070   /*------------------------------------------*/
0071   /*-------Momentum vs. Pseudorapidity--------*/
0072   /*------------------------------------------*/
0073 
0074   /*------------------------------------------*/
0075   /*---------Electrons (LoI Fig. 2-1)---------*/
0076   /*------------------------------------------*/
0077 //  TH2F *h_peta_e = new TH2F("h_peta_e", "", 100, -4, 3, 100, 0, 50 ); //250x015 10M
0078 //
0079 //  TCanvas *c_peta_e = new TCanvas( "c_peta_e" );
0080 //  c_peta_e->SetLogz();
0081 //
0082 //  //  T->Draw("particles.p : particles.eta>>h_peta_e", electron_cut && mother_cut && "trueQ2 > 1", "colz");
0083 //  T->Draw("particles.p : particles.eta>>h_peta_e", electron_cut && "trueQ2 > 1", "colz");
0084 //
0085 //  h_peta_e->GetXaxis()->SetTitle("Pseudorapidity #eta");
0086 //  h_peta_e->GetYaxis()->SetTitle("Electron Momentum p_{e-} [GeV]");
0087 
0088   //  c_p_eta_e->Print("Plots/pythia_peta_e_10M_250x010.eps");
0089   //  c_p_eta_e->Print("Plots/pythia_peta_e_10M_250x010.png");
0090 
0091   /*------------------------------------------*/
0092   /*----------Hadrons (LoI Fig. 2-4)----------*/
0093   /*------------------------------------------*/
0094   TH2F *h_p_eta_h = new TH2F("h_p_eta_h", "", 80,-5,5, 50,0,70); //250x015
0095 
0096   TCanvas *c_p_eta_h = new TCanvas( "c_p_eta_h" );
0097   c_p_eta_h->SetRightMargin(0.12);
0098 
0099   T->Draw("particles.p : particles.eta>>h_p_eta_h",hadron_cut && "trueQ2 > 1 && trueY > 0.01 && trueY < 0.80 && trueW2 > 10 && particles.z > 0.2", "colz");
0100 
0101 //  TH2F *h_p_eta_h1 = (TH2F*)h_p_eta_h->Clone("h_p_eta_h1");
0102 //  TH2F *h_p_eta_h2 = (TH2F*)h_p_eta_h->Clone("h_p_eta_h2");
0103 //  TH2F *h_p_eta_h3 = (TH2F*)h_p_eta_h->Clone("h_p_eta_h3");
0104 //
0105 //  T1->Draw("particles.p : particles.eta>>h_p_eta_h1",hadron_cut && "trueQ2 > 1 && trueY > 0.01 && trueY < 0.80 && trueW2 > 10 && particles.z > 0.2", "colz");
0106 //  T2->Draw("particles.p : particles.eta>>h_p_eta_h2",hadron_cut && "trueQ2 > 1 && trueY > 0.01 && trueY < 0.80 && trueW2 > 10 && particles.z > 0.2", "colz");
0107 //  T3->Draw("particles.p : particles.eta>>h_p_eta_h3",hadron_cut && "trueQ2 > 1 && trueY > 0.01 && trueY < 0.80 && trueW2 > 10 && particles.z > 0.2", "colz");
0108 //
0109 //  h_p_eta_h->Add(h_p_eta_h1);
0110 //  h_p_eta_h->Add(h_p_eta_h2);
0111 //  h_p_eta_h->Add(h_p_eta_h3);
0112 
0113   h_p_eta_h->GetXaxis()->SetTitle("Pseudorapidity #eta");
0114   h_p_eta_h->GetYaxis()->SetTitle("Hadron Momentum p_{Hadron} [GeV]");
0115   c_p_eta_h->SetLogz();
0116 
0117   h_p_eta_h->Draw("colz");
0118 
0119   /* Add boxes for PID acceptances */
0120   TBox * b_cpid = new TBox(-1.55,0.8,1.242,6); // DIRC
0121   b_cpid->SetFillStyle(0);
0122   b_cpid->SetLineWidth(2);
0123   b_cpid->Draw("sameL");
0124 
0125   TBox * b_epid = new TBox(-4,2,-1.55,8); // mRICH
0126   b_epid->SetFillStyle(0);
0127   b_epid->SetLineWidth(2);
0128   b_epid->Draw("sameL");
0129 
0130   TBox * b_fpid0 = new TBox(1.242,15,4,50); // Gas RICH
0131   b_fpid0->SetFillStyle(0);
0132   b_fpid0->SetLineWidth(2);
0133   b_fpid0->Draw("sameL");
0134 
0135   TBox * b_fpid1 = new TBox(1.242,2,1.85,8); // mRICH
0136   b_fpid1->SetFillStyle(0);
0137   b_fpid1->SetLineWidth(2);
0138   b_fpid1->Draw("sameL");
0139 
0140   TBox * b_fpid2 = new TBox(1.85,0,4,8); // TOF
0141   b_fpid2->SetFillStyle(0);
0142   b_fpid2->SetLineWidth(2);
0143   b_fpid2->Draw("sameL");
0144 
0145   //  c_p_eta_h->Print("Plots/pythia_peta_h_10M_250x010.eps");
0146   //  c_p_eta_h->Print("Plots/pythia_peta_h_10M_250x010.png");
0147 
0148 
0149 //  /*------------Momentum Spectra (Figure 2.2)--------------*/
0150 //
0151 //  /*-------- -3 < Eta < -2 ---------*/
0152 //
0153 //  TH1F* hp_e_n3n2 = new TH1F("hp_e_n3n2", "dN/dp vs. p", 60, 0, 30);
0154 //  TH1F* hp_p_n3n2 = new TH1F("hp_p_n3n2", "dN/dp vs. p", 60, 0, 30);
0155 //  TH1F* hp_y_n3n2 = new TH1F("hp_y_n3n2", "dN/dp vs. p", 60, 0, 30);
0156 //
0157 //  TCanvas *cp_e_n3n2 = new TCanvas("cp_e_n3n2");
0158 //  T->Draw("sqrt(particles.px**2 + particles.py**2 + particles.pz**2)>>hp_e_n3n2", electron_cut && eta_cut_n3n2 && "Q2 > 0.01", "goff");
0159 //  T->Draw("sqrt(particles.px**2 + particles.py**2 + particles.pz**2)>>hp_p_n3n2", Pion_charged_cut && eta_cut_n3n2 && "Q2 > 0.01", "goff");
0160 //  T->Draw("sqrt(particles.px**2 + particles.py**2 + particles.pz**2)>>hp_y_n3n2", photon_cut && eta_cut_n3n2 && status_cut && "Q2 > 0.01", "goff");
0161 //
0162 //
0163 //  TH1F* htmp_n3n2 = hp_e_n3n2->Clone();
0164 //  htmp_n3n2->SetTitle("");
0165 //  htmp_n3n2->GetXaxis()->SetTitle("p [GeV]");
0166 //  htmp_n3n2->GetYaxis()->SetTitle("dN/dp");
0167 //  htmp_n3n2->SetMaximum( 0.99e7);
0168 //  htmp_n3n2->Draw();
0169 //
0170 //  hp_e_n3n2->SetLineColor(2);
0171 //  hp_e_n3n2->Draw("same");
0172 //  hp_p_n3n2->SetLineColor(1);
0173 //  hp_p_n3n2->Draw("same");
0174 //  hp_y_n3n2->SetLineColor(4);
0175 //  hp_y_n3n2->Draw("same");
0176 //  cp_e_n3n2->SetLogy();
0177 //
0178 //  TLegend* leg_n3n2 = new TLegend(0.53,0.67,0.73,0.90);
0179 //  hp_e_n3n2->SetTitle("DIS electron");
0180 //  hp_p_n3n2->SetTitle("#pi#pm");
0181 //  hp_y_n3n2->SetTitle("Photons");
0182 //  leg_n3n2->AddEntry(hp_e_n3n2, "", "L");
0183 //  leg_n3n2->AddEntry(hp_p_n3n2, "", "L");
0184 //  leg_n3n2->AddEntry(hp_y_n3n2, "", "L");
0185 //  leg_n3n2->SetTextSize(0.04);
0186 //  leg_n3n2->Draw();
0187 //
0188 //  //  cp_e_n3n2->Print("Plots/pythia_MomSpec_n3n2_10M_250x010.eps");
0189 //  //  cp_e_n3n2->Print("Plots/pythia_MomSpec_n3n2_10M_250x010.png");
0190 //
0191 //
0192 //  /*Temporary Electron Purity Test*/
0193 //
0194 //
0195 //
0196 //
0197 //
0198 //
0199 //  /*-------- -2 < Eta < -1 ---------*/
0200 //
0201 //  TH1F* hp_e_n2n1 = new TH1F("hp_e_n2n1", "dN/dp vs. p", 60, 0, 30);
0202 //  TH1F* hp_p_n2n1 = new TH1F("hp_p_n2n1", "dN/dp vs. p", 60, 0, 30);
0203 //  TH1F* hp_y_n2n1 = new TH1F("hp_y_n2n1", "dN/dp vs. p", 60, 0, 30);
0204 //
0205 //  TCanvas *cp_e_n2n1 = new TCanvas("cp_e_n2n1");
0206 //  T->Draw("sqrt(particles.px**2 + particles.py**2 + particles.pz**2)>>hp_e_n2n1", electron_cut && eta_cut_n2n1 && "Q2 > 0.01", "goff");
0207 //  T->Draw("sqrt(particles.px**2 + particles.py**2 + particles.pz**2)>>hp_p_n2n1", Pion_charged_cut && eta_cut_n2n1 && "Q2 > 0.01", "goff");
0208 //  T->Draw("sqrt(particles.px**2 + particles.py**2 + particles.pz**2)>>hp_y_n2n1", photon_cut && eta_cut_n2n1 && status_cut && "Q2 > 0.01", "goff");
0209 //
0210 //  TH1F* htmp_n2n1 = hp_e_n2n1->Clone();
0211 //  htmp_n2n1->SetTitle("");
0212 //  htmp_n2n1->GetXaxis()->SetTitle("p [GeV]");
0213 //  htmp_n2n1->GetYaxis()->SetTitle("dN/dp");
0214 //  htmp_n2n1->SetMaximum( 0.99e7);
0215 //  htmp_n2n1->Draw();
0216 //
0217 //  hp_e_n2n1->SetLineColor(2);
0218 //  hp_e_n2n1->Draw("same");
0219 //  hp_p_n2n1->SetLineColor(1);
0220 //  hp_p_n2n1->Draw("same");
0221 //  hp_y_n2n1->SetLineColor(4);
0222 //  hp_y_n2n1->Draw("same");
0223 //  cp_e_n2n1->SetLogy();
0224 //
0225 //  TLegend* leg_n2n1 = new TLegend(0.53,0.67,0.73,0.90);
0226 //  hp_e_n2n1->SetTitle("DIS electron");
0227 //  hp_p_n2n1->SetTitle("#pi#pm");
0228 //  hp_y_n2n1->SetTitle("Photons");
0229 //  leg_n2n1->AddEntry(hp_e_n2n1, "", "L");
0230 //  leg_n2n1->AddEntry(hp_p_n2n1, "", "L");
0231 //  leg_n2n1->AddEntry(hp_y_n2n1, "", "L");
0232 //  leg_n2n1->SetTextSize(0.04);
0233 //  leg_n2n1->Draw();
0234 //
0235 //  //  cp_e_n2n1->Print("Plots/pythia_MomSpec_n2n1_10M_250x010.eps");
0236 //  //  cp_e_n2n1->Print("Plots/pythia_MomSpec_n2n1_10M_250x010.png");
0237 //
0238 //  /*-------- -1 < Eta < 0 ---------*/
0239 //
0240 //  TH1F* hp_e_n1z0 = new TH1F("hp_e_n1z0", "dN/dp vs. p", 60, 0, 30);
0241 //  TH1F* hp_p_n1z0 = new TH1F("hp_p_n1z0", "dN/dp vs. p", 60, 0, 30);
0242 //  TH1F* hp_y_n1z0 = new TH1F("hp_y_n1z0", "dN/dp vs. p", 60, 0, 30);
0243 //
0244 //  TCanvas *cp_e_n1z0 = new TCanvas("cp_e_n1z0");
0245 //  T->Draw("sqrt(particles.px**2 + particles.py**2 + particles.pz**2)>>hp_e_n1z0", electron_cut && eta_cut_n1z0 && "Q2 > 0.01", "goff");
0246 //  T->Draw("sqrt(particles.px**2 + particles.py**2 + particles.pz**2)>>hp_p_n1z0", Pion_charged_cut && eta_cut_n1z0 && "Q2 > 0.01", "goff");
0247 //  T->Draw("sqrt(particles.px**2 + particles.py**2 + particles.pz**2)>>hp_y_n1z0", photon_cut && eta_cut_n1z0 && status_cut && "Q2 > 0.01", "goff");
0248 //
0249 //  TH1F* htmp_n1z0 = hp_e_n1z0->Clone();
0250 //  htmp_n1z0->SetTitle("");
0251 //  htmp_n1z0->GetXaxis()->SetTitle("p [GeV]");
0252 //  htmp_n1z0->GetYaxis()->SetTitle("dN/dp");
0253 //  htmp_n1z0->SetMaximum( 0.99e7 );
0254 //  htmp_n1z0->Draw();
0255 //
0256 //  hp_e_n1z0->SetLineColor(2);
0257 //  hp_e_n1z0->Draw("same");
0258 //  hp_p_n1z0->SetLineColor(1);
0259 //  hp_p_n1z0->Draw("same");
0260 //  hp_y_n1z0->SetLineColor(4);
0261 //  hp_y_n1z0->Draw("same");
0262 //  cp_e_n1z0->SetLogy();
0263 //
0264 //  TLegend* leg_n1z0 = new TLegend(0.53,0.67,0.73,0.90);
0265 //  hp_e_n1z0->SetTitle("DIS electron");
0266 //  hp_p_n1z0->SetTitle("#pi#pm");
0267 //  hp_y_n1z0->SetTitle("Photons");
0268 //  leg_n1z0->AddEntry(hp_e_n1z0, "", "L");
0269 //  leg_n1z0->AddEntry(hp_p_n1z0, "", "L");
0270 //  leg_n1z0->AddEntry(hp_y_n1z0, "", "L");
0271 //  leg_n1z0->SetTextSize(0.04);
0272 //  leg_n1z0->Draw();
0273 //
0274 //  //  cp_e_n1z0->Print("Plots/pythia_MomSpec_n1z0_10M_250x010.eps");
0275 //  //  cp_e_n1z0->Print("Plots/pythia_MomSpec_n1z0_10M_250x010.png");
0276 
0277   return 0 ;
0278 }