Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HardHistos.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file HardHistos.C
1 void EdepPercentSmall (const char *part="e")//,int nevent = 1000)
2 {
3  char infile[100];
4  int pz[9] = {1,2,4,8,12,16,32,40,50};
5  double x[9];
6  double means[9] = {0};
7  double y[9];
8  double mval = 0;
9  int lastbincont = 0;
10  bool lastbin = false;
11 
12  for (int i=0; i<9; i++)
13 {
14  x[i] = pz[i];
15  y[i] = means[i];
16  sprintf(infile, "/sphenix/user/jpinkenburg/ShowerSize/ntuple/%s_eta0_%dGeV.root",part, pz[i]);
17  char hname [100];
18  sprintf(hname, "%s%dd",part,pz[i]);
19  TH1F *h1 = new TH1F(hname, hname, 8000, 0, 4);
20  TFile *f = TFile::Open(infile);
21  gROOT->cd();
22  TNtuple *nt = (TNtuple *)f->Get("de");
23  nt->Project(hname,"dtotal","(ID<=2)*edep");
24  //h1->Draw();
25  /* for (int j = 1000; j>0; j--)
26  {
27  if (lastbin == false)
28  {
29  if (h1->GetBinContent(j) == 0)
30  {
31  cout << j << endl;
32  }
33  else
34  {
35  lastbin = true;
36  lastbincont = (j/1000)*3.5;
37  }
38  }
39  else
40  {
41  j=0;
42  }
43  }
44  char revhname[100];
45  sprintf(revhname,"%s%dGeV",part,pz[i]);
46 
47  TH1F *h4 = new TH1F(revhname,revhname,10000,0,lastbincont);
48  nt->Project(revhname,"dtotal","(ID<=2)*edep","");
49  */f->Close();
50  h1->Draw();
51  /* mval = h1->Integral();
52  // cout << "mval " << mval << endl;
53  cout << "mval_supposed_to_be " << h4->Integral() << endl;
54  means[i] += mval;
55  mval = 0;
56  cout << "6" << endl;
57  */
58  char fname [100];
59  sprintf(fname, "%s_ThinBins.root",part);
60  TFile *fout = TFile::Open(fname,"UPDATE");
61  h1->Write();
62  fout->Write();
63  cout << h1->Integral() << " " << hname << " " << pz[i] << endl;
64  fout->Write();
65  fout->Close();
66  }
67  /* TFile *f1 = TFile::Open("anti_neutronShowerEdepPercent.root");
68  gROOT->cd();
69  TH2 *h2 = new TH2F("meanvals","anti_neutron",1,0,1,1,0,.01);
70  gStyle->SetOptStat(0);
71  TMarker *mean = new TMarker();
72  mean->SetMarkerStyle(20);
73  mean->SetMarkerColor(3);
74  TMarker *test = new TMarker();
75  test->SetMarkerStyle(20);
76  test->SetMarkerColor(5);
77  TCanvas *c2 = new TCanvas("c2","stupid graph",1);
78  double dtot[9] = {0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9};
79  TGraph *gr = new TGraph(9,dtot,means);
80  gr->Draw("AC*");
81 
82  h2->Draw();
83 
84  test->DrawMarker(0.5,0.005);
85  mean->DrawMarker(0,0);
86  double dtot[9] = {0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9};
87  double z[9];
88  // cout << "bflmv" << meanval[0] << endl;
89  for (int i=0;i<9;i++)
90  {
91  // sprintf(
92  cout << "coming" << endl;
93  z[i] = dtot[i];
94  // mean->DrawMarker(0,0);
95  // test->DrawMarker(dtot[i],.005);
96  cout << "meanval" << " " << dtot[i] << endl;
97  cout << "means" << " " << means[i] << endl;
98  // cout << means[i] << endl;
99 }
100  char fname [100];
101  sprintf(fname, "%sShowerEdepPercent.root",part);
102  TFile *fout = TFile::Open(fname,"UPDATE");
103  h2->Draw();
104  // h2->Write();
105  // fout->Write();
106  fout->Close();
107  f1->Close();
108  */
109 }
110 void EdepSmall(const char *calo="HOe", const char *part = "e")
111 {
112  int pz[9] = {1,2,4,8,12,16,32,40,50};
113  double x[9];
114  double y[9];
115  double xer[9] = {0};
116  double yer[9];
117  char hname[100];
118  char fname[100];
119  sprintf(fname,"%sShowerEdepPercent.root",part);
120  char area[100];
121  sprintf(area,"%s",calo);
122  TFile *fin = TFile::Open(fname);
123  gROOT->cd();
124  for (int i=0; i<9; i++)
125  {
126  x[i] = pz[i];
127  sprintf(hname,"%s%s%dd",calo,part,pz[i]);
128 TH1 *h1 = (TH1F *) fin->Get(hname);
129  y[i] = h1->GetMean(1);
130  yer[i] = h1->GetRMS(1);
131  }
132  gr = new TGraphErrors(9,x,y,xer,yer);
133  gr->SetTitle(area);
134  gr->Draw("ALP");
135  gr->SetMarkerStyle(20);
136  gr->SetMarkerColor(2);
137  fin->Close();
138 }