File indexing completed on 2025-08-06 08:11:56
0001 void ShSizePrep (const char *part="e")
0002 {
0003 char infile[100];
0004 int rad[11] = {0,1,2,3,4,5,6,7,8,9,100};
0005 double xr[11];
0006 int pz[8] = {1,2,4,8,16,32,40,50};
0007 double x[8];
0008 char *calo[] = {"E","HO","HI","BH","MAG"};
0009
0010 for (int i=0; i<8; i++)
0011 {
0012 for (int j=0; j<11; j++)
0013 {
0014 for (int k=0;k<5;k++)
0015 {
0016 x[i] = pz[i];
0017 xr[j] = rad[j];
0018 sprintf(infile, "%sSmallSH%dout.root",part, pz[i]);
0019 char hname [100];
0020 sprintf(hname, "%sSH%dRad%d%s",part,pz[i],rad[j],calo[k]);
0021 TH1F *h1 = new TH1F(hname, hname, 1000, 0, (pz[i]+1));
0022 TFile *f = TFile::Open(infile);
0023 if (! f)
0024 {
0025 cout << infile << " not found - bozo!!!" << endl;
0026 gSystem->Exit(1);
0027 }
0028 gROOT->cd();
0029 TNtuple *nt = (TNtuple *)f->Get("sz");
0030 char radn[100];
0031 sprintf(radn, "RAD==%d", rad[j]);
0032 nt->Project(hname,calo[k],radn);
0033 if (! nt)
0034 {
0035 cout << "sz" << " not found - bozo!!!" << endl;
0036 gSystem->Exit(1);
0037 }
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065 f->Close();
0066 h1->Draw();
0067 char fname [100];
0068 sprintf(fname, "%spercent.root",part);
0069 TFile *fout = TFile::Open(fname,"UPDATE");
0070 h1->Write();
0071 fout->Write();
0072 cout << h1->Integral() << " " << hname << endl;
0073
0074 fout->Close();
0075 }
0076 }
0077 }
0078 }
0079
0080 void ShSizeHist(const char *part = "e")
0081 {
0082 int rad[11] = {0,1,2,3,4,5,6,7,8,9,100};
0083 int pz[8] = {1,2,4,8,16,32,40,50};
0084 char *calo[] = {"E","HO","HI","BH","MAG"};
0085 double x[11];
0086 double y[11];
0087 double xer[11] = {0};
0088 double yer[11];
0089 char hname[100];
0090 char fname[100];
0091 sprintf(fname,"%spercent.root",part);
0092 char area[100];
0093 sprintf(area,"%s",part);
0094 TFile *fin = TFile::Open(fname);
0095 gROOT->cd();
0096 for (int i=0; i<8; i++)
0097 {
0098 for (int j=0; j<5; j++)
0099 {
0100 for (int k=0; k<11;k++)
0101 {
0102
0103 x[k] = rad[k];
0104 sprintf(hname,"%sSH%dRad%d%s",part,pz[i],rad[k],calo[j]);
0105 TH1 *h1 = (TH1F *) fin->Get(hname);
0106 if (! fin)
0107 {
0108 cout << "DEATH BY STUPIDITY" << endl;
0109 }
0110 cout << hname << endl;
0111 y[k] = h1->GetMean(1);
0112 yer[k] = h1->GetRMS(1);
0113 }
0114 gr = new TGraphErrors(10,x,y,xer,yer);
0115 char gname[100];
0116 sprintf(gname, "%s%d%sRADERR",part,pz[i],calo[j]);
0117 gr->SetTitle(gname);
0118 gr->SetName(gname);
0119 gr->Draw("ALP");
0120 gr->SetMarkerStyle(20);
0121 gr->SetMarkerColor(2);
0122 char fname[100];
0123 sprintf(fname,"%sShEdepErr.root",part);
0124 TFile *fout = TFile::Open(fname, "UPDATE");
0125 gr->Write();
0126 fout->Write();
0127 fout->Close();
0128 for (int m=0; m<11;m++)
0129 {
0130 y[m] = 0;
0131 yer[m] = 0;
0132 x[m] = 0;
0133 }
0134 }
0135 }
0136 fin->Close();
0137 }