Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ShSizePrep.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file ShSizePrep.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, "/sphenix/user/pinkenbu/jade/ntuple/%s_eta0_%dGeV.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("de");
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, "%scondor.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 }