File indexing completed on 2025-08-06 08:11:56
0001 void EdepPercentSmall ()
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 TCanvas *c3 = new TCanvas("TresGraphitos","stupid graph",1);
0019 TH1F *h4 = new TH1F("histo","histo",1000,0,.5);
0020
0021 TMarker *grmark = new TMarker();
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,"%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(1,var))/(h1->Integral());
0044 i++;
0045 }
0046 var+=10;
0047 }
0048 varnum[0] = 0;
0049 intnum[0] = 0;
0050 char fname [100];
0051 sprintf(fname, "PosterHistos.root");
0052 TFile *fout = TFile::Open(fname,"UPDATE");
0053 h1->Write();
0054 fout->Write();
0055 f->Close();
0056
0057 TH2 *h2 = new TH2F("meanvals","anti_neutron",1,0,5,1,0,1.2);
0058 gStyle->SetOptStat(0);
0059
0060
0061 TMarker *mean = new TMarker();
0062 mean->SetMarkerStyle(20);
0063 mean->SetMarkerColor(3);
0064 char canvname[100];
0065 sprintf(canvname,"%s%d",part[q],pz[w]);
0066
0067
0068 cout << "TEST V" << endl;
0069 TGraph *gr = new TGraph((i-2),varnum,intnum);
0070 char gtitle[100];
0071 sprintf(gtitle,"%s%dGeV;ConeSize;Percentage of Energy Deposited",part[q],pz[w]);
0072 char gname[100];
0073 sprintf(gname,"%s%dGeV",part[q],pz[w]);
0074 cout << intnum[50] << " " << varnum[50] << endl;
0075 gr->SetTitle(gtitle);
0076 gr->SetName(gname);
0077 gr->SetMarkerStyle(20);
0078 if (part[q] == "anti_neutron")
0079 {
0080 gr->SetMarkerColor(4);
0081 }
0082 else if (part[q] == "neutron")
0083 {
0084 gr->SetMarkerColor(2);
0085 }
0086 else if (part[q] == "gamma")
0087 {
0088 gr->SetMarkerColor(3);
0089 }
0090 else
0091 {
0092 cout << "idiot" << endl;
0093 }
0094 gr->SetMaximum(1.2);
0095 h2->Draw();
0096 gr->Draw("A*");
0097
0098
0099
0100
0101 h4->Write();
0102 gr->Write();
0103 cout << "TEST 1" << endl;
0104
0105 cout << "TEST II" << endl;
0106
0107 cout << "TEST III" << endl;
0108
0109 cout << "TEST IV" << endl;
0110
0111
0112
0113
0114 fout->Write();
0115 fout->Close();
0116
0117 for (int a=0;a<1000;a++)
0118 {
0119 intnum[a] = 0;
0120 varnum[a] = 0;
0121 }
0122
0123 }
0124 }
0125 for (int j=0;j<9;j++)
0126 {
0127 cout << "TEST VIII" << endl;
0128 TFile *fhist = TFile::Open("PosterHistos.root");
0129 cout << "TEST IX" << endl;
0130 char anhtotname[300];
0131 sprintf(anhtotname,"anti_neutron%dGeV;ConeSize;Percentage of Energy Deposited",pz[j]);
0132 auto h32 = (TH2F*)fhist->Get(anhtotname);
0133 char nhtotname[300];
0134 sprintf(nhtotname,"neutron%dGeV;ConeSize;Percentage of Energy Deposited",pz[j]);
0135 auto h12 = (TH2F*)fhist->Get(nhtotname);
0136 cout << "TEST X" << endl;
0137 char ghtotname[300];
0138 sprintf(ghtotname,"gamma%dGeV;ConeSize;Percentage of Energy Deposited",pz[j]);
0139 auto h22 = (TH2F*)fhist->Get(ghtotname);
0140 cout << "TEST XI" << endl;
0141 TCanvas *c12 = new TCanvas();
0142 cout << "TEST XII" << endl;
0143 h32->Draw();
0144 cout << "TEST XIII" << endl;
0145 h12->Draw("PMC same");
0146 h22->Draw("PMC same");
0147 cout <<"TEST XIV" << endl;
0148 fhist->Close();
0149 cout << "DONE" << endl;
0150 }
0151 TCanvas *c123 = new TCanvas();
0152 TFile *ff = TFile::Open("PosterHistos.root");
0153 auto h101 = (TH2F*)ff->Get("anti_neutron1GeV;ConeSize;Percentage of Energy Deposited");
0154 h101->Draw();
0155 ff->Close();
0156 for (int o=0;o<8;o++)
0157 {
0158 TFile *f_all = TFile::Open("PosterHistos.root");
0159 char aname[200];
0160 sprintf(aname,"anti_neutron%dGeV;ConeSize;Percentage of Energy Deposited",pz[(o+1)]);
0161 auto h100 = (TH2F*)f_all->Get(aname);
0162 h100->Draw("PMC same");
0163 f_all->Close();
0164 }
0165 }
0166
0167
0168 void ThreeGraphs ()
0169 {
0170
0171 char infile[100];
0172 int pz[9] = {1,2,4,8,12,16,32,40,50};
0173 double x[9];
0174 double means[9] = {0};
0175 double y[9];
0176 double mval = 0;
0177 int lastbincont = 0;
0178 bool lastbin = false;
0179 int var = 11;
0180 double intnum[1000] = {0};
0181 double varnum[1000] = {0};
0182 char *part[] = {"gamma","neutron","anti_neutron"};
0183 int i = 0;
0184 TGraph *gr = new TGraph();
0185
0186 for (int q=0; q<3; q++)
0187 {
0188
0189
0190 char ffile[100];
0191 sprintf(ffile,"%s_ThinBins.root", part[q]);
0192 TFile *f = TFile::Open(ffile);
0193 char hname[100];
0194 sprintf(hname,"%s12d",part[q]);
0195 TH1F *h1 = (TH1F *)f->Get(hname);
0196 var = 11;
0197 i = 0;
0198 while (var <= 8001)
0199 {
0200
0201 if (i<100)
0202 {
0203 varnum[i] = .005*(i+1);
0204 intnum[i] = (h1->Integral(1,var))/(h1->Integral());
0205 }
0206 var+=10;
0207 i++;
0208 }
0209
0210
0211
0212
0213
0214
0215
0216
0217 char fname [100];
0218 sprintf(fname, "PosterHistos.root");
0219 y TFile *fout = TFile::Open(fname,"UPDATE");
0220 h1->Write();
0221
0222 f->Close();
0223
0224
0225
0226
0227
0228 TH2 *h2 = new TH2F("meanvals","anti_neutron",1,0,4,1,0,50);
0229 gStyle->SetOptStat(0);
0230 TMarker *mean = new TMarker();
0231 mean->SetMarkerStyle(20);
0232 mean->SetMarkerColor(3);
0233
0234
0235 gr->TGraph((i-1),varnum,intnum);
0236 char gname[100];
0237 sprintf(gname,"12GeV;xtitle;ytitle");
0238 gr->SetTitle(gname);
0239 gr->SetName(gname);
0240 gr->Draw("A*");
0241
0242
0243
0244
0245
0246
0247 for (int a=0;a<1000;a++)
0248 {
0249 intnum[a] = 0;
0250 varnum[a] = 0;
0251 }
0252
0253
0254 }
0255 fout->Write();
0256 fout->Close();
0257 }
0258
0259
0260
0261
0262
0263 void StupidGraphs ()
0264 {
0265 TFile *fin = TFile::Open("PosterHistos.root");
0266 gROOT->cd();
0267 TH2 *h2 = new TH2F("DumbGraph","TresLines",1,0,10,1,0,50);
0268 gStyle->SetOptStat(0);
0269 TMarker *spf = new TMarker();
0270 spf->SetMarkerStyle(20);
0271 spf->SetMarkerColor(4);
0272 TCanvas *c1 = new TCanvas();
0273 h2->Draw();
0274 double x;
0275 double y;
0276
0277 char hname[100];
0278 sprintf(hname, "meanvals");
0279 TH2 *gr = (TH2F *) fin->Get(hname);
0280 cout << "herro" << endl;
0281 cout << gr()->GetPoint(1,x,y) << endl;
0282
0283
0284 }
0285
0286