Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
dtotalEdepPercent.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file dtotalEdepPercent.C
1 void EdepPercentSmall (const char *calo="HO", const char *part="e")
2 {
3  char infile[100];
4  // int pz[9] = {1,2,4,8,12,16,32,40,50};
5  // double x[9];
6  char hname [100];
7  sprintf(hname, "%s%sd",calo,part/*,pz[i]*/);
8  TH1F *h1 = new TH1F(hname, hname, 100, 0, 10);
9  for (int i=0; i<3; i++)
10 {
11  //x[i] = pz[i];
12  sprintf(infile, "/sphenix/user/jpinkenburg/ShowerSize/ntuple/%s_eta0_4GeV.root",part/*, pz[i]*/);
13  char hname [100];
14  // sprintf(hname, "%s%s12GeV",calo,part,pz[i]);
15  //TH1F *h1 = new TH1F(hname, "", 100, 0, 1);
16  TFile *f = TFile::Open(infile);
17  gROOT->cd();
18  TNtuple *nt = (TNtuple *)f->Get("de");
19  char calid [100];
20  sprintf(calid, "ID==%s", i);
21  nt->Project(hname,"edep",calid);
22  // char cal [100];
23  // sprintf(cal,"%s",calo);
24  /*
25  if (calo == "HO")
26  {
27  nt->Project(hname,"edep","ID==2");
28  }
29  else if(calo == "HI")
30  {
31  nt->Project(hname,"edep","ID==1");
32  }
33  else if(calo == "E")
34  {
35  nt->Project(hname,"edep","ID==0");
36  }
37  else if (calo == "MAG")
38  {
39  nt->Project(hname,"(MAG)/(EA+ES+HIA+HIS+HOA+HOS+BH+MAG)");
40  }
41  else if (calo == "BH")
42  {
43  nt->Project(hname,"(BH)/(EA+ES+HIA+HIS+HOA+HOS+BH+MAG)");
44  }
45  else
46  {
47  cout << "ERROR" << endl;
48  }*/
49  f->Close();
50  h1->Draw();
51  char fname [100];
52  sprintf(fname, "%sShowerPercent.root",part);
53  TFile *fout = TFile::Open(fname,"UPDATE");
54  h1->Write();
55  fout->Write();
56  cout << h1->Integral() << " " << hname << " " /*<< pz[i] <<*/ endl;
57  //fout->Write();
58  fout->Close();
59  }
60 }
61 void EdepSmall(const char *calo="HOe", const char *part = "e")
62 {
63  int pz[9] = {1,2,4,8,12,16,32,40,50};
64  double x[9];
65  double y[9];
66  double xer[9] = {0};
67  double yer[9];
68  char hname[100];
69  char fname[100];
70  sprintf(fname,"%spercent.root",part);
71  char area[100];
72  sprintf(area,"%s",calo);
73  TFile *fin = TFile::Open(fname);
74  gROOT->cd();
75  for (int i=0; i<9; i++)
76  {
77  x[i] = pz[i];
78  sprintf(hname,"%s%s%dd",calo,part,pz[i]);
79 TH1 *h1 = (TH1F *) fin->Get(hname);
80  y[i] = h1->GetMean(1);
81  yer[i] = h1->GetRMS(1);
82  }
83  gr = new TGraphErrors(9,x,y,xer,yer);
84  gr->SetTitle(area);
85  gr->Draw("ALP");
86  gr->SetMarkerStyle(20);
87  gr->SetMarkerColor(2);
88  fin->Close();
89 }