Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Summary.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file Summary.C
1 
2 void Summary(const char *input_root_name = "g4fwdtrack_fastsim_eval.root") {
3 
4  TFile* in_file = TFile::Open(input_root_name,"read");
5 
6  TH2D* _h2d_Delta_mom_vs_truth_mom = (TH2D*) in_file->Get("_h2d_Delta_mom_vs_truth_mom");
7  TH2D* _h2d_Delta_mom_vs_truth_eta = (TH2D*) in_file->Get("_h2d_Delta_mom_vs_truth_eta");
8 
9 
10  TCanvas *c0 = new TCanvas("c0","c0");
11  //c0->Divide(2,1);
12 
13  //c0->cd(1);
14  _h2d_Delta_mom_vs_truth_mom->FitSlicesY();
15  TH1D *h1d_mom_resolution_vs_truth_mom = (TH1D*) gDirectory->Get("_h2d_Delta_mom_vs_truth_mom_2");
16 
17  h1d_mom_resolution_vs_truth_mom->SetTitle("#sigma_{p}/p; momentum [GeV/c]; #sigma_{p}/p");
18  h1d_mom_resolution_vs_truth_mom->SetMarkerStyle(20);
19  h1d_mom_resolution_vs_truth_mom->SetMarkerColor(kBlack);
20  h1d_mom_resolution_vs_truth_mom->SetLineColor(kBlack);
21  h1d_mom_resolution_vs_truth_mom->Draw("e");
22  h1d_mom_resolution_vs_truth_mom->GetYaxis()->SetTitleOffset(1.5);
23 
24  TF1 *tf_pT_resolution = new TF1("tf_pT_resolution",
25  "sqrt([0]*[0] + x*x*[1]*[1])", 0, 40);
26  h1d_mom_resolution_vs_truth_mom->Fit(tf_pT_resolution, "s");
27 
28  TH1D* h1d_mom_offset_vs_truth_mom = (TH1D*) gDirectory->Get("_h2d_Delta_mom_vs_truth_mom_1");
29  h1d_mom_offset_vs_truth_mom->Draw("e,same");
30  h1d_mom_offset_vs_truth_mom->SetMarkerStyle(20);
31  h1d_mom_offset_vs_truth_mom->SetMarkerColor(kGray);
32  h1d_mom_offset_vs_truth_mom->SetLineColor(kGray);
33 
34  h1d_mom_offset_vs_truth_mom->Fit("pol0","s");
35 
36  double y_max = h1d_mom_resolution_vs_truth_mom->GetMaximum();
37  double y_min = h1d_mom_offset_vs_truth_mom->GetMinimum();
38 
39  h1d_mom_resolution_vs_truth_mom->GetYaxis()->SetRangeUser(y_min-0.01, y_max+0.01);
40 
41  c0->Update();
42 
43  gStyle->SetOptFit();
44  gStyle->SetOptStat(000000000);
45 
46 }