Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GammaNeutronEnergyHijing.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file GammaNeutronEnergyHijing.C
1 void Neutrals (/*TH1 *h1*/)//const char *part="e")//,int nevent = 1000)
2 {
3  cout << "TEST VII" << endl;
4  char infile[100];
5  int pz[9] = {1,2,4,8,12,16,32,40,50};
6  double x[9];
7  double means[9] = {0};
8  double y[9];
9  double mval = 0;
10  int lastbincont = 0;
11  bool lastbin = false;
12  int var = 11;
13  double intnum[1000] = {0};
14  double varnum[1000] = {0};
15  char *part[] = {"gamma","neutron","anti_neutron"};
16  int i = 0;
17  int w =4;
18  //TCanvas *c3 = new TCanvas("TresGraphitos","stupid graph",1);
19  // TH1F *h4 = new TH1F("histo","histo",1000,0,.5);
20  //TH2F *h3 = new TH2F("HistoGraph","HistoGraph",1000,0,.55,1000,0,1.2);
21  // TMarker *grmark = new TMarker();
22  // TCanvas *c19 = new TCanvas();
23  // h3->Draw();
24  for (int q=0; q<3; q++)
25  {
26  for (int w=0; w<9;w++)
27  {
28  cout << "TEST VI" << endl;
29  char ffile[100];
30  sprintf(ffile,"/phenix/u/jpinkenburg/sPHENIX/analysis/AntiSigma/macros/HistoBaseFiles/%s_ThinBins.root", part[q]);
31  TFile *f = TFile::Open(ffile);
32  char hname[100];
33  sprintf(hname,"%s%dd",part[q],pz[w]);
34  TH1F *h1 = (TH1F *)f->Get(hname);
35  var = 11;
36  i = 0;
37  while (var <= 8001)
38  {
39 
40  if (i<1000)
41  {
42  varnum[i] = .005*(i);
43  intnum[i] = (h1->Integral(var-10,var))/10000.;//(h1->Integral());
44  i++;
45  }
46  var+=10;
47  }
48  // varnum[0] = 0;
49  // intnum[0] = 0;
50  char fname [100];
51  sprintf(fname, "Gamma_Neutron_Hijing_Energy_Graphs.root");
52  TFile *fout = TFile::Open(fname,"UPDATE");
53  // h1->Write();
54  //fout->Write();
55  f->Close();
56  //char hname[100];
57  //sprintf(hname,"%s%dGeV",part[q],pz[w]);
58  // cout << h1->Integral() << " " << hname << " " << pz[i] << endl;
59  //TH2 *h2 = new TH2F("hname","hname",1,0,5,1,0,1.2);
60  gStyle->SetOptStat(0);
61 
62 
63  TMarker *mean = new TMarker();
64  mean->SetMarkerStyle(20);
65  mean->SetMarkerColor(3);
66  char canvname[100];
67  sprintf(canvname,"%s%d",part[q],pz[w]);
68  //TCanvas *c3 = new TCanvas(canvname,"stupid graph",1);
69  //double dtot[9] = {0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9};
70  cout << "TEST V" << endl;
71  TGraph *gr = new TGraph((i-2),varnum,intnum);
72  char gtitle[100];
73  sprintf(gtitle,"%s%dGeV;ConeSize;Percentage of Energy Deposited",part[q],pz[w]);
74  char gname[100];
75  sprintf(gname,"%s%dGeV",part[q],pz[w]);
76  cout << intnum[50] << " " << varnum[50] << endl;
77  gr->SetTitle(gtitle);
78  gr->SetName(gname);
79  gr->SetMarkerStyle(20);
80  if (part[q] == "anti_neutron")
81  {
82  gr->SetMarkerColor(4);
83  }
84  else if (part[q] == "neutron")
85  {
86  gr->SetMarkerColor(2);
87  }
88  else if (part[q] == "gamma")
89  {
90  gr->SetMarkerColor(3);
91  }
92  else
93  {
94  cout << "idiot" << endl;
95  }
96 // gr->SetMaximum(1.2);
97  //h2->Draw();
98  //gr->Draw("A*");
99  gr->Draw("ALP");
100  //c3->DrawFrame(0,0,0.5,1.2);
101  // gr->PaintGrapHist((i-1),varnum,intnum,"chopt");
102  // gr->SetHistogram(h4);
103  //h4->Write();
104  gr->Write();
105  cout << "TEST 1" << endl;
106  // TH2F *h3 = (TH2F *) "HistoGraph";
107  cout << "TEST II" << endl;
108 
109  cout << "TEST III" << endl;
110  //h3->Write();
111  cout << "TEST IV" << endl;
112  //double x;
113  //double y;
114  //gr()->GetPoint(
115 
116  fout->Write();
117  fout->Close();
118  // gr->Close();
119  for (int a=0;a<1000;a++)
120  {
121  intnum[a] = 0;
122  varnum[a] = 0;
123  }
124 
125  }
126  }
127 }
128 
129 void Hijing()
130 {
131  TFile *fin = TFile::Open("/sphenix/user/pinkenbu/jade/hijingdat2.root");
132  gROOT->cd();
133  TH1 *hjbkg = new TH1F("hjbkg","Hijing Background",100,0.,0.5);
134  TNtuple *de = (TNtuple *) fin->Get("de");
135  de->Project("hjbkg","dtotal","(ID<=2)*edep/250.");
136 
137  char fname [100];
138  sprintf(fname, "Gamma_Neutron_Hijing_Energy_Graphs.root");
139  TFile *fout = TFile::Open(fname,"UPDATE");
140  hjbkg->Write();
141  fout->Write();
142  fout->Close();
143  fin->Close();
144 }
145 
147 {
148  TCanvas *c1 = new TCanvas();
149 TFile *fin = TFile::Open("Gamma_Neutron_Hijing_Energy_Graphs.root");
150 gROOT->cd();
151 TH1 *h1lim = new TH1F("h1lim","",1,0,0.1);
152 TH1 *hjbkg = (TH1 *) fin->Get("hjbkg")->Clone();
153 TGraph *anti_neutron2GeV = (TGraph *) fin->Get("anti_neutron2GeV")->Clone();
154 TGraph *neutron2GeV = (TGraph *) fin->Get("neutron2GeV")->Clone();
155 h1lim->SetStats(0);
156 h1lim->SetMaximum(0.3);
157 h1lim->SetTitle("2 GeV Hadronic Showers with HIJING background");
158 h1lim->GetYaxis()->SetTitle("Deposited Energey [GeV]");
159 h1lim->GetYaxis()->SetTitleOffset(1.2);
160 h1lim->GetXaxis()->SetTitle("cone size (#sqrt{#Delta#Phi^{2}+#Delta#Theta^{2}})");
161 h1lim->GetXaxis()->SetTitleOffset(1.2);
162 h1lim->Draw();
163 hjbkg->SetStats(0);
164 hjbkg->SetLineColor(6);
165 hjbkg->SetMaximum(5.5);
166 hjbkg->SetLineWidth(2);
167 hjbkg->Draw("same");
168 anti_neutron2GeV->SetLineColor(4);
169 anti_neutron2GeV->SetLineWidth(2);
170 anti_neutron2GeV->Draw("same");
171 neutron2GeV->SetLineColor(2);
172 neutron2GeV->SetLineWidth(2);
173 neutron2GeV->Draw("same");
174 TLine *tl = new TLine();
175 tl->SetLineStyle(2);
176 tl->DrawLine(0.024,0,0.024,0.3);
177 TLegend *legrda = new TLegend(0.67,0.34,0.87,0.54,NULL,"brNDC");
178  legrda->SetLineColor(1);
179  legrda->SetLineStyle(1);
180  legrda->SetLineWidth(1);
181  legrda->SetFillColor(10);
182  legrda->SetFillStyle(1001);
183  legrda->SetBorderSize(0);
184 // legrda->SetTextSize(labelsize);
185  legrda->AddEntry(hjbkg,"HIJING bkg");
186  legrda->AddEntry(anti_neutron2GeV,"2 GeV Anti Neutron","l");
187  legrda->AddEntry(neutron2GeV,"2 GeV Neutron", "l");
188  legrda->AddEntry(tl,"EMCal tower size","l");
189  legrda->Draw();
190 
191 fin->Close();
192 c1->Print("Hijing2GeV.png");
193 }
194 
196 {
197  TCanvas *c1 = new TCanvas();
198 TFile *fin = TFile::Open("Gamma_Neutron_Hijing_Energy_Graphs.root");
199 gROOT->cd();
200 TH1 *hjbkg = (TH1 *) fin->Get("hjbkg")->Clone();
201 TGraph *anti_neutron50GeV = (TGraph *) fin->Get("anti_neutron50GeV")->Clone();
202 TGraph *neutron50GeV = (TGraph *) fin->Get("neutron50GeV")->Clone();
203 hjbkg->SetStats(0);
204 hjbkg->SetLineColor(6);
205 hjbkg->SetMaximum(5.5);
206 hjbkg->SetLineWidth(2);
207 hjbkg->SetTitle("50 GeV Hadronic Showers with HIJING background");
208 hjbkg->GetYaxis()->SetTitle("Deposited Energey [GeV]");
209 hjbkg->GetYaxis()->SetTitleOffset(0.8);
210 hjbkg->GetXaxis()->SetTitle("cone size (#sqrt{#Delta#Phi^{2}+#Delta#Theta^{2}})");
211 hjbkg->GetXaxis()->SetTitleOffset(1.2);
212 hjbkg->Draw();
213 anti_neutron50GeV->SetLineColor(4);
214 anti_neutron50GeV->SetLineWidth(2);
215 anti_neutron50GeV->Draw("same");
216 neutron50GeV->SetLineColor(2);
217 neutron50GeV->SetLineWidth(2);
218 neutron50GeV->Draw("same");
219 TLine *tl = new TLine();
220 tl->SetLineStyle(2);
221 tl->DrawLine(0.1,0,0.1,5.5);
222 TLegend *legrda = new TLegend(0.67,0.54,0.87,0.74,NULL,"brNDC");
223  legrda->SetLineColor(1);
224  legrda->SetLineStyle(1);
225  legrda->SetLineWidth(1);
226  legrda->SetFillColor(10);
227  legrda->SetFillStyle(1001);
228  legrda->SetBorderSize(0);
229 // legrda->SetTextSize(labelsize);
230  legrda->AddEntry(hjbkg,"HIJING bkg");
231  legrda->AddEntry(anti_neutron50GeV, "50 GeV Anti Neutron","l");
232  legrda->AddEntry(neutron50GeV, "50 GeV Neutron", "l");
233  legrda->AddEntry(tl, "HCal tower size","l");
234  legrda->Draw();
235 fin->Close();
236 c1->Print("Hijing50GeV.png");
237 }