File indexing completed on 2025-08-06 08:11:56
0001 void Neutrals ()
0002 {
0003 cout << "TEST VII" << endl;
0004 char infile[100];
0005 int pz[9] = {1,2,4,8,12,16,32,40,50};
0006 double x[9];
0007 double means[9] = {0};
0008 double y[9];
0009 double mval = 0;
0010 int lastbincont = 0;
0011 bool lastbin = false;
0012 int var = 11;
0013 double intnum[1000] = {0};
0014 double varnum[1000] = {0};
0015 char *part[] = {"gamma","neutron","anti_neutron"};
0016 int i = 0;
0017 int w =4;
0018
0019
0020
0021
0022
0023
0024 for (int q=0; q<3; q++)
0025 {
0026 for (int w=0; w<9;w++)
0027 {
0028 cout << "TEST VI" << endl;
0029 char ffile[100];
0030 sprintf(ffile,"/phenix/u/jpinkenburg/sPHENIX/analysis/AntiSigma/macros/HistoBaseFiles/%s_ThinBins.root", part[q]);
0031 TFile *f = TFile::Open(ffile);
0032 char hname[100];
0033 sprintf(hname,"%s%dd",part[q],pz[w]);
0034 TH1F *h1 = (TH1F *)f->Get(hname);
0035 var = 11;
0036 i = 0;
0037 while (var <= 8001)
0038 {
0039
0040 if (i<1000)
0041 {
0042 varnum[i] = .005*(i);
0043 intnum[i] = (h1->Integral(var-10,var))/10000.;
0044 i++;
0045 }
0046 var+=10;
0047 }
0048
0049
0050 char fname [100];
0051 sprintf(fname, "Gamma_Neutron_Hijing_Energy_Graphs.root");
0052 TFile *fout = TFile::Open(fname,"UPDATE");
0053
0054
0055 f->Close();
0056
0057
0058
0059
0060 gStyle->SetOptStat(0);
0061
0062
0063 TMarker *mean = new TMarker();
0064 mean->SetMarkerStyle(20);
0065 mean->SetMarkerColor(3);
0066 char canvname[100];
0067 sprintf(canvname,"%s%d",part[q],pz[w]);
0068
0069
0070 cout << "TEST V" << endl;
0071 TGraph *gr = new TGraph((i-2),varnum,intnum);
0072 char gtitle[100];
0073 sprintf(gtitle,"%s%dGeV;ConeSize;Percentage of Energy Deposited",part[q],pz[w]);
0074 char gname[100];
0075 sprintf(gname,"%s%dGeV",part[q],pz[w]);
0076 cout << intnum[50] << " " << varnum[50] << endl;
0077 gr->SetTitle(gtitle);
0078 gr->SetName(gname);
0079 gr->SetMarkerStyle(20);
0080 if (part[q] == "anti_neutron")
0081 {
0082 gr->SetMarkerColor(4);
0083 }
0084 else if (part[q] == "neutron")
0085 {
0086 gr->SetMarkerColor(2);
0087 }
0088 else if (part[q] == "gamma")
0089 {
0090 gr->SetMarkerColor(3);
0091 }
0092 else
0093 {
0094 cout << "idiot" << endl;
0095 }
0096
0097
0098
0099 gr->Draw("ALP");
0100
0101
0102
0103
0104 gr->Write();
0105 cout << "TEST 1" << endl;
0106
0107 cout << "TEST II" << endl;
0108
0109 cout << "TEST III" << endl;
0110
0111 cout << "TEST IV" << endl;
0112
0113
0114
0115
0116 fout->Write();
0117 fout->Close();
0118
0119 for (int a=0;a<1000;a++)
0120 {
0121 intnum[a] = 0;
0122 varnum[a] = 0;
0123 }
0124
0125 }
0126 }
0127 }
0128
0129 void Hijing()
0130 {
0131 TFile *fin = TFile::Open("/sphenix/user/pinkenbu/jade/hijingdat2.root");
0132 gROOT->cd();
0133 TH1 *hjbkg = new TH1F("hjbkg","Hijing Background",100,0.,0.5);
0134 TNtuple *de = (TNtuple *) fin->Get("de");
0135 de->Project("hjbkg","dtotal","(ID<=2)*edep/250.");
0136
0137 char fname [100];
0138 sprintf(fname, "Gamma_Neutron_Hijing_Energy_Graphs.root");
0139 TFile *fout = TFile::Open(fname,"UPDATE");
0140 hjbkg->Write();
0141 fout->Write();
0142 fout->Close();
0143 fin->Close();
0144 }
0145
0146 void DrawHijing2GeV()
0147 {
0148 TCanvas *c1 = new TCanvas();
0149 TFile *fin = TFile::Open("Gamma_Neutron_Hijing_Energy_Graphs.root");
0150 gROOT->cd();
0151 TH1 *h1lim = new TH1F("h1lim","",1,0,0.1);
0152 TH1 *hjbkg = (TH1 *) fin->Get("hjbkg")->Clone();
0153 TGraph *anti_neutron2GeV = (TGraph *) fin->Get("anti_neutron2GeV")->Clone();
0154 TGraph *neutron2GeV = (TGraph *) fin->Get("neutron2GeV")->Clone();
0155 h1lim->SetStats(0);
0156 h1lim->SetMaximum(0.3);
0157 h1lim->SetTitle("2 GeV Hadronic Showers with HIJING background");
0158 h1lim->GetYaxis()->SetTitle("Deposited Energey [GeV]");
0159 h1lim->GetYaxis()->SetTitleOffset(1.2);
0160 h1lim->GetXaxis()->SetTitle("cone size (#sqrt{#Delta#Phi^{2}+#Delta#Theta^{2}})");
0161 h1lim->GetXaxis()->SetTitleOffset(1.2);
0162 h1lim->Draw();
0163 hjbkg->SetStats(0);
0164 hjbkg->SetLineColor(6);
0165 hjbkg->SetMaximum(5.5);
0166 hjbkg->SetLineWidth(2);
0167 hjbkg->Draw("same");
0168 anti_neutron2GeV->SetLineColor(4);
0169 anti_neutron2GeV->SetLineWidth(2);
0170 anti_neutron2GeV->Draw("same");
0171 neutron2GeV->SetLineColor(2);
0172 neutron2GeV->SetLineWidth(2);
0173 neutron2GeV->Draw("same");
0174 TLine *tl = new TLine();
0175 tl->SetLineStyle(2);
0176 tl->DrawLine(0.024,0,0.024,0.3);
0177 TLegend *legrda = new TLegend(0.67,0.34,0.87,0.54,NULL,"brNDC");
0178 legrda->SetLineColor(1);
0179 legrda->SetLineStyle(1);
0180 legrda->SetLineWidth(1);
0181 legrda->SetFillColor(10);
0182 legrda->SetFillStyle(1001);
0183 legrda->SetBorderSize(0);
0184
0185 legrda->AddEntry(hjbkg,"HIJING bkg");
0186 legrda->AddEntry(anti_neutron2GeV,"2 GeV Anti Neutron","l");
0187 legrda->AddEntry(neutron2GeV,"2 GeV Neutron", "l");
0188 legrda->AddEntry(tl,"EMCal tower size","l");
0189 legrda->Draw();
0190
0191 fin->Close();
0192 c1->Print("Hijing2GeV.png");
0193 }
0194
0195 void DrawHijing50GeV()
0196 {
0197 TCanvas *c1 = new TCanvas();
0198 TFile *fin = TFile::Open("Gamma_Neutron_Hijing_Energy_Graphs.root");
0199 gROOT->cd();
0200 TH1 *hjbkg = (TH1 *) fin->Get("hjbkg")->Clone();
0201 TGraph *anti_neutron50GeV = (TGraph *) fin->Get("anti_neutron50GeV")->Clone();
0202 TGraph *neutron50GeV = (TGraph *) fin->Get("neutron50GeV")->Clone();
0203 hjbkg->SetStats(0);
0204 hjbkg->SetLineColor(6);
0205 hjbkg->SetMaximum(5.5);
0206 hjbkg->SetLineWidth(2);
0207 hjbkg->SetTitle("50 GeV Hadronic Showers with HIJING background");
0208 hjbkg->GetYaxis()->SetTitle("Deposited Energey [GeV]");
0209 hjbkg->GetYaxis()->SetTitleOffset(0.8);
0210 hjbkg->GetXaxis()->SetTitle("cone size (#sqrt{#Delta#Phi^{2}+#Delta#Theta^{2}})");
0211 hjbkg->GetXaxis()->SetTitleOffset(1.2);
0212 hjbkg->Draw();
0213 anti_neutron50GeV->SetLineColor(4);
0214 anti_neutron50GeV->SetLineWidth(2);
0215 anti_neutron50GeV->Draw("same");
0216 neutron50GeV->SetLineColor(2);
0217 neutron50GeV->SetLineWidth(2);
0218 neutron50GeV->Draw("same");
0219 TLine *tl = new TLine();
0220 tl->SetLineStyle(2);
0221 tl->DrawLine(0.1,0,0.1,5.5);
0222 TLegend *legrda = new TLegend(0.67,0.54,0.87,0.74,NULL,"brNDC");
0223 legrda->SetLineColor(1);
0224 legrda->SetLineStyle(1);
0225 legrda->SetLineWidth(1);
0226 legrda->SetFillColor(10);
0227 legrda->SetFillStyle(1001);
0228 legrda->SetBorderSize(0);
0229
0230 legrda->AddEntry(hjbkg,"HIJING bkg");
0231 legrda->AddEntry(anti_neutron50GeV, "50 GeV Anti Neutron","l");
0232 legrda->AddEntry(neutron50GeV, "50 GeV Neutron", "l");
0233 legrda->AddEntry(tl, "HCal tower size","l");
0234 legrda->Draw();
0235 fin->Close();
0236 c1->Print("Hijing50GeV.png");
0237 }