Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ShSizeEdep.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file ShSizeEdep.C
1 void ShSizePrep (const char *part="e")
2 {
3  char infile[100];
4  int rad[11] = {0,1,2,3,4,5,6,7,8,9,100};
5  double xr[11];
6  int pz[8] = {1,2,4,8,16,32,40,50};
7  double x[8];
8  char *calo[] = {"E","HO","HI","BH","MAG"};
9 
10  for (int i=0; i<8; i++)
11  {
12  for (int j=0; j<11; j++)
13  {
14  for (int k=0;k<5;k++)
15  {
16  x[i] = pz[i];
17  xr[j] = rad[j];
18  sprintf(infile, "%sSmallSH%dout.root",part, pz[i]);
19  char hname [100];
20  sprintf(hname, "%sSH%dRad%d%s",part,pz[i],rad[j],calo[k]);
21  TH1F *h1 = new TH1F(hname, hname, 1000, 0, (pz[i]+1));
22  TFile *f = TFile::Open(infile);
23  if (! f)
24  {
25  cout << infile << " not found - bozo!!!" << endl;
26  gSystem->Exit(1);
27  }
28  gROOT->cd();
29  TNtuple *nt = (TNtuple *)f->Get("sz");
30  char radn[100];
31  sprintf(radn, "RAD==%d", rad[j]);
32  nt->Project(hname,calo[k],radn);
33  if (! nt)
34  {
35  cout << "sz" << " not found - bozo!!!" << endl;
36  gSystem->Exit(1);
37  }
38  // char cal [100];
39  // sprintf(cal,"%s",calo);
40  /*if (calo == "HO")
41  {
42  nt->Project(hname,"(HOA+HOS)/(EA+ES+HIA+HIS+HOA+HOS+BH+MAG)");
43  }
44  else if(calo == "HI")
45  {
46  nt->Project(hname,"(HIA+HIS)/(EA+ES+HIA+HIS+HOA+HOS+BH+MAG)");
47  }
48  else if(calo == "E")
49  {
50  nt->Project(hname,"(EA+ES)/(EA+ES+HIA+HIS+HOA+HOS+BH+MAG)");
51  }
52  else if (calo == "MAG")
53  {
54  nt->Project(hname,"(MAG)/(EA+ES+HIA+HIS+HOA+HOS+BH+MAG)");
55  }
56  else if (calo == "BH")
57  {
58  nt->Project(hname,"(BH)/(EA+ES+HIA+HIS+HOA+HOS+BH+MAG)");
59  }
60  else
61  {
62  cout << "ERROR" << endl;
63  }
64  */
65  f->Close();
66  h1->Draw();
67  char fname [100];
68  sprintf(fname, "%spercent.root",part);
69  TFile *fout = TFile::Open(fname,"UPDATE");
70  h1->Write();
71  fout->Write();
72  cout << h1->Integral() << " " << hname << endl;
73  //fout->Write();
74  fout->Close();
75  }
76  }
77  }
78 }
79 
80 void ShSizeHist(const char *part = "e")
81 {
82  int rad[11] = {0,1,2,3,4,5,6,7,8,9,100};
83  int pz[8] = {1,2,4,8,16,32,40,50};
84  char *calo[] = {"E","HO","HI","BH","MAG"};
85  double x[11];
86  double y[11];
87  double xer[11] = {0};
88  double yer[11];
89  char hname[100];
90  char fname[100];
91  sprintf(fname,"%spercent.root",part);
92  char area[100];
93  sprintf(area,"%s",part);
94  TFile *fin = TFile::Open(fname);
95  gROOT->cd();
96  for (int i=0; i<8; i++)
97  {
98  for (int j=0; j<5; j++)
99  {
100  for (int k=0; k<11;k++)
101  {
102  // TFile *fin = TFile::Open(fname);
103  x[k] = rad[k];
104  sprintf(hname,"%sSH%dRad%d%s",part,pz[i],rad[k],calo[j]);
105  TH1 *h1 = (TH1F *) fin->Get(hname);
106  if (! fin)
107  {
108  cout << "DEATH BY STUPIDITY" << endl;
109  }
110  cout << hname << endl;
111  y[k] = h1->GetMean(1);
112  yer[k] = h1->GetRMS(1);
113  }
114  gr = new TGraphErrors(10,x,y,xer,yer);
115  char gname[100];
116  sprintf(gname, "%s%d%sRADERR",part,pz[i],calo[j]);
117  gr->SetTitle(gname);
118  gr->SetName(gname);
119  gr->Draw("ALP");
120  gr->SetMarkerStyle(20);
121  gr->SetMarkerColor(2);
122  char fname[100];
123  sprintf(fname,"%sShEdepErr.root",part);
124  TFile *fout = TFile::Open(fname, "UPDATE");
125  gr->Write();
126  fout->Write();
127  fout->Close();
128  for (int m=0; m<11;m++)
129  {
130  y[m] = 0;
131  yer[m] = 0;
132  x[m] = 0;
133  }
134  }
135  }
136  fin->Close();
137 }