Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
plot_momentum_vs_eta.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file plot_momentum_vs_eta.C
1 
8  //const TString infile = "data/pythia.ep.100.test.root"
9  )
10 {
11  gStyle->SetOptStat(kFALSE);
12 
13  /*--------------Get Input File--------------*/
14 
15 // float xsec_T1 = 0.94568934478641919;
16 // float xsec_T2 = 7.80038488753058562E-002;
17 // float xsec_T3 = 3.38307113522152677E-003;
18 //
19  TChain* T1 = new TChain("EICTree");
20  T1->AddFile("data/bpage/origin/pythia.ep.20x250.250Kevents.Q2=1.0-10.0.PDF=10800_1.root");
21  T1->AddFile("data/bpage/origin/pythia.ep.20x250.250Kevents.Q2=1.0-10.0.PDF=10800_2.root");
22  T1->AddFile("data/bpage/origin/pythia.ep.20x250.250Kevents.Q2=1.0-10.0.PDF=10800_3.root");
23  T1->AddFile("data/bpage/origin/pythia.ep.20x250.250Kevents.Q2=1.0-10.0.PDF=10800_4.root");
24  T1->AddFile("data/bpage/origin/pythia.ep.20x250.250Kevents.Q2=1.0-10.0.PDF=10800_5.root");
25  T1->AddFile("data/bpage/origin/pythia.ep.20x250.250Kevents.Q2=1.0-10.0.PDF=10800_6.root");
26  T1->AddFile("data/bpage/origin/pythia.ep.20x250.250Kevents.Q2=1.0-10.0.PDF=10800_7.root");
27  T1->AddFile("data/bpage/origin/pythia.ep.20x250.250Kevents.Q2=1.0-10.0.PDF=10800_8.root");
28  T1->AddFile("data/bpage/origin/pythia.ep.20x250.250Kevents.Q2=1.0-10.0.PDF=10800_9.root");
29  T1->AddFile("data/bpage/origin/pythia.ep.20x250.250Kevents.Q2=1.0-10.0.PDF=10800_10.root");
30 
31 // T1->SetWeight(xsec_T1 / xsec_T1,"global");
32 //
33 // TChain* T2 = new TChain("EICTree");
34 // T2->AddFile("data/bpage/origin/pythia.ep.20x250.250Kevents.Q2=10.0-100.0.PDF=10800_1.root");
35 // T2->SetWeight(xsec_T2 / xsec_T1,"global");
36 //
37 // TChain* T3 = new TChain("EICTree");
38 // T3->AddFile("data/bpage/origin/pythia.ep.20x250.50Kevents.Q2=100.0-1000.0.PDF=10800_1.root");
39 // T3->SetWeight(xsec_T3 / xsec_T1,"global");
40 
41 
42  TChain* T = new TChain("EICTree");
43  // T->AddFile("data/TEST/pythia.ep.20x250.1Mevents.1.RadCor=0.Q2gt1.root");
44  // T->AddFile("data/pythiaeRHIC/TREES/pythia.ep.20x250.RadCor=0.Q2gt1.50kevts.root");
45  T->Add(T1);
46  // T->Add(T2);
47  // T->Add(T3);
48 
49  /*------------------------------------------*/
50  /*--------------Define Cuts-----------------*/
51 
52  //TCut Q2_cut = "Q2 > 1";
53 
54  TCut electron_cut = "particles.id == 11";
55  TCut hadron_cut = "abs(particles.id) > 100";
56  TCut proton_cut = "particles.id == 2212";
57  TCut neutron_cut = "particles.id == 2112";
58  TCut Kaon_cut = "abs(particles.id) == 321 || particles.id == 311";
59  TCut Pion_charged_cut = "abs(particles.id) == 211";
60  //TCut Pion_cut = "abs(particles.id) == 211 || particles.id == 111";
61  TCut photon_cut = "particles.id == 22";
62 
63  TCut mother_cut = "particles.parentId == 0";
64  TCut status_cut = "particles.KS == 1";
65 
66  TCut eta_cut_n3n2 = "particles.eta > -3 && particles.eta < -2";
67  TCut eta_cut_n2n1 = "particles.eta > -2 && particles.eta < -1";
68  TCut eta_cut_n1z0 = "particles.eta > -1 && particles.eta < -0";
69 
70  /*------------------------------------------*/
71  /*-------Momentum vs. Pseudorapidity--------*/
72  /*------------------------------------------*/
73 
74  /*------------------------------------------*/
75  /*---------Electrons (LoI Fig. 2-1)---------*/
76  /*------------------------------------------*/
77 // TH2F *h_peta_e = new TH2F("h_peta_e", "", 100, -4, 3, 100, 0, 50 ); //250x015 10M
78 //
79 // TCanvas *c_peta_e = new TCanvas( "c_peta_e" );
80 // c_peta_e->SetLogz();
81 //
82 // // T->Draw("particles.p : particles.eta>>h_peta_e", electron_cut && mother_cut && "trueQ2 > 1", "colz");
83 // T->Draw("particles.p : particles.eta>>h_peta_e", electron_cut && "trueQ2 > 1", "colz");
84 //
85 // h_peta_e->GetXaxis()->SetTitle("Pseudorapidity #eta");
86 // h_peta_e->GetYaxis()->SetTitle("Electron Momentum p_{e-} [GeV]");
87 
88  // c_p_eta_e->Print("Plots/pythia_peta_e_10M_250x010.eps");
89  // c_p_eta_e->Print("Plots/pythia_peta_e_10M_250x010.png");
90 
91  /*------------------------------------------*/
92  /*----------Hadrons (LoI Fig. 2-4)----------*/
93  /*------------------------------------------*/
94  TH2F *h_p_eta_h = new TH2F("h_p_eta_h", "", 80,-5,5, 50,0,70); //250x015
95 
96  TCanvas *c_p_eta_h = new TCanvas( "c_p_eta_h" );
97  c_p_eta_h->SetRightMargin(0.12);
98 
99  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");
100 
101 // TH2F *h_p_eta_h1 = (TH2F*)h_p_eta_h->Clone("h_p_eta_h1");
102 // TH2F *h_p_eta_h2 = (TH2F*)h_p_eta_h->Clone("h_p_eta_h2");
103 // TH2F *h_p_eta_h3 = (TH2F*)h_p_eta_h->Clone("h_p_eta_h3");
104 //
105 // 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");
106 // 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");
107 // 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");
108 //
109 // h_p_eta_h->Add(h_p_eta_h1);
110 // h_p_eta_h->Add(h_p_eta_h2);
111 // h_p_eta_h->Add(h_p_eta_h3);
112 
113  h_p_eta_h->GetXaxis()->SetTitle("Pseudorapidity #eta");
114  h_p_eta_h->GetYaxis()->SetTitle("Hadron Momentum p_{Hadron} [GeV]");
115  c_p_eta_h->SetLogz();
116 
117  h_p_eta_h->Draw("colz");
118 
119  /* Add boxes for PID acceptances */
120  TBox * b_cpid = new TBox(-1.55,0.8,1.242,6); // DIRC
121  b_cpid->SetFillStyle(0);
122  b_cpid->SetLineWidth(2);
123  b_cpid->Draw("sameL");
124 
125  TBox * b_epid = new TBox(-4,2,-1.55,8); // mRICH
126  b_epid->SetFillStyle(0);
127  b_epid->SetLineWidth(2);
128  b_epid->Draw("sameL");
129 
130  TBox * b_fpid0 = new TBox(1.242,15,4,50); // Gas RICH
131  b_fpid0->SetFillStyle(0);
132  b_fpid0->SetLineWidth(2);
133  b_fpid0->Draw("sameL");
134 
135  TBox * b_fpid1 = new TBox(1.242,2,1.85,8); // mRICH
136  b_fpid1->SetFillStyle(0);
137  b_fpid1->SetLineWidth(2);
138  b_fpid1->Draw("sameL");
139 
140  TBox * b_fpid2 = new TBox(1.85,0,4,8); // TOF
141  b_fpid2->SetFillStyle(0);
142  b_fpid2->SetLineWidth(2);
143  b_fpid2->Draw("sameL");
144 
145  // c_p_eta_h->Print("Plots/pythia_peta_h_10M_250x010.eps");
146  // c_p_eta_h->Print("Plots/pythia_peta_h_10M_250x010.png");
147 
148 
149 // /*------------Momentum Spectra (Figure 2.2)--------------*/
150 //
151 // /*-------- -3 < Eta < -2 ---------*/
152 //
153 // TH1F* hp_e_n3n2 = new TH1F("hp_e_n3n2", "dN/dp vs. p", 60, 0, 30);
154 // TH1F* hp_p_n3n2 = new TH1F("hp_p_n3n2", "dN/dp vs. p", 60, 0, 30);
155 // TH1F* hp_y_n3n2 = new TH1F("hp_y_n3n2", "dN/dp vs. p", 60, 0, 30);
156 //
157 // TCanvas *cp_e_n3n2 = new TCanvas("cp_e_n3n2");
158 // T->Draw("sqrt(particles.px**2 + particles.py**2 + particles.pz**2)>>hp_e_n3n2", electron_cut && eta_cut_n3n2 && "Q2 > 0.01", "goff");
159 // 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");
160 // 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");
161 //
162 //
163 // TH1F* htmp_n3n2 = hp_e_n3n2->Clone();
164 // htmp_n3n2->SetTitle("");
165 // htmp_n3n2->GetXaxis()->SetTitle("p [GeV]");
166 // htmp_n3n2->GetYaxis()->SetTitle("dN/dp");
167 // htmp_n3n2->SetMaximum( 0.99e7);
168 // htmp_n3n2->Draw();
169 //
170 // hp_e_n3n2->SetLineColor(2);
171 // hp_e_n3n2->Draw("same");
172 // hp_p_n3n2->SetLineColor(1);
173 // hp_p_n3n2->Draw("same");
174 // hp_y_n3n2->SetLineColor(4);
175 // hp_y_n3n2->Draw("same");
176 // cp_e_n3n2->SetLogy();
177 //
178 // TLegend* leg_n3n2 = new TLegend(0.53,0.67,0.73,0.90);
179 // hp_e_n3n2->SetTitle("DIS electron");
180 // hp_p_n3n2->SetTitle("#pi#pm");
181 // hp_y_n3n2->SetTitle("Photons");
182 // leg_n3n2->AddEntry(hp_e_n3n2, "", "L");
183 // leg_n3n2->AddEntry(hp_p_n3n2, "", "L");
184 // leg_n3n2->AddEntry(hp_y_n3n2, "", "L");
185 // leg_n3n2->SetTextSize(0.04);
186 // leg_n3n2->Draw();
187 //
188 // // cp_e_n3n2->Print("Plots/pythia_MomSpec_n3n2_10M_250x010.eps");
189 // // cp_e_n3n2->Print("Plots/pythia_MomSpec_n3n2_10M_250x010.png");
190 //
191 //
192 // /*Temporary Electron Purity Test*/
193 //
194 //
195 //
196 //
197 //
198 //
199 // /*-------- -2 < Eta < -1 ---------*/
200 //
201 // TH1F* hp_e_n2n1 = new TH1F("hp_e_n2n1", "dN/dp vs. p", 60, 0, 30);
202 // TH1F* hp_p_n2n1 = new TH1F("hp_p_n2n1", "dN/dp vs. p", 60, 0, 30);
203 // TH1F* hp_y_n2n1 = new TH1F("hp_y_n2n1", "dN/dp vs. p", 60, 0, 30);
204 //
205 // TCanvas *cp_e_n2n1 = new TCanvas("cp_e_n2n1");
206 // T->Draw("sqrt(particles.px**2 + particles.py**2 + particles.pz**2)>>hp_e_n2n1", electron_cut && eta_cut_n2n1 && "Q2 > 0.01", "goff");
207 // 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");
208 // 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");
209 //
210 // TH1F* htmp_n2n1 = hp_e_n2n1->Clone();
211 // htmp_n2n1->SetTitle("");
212 // htmp_n2n1->GetXaxis()->SetTitle("p [GeV]");
213 // htmp_n2n1->GetYaxis()->SetTitle("dN/dp");
214 // htmp_n2n1->SetMaximum( 0.99e7);
215 // htmp_n2n1->Draw();
216 //
217 // hp_e_n2n1->SetLineColor(2);
218 // hp_e_n2n1->Draw("same");
219 // hp_p_n2n1->SetLineColor(1);
220 // hp_p_n2n1->Draw("same");
221 // hp_y_n2n1->SetLineColor(4);
222 // hp_y_n2n1->Draw("same");
223 // cp_e_n2n1->SetLogy();
224 //
225 // TLegend* leg_n2n1 = new TLegend(0.53,0.67,0.73,0.90);
226 // hp_e_n2n1->SetTitle("DIS electron");
227 // hp_p_n2n1->SetTitle("#pi#pm");
228 // hp_y_n2n1->SetTitle("Photons");
229 // leg_n2n1->AddEntry(hp_e_n2n1, "", "L");
230 // leg_n2n1->AddEntry(hp_p_n2n1, "", "L");
231 // leg_n2n1->AddEntry(hp_y_n2n1, "", "L");
232 // leg_n2n1->SetTextSize(0.04);
233 // leg_n2n1->Draw();
234 //
235 // // cp_e_n2n1->Print("Plots/pythia_MomSpec_n2n1_10M_250x010.eps");
236 // // cp_e_n2n1->Print("Plots/pythia_MomSpec_n2n1_10M_250x010.png");
237 //
238 // /*-------- -1 < Eta < 0 ---------*/
239 //
240 // TH1F* hp_e_n1z0 = new TH1F("hp_e_n1z0", "dN/dp vs. p", 60, 0, 30);
241 // TH1F* hp_p_n1z0 = new TH1F("hp_p_n1z0", "dN/dp vs. p", 60, 0, 30);
242 // TH1F* hp_y_n1z0 = new TH1F("hp_y_n1z0", "dN/dp vs. p", 60, 0, 30);
243 //
244 // TCanvas *cp_e_n1z0 = new TCanvas("cp_e_n1z0");
245 // T->Draw("sqrt(particles.px**2 + particles.py**2 + particles.pz**2)>>hp_e_n1z0", electron_cut && eta_cut_n1z0 && "Q2 > 0.01", "goff");
246 // 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");
247 // 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");
248 //
249 // TH1F* htmp_n1z0 = hp_e_n1z0->Clone();
250 // htmp_n1z0->SetTitle("");
251 // htmp_n1z0->GetXaxis()->SetTitle("p [GeV]");
252 // htmp_n1z0->GetYaxis()->SetTitle("dN/dp");
253 // htmp_n1z0->SetMaximum( 0.99e7 );
254 // htmp_n1z0->Draw();
255 //
256 // hp_e_n1z0->SetLineColor(2);
257 // hp_e_n1z0->Draw("same");
258 // hp_p_n1z0->SetLineColor(1);
259 // hp_p_n1z0->Draw("same");
260 // hp_y_n1z0->SetLineColor(4);
261 // hp_y_n1z0->Draw("same");
262 // cp_e_n1z0->SetLogy();
263 //
264 // TLegend* leg_n1z0 = new TLegend(0.53,0.67,0.73,0.90);
265 // hp_e_n1z0->SetTitle("DIS electron");
266 // hp_p_n1z0->SetTitle("#pi#pm");
267 // hp_y_n1z0->SetTitle("Photons");
268 // leg_n1z0->AddEntry(hp_e_n1z0, "", "L");
269 // leg_n1z0->AddEntry(hp_p_n1z0, "", "L");
270 // leg_n1z0->AddEntry(hp_y_n1z0, "", "L");
271 // leg_n1z0->SetTextSize(0.04);
272 // leg_n1z0->Draw();
273 //
274 // // cp_e_n1z0->Print("Plots/pythia_MomSpec_n1z0_10M_250x010.eps");
275 // // cp_e_n1z0->Print("Plots/pythia_MomSpec_n1z0_10M_250x010.png");
276 
277  return 0 ;
278 }