Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
makePlot_LoI_Momentum.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file makePlot_LoI_Momentum.C
1 
9  const TString infile = "data/pythia.ep.100.test.root"
10  )
11 {
12  gStyle->SetOptStat(kFALSE);
13 
14  /*--------------Get Input File--------------*/
15 
16  TFile *f_pyth = new TFile( infile, "OPEN");
17  TTree* T = (TTree*)f_pyth->Get("tree");
18  T->Print();
19 
20  /*------------------------------------------*/
21  /*--------------Define Cuts-----------------*/
22 
23  //TCut Q2_cut = "Q2 > 1";
24 
25  TCut electron_cut = "p.fKF == 11";
26  TCut hadron_cut = "abs(p.fKF) > 100";
27  TCut proton_cut = "p.fKF == 2212";
28  TCut neutron_cut = "p.fKF == 2112";
29  TCut Kaon_cut = "abs(p.fKF) == 321 || p.fKF == 311";
30  TCut Pion_charged_cut = "abs(p.fKF) == 211";
31  //TCut Pion_cut = "abs(p.fKF) == 211 || p.fKF == 111";
32  TCut photon_cut = "p.fKF == 22";
33 
34  TCut mother_cut = "p.fParent == 0";
35  TCut status_cut = "p.fKS < 10";
36 
37  TCut eta_cut_n3n2 = "TMath::ASinH(p.fPz/sqrt((p.fPx)**2 + (p.fPy)**2)) > -3 && TMath::ASinH(p.fPz/sqrt((p.fPx)**2 + (p.fPy)**2)) < -2";
38  TCut eta_cut_n2n1 = "TMath::ASinH(p.fPz/sqrt((p.fPx)**2 + (p.fPy)**2)) > -2 && TMath::ASinH(p.fPz/sqrt((p.fPx)**2 + (p.fPy)**2)) < -1";
39  TCut eta_cut_n1z0 = "TMath::ASinH(p.fPz/sqrt((p.fPx)**2 + (p.fPy)**2)) > -1 && TMath::ASinH(p.fPz/sqrt((p.fPx)**2 + (p.fPy)**2)) < -0";
40 
41  /*------------------------------------------*/
42  /*-------Momentum vs. Pseudorapidity--------*/
43  /*------------------------------------------*/
44 
45  /*------------------------------------------*/
46  /*---------Electrons (LoI Fig. 2-1)---------*/
47  /*------------------------------------------*/
48  TH2F *h_peta_e = new TH2F("h_peta_e", "", 100, -4, 3, 100, 0, 50 ); //250x015 10M
49 
50  TCanvas *c_peta_e = new TCanvas( "c_peta_e" );
51  c_peta_e->SetLogz();
52 
53  T->Draw("sqrt((p.fPx)**2 + (p.fPy)**2 + (p.fPz)**2 ):TMath::ASinH(p.fPz/sqrt((p.fPx)**2 + (p.fPy)**2))>>h_peta_e", electron_cut && mother_cut && "Q2 > 1", "colz");
54 
55  h_peta_e->GetXaxis()->SetTitle("Pseudorapidity #eta");
56  h_peta_e->GetYaxis()->SetTitle("Electron Momentum p_{e-} [GeV]");
57 
58  // c_p_eta_e->Print("Plots/Pythia_peta_e_10M_250x010.eps");
59  // c_p_eta_e->Print("Plots/Pythia_peta_e_10M_250x010.png");
60 
61  /*------------------------------------------*/
62  /*----------Hadrons (LoI Fig. 2-4)----------*/
63  /*------------------------------------------*/
64  TH2F *h_p_eta_h = new TH2F("h_p_eta_h", "", 60,-6,6, 200,0,225); //250x015 10M
65 
66  TCanvas *c_p_eta_h = new TCanvas( "c_p_eta_h" );
67  // T->Draw("sqrt((p.fPx)**2 + (p.fPy)**2 + (p.fPz)**2 ):TMath::ASinH(p.fPz/sqrt((p.fPx)**2 + (p.fPy)**2))>>h_p_eta_h",hadron_cut && "Q2 > 1 && 0.01 < y < 0.80 && W2 > 10", "colz");
68  T->Draw("sqrt((p.fPx)**2 + (p.fPy)**2 + (p.fPz)**2 ):TMath::ASinH(p.fPz/sqrt((p.fPx)**2 + (p.fPy)**2))>>h_p_eta_h",hadron_cut && "Q2 > 1 && 0.01 < y < 0.80", "colz");
69 
70  h_p_eta_h->GetXaxis()->SetTitle("Pseudorapidity #eta");
71  h_p_eta_h->GetYaxis()->SetTitle("Hadron Momentum p_{Hadron} [GeV]");
72  c_p_eta_h->SetLogz();
73 
74  // c_p_eta_h->Print("Plots/Pythia_peta_h_10M_250x010.eps");
75  // c_p_eta_h->Print("Plots/Pythia_peta_h_10M_250x010.png");
76 
77 
78  /*------------Momentum Spectra (Figure 2.2)--------------*/
79 
80  /*-------- -3 < Eta < -2 ---------*/
81 
82  TH1F* hp_e_n3n2 = new TH1F("hp_e_n3n2", "dN/dp vs. p", 60, 0, 30);
83  TH1F* hp_p_n3n2 = new TH1F("hp_p_n3n2", "dN/dp vs. p", 60, 0, 30);
84  TH1F* hp_y_n3n2 = new TH1F("hp_y_n3n2", "dN/dp vs. p", 60, 0, 30);
85 
86  TCanvas *cp_e_n3n2 = new TCanvas("cp_e_n3n2");
87  T->Draw("sqrt(p.fPx**2 + p.fPy**2 + p.fPz**2)>>hp_e_n3n2", electron_cut && eta_cut_n3n2 && "Q2 > 0.01", "goff");
88  T->Draw("sqrt(p.fPx**2 + p.fPy**2 + p.fPz**2)>>hp_p_n3n2", Pion_charged_cut && eta_cut_n3n2 && "Q2 > 0.01", "goff");
89  T->Draw("sqrt(p.fPx**2 + p.fPy**2 + p.fPz**2)>>hp_y_n3n2", photon_cut && eta_cut_n3n2 && status_cut && "Q2 > 0.01", "goff");
90 
91 
92  TH1F* htmp_n3n2 = hp_e_n3n2->Clone();
93  htmp_n3n2->SetTitle("");
94  htmp_n3n2->GetXaxis()->SetTitle("p [GeV]");
95  htmp_n3n2->GetYaxis()->SetTitle("dN/dp");
96  htmp_n3n2->SetMaximum( 0.99e7);
97  htmp_n3n2->Draw();
98 
99  hp_e_n3n2->SetLineColor(2);
100  hp_e_n3n2->Draw("same");
101  hp_p_n3n2->SetLineColor(1);
102  hp_p_n3n2->Draw("same");
103  hp_y_n3n2->SetLineColor(4);
104  hp_y_n3n2->Draw("same");
105  cp_e_n3n2->SetLogy();
106 
107  TLegend* leg_n3n2 = new TLegend(0.53,0.67,0.73,0.90);
108  hp_e_n3n2->SetTitle("DIS electron");
109  hp_p_n3n2->SetTitle("#pi#pm");
110  hp_y_n3n2->SetTitle("Photons");
111  leg_n3n2->AddEntry(hp_e_n3n2, "", "L");
112  leg_n3n2->AddEntry(hp_p_n3n2, "", "L");
113  leg_n3n2->AddEntry(hp_y_n3n2, "", "L");
114  leg_n3n2->SetTextSize(0.04);
115  leg_n3n2->Draw();
116 
117  // cp_e_n3n2->Print("Plots/Pythia_MomSpec_n3n2_10M_250x010.eps");
118  // cp_e_n3n2->Print("Plots/Pythia_MomSpec_n3n2_10M_250x010.png");
119 
120 
121  /*Temporary Electron Purity Test*/
122 
123 
124 
125 
126 
127 
128  /*-------- -2 < Eta < -1 ---------*/
129 
130  TH1F* hp_e_n2n1 = new TH1F("hp_e_n2n1", "dN/dp vs. p", 60, 0, 30);
131  TH1F* hp_p_n2n1 = new TH1F("hp_p_n2n1", "dN/dp vs. p", 60, 0, 30);
132  TH1F* hp_y_n2n1 = new TH1F("hp_y_n2n1", "dN/dp vs. p", 60, 0, 30);
133 
134  TCanvas *cp_e_n2n1 = new TCanvas("cp_e_n2n1");
135  T->Draw("sqrt(p.fPx**2 + p.fPy**2 + p.fPz**2)>>hp_e_n2n1", electron_cut && eta_cut_n2n1 && "Q2 > 0.01", "goff");
136  T->Draw("sqrt(p.fPx**2 + p.fPy**2 + p.fPz**2)>>hp_p_n2n1", Pion_charged_cut && eta_cut_n2n1 && "Q2 > 0.01", "goff");
137  T->Draw("sqrt(p.fPx**2 + p.fPy**2 + p.fPz**2)>>hp_y_n2n1", photon_cut && eta_cut_n2n1 && status_cut && "Q2 > 0.01", "goff");
138 
139  TH1F* htmp_n2n1 = hp_e_n2n1->Clone();
140  htmp_n2n1->SetTitle("");
141  htmp_n2n1->GetXaxis()->SetTitle("p [GeV]");
142  htmp_n2n1->GetYaxis()->SetTitle("dN/dp");
143  htmp_n2n1->SetMaximum( 0.99e7);
144  htmp_n2n1->Draw();
145 
146  hp_e_n2n1->SetLineColor(2);
147  hp_e_n2n1->Draw("same");
148  hp_p_n2n1->SetLineColor(1);
149  hp_p_n2n1->Draw("same");
150  hp_y_n2n1->SetLineColor(4);
151  hp_y_n2n1->Draw("same");
152  cp_e_n2n1->SetLogy();
153 
154  TLegend* leg_n2n1 = new TLegend(0.53,0.67,0.73,0.90);
155  hp_e_n2n1->SetTitle("DIS electron");
156  hp_p_n2n1->SetTitle("#pi#pm");
157  hp_y_n2n1->SetTitle("Photons");
158  leg_n2n1->AddEntry(hp_e_n2n1, "", "L");
159  leg_n2n1->AddEntry(hp_p_n2n1, "", "L");
160  leg_n2n1->AddEntry(hp_y_n2n1, "", "L");
161  leg_n2n1->SetTextSize(0.04);
162  leg_n2n1->Draw();
163 
164  // cp_e_n2n1->Print("Plots/Pythia_MomSpec_n2n1_10M_250x010.eps");
165  // cp_e_n2n1->Print("Plots/Pythia_MomSpec_n2n1_10M_250x010.png");
166 
167  /*-------- -1 < Eta < 0 ---------*/
168 
169  TH1F* hp_e_n1z0 = new TH1F("hp_e_n1z0", "dN/dp vs. p", 60, 0, 30);
170  TH1F* hp_p_n1z0 = new TH1F("hp_p_n1z0", "dN/dp vs. p", 60, 0, 30);
171  TH1F* hp_y_n1z0 = new TH1F("hp_y_n1z0", "dN/dp vs. p", 60, 0, 30);
172 
173  TCanvas *cp_e_n1z0 = new TCanvas("cp_e_n1z0");
174  T->Draw("sqrt(p.fPx**2 + p.fPy**2 + p.fPz**2)>>hp_e_n1z0", electron_cut && eta_cut_n1z0 && "Q2 > 0.01", "goff");
175  T->Draw("sqrt(p.fPx**2 + p.fPy**2 + p.fPz**2)>>hp_p_n1z0", Pion_charged_cut && eta_cut_n1z0 && "Q2 > 0.01", "goff");
176  T->Draw("sqrt(p.fPx**2 + p.fPy**2 + p.fPz**2)>>hp_y_n1z0", photon_cut && eta_cut_n1z0 && status_cut && "Q2 > 0.01", "goff");
177 
178  TH1F* htmp_n1z0 = hp_e_n1z0->Clone();
179  htmp_n1z0->SetTitle("");
180  htmp_n1z0->GetXaxis()->SetTitle("p [GeV]");
181  htmp_n1z0->GetYaxis()->SetTitle("dN/dp");
182  htmp_n1z0->SetMaximum( 0.99e7 );
183  htmp_n1z0->Draw();
184 
185  hp_e_n1z0->SetLineColor(2);
186  hp_e_n1z0->Draw("same");
187  hp_p_n1z0->SetLineColor(1);
188  hp_p_n1z0->Draw("same");
189  hp_y_n1z0->SetLineColor(4);
190  hp_y_n1z0->Draw("same");
191  cp_e_n1z0->SetLogy();
192 
193  TLegend* leg_n1z0 = new TLegend(0.53,0.67,0.73,0.90);
194  hp_e_n1z0->SetTitle("DIS electron");
195  hp_p_n1z0->SetTitle("#pi#pm");
196  hp_y_n1z0->SetTitle("Photons");
197  leg_n1z0->AddEntry(hp_e_n1z0, "", "L");
198  leg_n1z0->AddEntry(hp_p_n1z0, "", "L");
199  leg_n1z0->AddEntry(hp_y_n1z0, "", "L");
200  leg_n1z0->SetTextSize(0.04);
201  leg_n1z0->Draw();
202 
203  // cp_e_n1z0->Print("Plots/Pythia_MomSpec_n1z0_10M_250x010.eps");
204  // cp_e_n1z0->Print("Plots/Pythia_MomSpec_n1z0_10M_250x010.png");
205 
206  return 0 ;
207 }