Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GammaNeutronEnergy2DGraphMaker.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file GammaNeutronEnergy2DGraphMaker.C
2 {
3  TFile *fin = TFile::Open("Gamma_Neutron_Energy_Graphs.root");
4  gROOT->cd();
5  TCanvas *c1 = new TCanvas();
6  gStyle->SetOptStat(0);
7  TH2F *n2h2 = new TH2F("Percentage of Energy Deposited by 2 GeV Particles vs Cone Size","Percentage of Energy Deposited by 2 GeV Particles vs Cone Size",1,0,1,1,0,1.1);
8  TGraph *n2gr = (TGraph *) fin->Get("neutron2GeV")->Clone();
9  n2h2->SetXTitle("Cone Size");
10  n2h2->SetYTitle("Percentage of Energy Deposited");
11  n2h2->Draw();
12  n2gr->Draw("*");
13  TGraph *g2gr = (TGraph *) fin->Get("gamma2GeV")->Clone();
14  //TH2F *g2h2 = new TH2F("g2h2","g2h2",1,0,1,1,0,1.1);
15  // g2h2->Draw("same");
16  g2gr->Draw("*");
17  TLine *tl = new TLine();
18  tl->SetLineStyle(2);
19  tl->DrawLine(0.1,0,0.1,1.1);
20  TLine *t2 = new TLine();
21  t2->SetLineStyle(6);
22  t2->DrawLine(0.024,0,0.024,1.1);
23  TLegend *legrda = new TLegend(0.63,0.24,0.84,0.59,NULL,"brNDC");
24  legrda->SetLineColor(1);
25  legrda->SetLineStyle(1);
26  legrda->SetLineWidth(1);
27  legrda->SetFillColor(10);
28  legrda->SetFillStyle(1001);
29  legrda->SetBorderSize(0);
30  // legrda->SetTextSize(labelsize);
31  //legrda->AddEntry(hjbkg,"HIJING bkg");
32  legrda->AddEntry(gamma2GeV, "2 GeV Gamma","p");
33  legrda->AddEntry(neutron2GeV, "2 GeV Neutron", "p");
34  legrda->AddEntry(tl, "HCAL tower size","l");
35  legrda->AddEntry(t2,"EMCAL tower size","l");
36  legrda->Draw();
37  c1->Print("Gamma_vs_Neutron_2GeV.png");
38 
39  TCanvas *c2 = new TCanvas();
40  gStyle->SetOptStat(0);
41  TH2F *n50h2 = new TH2F("Percentage of Energy Deposited by 50 GeV Particles vs Cone Size","Percentage of Energy Deposited by 50 GeV Particles vs Cone Size",1,0,1,1,0,1.1);
42  TGraph *n50gr = (TGraph *) fin->Get("neutron50GeV")->Clone();
43  n50h2->SetXTitle("Cone Size");
44  n50h2->SetYTitle("Percentage of Energy Deposited");
45  n50h2->Draw();
46  n50gr->Draw("*");
47  TGraph *g50gr = (TGraph *) fin->Get("gamma50GeV")->Clone();
48  //TH2F *g50h2 = new TH2F("g50h2","g50h2",1,0,1,1,0,1.1);
49  //g50h2->Draw("same");
50  g50gr->Draw("*");
51  TLine *tl = new TLine();
52  tl->SetLineStyle(2);
53  tl->DrawLine(0.1,0,0.1,1.1);
54  TLine *t2 = new TLine();
55  t2->SetLineStyle(6);
56  t2->DrawLine(0.024,0,0.024,1.1);
57  TLegend *legrda2 = new TLegend(0.63,0.24,0.84,0.59,NULL,"brNDC");
58  legrda2->SetLineColor(1);
59  legrda2->SetLineStyle(1);
60  legrda2->SetLineWidth(1);
61  legrda2->SetFillColor(10);
62  legrda2->SetFillStyle(1001);
63  legrda2->SetBorderSize(0);
64  // legrda2->SetTextSize(labelsize);
65  //legrda2->AddEntry(hjbkg,"HIJING bkg");
66  legrda2->AddEntry(gamma50GeV, "50 GeV Gamma","p");
67  legrda2->AddEntry(neutron50GeV, "50 GeV Neutron", "p");
68  legrda2->AddEntry(tl, "HCAL tower size","l");
69  legrda2->AddEntry(t2,"EMCAL tower size","l");
70  legrda2->Draw();
71  c2->Print("Gamma_vs_Neutron_50GeV.png");
72 
73 
74  TCanvas *c3 = new TCanvas();
75  gStyle->SetOptStat(0);
76  TH2F *ga2 = new TH2F("Gamma Energy Deposition vs Cone Size","Gamma Energy Deposition vs Cone Size",1,0,0.5,1,0,1.1);
77  TGraph *gamma2GeV = (TGraph *) fin->Get("gamma2GeV")->Clone();
78  ga2->SetXTitle("Cone Size");
79  ga2->SetYTitle("Percentage of Energy Deposited");
80  ga2->Draw();
81  gamma2GeV->SetMarkerSize(1);
82  gamma2GeV->SetMarkerStyle(4);
83  gamma2GeV->Draw("P");
84  int pz[7] = {4,8,12,16,32,40,50};
85  int col[7] = {2,9,4,5,6,7,8};
86  int mark[7] = {24,25,26,27,28,35,36};
87  for (int i=0; i<7;i++)
88  {
89  char hname[100];
90  sprintf(hname,"gamma%dGeV",pz[i]);
91  //TH2F *gall = new TH2F(hname,hname,1,0,0.5,1,0,1.1);
92  TGraph *gamall = (TGraph *) fin->Get(hname);
93  //gall->Draw("same");
94  gamall->SetMarkerColor(col[i]);
95  gamall->SetMarkerStyle(4);
96  gamall->SetMarkerSize(1);
97  //gamall->SetLineWidth(3);
98  gamall->Draw("P");
99  }
100  TLine *tl = new TLine();
101  tl->SetLineStyle(2);
102  tl->DrawLine(0.1,0,0.1,1.1);
103  TLine *t2 = new TLine();
104  t2->SetLineStyle(6);
105  t2->DrawLine(0.024,0,0.024,1.1);
106  TLegend *legrda3 = new TLegend(0.63,0.24,0.84,0.59,NULL,"brNDC");
107  legrda3->SetLineColor(1);
108  legrda3->SetLineStyle(1);
109  legrda3->SetLineWidth(1);
110  legrda3->SetFillColor(10);
111  legrda3->SetFillStyle(1001);
112  legrda3->SetBorderSize(0);
113  // legrda3->SetTextSize(labelsize);
114  //legrda3->AddEntry(hjbkg,"HIJING bkg");
115  legrda3->AddEntry(gamma2GeV, "2 GeV Gamma","p");
116  legrda3->AddEntry(gamma4GeV, "4 GeV Gamma","p");
117  legrda3->AddEntry(gamma8GeV, "8 GeV Gamma","p");
118  legrda3->AddEntry(gamma12GeV, "12 GeV Gamma","p");
119  legrda3->AddEntry(gamma16GeV, "16 GeV Gamma","p");
120  legrda3->AddEntry(gamma32GeV, "32 GeV Gamma","p");
121  legrda3->AddEntry(gamma40GeV, "40 GeV Gamma","p");
122  legrda3->AddEntry(gamma50GeV, "50 GeV Gamma","p");
123  legrda3->AddEntry(tl, "HCAL tower size","l" );
124  legrda3->AddEntry(t2,"EMCAL tower size", "l");
125  legrda3->Draw();
126  c3->Print("Gamma_All.png");
127 
128  TCanvas *c4 = new TCanvas();
129  gStyle->SetOptStat(0);
130  TH2F *an2 = new TH2F("Antineutron Energy Deposition vs Cone Size","Antineutron Energy Deposition vs Cone Size",1,0,0.5,1,0,1.1);
131  TGraph *anti_neutron2GeV = (TGraph *) fin->Get("anti_neutron2GeV")->Clone();
132  an2->SetXTitle("Cone Size");
133  an2->SetYTitle("Percentage of Energy Deposited");
134  an2->Draw();
135  anti_neutron2GeV->SetMarkerSize(1);
136  anti_neutron2GeV->SetMarkerStyle(4);
137  anti_neutron2GeV->Draw("P");
138  int pz[7] = {4,8,12,16,32,40,50};
139  int col[7] = {2,9,4,5,6,7,8};
140  int mark[7] = {24,25,26,27,28,35,36};
141  for (int i=0; i<7;i++)
142  {
143  char hname[100];
144  sprintf(hname,"anti_neutron%dGeV",pz[i]);
145  //TH2F *gall = new TH2F(hname,hname,1,0,0.5,1,0,1.1);
146  TGraph *anall = (TGraph *) fin->Get(hname);
147  //gall->Draw("same");
148  anall->SetMarkerColor(col[i]);
149  anall->SetMarkerStyle(4);
150  anall->SetMarkerSize(1);
151  //gamall->SetLineWidth(3);
152  anall->Draw("P");
153  }
154  TLine *tl = new TLine();
155  tl->SetLineStyle(2);
156  tl->DrawLine(0.1,0,0.1,1.1);
157  TLine *t2 = new TLine();
158  t2->SetLineStyle(6);
159  t2->DrawLine(0.024,0,0.024,1.1);
160  TLegend *legrda4 = new TLegend(0.63,0.24,0.84,0.59,NULL,"brNDC");
161  legrda4->SetLineColor(1);
162  legrda4->SetLineStyle(1);
163  legrda4->SetLineWidth(1);
164  legrda4->SetFillColor(10);
165  legrda4->SetFillStyle(1001);
166  legrda4->SetBorderSize(0);
167  // legrda4->SetTextSize(labelsize);
168  //legrda4->AddEntry(hjbkg,"HIJING bkg");
169 legrda4->AddEntry(anti_neutron2GeV, "2 GeV Anti Neutron","p");
170 legrda4->AddEntry(anti_neutron4GeV, "4 GeV Anti Neutron","p");
171 legrda4->AddEntry(anti_neutron8GeV, "8 GeV Anti Neutron","p");
172 legrda4->AddEntry(anti_neutron12GeV, "12 GeV Anti Neutron","p");
173 legrda4->AddEntry(anti_neutron16GeV, "16 GeV Anti Neutron","p");
174 legrda4->AddEntry(anti_neutron32GeV, "32 GeV Anti Neutron","p");
175 legrda4->AddEntry(anti_neutron40GeV, "40 GeV Anti Neutron","p");
176 legrda4->AddEntry(anti_neutron50GeV, "50 GeV Anti Neutron","p");
177  legrda4->AddEntry(tl, "HCAL tower size","l");
178  legrda4->AddEntry(t2,"EMCAL Tower size","l");
179  legrda4->Draw();
180  c4->Print("Antineutron_All.png");
181 
182  TCanvas *c5 = new TCanvas();
183  gStyle->SetOptStat(0);
184  TH2F *n2 = new TH2F("Neutron Energy Deposition vs Cone Size","Neutron Energy Deposition vs Cone Size",1,0,0.5,1,0,1.1);
185  TGraph *neutron2GeV = (TGraph *) fin->Get("neutron2GeV")->Clone();
186  n2->SetXTitle("Cone Size");
187  n2->SetYTitle("Percentage of Energy Deposited");
188  n2->Draw();
189  neutron2GeV->SetMarkerSize(1);
190  neutron2GeV->SetMarkerStyle(4);
191  neutron2GeV->Draw("P");
192  int pz[7] = {4,8,12,16,32,40,50};
193  int col[7] = {2,9,4,5,6,7,8};
194  int mark[7] = {24,25,26,27,28,35,36};
195  for (int i=0; i<7;i++)
196  {
197  char hname[100];
198  sprintf(hname,"neutron%dGeV",pz[i]);
199  //TH2F *gall = new TH2F(hname,hname,1,0,0.5,1,0,1.1);
200  TGraph *nall = (TGraph *) fin->Get(hname);
201  //gall->Draw("same");
202  nall->SetMarkerColor(col[i]);
203  nall->SetMarkerStyle(4);
204  nall->SetMarkerSize(1);
205  //gamall->SetLineWidth(3);
206  nall->Draw("P");
207  }
208  TLine *tl = new TLine();
209  tl->SetLineStyle(2);
210  tl->DrawLine(0.1,0,0.1,1.1);
211  TLine *t2 = new TLine();
212  t2->SetLineStyle(6);
213  t2->DrawLine(0.024,0,0.024,1.1);
214  TLegend *legrda5 = new TLegend(0.63,0.24,0.84,0.59,NULL,"brNDC");
215  legrda5->SetLineColor(1);
216  legrda5->SetLineStyle(1);
217  legrda5->SetLineWidth(1);
218  legrda5->SetFillColor(10);
219  legrda5->SetFillStyle(1001);
220  legrda5->SetBorderSize(0);
221  // legrda->SetTextSize(labelsize);
222  //legrda->AddEntry(hjbkg,"HIJING bkg");
223 legrda5->AddEntry(neutron2GeV, "2 GeV Neutron","p");
224 legrda5->AddEntry(neutron4GeV, "4 GeV Neutron","p");
225 legrda5->AddEntry(neutron8GeV, "8 GeV Neutron","p");
226 legrda5->AddEntry(neutron12GeV, "12 GeV Neutron","p");
227 legrda5->AddEntry(neutron16GeV, "16 GeV Neutron","p");
228 legrda5->AddEntry(neutron32GeV, "32 GeV Neutron","p");
229 legrda5->AddEntry(neutron40GeV, "40 GeV Neutron","p");
230 legrda5->AddEntry(neutron50GeV, "50 GeV Neutron","p");
231  legrda5->AddEntry(tl, "HCAL tower size","l");
232  legrda5->AddEntry(t2,"EMCAL tower size","l");
233  legrda5->Draw();
234  c5->Print("Neutron_All.png");
235 
236  fin->Close();
237 }
238